This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[Patch, fortran] PR28817 and PR21918
- From: Paul Thomas <paulthomas2 at wanadoo dot fr>
- To: patch <gcc-patches at gcc dot gnu dot org>, "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>
- Date: Sun, 17 Sep 2006 14:44:25 +0200
- Subject: [Patch, fortran] PR28817 and PR21918
:ADDPATCH fortran:
This PR is associated with the warnings produced by -Wunused. At
present, gcc/errors.c(warning) is used and this, for some reason, is
scambling the line numbers. Tobi Schlueter proposed to use gfc_warning
in the context of PR21918 and this patch implements that. The drawback
is the the gfc warning is a bit less concise than its gcc counterpart;
maybe we should introduce a %l format, as well as a %L format, for
locii? However, the information is correct. I could not readily think
of a way to test this.
Regtested on FC5/Athlon
OK for trunk and 4.1?
Paul
2006-09-17 Paul Thomas <pault@gcc.gnu.org>
PR fortran/28817
PR fortran/21918
* trans-decl.c (generate_local_decl): Change from 'warning' to
'gfc_warning' to have line numbers correctly reported.
Index: gcc/fortran/trans-decl.c
===================================================================
*** gcc/fortran/trans-decl.c (revision 116991)
--- gcc/fortran/trans-decl.c (working copy)
*************** generate_local_decl (gfc_symbol * sym)
*** 2883,2894 ****
if (sym->attr.referenced)
gfc_get_symbol_decl (sym);
else if (sym->attr.dummy && warn_unused_parameter)
! warning (0, "unused parameter %qs", sym->name);
/* 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))
! warning (0, "unused variable %qs", sym->name);
/* For variable length CHARACTER parameters, the PARM_DECL already
references the length variable, so force gfc_get_symbol_decl
even when not referenced. If optimize > 0, it will be optimized
--- 2883,2896 ----
if (sym->attr.referenced)
gfc_get_symbol_decl (sym);
else if (sym->attr.dummy && warn_unused_parameter)
! gfc_warning ("Unused parameter %s declared 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,
! &sym->declared_at);
/* For variable length CHARACTER parameters, the PARM_DECL already
references the length variable, so force gfc_get_symbol_decl
even when not referenced. If optimize > 0, it will be optimized
2006-09-17 Paul Thomas <pault@gcc.gnu.org>
PR fortran/28817
PR fortran/21918
* trans-decl.c (generate_local_decl): Change from 'warning' to
'gfc_warning' to have line numbers correctly reported.