This is the mail archive of the 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 to add ATTRIBUTE_PRINTF to errors.h

The comment in errors.h notwithstanding, all of the variadic functions
in errors.c should be using ATTRIBUTE_PRINTF since they all simply
pass along to vfprintf.

The errors.h file is mostly used by generator programs, but there are
a few cases like rtl.c in which it is used with both generator
programs and the gcc backend which relies on the extended functions in
diagnostic.c.  I would say that these dual use files >must not< use
any of the extensions in the diagnostic framework because if it did
then when it is linked with a generator program it won't work!

So this patch enforces that dictum.  Bootstrapped on
sparc-sun-solaris2.7, no new warnings.

Ok for mainline?


2003-05-20  Kaveh R. Ghazi  <>

	* errors.h (warning, error, fatal, internal_error): Add

diff -rup orig/egcc-CVS20030519/gcc/errors.h egcc-CVS20030519/gcc/errors.h
--- orig/egcc-CVS20030519/gcc/errors.h	2002-06-02 21:13:14.000000000 -0400
+++ egcc-CVS20030519/gcc/errors.h	2003-05-20 18:45:18.629159000 -0400
@@ -20,19 +20,15 @@ Software Foundation, 59 Temple Place - S
 /* warning, error, and fatal.  These definitions are suitable for use
    in the generator programs; eventually we would like to use them in
-   cc1 too, but that's a longer term project.
-   N.B. We cannot presently use ATTRIBUTE_PRINTF with these functions,
-   because they can be extended with additional format specifiers which
-   GCC does not know about.  */
+   cc1 too, but that's a longer term project.  */
 #ifndef GCC_ERRORS_H
 #define GCC_ERRORS_H
-extern void warning PARAMS ((const char *, ...));
-extern void error   PARAMS ((const char *, ...));
-extern void fatal   PARAMS ((const char *, ...)) ATTRIBUTE_NORETURN;
-extern void internal_error   PARAMS ((const char *, ...)) ATTRIBUTE_NORETURN;
+extern void warning PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1;
+extern void error   PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1;
+extern void fatal   PARAMS ((const char *, ...)) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_1;
+extern void internal_error   PARAMS ((const char *, ...)) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_1;
 extern const char *trim_filename   PARAMS ((const char *));
 extern void fancy_abort PARAMS ((const char *, int, const char *))

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