This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: On 'unused parameter' warnings


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,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]