This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/21918] Warnings about unused variables should point to the declaration
- From: "tobi at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Jun 2005 20:47:58 -0000
- Subject: [Bug fortran/21918] Warnings about unused variables should point to the declaration
- References: <20050604230336.21918.schnetter@aei.mpg.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From tobi at gcc dot gnu dot org 2005-06-23 20:47 -------
We have a declared_at field in gfc_symbol, with this, this is easily fixed.
Index: trans-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/trans-decl.c,v
retrieving revision 1.61
diff -u -p -r1.61 trans-decl.c
--- trans-decl.c 11 Jun 2005 22:29:17 -0000 1.61
+++ trans-decl.c 23 Jun 2005 20:44:39 -0000
@@ -2222,12 +2222,14 @@ generate_local_decl (gfc_symbol * sym)
if (sym->attr.referenced)
gfc_get_symbol_decl (sym);
else if (sym->attr.dummy && warn_unused_parameter)
- warning (0, "unused parameter %qs", sym->name);
+ 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))
- warning (0, "unused variable %qs", sym->name);
+ gfc_warning ("unused variable %s declared at %L", sym->name,
+ sym->declared_at);
}
}
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |tobi at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2005-06-05 06:39:21 |2005-06-23 20:47:57
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21918