diff options
author | Joerg Sonnenberger <joerg@bec.de> | 2012-02-28 16:48:01 +0100 |
---|---|---|
committer | Joerg Sonnenberger <joerg@bec.de> | 2012-02-28 16:48:01 +0100 |
commit | 3d43464bf55fa5a465c21eac9d7879537676edad (patch) | |
tree | f12db7a76759930600b44d1c5ec4d28b12baae7e /libarchive_fe | |
parent | fe2fbc051adb39a164fba81e0a3489176e765f06 (diff) | |
download | libarchive-3d43464bf55fa5a465c21eac9d7879537676edad.tar.gz |
Allow format string checking with GCC.
Diffstat (limited to 'libarchive_fe')
-rw-r--r-- | libarchive_fe/err.c | 2 | ||||
-rw-r--r-- | libarchive_fe/err.h | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/libarchive_fe/err.c b/libarchive_fe/err.c index eb3f9f3e..a0173983 100644 --- a/libarchive_fe/err.c +++ b/libarchive_fe/err.c @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); #include "err.h" +static void lafe_vwarnc(int, const char *, va_list) __LA_PRINTFLIKE(2, 0); + const char *lafe_progname; static void diff --git a/libarchive_fe/err.h b/libarchive_fe/err.h index dd794481..ca1af356 100644 --- a/libarchive_fe/err.h +++ b/libarchive_fe/err.h @@ -33,9 +33,17 @@ #define __LA_DEAD #endif +#if defined(__GNUC__) && (__GNUC__ > 2 || \ + (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) +#define __LA_PRINTFLIKE(f,a) __attribute__((__format__(__printf__, f, a))) +#else +#define __LA_PRINTFLIKE(f,a) +#endif + extern const char *lafe_progname; -void lafe_warnc(int code, const char *fmt, ...); -void lafe_errc(int eval, int code, const char *fmt, ...) __LA_DEAD; +void lafe_warnc(int code, const char *fmt, ...) __LA_PRINTFLIKE(2, 3); +void lafe_errc(int eval, int code, const char *fmt, ...) __LA_DEAD + __LA_PRINTFLIKE(3, 4); #endif |