public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] include/tst_test_macro.h: Fix zero-length gnu_printf format string warning
@ 2021-06-29  9:25 Yang Xu
  2021-06-29  9:25 ` [LTP] [PATCH 2/2] lib/newlib_tests/test_macros*.c: Include more test macros Yang Xu
  2021-06-29 10:10 ` [LTP] [PATCH 1/2] include/tst_test_macro.h: Fix zero-length gnu_printf format string warning Li Wang
  0 siblings, 2 replies; 8+ messages in thread
From: Yang Xu @ 2021-06-29  9:25 UTC (permalink / raw)
  To: ltp

When build test_macro02.c, it reports the following warning.

CC lib/newlib_tests/test_macros01
In file included from ../../include/tst_test.h:21,
                 from test_macros02.c:10:
test_macros02.c: In function ?do_test?:
../../include/tst_test_macros.h:142:31: warning: zero-length gnu_printf format string [-Wformat-zero-length]
  142 |     TST_MSG_(TPASS | TTERRNO, "",                  \
      |                               ^~

Fix this by adding space string in format when using TST_MSG_ macro.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 include/tst_test_macros.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h
index 78cee47de..41886fbbc 100644
--- a/include/tst_test_macros.h
+++ b/include/tst_test_macros.h
@@ -139,7 +139,7 @@ extern void *TST_RET_PTR;
 		                                                               \
 		if (ERRNO) {                                                   \
 			if (TST_ERR == ERRNO) {                                \
-				TST_MSG_(TPASS | TTERRNO, "",                  \
+				TST_MSG_(TPASS | TTERRNO, " ",                 \
 				         #SCALL, ##__VA_ARGS__);               \
 				TST_PASS = 1;                                  \
 			} else {                                               \
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-06-30  2:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-29  9:25 [LTP] [PATCH 1/2] include/tst_test_macro.h: Fix zero-length gnu_printf format string warning Yang Xu
2021-06-29  9:25 ` [LTP] [PATCH 2/2] lib/newlib_tests/test_macros*.c: Include more test macros Yang Xu
2021-06-29 10:20   ` Li Wang
2021-06-29 10:33     ` xuyang2018.jy
2021-06-29 11:14     ` [LTP] [PATCH v2] " Yang Xu
2021-06-29 12:29       ` Li Wang
2021-06-30  2:53         ` xuyang2018.jy
2021-06-29 10:10 ` [LTP] [PATCH 1/2] include/tst_test_macro.h: Fix zero-length gnu_printf format string warning Li Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox