]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: include headers only when used
authorViktor Szakats <commit@vsz.me>
Mon, 29 Dec 2025 02:44:27 +0000 (03:44 +0100)
committerViktor Szakats <commit@vsz.me>
Wed, 31 Dec 2025 16:00:56 +0000 (17:00 +0100)
Cherry-picked from #20106

Closes #20131

tests/libtest/lib758.c
tests/tunit/tool1604.c
tests/unit/unit1304.c
tests/unit/unit1307.c
tests/unit/unit1656.c
tests/unit/unit1657.c
tests/unit/unit1660.c
tests/unit/unit2603.c

index 12f476e9c72dba88bc08eb52a0b92e0f42c44f18..f6f371948e89e0105dc53abd699823fc7e5738e3 100644 (file)
@@ -30,8 +30,6 @@
 
 #include "first.h"
 
-#include "testtrace.h"
-
 #ifdef USE_OPENSSL
 
 #include <openssl/ssl.h>
@@ -43,6 +41,8 @@
 
 #ifdef T578_ENABLED
 
+#include "testtrace.h"
+
 static struct t758_ctx {
   int socket_calls;
   int max_socket_calls;
index de665bbc5e9c16c341d019f30b7c56c77d31e87c..ec23984869ff70434035c1d42884c774f0e71d49 100644 (file)
  ***************************************************************************/
 #include "unitcheck.h"
 
+#if defined(_WIN32) || defined(MSDOS)
+
 #include "tool_cfgable.h"
 #include "tool_doswin.h"
 
-#if defined(_WIN32) || defined(MSDOS)
 static char *getflagstr(int flags)
 {
   char *buf = curlx_malloc(256);
index 3e09a0c27761b23dfc65c96b61c17a2ec692b52d..3438c971043514006a3ef4273dd2a0361eba0a47 100644 (file)
  *
  ***************************************************************************/
 #include "unitcheck.h"
-#include "netrc.h"
 
 #ifndef CURL_DISABLE_NETRC
 
+#include "netrc.h"
+
 static void t1304_stop(char **password, char **login)
 {
   Curl_safefree(*password);
index 5c147c6eda1a1338161121cb7086cf2e995416dd..146d5ae7148a4fe3f44cb7fc66e30a000f5f84ed 100644 (file)
  ***************************************************************************/
 #include "unitcheck.h"
 
-#include "curl_fnmatch.h"
-
 #ifndef CURL_DISABLE_FTP
 
+#include "curl_fnmatch.h"
+
 /*
    CURL_FNMATCH_MATCH    0
    CURL_FNMATCH_NOMATCH  1
index 7cdca884b808bb28b5fc87e86c293e242cd2100e..cdd0df9bb21de5a93b015abc0f97f15b2a423b19 100644 (file)
  ***************************************************************************/
 #include "unitcheck.h"
 
-#include "vtls/x509asn1.h"
-
 #if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_MBEDTLS)
 
+#include "vtls/x509asn1.h"
+
 struct test_spec {
   const char *input;
   const char *exp_output;
index 850b3ef730860d11e8d89802bf986d65ba3faa41..515e2b595ae8844d73f46098b35327d864cb100b 100644 (file)
  ***************************************************************************/
 #include "unitcheck.h"
 
-#include "vtls/x509asn1.h"
-
 #if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_MBEDTLS)
 
+#include "vtls/x509asn1.h"
+
 struct test1657_spec {
   CURLcode (*setbuf)(const struct test1657_spec *spec, struct dynbuf *buf);
   size_t n;
index 77d72a0631353e80894f72c8c72aabac9d011c89..3ba81d939bdb01c298e99e161af49662ac9c1e80 100644 (file)
  ***************************************************************************/
 #include "unitcheck.h"
 
+#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_HSTS)
+
 #include "urldata.h"
 #include "hsts.h"
 
-#if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_HSTS)
-static CURLcode test_unit1660(const char *arg)
-{
-  UNITTEST_BEGIN_SIMPLE
-  puts("nothing to do when HTTP or HSTS are disabled");
-  UNITTEST_END_SIMPLE
-}
-#else
-
 static void showsts(struct stsentry *e, const char *chost)
 {
   if(!e)
@@ -168,4 +161,11 @@ static CURLcode test_unit1660(const char *arg)
 
   UNITTEST_END(curl_global_cleanup())
 }
+#else
+static CURLcode test_unit1660(const char *arg)
+{
+  UNITTEST_BEGIN_SIMPLE
+  puts("nothing to do when HTTP or HSTS are disabled");
+  UNITTEST_END_SIMPLE
+}
 #endif
index 0afa26edeb244b68fd905f29ceecc9ef6450ad66..fbe5f89420af74bbe8ec1035c163574e30cc7393 100644 (file)
  ***************************************************************************/
 #include "unitcheck.h"
 
+#ifndef CURL_DISABLE_HTTP
+
 #include "urldata.h"
 #include "http1.h"
 #include "curl_trc.h"
 
-#ifndef CURL_DISABLE_HTTP
 static void check_eq(const char *s, const char *exp_s, const char *name)
 {
   if(s && exp_s) {