]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: drop superfluous `STDC_HEADERS` macro
authorViktor Szakats <commit@vsz.me>
Sun, 28 Jun 2026 10:19:11 +0000 (12:19 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 29 Jun 2026 09:11:16 +0000 (11:11 +0200)
It is traditionally defined by autotools to detect the presence of set
of standard C89 headers. autoconf 2.70 (2020-12-08) reduced the headers
covered to `stdlib.h`, `string.h`. After 2.59d (2006-06-05) obsoleting
it earlier. CMake replicated this detection, and curl included
`curl/stdcheaders.h` if standard headers were missing. However, such
condition could never happen because curl sources already assume all
checked standard headers (`stdarg.h`, `stdlib.h`, `string.h`) and
include them unconditionally.

Since this is an unused feature detection and an impossible fallback
path, drop them from CMake and curl's source. autotools continues to do
the detection by default, but its result is unused after this patch.

This leaves public `curl/stdcheaders.h` unused from within the codebase.

Refs:
https://github.com/autotools-mirror/autoconf/commit/f0c7c425539964047b0cb986d2ea5f5687a07069
https://github.com/autotools-mirror/autoconf/commit/86c213d0e355296f026a36e3203c0813041aae89

Follow-up to 65dae4ad80b02f25a25e17af62ea4f2940970330 #22191
Follow-up to 4c5307b45655ba75ab066564afdc0c111a8b9291
Ref: ae1912cb0d494b48d514d937826c9fe83ec96c4d

Closes #22206

.github/scripts/cmp-config.pl
CMake/CurlTests.c
CMake/unix-cache.cmake
CMake/win32-cache.cmake
CMakeLists.txt
lib/config-os400.h
lib/config-win32.h
lib/curl_config-cmake.h.in
lib/curl_setup.h
projects/vms/config_h.com

index b697ae1203a46c34dbefaf29fb7ab806eb4988a7..a0d33498a75fe306b9903f5805d4ff310b1b890a 100755 (executable)
@@ -88,6 +88,7 @@ my %remove = (
     '#define PACKAGE_TARNAME "curl"' => 1,
     '#define PACKAGE_URL ""' => 1,
     '#define PACKAGE_VERSION "-"' => 1,
+    '#define STDC_HEADERS 1' => 1,
     '#define VERSION "-"' => 1,
     '#define _FILE_OFFSET_BITS 64' => 1,
     );
index 95cd89bb63219ffcc71dfaa37d880ac70d84201b..c9d0b93d21d98ba2582e662292ea32e1008b2b78 100644 (file)
@@ -114,16 +114,6 @@ int main(void)
 }
 #endif
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-int main(void)
-{
-  return 0;
-}
-#endif
-
 #ifdef HAVE_FILE_OFFSET_BITS
 #include <sys/types.h>
 /* Check that off_t can represent 2**63 - 1 correctly.
index 97be36d5f3c2f010402cc3b7c084618303a1e32a..287c3fdf9ef6f907ce5443a9ab07e375ba9b3143 100644 (file)
@@ -314,5 +314,4 @@ set(HAVE_UTIME 1)
 set(HAVE_UTIMES 1)
 set(HAVE_UTIME_H 1)
 set(HAVE_WRITABLE_ARGV 1)
-set(STDC_HEADERS 1)
 set(USE_UNIX_SOCKETS 1)
index c1080872738646101a1cef2a80081eea555b2052..a684b459b08543ee0788517911050f5bb2b784d5 100644 (file)
@@ -161,7 +161,6 @@ set(HAVE_TERMIO_H 0)
 set(HAVE_TIME_T_UNSIGNED 0)
 set(HAVE_UTIME 1)
 set(HAVE_UTIMES 0)
-set(STDC_HEADERS 1)
 
 # Types and sizes
 
index 5929b741cec69c06a3db3310c83e5b931ecb2547..5aa412fc98a7ddc3c487500c0e07885526c44dfe 100644 (file)
@@ -1731,7 +1731,6 @@ foreach(_curl_test IN ITEMS
     HAVE_GETHOSTBYNAME_R_5
     HAVE_GETHOSTBYNAME_R_6
     HAVE_BOOL_T
-    STDC_HEADERS
     HAVE_ATOMIC
 )
   curl_internal_test(${_curl_test})
index 76841af202ecbcfa7d0f03dc5aa7872709e6f311..050fd9d7dac6432be55601b137551528eb631cf4 100644 (file)
 /* Size of time_t in number of bytes */
 #define SIZEOF_TIME_T           4
 
-/* Define to 1 if all of the C89 standard headers exist (not only the ones
-   required in a freestanding environment). This macro is provided for
-   backward compatibility; new code need not use it. */
-#define STDC_HEADERS            1
-
 /* Define if you want to enable IPv6 support */
 #define USE_IPV6
 
index fedfb8f30ed83c40f54ca985f2ec9c7f533ec1d5..1f4f12f433a2d563fedcd2f382b97ea173fb80e5 100644 (file)
@@ -71,9 +71,6 @@
 /*                        OTHER HEADER INFO                         */
 /* ---------------------------------------------------------------- */
 
-/* Define if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
 /* Define to 1 if bool is an available type. */
 #if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || defined(__MINGW32__)
 #define HAVE_BOOL_T 1
index 92280010c08ed53c799d319eb1fb085ead6c2512..add3b26aadf2ee29ae2626f7d214803a86f32fe4 100644 (file)
@@ -634,9 +634,6 @@ ${SIZEOF_SIZE_T_CODE}
 /* The size of `time_t', as computed by sizeof. */
 ${SIZEOF_TIME_T_CODE}
 
-/* Define to 1 if you have the ANSI C header files. */
-#cmakedefine STDC_HEADERS 1
-
 /* Define if you have POSIX pthreads */
 #cmakedefine HAVE_THREADS_POSIX 1
 
index a26bb23cb25083a0b4f5017a441995b97101f03c..065fd04dde3fde8c9d86ad5cc4a42547c1d814c6 100644 (file)
 #  endif
 #endif
 
-#ifndef STDC_HEADERS /* no standard C headers! */
-#include <curl/stdcheaders.h>
-#endif
-
 #include <stdint.h>
 #define HAVE_UINTPTR_T  /* assume uintptr_t is provided by stdint.h */
 
index 0b23cc6633e55540686b8f181fa8d33cbaaf6f07..2de76ad7318ac5ce44cdfe20642449f85ac1d8cc 100644 (file)
@@ -1648,16 +1648,6 @@ $           write tf "#endif"
 $           goto cfgh_in_loop1
 $       endif
 $!
-$!      Process STDC_HEADERS (SAMBA!)
-$!---------------------------
-$       if key2 .eqs. "STDC_HEADERS"
-$       then
-$           write tf "#ifndef STDC_HEADERS"
-$           write tf "#define STDC_HEADERS 1"
-$           write tf "#endif"
-$           goto cfgh_in_loop1
-$       endif
-$!
 $!      Process PROTOTYPES directive
 $!-------------------------------------
 $       if key2 .eqs. "PROTOTYPES"