Skip to content

Commit 41ce7c7

Browse files
committed
tests/nutlogtest.c: use support for plain "-Wformat" and for "-Wformat-extra-args" in pragmas to quiesce "bogus-looking" test cases [networkupstools#2450]
Signed-off-by: Jim Klimov <[email protected]>
1 parent 8ccaa27 commit 41ce7c7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/nutlogtest.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,24 @@ int main(void) {
8484
ret++;
8585
}
8686

87-
#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW)
87+
#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT)
8888
# pragma GCC diagnostic push
8989
# pragma GCC diagnostic ignored "-Wformat"
90+
#endif
91+
#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_EXTRA_ARGS)
92+
# pragma GCC diagnostic push
93+
# pragma GCC diagnostic ignored "-Wformat-extra-args"
9094
#endif
9195
if (snprintf_dynamic(buf, sizeof(buf), dynfmt, "%d", "Single string via dynamic format", 1) < 0) {
9296
upsdebugx(0, "D: snprintf_dynamic() correctly reports mis-matched formats");
9397
} else {
9498
upsdebugx(0, "E: snprintf_dynamic() wrongly reports well-matched formats");
9599
ret++;
96100
}
97-
#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW)
101+
#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_EXTRA_ARGS)
102+
# pragma GCC diagnostic pop
103+
#endif
104+
#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT)
98105
# pragma GCC diagnostic pop
99106
#endif
100107

0 commit comments

Comments
 (0)