diff options
author | Zack Weinberg <zack@gcc.gnu.org> | 2003-03-22 03:28:39 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2003-03-22 03:28:39 +0000 |
commit | d9b2742a3d4bfc03500e14e4e9bcc7ae9275a079 (patch) | |
tree | f2f70c0a43139b7fcdfc3aeacf5ad628d08890c3 /gcc/c-decl.c | |
parent | bea41393885329698043d1b7a22cb3e7a8791031 (diff) | |
download | gcc-d9b2742a3d4bfc03500e14e4e9bcc7ae9275a079.zip gcc-d9b2742a3d4bfc03500e14e4e9bcc7ae9275a079.tar.gz gcc-d9b2742a3d4bfc03500e14e4e9bcc7ae9275a079.tar.bz2 |
c-common.c: Include intl.h.
* c-common.c: Include intl.h.
(shadow_warning): Rewrite to allow better diagnostic translations.
* c-common.h: Update prototype of shadow_warning. Declare sw_kind enum.
* c-decl.c (warn_if_shadowing): Update calls to shadow_warning;
use it throughout.
* Makefile.in (c-common.o): Add intl.h.
cp:
* decl.c: Update calls to shadow_warning.
po:
* gcc.pot: Regenerate.
From-SVN: r64699
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index a4b435e..52b42a1 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1599,12 +1599,14 @@ static void warn_if_shadowing (x, oldlocal) tree x, oldlocal; { - tree name; + tree sym; + const char *name; if (DECL_EXTERNAL (x)) return; - name = DECL_NAME (x); + sym = DECL_NAME (x); + name = IDENTIFIER_POINTER (sym); /* Warn if shadowing an argument at the top level of the body. */ if (oldlocal != 0 @@ -1615,14 +1617,7 @@ warn_if_shadowing (x, oldlocal) /* Check that the decl being shadowed comes from the parm level, one level up. */ && chain_member (oldlocal, current_binding_level->level_chain->names)) - { - if (TREE_CODE (oldlocal) == PARM_DECL) - pedwarn ("declaration of `%s' shadows a parameter", - IDENTIFIER_POINTER (name)); - else - pedwarn ("declaration of `%s' shadows a symbol from the parameter list", - IDENTIFIER_POINTER (name)); - } + shadow_warning (SW_PARAM, true, name, oldlocal); /* Maybe warn if shadowing something else. */ else if (warn_shadow /* No shadow warnings for internally generated vars. */ @@ -1641,14 +1636,14 @@ warn_if_shadowing (x, oldlocal) else if (oldlocal) { if (TREE_CODE (oldlocal) == PARM_DECL) - shadow_warning ("a parameter", name, oldlocal); + shadow_warning (SW_PARAM, false, name, oldlocal); else - shadow_warning ("a previous local", name, oldlocal); + shadow_warning (SW_LOCAL, false, name, oldlocal); } - else if (IDENTIFIER_GLOBAL_VALUE (name) != 0 - && IDENTIFIER_GLOBAL_VALUE (name) != error_mark_node) - shadow_warning ("a global declaration", name, - IDENTIFIER_GLOBAL_VALUE (name)); + else if (IDENTIFIER_GLOBAL_VALUE (sym) != 0 + && IDENTIFIER_GLOBAL_VALUE (sym) != error_mark_node) + shadow_warning (SW_GLOBAL, false, name, + IDENTIFIER_GLOBAL_VALUE (sym)); } } |