This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: On 'unused parameter' warnings
- From: Daniel Franke <franke dot daniel at gmail dot com>
- To: fortran at gcc dot gnu dot org
- Cc: Thomas Koenig <tkoenig at alice-dsl dot net>, Angelo Graziosi <Angelo dot Graziosi at roma1 dot infn dot it>, Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- Date: Sun, 29 Jul 2007 11:50:16 +0200
- Subject: Re: On 'unused parameter' warnings
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:from:to:subject:date:user-agent:cc:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=gmKTub5V1OyKtbGDCDSF2Y1DKDCbp1+uE4cNtcCA+6p6fS2k9w2odPmdVYX5vP0yWJg7il5WyfnZu/U9yCg3HZRBMscp5Bi+myAa7kAC9pLEXWAaqVn7ZNZeokXVjITnZDqjYX74GJte3Ow6aweul7/XyHO7mYAhig+kIEtOnOg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:from:to:subject:date:user-agent:cc:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=MUkrZjG+w4U8P5pe+Vw3n0T9s8YBUoYnrzrPAjq3/2EDJpUsbuq/AngBh8kYrWsy46Xy530sGi6BqzX+jTqoMdS/JN/RDCQABzCm1ImKaox9ZQesaKeUIab3QXfzxxRWcMbyZFfnAe2WwWBZfql9t2nWvi1WuledDH+w32GjCKQ=
- References: <Pine.OSF.4.58.0707290112300.15621@ax0rm1.roma1.infn.it> <200707291107.15997.franke.daniel@gmail.com> <1185701790.3993.0.camel@meiner.onlinehome.de>
On Sunday 29 July 2007 11:36:30 Thomas Koenig wrote:
> On Sun, 2007-07-29 at 11:07 +0200, Daniel Franke wrote:
> > Try -Wno-unused-variable.
>
> IMHO, a -Wno-unused-parameter option could be a good idea.
Thomas,
there is -Wunused-parameter defined by gcc (warn_unused_parameter), but
in gcc documents -Wunused-parameter as "Warn whenever a function parameter is
unused aside from its declaration." while we have:
$> cat unused.f90
PARAMETER, INTEGER :: x = 42
END
$> fortran-svn -Wall unused.f90
unused.f90:1.23:
INTEGER, PARAMETER :: x = 42
1
Warning: unused parameter 'x' declared at (1)
IIRC, that is the reason why I tied unused parameters to -Wunused-variable
instead of -Wunused-parameter. OTOH, we could do it anyway and just document
the differences to gcc. The change is minimal:
Index: trans-decl.c
===================================================================
--- trans-decl.c (revision 126998)
+++ trans-decl.c (working copy)
@@ -3033,7 +3033,7 @@
}
else if (sym->attr.flavor == FL_PARAMETER)
{
- if (warn_unused_variable
+ if (warn_unused_parameter
&& !sym->attr.referenced
&& !sym->attr.use_assoc)
gfc_warning ("unused parameter '%s' declared at %L", sym->name,