From: Theodore Ts'o Date: Thu, 27 Nov 2003 04:19:28 +0000 (-0500) Subject: com_err.h, com_err.c: Use GCC attributes to mark com_err and X-Git-Tag: E2FSPROGS-1_35-WIP-1207~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2540bb79b728cbfb88ed80e8ca2c2d8c0edc129b;p=thirdparty%2Fe2fsprogs.git 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 91a47521b..6a689341e 100644 --- a/lib/et/ChangeLog +++ b/lib/et/ChangeLog @@ -1,3 +1,9 @@ +2003-11-26 Theodore Ts'o + + * 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 * 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 76fdc78fe..77938b04b 100644 --- a/lib/et/com_err.c +++ b/lib/et/com_err.c @@ -16,6 +16,11 @@ #include "error_table.h" #include "internal.h" +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) diff --git a/lib/et/com_err.h b/lib/et/com_err.h index 60494c2fc..a49c5a5a1 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 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,