aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2001-12-05 23:20:00 +0000
committerNeil Booth <neil@gcc.gnu.org>2001-12-05 23:20:00 +0000
commit26f943fd3600236b05ab91a36f7ee8f1043c07af (patch)
treee2ef9f427adfe62b09b758c20b2ffdb1802526ba /gcc/c-common.c
parent8ca8f9a70b751319f7281564aa0ab0e93b3ef6e2 (diff)
downloadgcc-26f943fd3600236b05ab91a36f7ee8f1043c07af.zip
gcc-26f943fd3600236b05ab91a36f7ee8f1043c07af.tar.gz
gcc-26f943fd3600236b05ab91a36f7ee8f1043c07af.tar.bz2
c-common.c (shadow_warning): New function, moved from cp/decl.c.
* c-common.c (shadow_warning): New function, moved from cp/decl.c. * c-common.h (shadow_warning): New. * c-decl.c: Include c-common.h. (warn_if_shadowing): New, broken out of pushdecl. (pushdecl): Use warn_if_shadowing. (store_parm_decls): Prevent duplicate -Wshadow warnings. cp: * decl.c: Include c-common.h. (shadow_warning): Move to c-common.c. testsuite: * gcc.dg/Wshadow-1.c: New test. From-SVN: r47701
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index f5fc0d3..29bb059 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -4017,3 +4017,17 @@ c_common_insert_default_attributes (decl)
#undef DEF_ATTR_TREE_LIST
#undef DEF_FN_ATTR
}
+
+/* Output a -Wshadow warning MSGID about NAME, an IDENTIFIER_NODE, and
+ additionally give the location of the previous declaration DECL. */
+void
+shadow_warning (msgid, name, decl)
+ const char *msgid;
+ tree name, decl;
+{
+ warning ("declaration of `%s' shadows %s", IDENTIFIER_POINTER (name), msgid);
+ warning_with_file_and_line (DECL_SOURCE_FILE (decl),
+ DECL_SOURCE_LINE (decl),
+ "shadowed declaration is here");
+}
+