Skip to content

tool_getparam: avoid -Wcomma with Apple clang in C89 mode#20362

Closed
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:c891
Closed

tool_getparam: avoid -Wcomma with Apple clang in C89 mode#20362
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:c891

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Jan 19, 2026

Seen with Apple clang 17:

curl/src/tool_getparam.c:3062:12: warning: possible misuse of comma operator here [-Wcomma]
 3062 |   for(i = 1, stillflags = TRUE; i < argc && !result; i++) {
      |            ^
curl/src/tool_getparam.c:3062:7: note: cast expression to void to silence warning
 3062 |   for(i = 1, stillflags = TRUE; i < argc && !result; i++) {
      |       ^~~~~
      |       (void)( )

```
src/tool_getparam.c:3062:12: warning: possible misuse of comma operator here [-Wcomma]
 3062 |   for(i = 1, stillflags = TRUE; i < argc && !result; i++) {
      |            ^
src/tool_getparam.c:3062:7: note: cast expression to void to silence warning
 3062 |   for(i = 1, stillflags = TRUE; i < argc && !result; i++) {
      |       ^~~~~
      |       (void)( )
```
@bagder
Copy link
Member

bagder commented Jan 19, 2026

warning: possible misuse of comma operator here

Candidate for most silly warning in 2026...

@vszakats
Copy link
Member Author

warning: possible misuse of comma operator here

Candidate for most silly warning in 2026...

It's silly, yes. Seen with Apple clang.

@vszakats vszakats changed the title tool_getparam: avoid compiler warning in C89 mode tool_getparam: avoid -Wcomma with Apple clang in C89 mode Jan 19, 2026
@vszakats vszakats closed this in e8189c4 Jan 19, 2026
@vszakats vszakats deleted the c891 branch January 19, 2026 23:21
vszakats added a commit to vszakats/curl that referenced this pull request Jan 20, 2026
vszakats added a commit to vszakats/curl that referenced this pull request Jan 20, 2026
vszakats added a commit that referenced this pull request Jan 20, 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 #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

Closes #20363
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.

2 participants