From 41ce7c7c6906e0324434ec5fdac6f5ff30c545a3 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 2 Jun 2024 12:52:11 +0200 Subject: [PATCH] tests/nutlogtest.c: use support for plain "-Wformat" and for "-Wformat-extra-args" in pragmas to quiesce "bogus-looking" test cases [#2450] Signed-off-by: Jim Klimov --- tests/nutlogtest.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/nutlogtest.c b/tests/nutlogtest.c index 9cdb87e598..4ba0ce3427 100644 --- a/tests/nutlogtest.c +++ b/tests/nutlogtest.c @@ -84,9 +84,13 @@ int main(void) { ret++; } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW) +#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wformat" +#endif +#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_EXTRA_ARGS) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-extra-args" #endif if (snprintf_dynamic(buf, sizeof(buf), dynfmt, "%d", "Single string via dynamic format", 1) < 0) { upsdebugx(0, "D: snprintf_dynamic() correctly reports mis-matched formats"); @@ -94,7 +98,10 @@ int main(void) { upsdebugx(0, "E: snprintf_dynamic() wrongly reports well-matched formats"); ret++; } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW) +#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_EXTRA_ARGS) +# pragma GCC diagnostic pop +#endif +#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT) # pragma GCC diagnostic pop #endif