-Wunused and argument lists
Steve Kargl
sgk@troutmask.apl.washington.edu
Tue Oct 4 20:10:00 GMT 2005
On Tue, Oct 04, 2005 at 12:40:19PM -0700, David C. Thompson wrote:
> Hi,
>
> I'm trying to get warning-free compiles of some old F77 code using
> gfortran (a gcc compiled from CVS at hpc.sourceforge.net, dated Sep.
> '05), but I am having trouble with -Wunused; I have some functions where
> not all the arguments are used, but those arguments must still be passed
> because a library requires the argument list as given. For example:
>
> REAL*8 FUNCTION f(a,b)
> IMPLICIT NONE
> INTEGER*4 a,b
> F = 7.7d1*a
> END
>
> will get a warning about "b" being unused, but I am not free to remove
> "b" from the argument list. In C, I would just use
>
I don't know if logical is getting inverted, but
troutmask:kargl[36] cat > lo.f
REAL*8 FUNCTION f(a,b)
IMPLICIT NONE
INTEGER*4 a,b
F = 7.7d1*a
END
troutmask:kargl[37] gfc -Wunused -c lo.f
lo.f: In function 'f':
lo.f:1: warning: unused variable 'b'
troutmask:kargl[38] gfc -Wno-unused -c lo.f
troutmask:kargl[39]
-Wunused == report unused variables
-Wno-unused == do not report unused variables.
--
Steve
More information about the Fortran
mailing list