I want to detect unused variables when building a project with fpm. For example:
integer :: i
end program main
With GFortran, I do:
$ gfortran main.f90 -Wall
3 | integer :: i
Warning: Unused variable ‘i’ declared at (1) [-Wunused-variable]
but fpm says nothing with the same flag:
$ fpm build --flag "-Wall"
fpm: Entering directory '/tmp/essai'
[100%] Project compiled successfully.
fpm: Leaving directory '/tmp/essai'
What am I doing wrong?
By the way, the
--flag option seems not documented in the fpm doc.
Have you tried the -verbose output flag? It might be there but hidden.
fpm build --verbose I can see it. That interesting option should also be documented (it is cited only in the new
fpm publish section of the doc).
But it is really troubling that fpm overrides (or rather hides) my flags in its standard output:
$ fpm build --flag "-Wunused"
does not do what the naive user expects.
Is there the possibility, after compilation, to see the produced warning messages? Without having to dig inside the build directory?
A command like:
fpm log display beatiful_module.f90
Yes, this has been discussed and is planned, see: