diff options
author | Daniel Franke <franke.daniel@gmail.com> | 2007-08-01 09:51:37 -0400 |
---|---|---|
committer | Daniel Franke <dfranke@gcc.gnu.org> | 2007-08-01 09:51:37 -0400 |
commit | d92693b4190b173e71b241fb8f631ae4fa7c3bdc (patch) | |
tree | 26c163078c255bb5354f9a49d77f7a154187884d /gcc | |
parent | d05360a6128c8ba1e2c616bc94d23a5c686b92db (diff) | |
download | gcc-d92693b4190b173e71b241fb8f631ae4fa7c3bdc.zip gcc-d92693b4190b173e71b241fb8f631ae4fa7c3bdc.tar.gz gcc-d92693b4190b173e71b241fb8f631ae4fa7c3bdc.tar.bz2 |
trans-decl.c (generate_local_decl): Emit warning on unused parameter on "-Wall -Wextra" or "-Wunused-parameter" but...
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", changed
messages that start with lower case to upper case.
* 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 and
error message text.
From-SVN: r127126
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fortran/invoke.texi | 12 | ||||
-rw-r--r-- | gcc/fortran/trans-decl.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/parameter_unused.f90 | 4 |
5 files changed, 31 insertions, 8 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 81ba111..5db8979 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,13 @@ 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", changed + messages that start with lower case to upper case. + * invoke.texi (-Wparameter-unused): Document differences between gcc + and gfortran regarding this option. + +2007-08-01 Daniel Franke <franke.daniel@gmail.com> + PR fortran/32945 * expr.c (check_specification_function): Skip check if no symtree is available. diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index 3064633..e52bff8 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -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}, @option{-std=f2003}, and 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 diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 2e14473..97d6e5c 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -2998,17 +2998,17 @@ generate_local_decl (gfc_symbol * sym) else if (warn_unused_variable && sym->attr.dummy && sym->attr.intent == INTENT_OUT) - gfc_warning ("dummy argument '%s' at %L was declared INTENT(OUT) but was not set", + gfc_warning ("Dummy argument '%s' at %L was declared INTENT(OUT) but was not set", sym->name, &sym->declared_at); /* Specific warning for unused dummy arguments. */ else if (warn_unused_variable && sym->attr.dummy) - gfc_warning ("unused dummy argument '%s' at %L", sym->name, + gfc_warning ("Unused dummy argument '%s' at %L", sym->name, &sym->declared_at); /* Warn for unused variables, but not if they're inside a common block or are use-associated. */ else if (warn_unused_variable && !(sym->attr.in_common || sym->attr.use_assoc)) - gfc_warning ("unused variable '%s' declared at %L", sym->name, + gfc_warning ("Unused variable '%s' declared at %L", sym->name, &sym->declared_at); /* For variable length CHARACTER parameters, the PARM_DECL already references the length variable, so force gfc_get_symbol_decl @@ -3031,10 +3031,10 @@ 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, + gfc_warning ("Unused parameter '%s' declared at %L", sym->name, &sym->declared_at); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 81e9296..641db86 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2007-08-01 Daniel Franke <franke.daniel@gmail.com> + * gfortran.dg/parameter_unused.f90: Adjusted dg-options and + error message text. + +2007-08-01 Daniel Franke <franke.daniel@gmail.com> + PR fortran/32945 * gfortran.dg/initialization_12.f90: New test. diff --git a/gcc/testsuite/gfortran.dg/parameter_unused.f90 b/gcc/testsuite/gfortran.dg/parameter_unused.f90 index 7496169..86d5085 100644 --- a/gcc/testsuite/gfortran.dg/parameter_unused.f90 +++ b/gcc/testsuite/gfortran.dg/parameter_unused.f90 @@ -1,9 +1,9 @@ ! { dg-do compile } -! { dg-options "-Wunused" } +! { dg-options "-Wunused-parameter" } ! ! PR fortran/31129 - No warning on unused parameters ! program fred -integer,parameter :: j = 9 ! { dg-warning "unused parameter" } +integer,parameter :: j = 9 ! { dg-warning "Unused parameter" } end |