Patch to add attributes to <sys/syslog.h>

Joseph S. Myers jsm28@cam.ac.uk
Thu Dec 7 03:30:00 GMT 2000


<sys/syslog.h> should have format attributes for syslog and vsyslog.
Patch below.

(Adding -Wmissing-format-attribute to the all-warnings case might find
more cases, but would need to be autoconfed since it needs a recent
compiler.)

--- syslog.h	Sat Oct  9 21:22:07 1999
+++ syslog.h.new	Thu Dec  7 11:25:19 2000
@@ -179,12 +179,13 @@
 extern int setlogmask (int __mask) __THROW;
 
 /* Generate a log message using FMT string and option arguments.  */
-extern void syslog (int __pri, __const char *__fmt, ...) __THROW;
+extern void syslog (int __pri, __const char *__fmt, ...) __THROW
+     __attribute__((__format__(__printf__, 2, 3)));
 
 #ifdef __USE_BSD
 /* Generate a log message using FMT and using arguments pointed to by AP.  */
 extern void vsyslog (int __pri, __const char *__fmt, __gnuc_va_list __ap)
-     __THROW;
+     __THROW __attribute__((__format__(__printf__, 2, 0)));
 #endif
 
 __END_DECLS

-- 
Joseph S. Myers
jsm28@cam.ac.uk



More information about the Libc-alpha mailing list