-Wno-unused-parameter does not work?
Satish Balay
balay@fastmail.fm
Fri May 4 14:37:00 GMT 2007
I've tried the following with both:
GNU Fortran 95 (GCC) 4.1.1 20070105 (Red Hat 4.1.1-51)
GNU Fortran 95 (GCC) 4.1.2
In the following code, I'd like to get a warning for unused variable
'b' - not not 'a' which is a parameter to the subroutine. However I'm
unable to do this with gfortran. It either warns be about both [if I
use -Wall] - or none [-Wall -Wno-unused-variable].
I assumed "-Wall -Wno-unused-parameter" should provide what I want,
but its not working. Is this option supported? [-Wunused-parameter
appears to work correctly - as expected]
thanks,
Satish
>>>>>>>>>>
asterix:/home/balay/junk/test>cat foo.F
subroutine bar(a)
integer a
integer b
end
asterix:/home/balay/junk/test>strings /usr/bin/gfortran |grep unused-parameter
-Wunused-parameter
asterix:/home/balay/junk/test>gfortran -Wall -Wno-unused-variable -c foo.F
asterix:/home/balay/junk/test>gfortran -Wall -Wno-unused-parameter -c foo.F
In file foo.F:3
integer b
1
Warning: Unused variable b declared at (1)
In file foo.F:1
subroutine bar(a)
1
Warning: Unused variable a declared at (1)
asterix:/home/balay/junk/test>gfortran -c -Wunused-parameter foo.F
In file foo.F:1
subroutine bar(a)
1
Warning: Unused parameter a declared at (1)
foo.F:1: warning: unused parameter âÂÂaâÂÂ
<<<<<<<<<<
More information about the Fortran
mailing list