Skip to content

build: drop global suppression of -Wformat-nonliteral, fix fallouts#20366

Closed
vszakats wants to merge 12 commits intocurl:masterfrom
vszakats:bfmtlit
Closed

build: drop global suppression of -Wformat-nonliteral, fix fallouts#20366
vszakats wants to merge 12 commits intocurl:masterfrom
vszakats:bfmtlit

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Jan 20, 2026

Extend two existing local suppressions to GCC, and add another
GCC-specific one as a replacement.

Before this patch suppressing this warning was odd with clang, because
after this option, -Wformat=2 is used, which re-enables it.

Also:

  • mprintf: minimize scope of a warning suppression.
  • tests/server: suppress this warning for a system vsnprintf() call
    where it could trigger in C89 builds or with
    CFLAGS=-DCURL_NO_FMT_CHECKS set. Seen with Apple clang 17:
    curl/tests/server/util.c:114:37: warning: format string is not a string literal [-Wformat-nonliteral]
      114 |   vsnprintf(buffer, sizeof(buffer), msg, ap);
          |                                     ^~~
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:124:69: note: expanded from macro 'vsnprintf'
      124 | #define vsnprintf(str, len, ...) __vsnprintf_chk_func (str, len, 0, __VA_ARGS__)
          |                                                                     ^~~~~~~~~~~
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:81:65: note: expanded from macro '__vsnprintf_chk_func'
       81 |         __builtin___vsnprintf_chk (str, len, flag, __darwin_obsz(str), format, ap)
          |                                                                        ^~~~~~
    

Ref: #20363

@github-actions github-actions bot added the tests label Jan 20, 2026
@vszakats vszakats changed the title build: drop global suppression of -Wformat-nonliteral build: drop global suppression of -Wformat-nonliteral, fix fallouts Jan 20, 2026
@vszakats vszakats closed this in f07a98a Jan 20, 2026
@vszakats vszakats deleted the bfmtlit branch January 20, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant