summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2015-04-05 13:46:23 +0200
committerUli Schlachter <psychon@znc.in>2015-04-05 13:46:23 +0200
commit63ca7f6c8814ee4974a1ae784ab06eca01e6dff2 (patch)
tree40e308858984df2010d38cfbc07fa08df15a8baf
parent88cebd842ef076da6db0645df34321a19488a3ab (diff)
tests: Use attribute((format(printf,x,y))) if possible
Signed-off-by: Uli Schlachter <psychon@znc.in>
-rw-r--r--tests/test.c12
1 files changed, 11 insertions, 1 deletions
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 <stdlib.h>
#include <string.h>
+#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;