diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2001-12-05 23:20:00 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-12-05 23:20:00 +0000 |
commit | 26f943fd3600236b05ab91a36f7ee8f1043c07af (patch) | |
tree | e2ef9f427adfe62b09b758c20b2ffdb1802526ba /gcc/cp | |
parent | 8ca8f9a70b751319f7281564aa0ab0e93b3ef6e2 (diff) | |
download | gcc-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/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl.c | 16 |
2 files changed, 6 insertions, 15 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b01f868..a0a3f49 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2001-12-05 Neil Booth <neil@daikokuya.demon.co.uk> + + * decl.c: Include c-common.h. + (shadow_warning): Move to c-common.c. + Wed Dec 5 17:00:49 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> * decl.c (duplicate_decls): Don't copy DECL_NO_CHECK_MEMORY_USAGE. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 3916610..2df8b22 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -45,6 +45,7 @@ Boston, MA 02111-1307, USA. */ #include "ggc.h" #include "tm_p.h" #include "target.h" +#include "c-common.h" extern const struct attribute_spec *lang_attribute_table; @@ -147,7 +148,6 @@ static tree push_cp_library_fn PARAMS ((enum tree_code, tree)); static tree build_cp_library_fn PARAMS ((tree, enum tree_code, tree)); static void store_parm_decls PARAMS ((tree)); static int cp_missing_noreturn_ok_p PARAMS ((tree)); -static void shadow_warning PARAMS ((const char *, tree, tree)); #if defined (DEBUG_CP_BINDING_LEVELS) static void indent PARAMS ((void)); @@ -3787,20 +3787,6 @@ duplicate_decls (newdecl, olddecl) return 1; } -/* Output a -Wshadow warning MSGID, if non-NULL, and give the location - of the previous declaration. */ -static 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"); -} - - /* Record a decl-node X as belonging to the current lexical scope. Check for errors (such as an incompatible declaration for the same name already seen in the same scope). |