From 63ca7f6c8814ee4974a1ae784ab06eca01e6dff2 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 5 Apr 2015 13:46:23 +0200 Subject: [PATCH] tests: Use attribute((format(printf,x,y))) if possible Signed-off-by: Uli Schlachter --- tests/test.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/test.c b/tests/test.c index 9d10c0e..7d7614b 100644 --- a/tests/test.c +++ b/tests/test.c @@ -29,9 +29,19 @@ #include #include +#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203) +#define ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y))) +#else +#define ATTRIBUTE_PRINTF(x,y) +#endif + #define SKIP 77 -static int check_strings(const char *expected, const char *actual, const char *format, ...) +static int check_strings(const char *expected, const char *actual, + const char *format, ...) ATTRIBUTE_PRINTF(3, 4); + +static int check_strings(const char *expected, const char *actual, + const char *format, ...) { va_list ap;