]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
clang-tidy: check `readability-redundant-preprocessor`, fix fallouts
authorViktor Szakats <commit@vsz.me>
Wed, 18 Feb 2026 13:27:20 +0000 (14:27 +0100)
committerViktor Szakats <commit@vsz.me>
Thu, 19 Feb 2026 14:27:17 +0000 (15:27 +0100)
Also:
- cipher_suite: merge `USE_MBEDTLS` `#if` blocks.

Ref: https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-preprocessor.html

Closes #20628

.clang-tidy.yml
lib/content_encoding.c
lib/vtls/cipher_suite.c
src/tool_help.c

index 36c117c3e085689320f60c2ecc19383c8b9a3826..582237eea5f1be462108b7b952756e9f40e48633 100644 (file)
@@ -16,4 +16,5 @@ Checks: >-
   misc-const-correctness,
   portability-*,
   readability-named-parameter,
-  readability-redundant-control-flow
+  readability-redundant-control-flow,
+  readability-redundant-preprocessor
index 6f58054bb29557117890f53a973c3ecae58c404b..8878d8ee6888dca58b63b65e17db70b5df772c87 100644 (file)
@@ -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
 };
 
index 562a3477355d7764c16550460966d9563df18b8f..af5158278404acadd3bf316095f43cd8ec038a39 100644 (file)
@@ -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,,,,,,),
index d743fe395344a5d8094d9afb1401cf747491ef34..50cca527057333b3dfcfd0e3f8bdea076f7a59df 100644 (file)
@@ -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. "