This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

-Wunused-parameter


Follow-up to 
	http://gcc.gnu.org/ml/fortran/2007-07/msg00545.html


gcc/fortran:
2007-08-01  Daniel Franke  <franke.daniel@gmail.com>

	* trans-decl.c (generate_local_decl): Emit warning on unused parameter
	on "-Wall -Wextra" or "-Wunused-parameter" but not on "-Wall".
	* invoke.texi (-Wparameter-unused): Document differences between gcc 
	and gfortran regarding this option.

gcc/testsuite:
2007-08-01  Daniel Franke  <franke.daniel@gmail.com>

	* gfortran.dg/parameter_unused.f90: Adjusted dg-options.


Bootstrapped and regression tested on i686-pc-linux-gnu.
Ok for trunk?

Regards
	Daniel
Index: fortran/trans-decl.c
===================================================================
--- fortran/trans-decl.c	(revision 127062)
+++ fortran/trans-decl.c	(working copy)
@@ -3031,7 +3031,7 @@ generate_local_decl (gfc_symbol * sym)
     }
   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: fortran/invoke.texi
===================================================================
--- fortran/invoke.texi	(revision 127062)
+++ fortran/invoke.texi	(working copy)
@@ -130,7 +130,7 @@ and warnings}.
 -fsyntax-only  -pedantic  -pedantic-errors @gol
 -Wall  -Waliasing  -Wampersand  -Wcharacter-truncation  -Wconversion @gol
 -Wimplicit-interface  -Wline-truncation  -Wnonstd-intrinsics  -Wsurprising @gol
--Wno-tabs  -Wunderflow}
+-Wno-tabs  -Wunderflow -Wunused-parameter}
 
 @item Debugging Options
 @xref{Debugging Options,,Options for debugging your program or GNU Fortran}.
@@ -488,6 +488,16 @@ for @option{-pedantic}, @option{-std=f95
 Produce a warning when numerical constant expressions are
 encountered, which yield an UNDERFLOW during compilation.
 
+@item -Wunused-parameter
+@opindex @code{Wunused-parameter}
+@cindex warnings, unused parameter
+@cindex unused parameter
+Contrary to @command{gcc}'s meaning of @option{-Wunused-parameter},
+@command{gfortran}'s implementation of this option does not warn
+about unused dummy arguments, but about unused @code{PARAMETER} values.
+@option{-Wunused-parameter} is not included in @option{-Wall} but is
+implied by @option{-Wall -Wextra}.
+
 @item -Werror
 @opindex @code{Werror}
 @cindex warnings, to errors
Index: testsuite/gfortran.dg/parameter_unused.f90
===================================================================
--- testsuite/gfortran.dg/parameter_unused.f90	(revision 127062)
+++ testsuite/gfortran.dg/parameter_unused.f90	(working copy)
@@ -1,5 +1,5 @@
 ! { dg-do compile }
-! { dg-options "-Wunused" }
+! { dg-options "-Wunused-parameter" }
 !
 ! PR fortran/31129 - No warning on unused parameters
 !

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