Go to file
Viktor Szakats 5fa534b0da
sectransp: fix clang compiler warnings, stop silencing them
Fix `-Wpointer-bool-conversion` warnings with the method suggested by
both Apple clang and mainline llvm. This was already tried and dropped
in #1705 (in year 2017), but the issue reported there no longer
replicates.

Verified with Apple clang 14, llvm 15, llvm 18 and gcc 11, 14 that the
generated objects are bit by bit identical before and after this patch.

Also:
- stop silencing `-Wtautological-pointer-compare`. This warning don't
  seem to be appearing anymore (with or without this patch), at least
  with the tested compilers and SDKs (clang 13.1.6-16.0.0beta, llvm 15,
  18, gcc 11, 14) and minimum macOS target of 10.8. Older targets fail
  to build curl with SecureTransport.

- silence `-Wunreachable-code` for clang only. Previously I applied it
  also to GCC, by mistake.
  Ref: 8d7172d20a

Apple clang `-Wpointer-bool-conversion`:
```
curl/lib/vtls/sectransp.c:1103:6: error: address of function 'SSLCreateContext' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
  if(SSLCreateContext) {  /* use the newer API if available */
  ~~ ^~~~~~~~~~~~~~~~
curl/lib/vtls/sectransp.c:1103:6: note: prefix with the address-of operator to silence this warning
  if(SSLCreateContext) {  /* use the newer API if available */
     ^
     &
```
Ref: https://github.com/curl/curl/actions/runs/9819538439/job/27113201384#step:8:382

llvm `-Wpointer-bool-conversion`:
```
curl/lib/vtls/sectransp.c:2663:8: error: address of function 'SSLCreateContext' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
    if(SSLCreateContext)
    ~~ ^~~~~~~~~~~~~~~~
curl/lib/vtls/sectransp.c:2663:8: note: prefix with the address-of operator to silence this warning
    if(SSLCreateContext)
       ^
       &
```
Ref: https://github.com/curl/curl/actions/runs/9819538439/job/27113200291#step:8:417

gcc still needs `-Waddress` suppressed to avoid these:
```
curl/lib/vtls/n/sectransp.c: In function 'getsubject':
curl/lib/vtls/n/sectransp.c:379:6: warning: the address of 'SecCertificateCopyLongDescription' will always evaluate as 'true' [-Waddress]
  379 |   if(&SecCertificateCopyLongDescription)
      |      ^
[...]
```

Follow-up to 59cadacfcc #14128
Follow-up to af271ce9b9 #1722
Follow-up to 2b7ce3f56d #1706
Cherry-picked from #14097
Closes #14162
2024-07-13 12:00:13 +02:00
.circleci CI/circleci: config tidy-ups, bump up test parallelism 2024-07-13 04:03:05 +02:00
.github GHA/windows: re-add gsasl to MSVC jobs 2024-07-12 17:03:24 +02:00
CMake build: tidy up __builtin_available feature checks (Apple) 2024-07-10 11:42:46 +02:00
docs tidy-up: adjust casing of project names 2024-07-12 13:56:16 +02:00
include tidy-up: adjust casing of project names 2024-07-12 13:56:16 +02:00
lib sectransp: fix clang compiler warnings, stop silencing them 2024-07-13 12:00:13 +02:00
LICENSES copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
m4 tidy-up: adjust casing of project names 2024-07-12 13:56:16 +02:00
packages tidy-up: adjust casing of project names 2024-07-12 13:56:16 +02:00
plan9 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
projects tidy-up: adjust casing of project names 2024-07-12 13:56:16 +02:00
scripts reuse: switch to REUSE 3.2 and REUSE.toml 2024-07-05 20:47:48 +02:00
src curl: follow-up to fix categories in --help 2024-07-05 14:44:43 -07:00
tests tidy-up: adjust casing of project names 2024-07-12 13:56:16 +02:00
winbuild tidy-up: adjust casing of project names 2024-07-12 13:56:16 +02:00
.azure-pipelines.yml CI: fix typo in job name 2024-06-27 13:33:30 +02:00
.cirrus.yml CI: bump FreeBSD Python packages 2024-07-09 23:31:27 +02:00
.dcignore copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
.dir-locals.el copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
.git-blame-ignore-revs copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
.gitattributes winbuild: MS-DOS batch tidy-ups 2024-07-02 19:26:15 +02:00
.gitignore TLS: add support for ECH (Encrypted Client Hello) 2024-04-16 08:10:53 +02:00
.mailmap .mailmap: update Gisle's preferred email 2024-04-09 08:50:07 +02:00
acinclude.m4 build: tidy up __builtin_available feature checks (Apple) 2024-07-10 11:42:46 +02:00
appveyor.sh CI: simplify running curl with DLLs 2024-07-10 11:30:39 +02:00
appveyor.yml build: untangle CURLDEBUG and DEBUGBUILD macros 2024-05-28 08:12:00 +02:00
buildconf copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
buildconf.bat buildconf.bat: remove outdated groff/nroff use 2024-03-07 22:38:16 +01:00
CHANGES curl.se: new home 2020-11-04 23:59:47 +01:00
CMakeLists.txt cmake: detect libidn2 also via pkg-config 2024-07-10 11:42:47 +02:00
configure.ac tidy-up: adjust casing of project names 2024-07-12 13:56:16 +02:00
COPYING COPYING: update copyright year 2024-01-08 18:40:06 +01:00
curl-config.in curl-config: revert to backticks to support old target envs 2024-06-04 10:13:21 +02:00
Dockerfile Dockerfile: update debian:bookworm-slim to 39868a6 2024-07-03 08:39:27 +02:00
GIT-INFO.md GIT-INFO.md: remove version requirements 2024-07-08 23:06:05 +02:00
libcurl.def lib: add curl_multi_waitfds 2024-04-09 16:53:40 +02:00
libcurl.pc.in libcurl.pc: add Requires.private, Requires for static linking 2024-06-13 11:17:33 +02:00
Makefile.am winbuild: MS-DOS batch tidy-ups 2024-07-02 19:26:15 +02:00
Makefile.dist Makefile.mk: drop Windows support 2023-12-16 13:12:22 +00:00
maketgz projects: drop MSVC project files for recent versions 2024-04-10 07:55:24 +02:00
README docs: minor grammar fixes 2022-09-29 10:44:12 +02:00
README.md tidy-up: mostly whitespace nits 2023-08-31 23:02:10 +00:00
RELEASE-NOTES tidy-up: adjust casing of project names 2024-07-12 13:56:16 +02:00
renovate.json GHA: unify http3 workflows into one 2024-06-01 10:57:23 +02:00
REUSE.toml reuse: fix typo in comment 2024-07-06 02:39:24 +02:00
SECURITY.md SECURITY-PROCESS.md. call it vulnerability disclosure policy 2023-09-14 17:04:33 +02:00

curl logo

Curl is a command-line tool for transferring data specified with URL syntax. Find out how to use curl by reading the curl.1 man page or the MANUAL document. Find out how to install Curl by reading the INSTALL document.

libcurl is the library curl is using to do its job. It is readily available to be used by your software. Read the libcurl.3 man page to learn how.

You can find answers to the most frequent questions we get in the FAQ document.

Study the COPYING file for distribution terms.

Contact

If you have problems, questions, ideas or suggestions, please contact us by posting to a suitable mailing list.

All contributors to the project are listed in the THANKS document.

Commercial support

For commercial support, maybe private and dedicated help with your problems or applications using (lib)curl visit the support page.

Website

Visit the curl website for the latest news and downloads.

Git

To download the latest source from the Git server, do this:

git clone https://github.com/curl/curl.git

(you will get a directory named curl created, filled with the source code)

Security problems

Report suspected security problems via our HackerOne page and not in public.

Notice

Curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan. This notice is included here to comply with the distribution terms.

Backers

Thank you to all our backers! 🙏 Become a backer.

Sponsors

Support this project by becoming a sponsor.