]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: assume `stdint.h`
authorViktor Szakats <commit@vsz.me>
Wed, 21 Jan 2026 15:20:51 +0000 (16:20 +0100)
committerViktor Szakats <commit@vsz.me>
Wed, 28 Jan 2026 11:05:20 +0000 (12:05 +0100)
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

14 files changed:
CMakeLists.txt
configure.ac
lib/config-win32.h
lib/curl_config-cmake.h.in
lib/curl_setup.h
lib/curl_setup_once.h
lib/curlx/timeval.c
lib/doh.h
lib/dynhds.h
lib/formdata.c
lib/hostip.h
lib/http.h
lib/http2.c
lib/vtls/cipher_suite.h

index 755835ece3f00eebb21e93d87b0050a73b971a00..9c40a4e8ab17bc46ef325a8299c1d50d0229ad20 100644 (file)
@@ -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)
index 114ba39d485c75cc16badcc5568291c83a57b796..611399bfcfbc46779cd307916b676e277aac0f65 100644 (file)
@@ -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
index 1a0c445b3d434f86f8514a12a8be42b47ffcc5ac..2609d5743650af8b802a7772bc054e91ee84e46a 100644 (file)
 #define HAVE_STDBOOL_H 1
 #endif
 
-/* Define to 1 if you have the <stdint.h> header file. */
-#if defined(_MSC_VER) || defined(__MINGW32__)
-#define HAVE_STDINT_H 1
-#endif
-
 /* Define if you have the <sys/param.h> header file. */
 #ifdef __MINGW32__
 #define HAVE_SYS_PARAM_H 1
index 74d9d714da4846c7f5866ef5cdcb2a298b7d865a..a418b1674832505a8501e1c15a4bed65476e8d47 100644 (file)
 /* Define to 1 if you have the sendmmsg function. */
 #cmakedefine HAVE_SENDMMSG 1
 
-/* Define to 1 if you have the <stdint.h> header file. */
-#cmakedefine HAVE_STDINT_H 1
-
 /* Define to 1 if you have the 'fsetxattr' function. */
 #cmakedefine HAVE_FSETXATTR 1
 
index 900264b8ff114a7c09c69c542157ba9ca3371f30..432d85018349906ee6e7695f8d78b87de01d0f04 100644 (file)
 #include <curl/stdcheaders.h>
 #endif
 
-#if defined(HAVE_STDINT_H) || defined(USE_WOLFSSL)
 #include <stdint.h>
-#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
 #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 <limits.h>
 
 #ifdef _WIN32
index df20b729375d85beab8fd6cc8b0e8027904c7e7f..48ca36b560b9fb4167461c2d8f076426ec0e64b7 100644 (file)
@@ -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 */
index 75c49848158fb84c058874de41d11d3fbe2f3dc4..734b784c04f04b4b2258106dad2ba52a7551f951 100644 (file)
@@ -117,7 +117,6 @@ void curlx_pnow(struct curltime *pnow)
 
 #elif defined(HAVE_MACH_ABSOLUTE_TIME)
 
-#include <stdint.h>
 #include <mach/mach_time.h>
 
 void curlx_pnow(struct curltime *pnow)
index 427dac669b599dc2fa08f724c48a4a0d3d00a1a5..0dc6a3f2a490024225e76806399b8d715a094d28 100644 (file)
--- a/lib/doh.h
+++ b/lib/doh.h
  ***************************************************************************/
 #include "urldata.h"
 
-#ifdef USE_HTTPSRR
-# include <stdint.h>
-#endif
-
 #ifndef CURL_DISABLE_DOH
 
 typedef enum {
index 170721cf78c5919b1622f81101a192259c160898..2cfa290571201bfbed02112326973f7e5ffe3b73 100644 (file)
@@ -175,7 +175,6 @@ CURLcode Curl_dynhds_h1_dprint(struct dynhds *dynhds, struct dynbuf *dbuf);
 
 #ifdef USE_NGHTTP2
 
-#include <stdint.h>
 #include <nghttp2/nghttp2.h>
 
 nghttp2_nv *Curl_dynhds_to_nva(struct dynhds *dynhds, size_t *pcount);
index b4a7e110d1db0ac98d8c5d2fe00da19659e7acb9..bb2c702fe0b090bb2bf51752c81c71bc77061b58 100644 (file)
@@ -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))
index 0257e4364546bb2228c936d9de7c465a51b77384..645868eb4319ec41b94979942aca8ea78602563f 100644 (file)
 #include "hash.h"
 #include "curlx/timeval.h" /* for curltime, timediff_t */
 
-#ifdef USE_HTTPSRR
-# include <stdint.h>
-#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
index c78565bb2090062d278a0db17c0b030ccaad6c92..6ef391af60200b7b3b86df2e1655cacdfae88d93 100644 (file)
@@ -58,11 +58,6 @@ extern const struct Curl_scheme Curl_scheme_https;
 
 #ifndef CURL_DISABLE_HTTP
 
-#ifdef USE_HTTP3
-#include <stdint.h>
-#endif
-
-
 struct dynhds;
 
 struct http_negotiation {
index ac5a070f1701c31f8f97f7755ee2fd8648c65b17..3f3e3dc96b8f6d49890a1fad0ac7c7f008b07246 100644 (file)
@@ -24,7 +24,6 @@
 #include "curl_setup.h"
 
 #if !defined(CURL_DISABLE_HTTP) && defined(USE_NGHTTP2)
-#include <stdint.h>
 #include <nghttp2/nghttp2.h>
 
 #include "urldata.h"
index a17284f86eabc617a099699a923309bc70d36b34..f625ce38cbfce3e691d1962ac3111ee9a2552716 100644 (file)
@@ -26,7 +26,6 @@
 #include "../curl_setup.h"
 
 #if defined(USE_MBEDTLS) || defined(USE_RUSTLS)
-#include <stdint.h>
 
 /* 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);