From 82b5e52a9e41fbc4893f2dd0d2ba99bb2db70f4c Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 6 Jul 2004 23:42:45 +0100 Subject: [PATCH] toplev.h (NO_FRONT_END_DIAG, [...]): Define. * toplev.h (NO_FRONT_END_DIAG, ATTRIBUTE_GCC_FE_DIAG): Define. (warning, error, pedwarn, sorry): Use ATTRIBUTE_GCC_FE_DIAG. cp: * decl.c (check_tag_decl): Name redeclared type in diagnostic. From-SVN: r84174 --- gcc/ChangeLog | 5 +++++ gcc/cp/ChangeLog | 4 ++++ gcc/cp/decl.c | 2 +- gcc/toplev.h | 19 ++++++++++++++----- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5ae46ce891f..68ae8edabf6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-07-06 Joseph S. Myers + + * toplev.h (NO_FRONT_END_DIAG, ATTRIBUTE_GCC_FE_DIAG): Define. + (warning, error, pedwarn, sorry): Use ATTRIBUTE_GCC_FE_DIAG. + 2004-07-06 Richard Henderson * config/i386/i386.c (legitimize_pic_address): Make static. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f6982704c2e..bde9ccf81e5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2004-07-06 Joseph S. Myers + + * decl.c (check_tag_decl): Name redeclared type in diagnostic. + 2004-07-06 Giovanni Bajo PR c++/3671 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2e4e1afd46b..5f3b901a008 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3424,7 +3424,7 @@ check_tag_decl (cp_decl_specifier_seq *declspecs) else if (declspecs->redefined_builtin_type) { if (!in_system_header) - pedwarn ("redeclaration of C++ built-in type", + pedwarn ("redeclaration of C++ built-in type %qT", declspecs->redefined_builtin_type); return NULL_TREE; } diff --git a/gcc/toplev.h b/gcc/toplev.h index 19402520619..6f6cad32a7c 100644 --- a/gcc/toplev.h +++ b/gcc/toplev.h @@ -45,23 +45,32 @@ extern void _fatal_insn (const char *, rtx, const char *, int, const char *) style, use the generic one. */ #ifndef GCC_DIAG_STYLE #define GCC_DIAG_STYLE __gcc_diag__ +#define NO_FRONT_END_DIAG #endif /* None of these functions are suitable for ATTRIBUTE_PRINTF, because each language front end can extend them with its own set of format - specifiers. We must use custom format checks. */ + specifiers. We must use custom format checks. Note that at present + the front-end %D specifier is used in non-front-end code with some + functions, and those formats can only be checked in front-end code. */ #if GCC_VERSION >= 3005 #define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m) +#ifdef NO_FRONT_END_DIAG +#define ATTRIBUTE_GCC_FE_DIAG(m, n) ATTRIBUTE_NONNULL(m) +#else +#define ATTRIBUTE_GCC_FE_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m) +#endif #else #define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m) +#define ATTRIBUTE_GCC_FE_DIAG(m, n) ATTRIBUTE_NONNULL(m) #endif extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) ATTRIBUTE_NORETURN; -extern void warning (const char *, ...); -extern void error (const char *, ...); +extern void warning (const char *, ...) ATTRIBUTE_GCC_FE_DIAG(1,2); +extern void error (const char *, ...) ATTRIBUTE_GCC_FE_DIAG(1,2); extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) ATTRIBUTE_NORETURN; -extern void pedwarn (const char *, ...); -extern void sorry (const char *, ...); +extern void pedwarn (const char *, ...) ATTRIBUTE_GCC_FE_DIAG(1,2); +extern void sorry (const char *, ...) ATTRIBUTE_GCC_FE_DIAG(1,2); extern void inform (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); extern void rest_of_decl_compilation (tree, const char *, int, int); -- 2.30.2