[PATCH]: Add even more format attributes
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Fri May 27 20:36:00 GMT 2005
A few more places for the format attribute.
Bootstrapped on x86_64-unknown-linux-gnu, ok for mainline?
Thanks,
--Kaveh
2005-05-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* c-decl.c (locate_old_decl): Add format attribute.
(implicit_decl_warning): Likewise.
cp:
* call.c (convert_like_real): Add format attribute.
* typeck.c (check_for_casting_away_constness,
build_static_cast_1): Likewise.
* typeck2.c (readonly_error, cxx_incomplete_type_diagnostic):
Likewise.
diff -rup orig/egcc-CVS20050526/gcc/c-decl.c egcc-CVS20050526/gcc/c-decl.c
--- orig/egcc-CVS20050526/gcc/c-decl.c 2005-05-25 15:10:27.000000000 -0400
+++ egcc-CVS20050526/gcc/c-decl.c 2005-05-27 11:44:54.000000000 -0400
@@ -1101,7 +1101,7 @@ validate_proto_after_old_defn (tree newd
first in a pair of mismatched declarations, using the diagnostic
function DIAG. */
static void
-locate_old_decl (tree decl, void (*diag)(const char *, ...))
+locate_old_decl (tree decl, void (*diag)(const char *, ...) ATTRIBUTE_GCC_CDIAG(1,2))
{
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl))
;
@@ -2258,7 +2258,7 @@ pushdecl_top_level (tree x)
static void
implicit_decl_warning (tree id, tree olddecl)
{
- void (*diag) (const char *, ...);
+ void (*diag) (const char *, ...) ATTRIBUTE_GCC_CDIAG(1,2);
switch (mesg_implicit_function_declaration)
{
case 0: return;
diff -rup orig/egcc-CVS20050526/gcc/cp/call.c egcc-CVS20050526/gcc/cp/call.c
--- orig/egcc-CVS20050526/gcc/cp/call.c 2005-05-26 21:27:19.000000000 -0400
+++ egcc-CVS20050526/gcc/cp/call.c 2005-05-27 11:43:11.000000000 -0400
@@ -4122,7 +4122,7 @@ convert_like_real (conversion *convs, tr
bool c_cast_p)
{
tree totype = convs->type;
- void (*diagnostic_fn)(const char *, ...);
+ void (*diagnostic_fn)(const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1,2);
if (convs->bad_p
&& convs->kind != ck_user
diff -rup orig/egcc-CVS20050526/gcc/cp/typeck.c egcc-CVS20050526/gcc/cp/typeck.c
--- orig/egcc-CVS20050526/gcc/cp/typeck.c 2005-05-24 22:01:28.000000000 -0400
+++ egcc-CVS20050526/gcc/cp/typeck.c 2005-05-27 11:43:30.000000000 -0400
@@ -4430,7 +4430,7 @@ build_compound_expr (tree lhs, tree rhs)
static void
check_for_casting_away_constness (tree src_type, tree dest_type,
- void (*diag_fn)(const char *, ...),
+ void (*diag_fn)(const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1,2),
const char *description)
{
if (diag_fn && casts_away_constness (src_type, dest_type))
@@ -4484,7 +4484,7 @@ build_static_cast_1 (tree type, tree exp
tree intype;
tree result;
tree orig;
- void (*diag_fn)(const char*, ...);
+ void (*diag_fn)(const char*, ...) ATTRIBUTE_GCC_CXXDIAG(1,2);
const char *desc;
/* Assume the cast is valid. */
diff -rup orig/egcc-CVS20050526/gcc/cp/typeck2.c egcc-CVS20050526/gcc/cp/typeck2.c
--- orig/egcc-CVS20050526/gcc/cp/typeck2.c 2005-04-24 08:39:11.000000000 -0400
+++ egcc-CVS20050526/gcc/cp/typeck2.c 2005-05-27 11:43:47.000000000 -0400
@@ -74,7 +74,7 @@ void
readonly_error (tree arg, const char* string, int soft)
{
const char *fmt;
- void (*fn) (const char *, ...);
+ void (*fn) (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1,2);
if (soft)
fn = pedwarn;
@@ -347,8 +347,8 @@ void
cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type)
{
int decl = 0;
- void (*p_msg) (const char *, ...);
- void (*p_msg_at) (const char *, ...);
+ void (*p_msg) (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1,2);
+ void (*p_msg_at) (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1,2);
if (diag_type == 1)
{
More information about the Gcc-patches
mailing list