From 210d8eca5b1e7cf6944d19cba92fe29a771f7664 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 12 Mar 2026 14:59:11 +0100 Subject: [PATCH] build: compiler warning silencing tidy-ups - tool_getparam: revert an unnecessary/no-op C89 warning silencer. Follow-up to 09c9afdd711d0b2ee9f524a235803e755e1074b7 #20363 - tool_writeout: add comment saying silencing is a no-op for llvm/clang. For `strftime()` it is a GCC-specific, as of llvm/clang v22.1.0. Follow-up to f07a98ae113b832a8748ba66e1554a7f14c6897e #20366 - unit1652: drop always-false `!defined(__clang__)` guard. Pointed-out-by: Orgad Shaneh Ref: #20902 Follow-up to 7e814c8717939393d4436d75f5f0c3ffa98c8c53 #16062 - unit1652: document that `-Wformat` is necessary for GCC v5 to v8. Follow-up to 71cf0d1fca9e1f53524e1545ef0c08d174458d80 #14772 Closes #20908 --- src/tool_getparam.c | 3 ++- src/tool_writeout.c | 2 +- tests/unit/unit1652.c | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/tool_getparam.c b/src/tool_getparam.c index 3337feba52..eac6cafd0c 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -3057,7 +3057,8 @@ ParameterError parse_args(int argc, argv_item_t argv[]) ParameterError err = PARAM_OK; struct OperationConfig *config = global->first; - for(i = 1, stillflags = TRUE; i < argc && !err; i++) { + stillflags = TRUE; + for(i = 1; i < argc && !err; i++) { orig_opt = convert_tchar_to_UTF8(argv[i]); if(!orig_opt) return PARAM_NO_MEM; diff --git a/src/tool_writeout.c b/src/tool_writeout.c index 22c83efd03..79e34cbc44 100644 --- a/src/tool_writeout.c +++ b/src/tool_writeout.c @@ -580,7 +580,7 @@ static const char *outtime(const char *ptr, /* %time{ ... */ if(!result) { struct tm utc; result = curlx_gmtime(secs, &utc); -#ifdef __GNUC__ +#ifdef __GNUC__ /* includes llvm/clang, but not affected as of v22.1.0 */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" #endif diff --git a/tests/unit/unit1652.c b/tests/unit/unit1652.c index 80a9de8da1..f13b70df12 100644 --- a/tests/unit/unit1652.c +++ b/tests/unit/unit1652.c @@ -88,9 +88,9 @@ static CURLcode test_unit1652(const char *arg) UNITTEST_BEGIN(t1652_setup(&easy)) -#if defined(CURL_GNUC_DIAG) && !defined(__clang__) +#ifdef CURL_GNUC_DIAG #pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wformat" /* for GCC v5 to v8 */ #pragma GCC diagnostic ignored "-Wformat-zero-length" #if __GNUC__ >= 7 #pragma GCC diagnostic ignored "-Wformat-overflow" @@ -157,7 +157,7 @@ static CURLcode test_unit1652(const char *arg) fail_unless(output[sizeof(output) - 1] == '\0', "Truncation of infof input 3"); -#if defined(CURL_GNUC_DIAG) && !defined(__clang__) +#ifdef CURL_GNUC_DIAG #pragma GCC diagnostic pop #endif