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-common.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-common.c')
-rw-r--r-- | gcc/c-common.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 0065430..ee4549c 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -23,6 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "system.h" #include "coretypes.h" #include "tm.h" +#include "intl.h" #include "tree.h" #include "flags.h" #include "toplev.h" @@ -4807,14 +4808,23 @@ c_common_insert_default_attributes (decl) #undef DEF_FN_ATTR } -/* Output a -Wshadow warning MSGID about NAME, an IDENTIFIER_NODE, and - additionally give the location of the previous declaration DECL. */ +/* Output a -Wshadow warning MSGCODE about NAME, and give the location + of the previous declaration DECL. MANDATORY says whether this is a + mandatory warning (i.e. use pedwarn). */ void -shadow_warning (msgid, name, decl) - const char *msgid; - tree name, decl; +shadow_warning (msgcode, mandatory, name, decl) + enum sw_kind msgcode; + int mandatory; /* really bool */ + const char *name; + tree decl; { - warning ("declaration of `%s' shadows %s", IDENTIFIER_POINTER (name), msgid); + static const char *const msgs[] = { + /* SW_PARAM */ N_("declaration of \"%s\" shadows a parameter"), + /* SW_LOCAL */ N_("declaration of \"%s\" shadows a previous local"), + /* SW_GLOBAL */ N_("declaration of \"%s\" shadows a global declaration") + }; + + (mandatory ? pedwarn : warning) (msgs[msgcode], name); warning_with_file_and_line (DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl), "shadowed declaration is here"); |