From: Viktor Szakats Date: Wed, 21 Jan 2026 15:20:51 +0000 (+0100) Subject: build: assume `stdint.h` X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=feb52be197c695fa783d68c11924f474c2add6b7;p=thirdparty%2Fcurl.git build: assume `stdint.h` curl requires `stdint.h` from C99, and no longer builds without it since v8.18.0 (after dropping VS2008 support). Assume it's available, drop feature checks. Also: - drop duplicate `stdint.h` includes. - introduce internal `HAVE_UINTPTR_T`, enabled by default. - OS400: disable `HAVE_UINTPTR_T`. - build: keep cmake pre-fill and `cmp-config.pl` exception because cmake and autotools both detect `stdint.h` implicitly. Co-authored-by: Dan Fandrich Ref: #20405 Ref: #20384 Follow-up to 2e1a045d8985e5daa4d9a4f908ed870a16d8e41e #17931 Closes #20406 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 755835ece3..9c40a4e8ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1497,7 +1497,6 @@ check_include_file("poll.h" HAVE_POLL_H) check_include_file("pwd.h" HAVE_PWD_H) check_include_file("stdatomic.h" HAVE_STDATOMIC_H) check_include_file("stdbool.h" HAVE_STDBOOL_H) -check_include_file("stdint.h" HAVE_STDINT_H) check_include_file("strings.h" HAVE_STRINGS_H) check_include_file("stropts.h" HAVE_STROPTS_H) check_include_file("termio.h" HAVE_TERMIO_H) diff --git a/configure.ac b/configure.ac index 114ba39d48..611399bfcf 100644 --- a/configure.ac +++ b/configure.ac @@ -4000,7 +4000,6 @@ AC_CHECK_HEADERS( libgen.h \ locale.h \ stdbool.h \ - stdint.h \ sys/filio.h \ sys/eventfd.h, dnl to do if not found diff --git a/lib/config-win32.h b/lib/config-win32.h index 1a0c445b3d..2609d57436 100644 --- a/lib/config-win32.h +++ b/lib/config-win32.h @@ -46,11 +46,6 @@ #define HAVE_STDBOOL_H 1 #endif -/* Define to 1 if you have the header file. */ -#if defined(_MSC_VER) || defined(__MINGW32__) -#define HAVE_STDINT_H 1 -#endif - /* Define if you have the header file. */ #ifdef __MINGW32__ #define HAVE_SYS_PARAM_H 1 diff --git a/lib/curl_config-cmake.h.in b/lib/curl_config-cmake.h.in index 74d9d714da..a418b16748 100644 --- a/lib/curl_config-cmake.h.in +++ b/lib/curl_config-cmake.h.in @@ -472,9 +472,6 @@ /* Define to 1 if you have the sendmmsg function. */ #cmakedefine HAVE_SENDMMSG 1 -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDINT_H 1 - /* Define to 1 if you have the 'fsetxattr' function. */ #cmakedefine HAVE_FSETXATTR 1 diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 900264b8ff..432d850183 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -466,9 +466,8 @@ #include #endif -#if defined(HAVE_STDINT_H) || defined(USE_WOLFSSL) #include -#endif +#define HAVE_UINTPTR_T /* assume uintptr_t is provided by stdint.h */ #ifdef __DJGPP__ /* By default, DJGPP provides this type as a version of 'unsigned long' which @@ -477,6 +476,11 @@ #define uint32_t unsigned int #endif +/* Disable uintptr_t for targets known to miss it from stdint.h */ +#ifdef __OS400__ +#undef HAVE_UINTPTR_T +#endif + #include #ifdef _WIN32 diff --git a/lib/curl_setup_once.h b/lib/curl_setup_once.h index df20b72937..48ca36b560 100644 --- a/lib/curl_setup_once.h +++ b/lib/curl_setup_once.h @@ -62,7 +62,7 @@ /* Macro to strip 'const' without triggering a compiler warning. Use it for APIs that do not or cannot support the const qualifier. */ -#ifdef HAVE_STDINT_H +#ifdef HAVE_UINTPTR_T # define CURL_UNCONST(p) ((void *)(uintptr_t)(const void *)(p)) #else # define CURL_UNCONST(p) ((void *)(p)) /* Fall back to simple cast */ diff --git a/lib/curlx/timeval.c b/lib/curlx/timeval.c index 75c4984815..734b784c04 100644 --- a/lib/curlx/timeval.c +++ b/lib/curlx/timeval.c @@ -117,7 +117,6 @@ void curlx_pnow(struct curltime *pnow) #elif defined(HAVE_MACH_ABSOLUTE_TIME) -#include #include void curlx_pnow(struct curltime *pnow) diff --git a/lib/doh.h b/lib/doh.h index 427dac669b..0dc6a3f2a4 100644 --- a/lib/doh.h +++ b/lib/doh.h @@ -25,10 +25,6 @@ ***************************************************************************/ #include "urldata.h" -#ifdef USE_HTTPSRR -# include -#endif - #ifndef CURL_DISABLE_DOH typedef enum { diff --git a/lib/dynhds.h b/lib/dynhds.h index 170721cf78..2cfa290571 100644 --- a/lib/dynhds.h +++ b/lib/dynhds.h @@ -175,7 +175,6 @@ CURLcode Curl_dynhds_h1_dprint(struct dynhds *dynhds, struct dynbuf *dbuf); #ifdef USE_NGHTTP2 -#include #include nghttp2_nv *Curl_dynhds_to_nva(struct dynhds *dynhds, size_t *pcount); diff --git a/lib/formdata.c b/lib/formdata.c index b4a7e110d1..bb2c702fe0 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -310,7 +310,7 @@ static CURLFORMcode FormAdd(struct curl_httppost **httppost, struct curl_httppost *lastnode = NULL; #define form_ptr_arg(t) (forms ? (t)(void *)avalue : va_arg(params, t)) -#ifdef HAVE_STDINT_H +#ifdef HAVE_UINTPTR_T #define form_int_arg(t) (forms ? (t)(uintptr_t)avalue : va_arg(params, t)) #else #define form_int_arg(t) (forms ? (t)(void *)avalue : va_arg(params, t)) diff --git a/lib/hostip.h b/lib/hostip.h index 0257e43645..645868eb43 100644 --- a/lib/hostip.h +++ b/lib/hostip.h @@ -28,10 +28,6 @@ #include "hash.h" #include "curlx/timeval.h" /* for curltime, timediff_t */ -#ifdef USE_HTTPSRR -# include -#endif - /* Allocate enough memory to hold the full name information structs and * everything. OSF1 is known to require at least 8872 bytes. The buffer * required for storing all possible aliases and IP numbers is according to diff --git a/lib/http.h b/lib/http.h index c78565bb20..6ef391af60 100644 --- a/lib/http.h +++ b/lib/http.h @@ -58,11 +58,6 @@ extern const struct Curl_scheme Curl_scheme_https; #ifndef CURL_DISABLE_HTTP -#ifdef USE_HTTP3 -#include -#endif - - struct dynhds; struct http_negotiation { diff --git a/lib/http2.c b/lib/http2.c index ac5a070f17..3f3e3dc96b 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -24,7 +24,6 @@ #include "curl_setup.h" #if !defined(CURL_DISABLE_HTTP) && defined(USE_NGHTTP2) -#include #include #include "urldata.h" diff --git a/lib/vtls/cipher_suite.h b/lib/vtls/cipher_suite.h index a17284f86e..f625ce38cb 100644 --- a/lib/vtls/cipher_suite.h +++ b/lib/vtls/cipher_suite.h @@ -26,7 +26,6 @@ #include "../curl_setup.h" #if defined(USE_MBEDTLS) || defined(USE_RUSTLS) -#include /* Lookup IANA id for cipher suite string, returns 0 if not recognized */ uint16_t Curl_cipher_suite_lookup_id(const char *cs_str, size_t cs_len);