Skip to content

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

Closed
vszakats wants to merge 20 commits into
curl:masterfrom
vszakats:c89gha
Closed

vszakats wants to merge 20 commits into
curl:masterfrom
vszakats:c89gha

Conversation

@vszakats

@vszakats vszakats commented Jan 19, 2026 •

Copy link
Copy Markdown
Member
  • 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
vszakats added a commit to vszakats/curl that referenced this pull request Mar 12, 2026
vszakats added a commit that referenced this pull request Mar 12, 2026
- tool_getparam: revert an unnecessary/no-op C89 warning silencer.
  Follow-up to 09c9afd #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 f07a98a #20366

- unit1652: drop always-false `!defined(__clang__)` guard.
  Pointed-out-by: Orgad Shaneh
  Ref: #20902
  Follow-up to 7e814c8 #16062

- unit1652: document that `-Wformat` is necessary for GCC v5 to v8.
  Follow-up to 71cf0d1 #14772

Closes #20908
vszakats added a commit that referenced this pull request Mar 19, 2026
From Apple clang-only prior to this patch.

Silencing (seen after macos-15 runner accidentally switched to
llvm/clang by default):
```
/Users/runner/work/curl/curl/lib/curlx/warnless.h:64:1: error: '_Bool' is a C99 extension [-Werror,-Wc99-extensions]
   64 | bool curlx_sztouz(ssize_t sznum, size_t *puznum);
      | ^
/opt/homebrew/Cellar/llvm@18/18.1.8/lib/clang/18/include/stdbool.h:20:14: note: expanded from macro 'bool'
   20 | #define bool _Bool
      |              ^
[...]
```
Ref: https://github.com/curl/curl/actions/runs/23304345180/job/67774031335?pr=21014#step:11:39

Follow-up to 09c9afd #20363
Ref: actions/runner-images#13827

Closes #21015
vszakats added a commit that referenced this pull request Apr 8, 2026
Syncing with CMake.

Follow-up to 43397b0 #21015
Follow-up to 09c9afd #20363

Closes #21263
outcast36 pushed a commit to greearb/curl that referenced this pull request Jun 3, 2026
- tool_getparam: revert an unnecessary/no-op C89 warning silencer.
  Follow-up to 09c9afd curl#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 f07a98a curl#20366

- unit1652: drop always-false `!defined(__clang__)` guard.
  Pointed-out-by: Orgad Shaneh
  Ref: curl#20902
  Follow-up to 7e814c8 curl#16062

- unit1652: document that `-Wformat` is necessary for GCC v5 to v8.
  Follow-up to 71cf0d1 curl#14772

Closes curl#20908
outcast36 pushed a commit to greearb/curl that referenced this pull request Jun 3, 2026
From Apple clang-only prior to this patch.

Silencing (seen after macos-15 runner accidentally switched to
llvm/clang by default):
```
/Users/runner/work/curl/curl/lib/curlx/warnless.h:64:1: error: '_Bool' is a C99 extension [-Werror,-Wc99-extensions]
   64 | bool curlx_sztouz(ssize_t sznum, size_t *puznum);
      | ^
/opt/homebrew/Cellar/llvm@18/18.1.8/lib/clang/18/include/stdbool.h:20:14: note: expanded from macro 'bool'
   20 | #define bool _Bool
      |              ^
[...]
```
Ref: https://github.com/curl/curl/actions/runs/23304345180/job/67774031335?pr=21014#step:11:39

Follow-up to 09c9afd curl#20363
Ref: actions/runner-images#13827

Closes curl#21015
outcast36 pushed a commit to greearb/curl that referenced this pull request Jun 3, 2026
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