OSDN Git Service

com_err.h, com_err.c: Use GCC attributes to mark com_err and
authorTheodore Ts'o <tytso@mit.edu>
Thu, 27 Nov 2003 04:19:28 +0000 (23:19 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 27 Nov 2003 04:19:28 +0000 (23:19 -0500)
default_com_err_proc as taking printf-style format
strings.

lib/et/ChangeLog
lib/et/com_err.c
lib/et/com_err.h

index 91a4752..6a68934 100644 (file)
@@ -1,3 +1,9 @@
+2003-11-26  Theodore Ts'o  <tytso@mit.edu>
+
+       * com_err.h, com_err.c: Use GCC attributes to mark com_err and
+               default_com_err_proc as taking printf-style format
+               strings.
+
 2003-11-22  Theodore Ts'o  <tytso@mit.edu>
 
        * com_err.h: Retore the type of n_msgs in the error_table
index 76fdc78..77938b0 100644 (file)
 static void
 default_com_err_proc (const char *whoami, errcode_t code, const
                      char *fmt, va_list args)
+       COM_ERR_ATTR((format(printf, 3, 0)));
+
+static void
+default_com_err_proc (const char *whoami, errcode_t code, const
+                     char *fmt, va_list args)
 {
     if (whoami) {
        fputs(whoami, stderr);
index 60494c2..a49c5a5 100644 (file)
 
 #if !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)
 
+#ifdef __GNUC__
+#define COM_ERR_ATTR(x) __attribute__(x)
+#else
+#define COM_ERR_ATTR(x)
+#endif
+
 #include <stdarg.h>
 
 typedef long errcode_t;
@@ -19,12 +25,15 @@ struct error_table {
        long base;
        int n_msgs;
 };
-
 struct et_list;
 
-extern void com_err (const char *, long, const char *, ...);
+extern void com_err (const char *, long, const char *, ...)
+       COM_ERR_ATTR((format(printf, 3, 4)));
+
 extern void com_err_va (const char *whoami, errcode_t code, const char *fmt,
-                va_list args);
+                va_list args)
+       COM_ERR_ATTR((format(printf, 3, 0)));
+
 extern char const *error_message (long);
 extern void (*com_err_hook) (const char *, long, const char *, va_list);
 extern void (*set_com_err_hook (void (*) (const char *, long,