Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

1 participant