Skip to content

build: extend GNU C guards to clang where applicable, fix fallouts#17955

Closed
vszakats wants to merge 10 commits intocurl:masterfrom
vszakats:clangcc-guards
Closed

build: extend GNU C guards to clang where applicable, fix fallouts#17955
vszakats wants to merge 10 commits intocurl:masterfrom
vszakats:clangcc-guards

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Jul 17, 2025

Some GNU C version guards implicitly include the clang compiler, because
clang reports itself as GCC 4.2.1.

This implicit inclusion doesn't happen if the guard requires a GCC
version above 4.2.1.

Fix two such guards to explicitly include clang where it does support
the guarded feature:

Also fix compile warnings triggered by the above:

@vszakats vszakats marked this pull request as draft July 17, 2025 17:02
vszakats added 3 commits July 17, 2025 19:11
First supported in llvm/clang 3.8. Use a version number that covers
this also for Apple clang, which matched 3.8 at its version 7.3.
```
D:/a/curl/curl/tests/libtest/lib1912.c:44:57: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
   44 |       print_err(o->name, "CURLOT_LONG or CURLOT_VALUES");
      |                                                         ^
D:/a/curl/curl/tests/libtest/lib1912.c:48:41: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
   48 |       print_err(o->name, "CURLOT_OFF_T");
      |                                         ^
D:/a/curl/curl/tests/libtest/lib1912.c:52:42: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
   52 |       print_err(o->name, "CURLOT_STRING");
      |                                          ^
D:/a/curl/curl/tests/libtest/lib1912.c:56:41: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
   56 |       print_err(o->name, "CURLOT_SLIST");
      |                                         ^
D:/a/curl/curl/tests/libtest/lib1912.c:60:41: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
   60 |       print_err(o->name, "CURLOT_CBPTR");
      |                                         ^
D:/a/curl/curl/tests/libtest/lib1912.c:65:44: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
   65 |       print_err(o->name, "CURLOT_FUNCTION");
      |                                            ^
D:/a/curl/curl/tests/libtest/lib1912.c:69:44: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
   69 |       print_err(o->name, "CURLOT_FUNCTION");
      |                                            ^
D:/a/curl/curl/tests/libtest/lib1912.c:73:42: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
   73 |       print_err(o->name, "CURLOT_OBJECT");
      |                                          ^
```
https://github.com/curl/curl/actions/runs/16351302841/job/46198524880?pr=17955#step:12:61
```
D:/a/curl/curl/tests/libtest/lib2032.c:145:29: error: sizeof on pointer operation will return size of 'CURL **' (aka 'void **') instead of 'CURL *[3]' (aka 'void *[3]') [-Werror,-Wsizeof-array-decay]
  145 |                   ntlm_easy + num_handles);
      |                   ~~~~~~~~~ ^
```
https://github.com/curl/curl/actions/runs/16351302841/job/46198524880?pr=17955#step:12:86
@vszakats vszakats changed the title [TEST] try typecheck-gcc with clang build: extend GNU C guards to clang where applicable, fix fallouts Jul 17, 2025
@vszakats vszakats marked this pull request as ready for review July 17, 2025 18:10
@github-actions github-actions bot added the CI Continuous Integration label Jul 17, 2025
@vszakats vszakats added the feature-window A merge of this requires an open feature window label Jul 21, 2025
@vszakats vszakats closed this in fd2ca23 Jul 27, 2025
@vszakats vszakats deleted the clangcc-guards branch July 27, 2025 21:02
vszakats added a commit that referenced this pull request Dec 12, 2025
- cmake: automatically disable typecheck when running clang-tidy,
  to avoid possible interference, and to improve performance.

- INSTALL-CMAKE: document both this, and unity=off for clang-tidy.

- GHA/linux: disable for some static analyzers CI jobs to avoid possible
  interference.

- GHA/linux: disable in Fil-C job to improve build performance.

Follow-up to 9e6f1c5 #19637
Follow-up to fd2ca23 #17955

Closes #19941
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration cmdline tool feature-window A merge of this requires an open feature window libcurl API tests

Development

Successfully merging this pull request may close these issues.

1 participant