mirror of
https://github.com/curl/curl.git
synced 2026-04-19 10:01:15 +03:00
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: https://github.com/curl/curl/pull/12331/commits/8d7172d20a48ebc6c1b1d94a76e2c5fb19dd9bfa 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 |
||
|---|---|---|
| .. | ||
| bearssl.c | ||
| bearssl.h | ||
| cipher_suite.c | ||
| cipher_suite.h | ||
| gtls.c | ||
| gtls.h | ||
| hostcheck.c | ||
| hostcheck.h | ||
| keylog.c | ||
| keylog.h | ||
| mbedtls.c | ||
| mbedtls.h | ||
| mbedtls_threadlock.c | ||
| mbedtls_threadlock.h | ||
| openssl.c | ||
| openssl.h | ||
| rustls.c | ||
| rustls.h | ||
| schannel.c | ||
| schannel.h | ||
| schannel_int.h | ||
| schannel_verify.c | ||
| sectransp.c | ||
| sectransp.h | ||
| vtls.c | ||
| vtls.h | ||
| vtls_int.h | ||
| wolfssl.c | ||
| wolfssl.h | ||
| x509asn1.c | ||
| x509asn1.h | ||