From: Viktor Szakats Date: Wed, 18 Feb 2026 13:27:20 +0000 (+0100) Subject: clang-tidy: check `readability-redundant-preprocessor`, fix fallouts X-Git-Tag: rc-8_19_0-3~98 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3cdc16742596e08427299865a25ef70dfee3400a;p=thirdparty%2Fcurl.git clang-tidy: check `readability-redundant-preprocessor`, fix fallouts Also: - cipher_suite: merge `USE_MBEDTLS` `#if` blocks. Ref: https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-preprocessor.html Closes #20628 --- diff --git a/.clang-tidy.yml b/.clang-tidy.yml index 36c117c3e0..582237eea5 100644 --- a/.clang-tidy.yml +++ b/.clang-tidy.yml @@ -16,4 +16,5 @@ Checks: >- misc-const-correctness, portability-*, readability-named-parameter, - readability-redundant-control-flow + readability-redundant-control-flow, + readability-redundant-preprocessor diff --git a/lib/content_encoding.c b/lib/content_encoding.c index 6f58054bb2..8878d8ee68 100644 --- a/lib/content_encoding.c +++ b/lib/content_encoding.c @@ -600,9 +600,7 @@ static const struct Curl_cwtype * const general_unencoders[] = { /* supported content decoders only for transfer encodings */ static const struct Curl_cwtype * const transfer_unencoders[] = { -#ifndef CURL_DISABLE_HTTP &Curl_httpchunk_unencoder, -#endif NULL }; diff --git a/lib/vtls/cipher_suite.c b/lib/vtls/cipher_suite.c index 562a347735..af51582784 100644 --- a/lib/vtls/cipher_suite.c +++ b/lib/vtls/cipher_suite.c @@ -159,13 +159,11 @@ struct cs_entry { /* !checksrc! disable COMMANOSPACE all */ static const struct cs_entry cs_list[] = { /* TLS 1.3 ciphers */ -#if defined(USE_MBEDTLS) || defined(USE_RUSTLS) CS_ENTRY(0x1301, TLS,AES,128,GCM,SHA256,,,), CS_ENTRY(0x1302, TLS,AES,256,GCM,SHA384,,,), CS_ENTRY(0x1303, TLS,CHACHA20,POLY1305,SHA256,,,,), CS_ENTRY(0x1304, TLS,AES,128,CCM,SHA256,,,), CS_ENTRY(0x1305, TLS,AES,128,CCM,8,SHA256,,), -#endif /* TLS 1.2 ciphers */ CS_ENTRY(0xC02B, TLS,ECDHE,ECDSA,WITH,AES,128,GCM,SHA256), CS_ENTRY(0xC02B, ECDHE,ECDSA,AES128,GCM,SHA256,,,), @@ -232,8 +230,6 @@ static const struct cs_entry cs_list[] = { CS_ENTRY(0xC031, ECDH,RSA,AES128,GCM,SHA256,,,), CS_ENTRY(0xC032, TLS,ECDH,RSA,WITH,AES,256,GCM,SHA384), CS_ENTRY(0xC032, ECDH,RSA,AES256,GCM,SHA384,,,), -#endif -#ifdef USE_MBEDTLS CS_ENTRY(0x0001, TLS,RSA,WITH,NULL,MD5,,,), CS_ENTRY(0x0001, NULL,MD5,,,,,,), CS_ENTRY(0x0002, TLS,RSA,WITH,NULL,SHA,,,), @@ -320,8 +316,6 @@ static const struct cs_entry cs_list[] = { CS_ENTRY(0xC036, ECDHE,PSK,AES256,CBC,SHA,,,), CS_ENTRY(0xCCAB, TLS,PSK,WITH,CHACHA20,POLY1305,SHA256,,), CS_ENTRY(0xCCAB, PSK,CHACHA20,POLY1305,,,,,), -#endif -#ifdef USE_MBEDTLS CS_ENTRY(0xC09C, TLS,RSA,WITH,AES,128,CCM,,), CS_ENTRY(0xC09C, AES128,CCM,,,,,,), CS_ENTRY(0xC09D, TLS,RSA,WITH,AES,256,CCM,,), @@ -338,8 +332,6 @@ static const struct cs_entry cs_list[] = { CS_ENTRY(0xC0AE, ECDHE,ECDSA,AES128,CCM8,,,,), CS_ENTRY(0xC0AF, TLS,ECDHE,ECDSA,WITH,AES,256,CCM,8), CS_ENTRY(0xC0AF, ECDHE,ECDSA,AES256,CCM8,,,,), -#endif -#ifdef USE_MBEDTLS /* entries marked ns are "non-standard", they are not in OpenSSL */ CS_ENTRY(0x0041, TLS,RSA,WITH,CAMELLIA,128,CBC,SHA,), CS_ENTRY(0x0041, CAMELLIA128,SHA,,,,,,), diff --git a/src/tool_help.c b/src/tool_help.c index d743fe3953..50cca52705 100644 --- a/src/tool_help.c +++ b/src/tool_help.c @@ -281,13 +281,11 @@ void tool_help(const char *category) curl_msnprintf(cmdbuf, sizeof(cmdbuf), "\n --no-%s", a->lname); else curl_msnprintf(cmdbuf, sizeof(cmdbuf), "\n %s", category); -#ifdef USE_MANUAL if(a->cmd == C_XATTR) /* this is the last option, which then ends when FILES starts */ showhelp("\nALL OPTIONS\n", cmdbuf, "\nFILES"); else showhelp("\nALL OPTIONS\n", cmdbuf, "\n -"); -#endif } #else curl_mfprintf(tool_stderr, "Cannot comply. "