]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
clang-tidy: check `misc-header-include-cycle`, fix in internal headers
authorViktor Szakats <commit@vsz.me>
Wed, 18 Feb 2026 14:14:06 +0000 (15:14 +0100)
committerViktor Szakats <commit@vsz.me>
Fri, 20 Feb 2026 16:33:02 +0000 (17:33 +0100)
Also opt-out `curl/curl.h` because it includes `curl/mprintf.h`, which
in turn includes `curl/curl.h` for `CURL_EXTERN`. Not changeable in
public headers to remain compatible. (Somehow only triggered for
examples.)

Ref: https://clang.llvm.org/extra/clang-tidy/checks/misc/header-include-cycle.html

Closes #20645

.clang-tidy.yml
lib/functypes.h
src/tool_operate.h
src/tool_sdecls.h

index 3bbb7cf5ca69d9ca000b7083f4c77db055274ee2..63d171c7667c4be7f0a05e9a2b872b41c95d9075 100644 (file)
@@ -12,8 +12,12 @@ Checks:
   - -clang-diagnostic-nullability-extension
   - bugprone-suspicious-realloc-usage
   - misc-const-correctness
+  - misc-header-include-cycle
   - portability-*
   - readability-named-parameter
   - readability-redundant-control-flow
   - readability-redundant-preprocessor
   - readability-uppercase-literal-suffix
+
+CheckOptions:
+  misc-header-include-cycle.IgnoredFilesList: 'curl/curl.h;openssl/ssl.h'
index df3cfd44c88f3f254dfa1907c1673192b326fd8a..887c2612ef94d83ce89e7fa8a019c3f78d804cbb 100644 (file)
@@ -23,8 +23,6 @@
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-#include "curl_setup.h"
-
 /* defaults:
 
    ssize_t recv(int, void *, size_t, int);
index 93c87e10e65936f2c08b8d4cf8043e50a65d6760..7e886f6ef043017edf50686626c1c0adcde55f6c 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "tool_cb_hdr.h"
 #include "tool_cb_prg.h"
-#include "tool_sdecls.h"
+#include "tool_cfgable.h"
 
 struct per_transfer {
   /* double linked */
index 9058233a688e183df4edc2d69812d513ebdd4c5a..5350b71a3714bc38f04f045180bfb82dd535d11c 100644 (file)
@@ -128,10 +128,4 @@ typedef enum {
   SANITIZE_ERR_LAST /* never use! */
 } SANITIZEcode;
 
-/*
- * Complete struct declarations which have OperationConfig struct members,
- * just in case this header is directly included in some source file.
- */
-#include "tool_cfgable.h"
-
 #endif /* HEADER_CURL_TOOL_SDECLS_H */