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 2e1a045d89 #17931

Closes #20406
This commit is contained in:
Viktor Szakats 2026-01-21 16:20:51 +01:00
parent f062b4b903
commit feb52be197
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
14 changed files with 8 additions and 31 deletions

View 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)

View 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

View file

@ -46,11 +46,6 @@
#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

View file

@ -472,9 +472,6 @@
/* 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

View file

@ -466,9 +466,8 @@
#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
@ -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 <limits.h>
#ifdef _WIN32

View 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 */

View 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)

View file

@ -25,10 +25,6 @@
***************************************************************************/
#include "urldata.h"
#ifdef USE_HTTPSRR
# include <stdint.h>
#endif
#ifndef CURL_DISABLE_DOH
typedef enum {

View 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);

View 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))

View file

@ -28,10 +28,6 @@
#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

View 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 {

View 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"

View 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);