curl/lib/vtls
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
..
bearssl.c vtls: replace addsessionid with set_sessionid 2024-07-09 23:14:58 +02:00
bearssl.h
cipher_suite.c tidy-up: adjust casing of project names 2024-07-12 13:56:16 +02:00
cipher_suite.h
gtls.c tidy-up: adjust casing of project names 2024-07-12 13:56:16 +02:00
gtls.h
hostcheck.c code: language cleanup in comments 2024-07-01 22:58:55 +02:00
hostcheck.h code: language cleanup in comments 2024-07-01 22:58:55 +02:00
keylog.c
keylog.h
mbedtls_threadlock.c
mbedtls_threadlock.h
mbedtls.c vtls: replace addsessionid with set_sessionid 2024-07-09 23:14:58 +02:00
mbedtls.h
openssl.c tidy-up: adjust casing of project names 2024-07-12 13:56:16 +02:00
openssl.h
rustls.c code: language cleanup in comments 2024-07-01 22:58:55 +02:00
rustls.h
schannel_int.h code: language cleanup in comments 2024-07-01 22:58:55 +02:00
schannel_verify.c code: language cleanup in comments 2024-07-01 22:58:55 +02:00
schannel.c vtls: replace addsessionid with set_sessionid 2024-07-09 23:14:58 +02:00
schannel.h
sectransp.c sectransp: fix clang compiler warnings, stop silencing them 2024-07-13 12:00:13 +02:00
sectransp.h
vtls_int.h vtls: replace addsessionid with set_sessionid 2024-07-09 23:14:58 +02:00
vtls.c vtls: replace addsessionid with set_sessionid 2024-07-09 23:14:58 +02:00
vtls.h
wolfssl.c tidy-up: adjust casing of project names 2024-07-12 13:56:16 +02:00
wolfssl.h
x509asn1.c x509asn1: remove superfluous free() 2024-06-28 14:45:47 +02:00
x509asn1.h