com_err.h, com_err.c: Use GCC attributes to mark com_err and
default_com_err_proc as taking printf-style format
strings.
diff --git a/lib/et/ChangeLog b/lib/et/ChangeLog
index 91a4752..6a68934 100644
--- a/lib/et/ChangeLog
+++ b/lib/et/ChangeLog
@@ -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
diff --git a/lib/et/com_err.c b/lib/et/com_err.c
index 76fdc78..77938b0 100644
--- a/lib/et/com_err.c
+++ b/lib/et/com_err.c
@@ -19,6 +19,11 @@
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);
diff --git a/lib/et/com_err.h b/lib/et/com_err.h
index 60494c2..a49c5a5 100644
--- a/lib/et/com_err.h
+++ b/lib/et/com_err.h
@@ -10,6 +10,12 @@
#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 @@
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,