From: Bruno Haible Date: Mon, 23 Oct 2006 11:21:15 +0000 (+0000) Subject: Add format attribute to error handling methods. X-Git-Tag: 0.16.x-branchpoint~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1103df63ef3ed435edd7d219d03f13522041ee63;p=thirdparty%2Fgettext.git Add format attribute to error handling methods. --- diff --git a/gettext-tools/libgettextpo/ChangeLog b/gettext-tools/libgettextpo/ChangeLog index ef310513a..15b69111b 100644 --- a/gettext-tools/libgettextpo/ChangeLog +++ b/gettext-tools/libgettextpo/ChangeLog @@ -1,3 +1,9 @@ +2006-10-21 Bruno Haible + + * gettext-po.h.in (struct po_error_handler): Add format attribute to + error, error_at_line fields. + * gettext-po.c (po_error_logger): Declare with format attribute. + 2006-10-20 Bruno Haible * Makefile.am (config.h): Treat .lo files like .o files. Define diff --git a/gettext-tools/libgettextpo/gettext-po.c b/gettext-tools/libgettextpo/gettext-po.c index e23f6863e..0dc287914 100644 --- a/gettext-tools/libgettextpo/gettext-po.c +++ b/gettext-tools/libgettextpo/gettext-po.c @@ -1227,6 +1227,9 @@ po_message_check_format (po_message_t message, po_xerror_handler_t handler) /* An error logger based on the po_error function pointer. */ static void +po_error_logger (const char *format, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); +static void po_error_logger (const char *format, ...) { va_list args; diff --git a/gettext-tools/libgettextpo/gettext-po.h.in b/gettext-tools/libgettextpo/gettext-po.h.in index ada8ad69f..b0e710fdf 100644 --- a/gettext-tools/libgettextpo/gettext-po.h.in +++ b/gettext-tools/libgettextpo/gettext-po.h.in @@ -55,7 +55,11 @@ struct po_error_handler Must increment the error_message_count variable declared in error.h. Must not return if STATUS is nonzero. */ void (*error) (int status, int errnum, - const char *format, ...); + const char *format, ...) +#if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) && !__STRICT_ANSI__ + __attribute__ ((__format__ (__printf__, 3, 4))) +#endif + ; /* Signal an error. The error message is built from FORMAT and the following arguments. The error location is at FILENAME line LINENO. ERRNUM, if @@ -64,7 +68,11 @@ struct po_error_handler Must not return if STATUS is nonzero. */ void (*error_at_line) (int status, int errnum, const char *filename, unsigned int lineno, - const char *format, ...); + const char *format, ...) +#if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) && !__STRICT_ANSI__ + __attribute__ ((__format__ (__printf__, 5, 6))) +#endif + ; /* Signal a multiline warning. The PREFIX applies to all lines of the MESSAGE. Free the PREFIX and MESSAGE when done. */