This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: add format attributes to errors.h


Having disentangled errors.h vs toplev.h here:
http://gcc.gnu.org/ml/gcc-patches/2005-05/msg02314.html

it is now possible to add printf format attributes to the functions in
errors.h without causing any warnings from files using the GCC
internal diagnostic routines.  In the process I found one format
argument bug which I corrected as well.

Bootstrapped on x86_64-unknown-linux-gnu with the previous patch, no
regressions.  Okay for mainline after we un-slush?

		Thanks,
		--Kaveh


2005-05-23  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* errors.h (warning, error, fatal, internal_error): Add printf
	attribute.
	* genmodes.c (make_vector_mode): Fix format arguments.

diff -rup orig/egcc-CVS20050522/gcc/errors.h egcc-CVS20050522/gcc/errors.h
--- orig/egcc-CVS20050522/gcc/errors.h	2005-04-29 16:43:19.000000000 -0400
+++ egcc-CVS20050522/gcc/errors.h	2005-05-23 19:54:36.000000000 -0400
@@ -30,10 +30,10 @@ Software Foundation, 59 Temple Place - S
 #ifndef GCC_ERRORS_H
 #define GCC_ERRORS_H
 
-extern void warning (int, const char *, ...);
-extern void error (const char *, ...);
-extern void fatal (const char *, ...) ATTRIBUTE_NORETURN;
-extern void internal_error (const char *, ...) ATTRIBUTE_NORETURN;
+extern void warning (int, const char *, ...) ATTRIBUTE_PRINTF_2;
+extern void error (const char *, ...) ATTRIBUTE_PRINTF_1;
+extern void fatal (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_1;
+extern void internal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_1;
 extern const char *trim_filename (const char *);
 
 extern int have_error;
diff -rup orig/egcc-CVS20050522/gcc/genmodes.c egcc-CVS20050522/gcc/genmodes.c
--- orig/egcc-CVS20050522/gcc/genmodes.c	2004-10-15 10:47:07.000000000 -0400
+++ egcc-CVS20050522/gcc/genmodes.c	2005-05-23 20:20:25.000000000 -0400
@@ -619,7 +619,7 @@ make_vector_mode (enum mode_class bclass
 			ncomponents, base) >= sizeof namebuf)
     {
       error ("%s:%d: mode name \"%s\" is too long",
-	     base, file, line);
+	     file, line, base);
       return;
     }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]