Skip to content

cmake: silence silly Apple clang warnings in C89 mode, test in CI#20363

Closed
vszakats wants to merge 20 commits intocurl:masterfrom
vszakats:c89gha
Closed

cmake: silence silly Apple clang warnings in C89 mode, test in CI#20363
vszakats wants to merge 20 commits intocurl:masterfrom
vszakats:c89gha

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Jan 19, 2026

  • stdbool.h is also included via system headers. Disabling it from curl
    does not fix it. Silencing lots of these:

    curl/lib/curlx/warnless.h:64:1: warning: '_Bool' is a C99 extension [-Wc99-extensions]
     64 | bool curlx_sztouz(ssize_t sznum, size_t *puznum);
        | ^
    /Library/Developer/CommandLineTools/usr/lib/clang/17/include/stdbool.h:24:14: note: expanded from macro 'bool'
     24 | #define bool _Bool
        |              ^
    
  • silence -Wcomma warnings.
    in favor of the global silencing approach, since a couple of more of
    these were hit (in vquic, tool1622, unit1309, unit1636), and it seems
    silly to update them all.
    Revert e8189c4 tool_getparam: avoid -Wcomma with Apple clang in C89 mode #20362

Also:

  • cmake: include C standard in 'platform flags' log line.
  • GHA/macos: switch a job to C89 to verify.
  • GHA/linux: show 'C89' in job names.

Ref: https://cmake.org/cmake/help/v3.7/variable/CMAKE_C_STANDARD.html


@vszakats vszakats marked this pull request as draft January 19, 2026 22:25
@github-actions github-actions bot added the CI Continuous Integration label Jan 19, 2026
@vszakats vszakats changed the title GHA/linux: switch one C89 job to cmake [TEST] GHA/linux: switch one C89 job to cmake Jan 19, 2026
@vszakats vszakats changed the title [TEST] GHA/linux: switch one C89 job to cmake build: silence compiler warning with C89 and Apple clang Jan 19, 2026
@vszakats vszakats added the cmake label Jan 19, 2026
@vszakats vszakats changed the title build: silence compiler warning with C89 and Apple clang cmake: silence compiler warning with C89 and Apple clang Jan 19, 2026
@vszakats vszakats changed the title cmake: silence compiler warning with C89 and Apple clang cmake: silence compiler warnings with C89 and Apple clang Jan 19, 2026
@vszakats vszakats changed the title cmake: silence compiler warnings with C89 and Apple clang cmake: silence -Wc99-extensions with C89 and Apple clang Jan 19, 2026
@vszakats vszakats changed the title cmake: silence -Wc99-extensions with C89 and Apple clang cmake: silence silly Apple clang warnings in C89 mode Jan 20, 2026
@vszakats vszakats added the appleOS specific to an Apple operating system label Jan 20, 2026
vszakats added a commit that referenced this pull request 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

Closes #20366
@vszakats vszakats marked this pull request as ready for review January 20, 2026 11:48
@vszakats vszakats changed the title cmake: silence silly Apple clang warnings in C89 mode cmake: silence silly Apple clang warnings in C89 mode, test in CI Jan 20, 2026
@vszakats vszakats closed this in 09c9afd Jan 20, 2026
@vszakats vszakats deleted the c89gha branch January 20, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

appleOS specific to an Apple operating system CI Continuous Integration cmake cmdline tool

Development

Successfully merging this pull request may close these issues.

1 participant