tests: put the printf attribute in the header for _test_print_failed()
authorBartosz Golaszewski <bartekgola@gmail.com>
Sun, 14 May 2017 11:37:51 +0000 (13:37 +0200)
committerBartosz Golaszewski <bartekgola@gmail.com>
Sun, 14 May 2017 11:37:51 +0000 (13:37 +0200)
If the printf attribute is only present next to the function's
definition, the compiler only checks the calls in the same compilation
unit.

In order to verify all the calls, annotate the declaration of
_test_print_failed() in gpiod-test.h.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
tests/gpiod-test.c
tests/gpiod-test.h

index 9f84fbd6441566aaba481a37cebfefda0a0a3ab3..8dfa913c008f4c6dc93e7cc2ab9a409ff816f34c 100644 (file)
@@ -653,7 +653,7 @@ void _test_register(struct _test_case *test)
        globals.num_tests++;
 }
 
-TEST_PRINTF(1, 2) void _test_print_failed(const char *fmt, ...)
+void _test_print_failed(const char *fmt, ...)
 {
        int status;
        va_list va;
index 26f8945507f19573f0de3fba5da92c80dcffaf7b..d4404b860ee95b556e7cffc4a624db7f53071b30 100644 (file)
@@ -41,7 +41,7 @@ struct _test_case {
 };
 
 void _test_register(struct _test_case *test);
-void _test_print_failed(const char *fmt, ...);
+void _test_print_failed(const char *fmt, ...) TEST_PRINTF(1, 2);
 
 /*
  * This macro should be used for code brevity instead of manually declaring