From: Viktor Szakats Date: Mon, 6 Nov 2023 02:17:39 +0000 (+0000) Subject: build: delete `HAVE_STDINT_H` and `HAVE_INTTYPES_H` X-Git-Tag: curl-8_5_0~130 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=60359ad5049c42f333ac179a58cda87d6e4143a0;p=thirdparty%2Fcurl.git build: delete `HAVE_STDINT_H` and `HAVE_INTTYPES_H` We use `stdint.h` unconditionally in all places except one. These uses are imposed by external dependencies / features. nghttp2, quic, wolfSSL and `HAVE_MACH_ABSOLUTE_TIME` do require this C99 header. It means that any of these features make curl require a C99 compiler. (In case of MSVC, this means Visual Studio 2010 or newer.) This patch changes the single use of `stdint.h` guarded by `HAVE_STDINT_H` to use `stdint.h` unconditionally. Also stop using `inttypes.h` as an alternative there. `HAVE_INTTYPES_H` wasn't used anywhere else, allowing to delete this feature check as well. Closes #12275 --- diff --git a/CMake/Platforms/WindowsCache.cmake b/CMake/Platforms/WindowsCache.cmake index e4525300c4..ec09fd4bd1 100644 --- a/CMake/Platforms/WindowsCache.cmake +++ b/CMake/Platforms/WindowsCache.cmake @@ -32,10 +32,8 @@ if(MINGW) set(HAVE_UNISTD_H 1) set(HAVE_LIBGEN_H 1) set(HAVE_STDDEF_H 1) # detected by CMake internally in check_type_size() - set(HAVE_STDINT_H 1) set(HAVE_STDBOOL_H 1) set(HAVE_BOOL_T "${HAVE_STDBOOL_H}") - set(HAVE_INTTYPES_H 1) set(HAVE_STRTOLL 1) set(HAVE_BASENAME 1) set(HAVE_STRCASECMP 1) @@ -55,18 +53,11 @@ else() set(HAVE_LOCALE_H 1) set(HAVE_STDDEF_H 1) # detected by CMake internally in check_type_size() set(HAVE_STDATOMIC_H 0) - if(NOT MSVC_VERSION LESS 1600) - set(HAVE_STDINT_H 1) - else() - set(HAVE_STDINT_H 0) - endif() if(NOT MSVC_VERSION LESS 1800) set(HAVE_STDBOOL_H 1) - set(HAVE_INTTYPES_H 1) set(HAVE_STRTOLL 1) else() set(HAVE_STDBOOL_H 0) - set(HAVE_INTTYPES_H 0) set(HAVE_STRTOLL 0) endif() set(HAVE_BOOL_T "${HAVE_STDBOOL_H}") diff --git a/CMakeLists.txt b/CMakeLists.txt index 3786c56622..e54dd98909 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1108,7 +1108,6 @@ if(WIN32) endif() endif() -check_include_file_concat("inttypes.h" HAVE_INTTYPES_H) check_include_file_concat("sys/filio.h" HAVE_SYS_FILIO_H) check_include_file_concat("sys/wait.h" HAVE_SYS_WAIT_H) check_include_file_concat("sys/ioctl.h" HAVE_SYS_IOCTL_H) @@ -1141,7 +1140,6 @@ check_include_file_concat("poll.h" HAVE_POLL_H) check_include_file_concat("pwd.h" HAVE_PWD_H) check_include_file_concat("stdatomic.h" HAVE_STDATOMIC_H) check_include_file_concat("stdbool.h" HAVE_STDBOOL_H) -check_include_file_concat("stdint.h" HAVE_STDINT_H) check_include_file_concat("strings.h" HAVE_STRINGS_H) check_include_file_concat("stropts.h" HAVE_STROPTS_H) check_include_file_concat("termio.h" HAVE_TERMIO_H) diff --git a/lib/config-amigaos.h b/lib/config-amigaos.h index 8f4d3e6c31..d168b446b6 100644 --- a/lib/config-amigaos.h +++ b/lib/config-amigaos.h @@ -32,7 +32,6 @@ #define HAVE_ARPA_INET_H 1 #define HAVE_CLOSESOCKET_CAMEL 1 -#define HAVE_INTTYPES_H 1 #define HAVE_IOCTLSOCKET_CAMEL 1 #define HAVE_IOCTLSOCKET_CAMEL_FIONBIO 1 #define HAVE_LONGLONG 1 diff --git a/lib/config-os400.h b/lib/config-os400.h index e9a6288630..357a36458b 100644 --- a/lib/config-os400.h +++ b/lib/config-os400.h @@ -104,9 +104,6 @@ /* Define if you have the `timeval' struct. */ #define HAVE_STRUCT_TIMEVAL -/* Define if you have the header file. */ -#define HAVE_INTTYPES_H - /* Define if you have the header file. */ #undef HAVE_IO_H @@ -152,9 +149,6 @@ /* Define if you have the `socket' function. */ #define HAVE_SOCKET -/* Define if you have the header file. */ -#undef HAVE_STDINT_H - /* The following define is needed on OS400 to enable strcmpi(), stricmp() and strdup(). */ diff --git a/lib/config-plan9.h b/lib/config-plan9.h index fa4be8e6d2..aa9623f922 100644 --- a/lib/config-plan9.h +++ b/lib/config-plan9.h @@ -91,7 +91,6 @@ #define HAVE_GMTIME_R 1 #define HAVE_INET_NTOP 1 #define HAVE_INET_PTON 1 -#define HAVE_INTTYPES_H 1 #define HAVE_LIBGEN_H 1 #define HAVE_LIBZ 1 #define HAVE_LOCALE_H 1 @@ -117,7 +116,6 @@ #define HAVE_SOCKET 1 #define HAVE_SSL_GET_SHUTDOWN 1 #define HAVE_STDBOOL_H 1 -#define HAVE_STDINT_H 1 #define HAVE_STRCASECMP 1 #define HAVE_STRDUP 1 #define HAVE_STRTOK_R 1 diff --git a/lib/config-riscos.h b/lib/config-riscos.h index 52c279f5bf..f3a8e68321 100644 --- a/lib/config-riscos.h +++ b/lib/config-riscos.h @@ -108,9 +108,6 @@ /* Define if you have the `timeval' struct. */ #define HAVE_STRUCT_TIMEVAL -/* Define if you have the header file. */ -#define HAVE_INTTYPES_H - /* Define if you have the header file. */ #undef HAVE_IO_H @@ -144,9 +141,6 @@ /* Define if you have the `socket' function. */ #define HAVE_SOCKET -/* Define if you have the header file. */ -#undef HAVE_STDINT_H - /* Define if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP diff --git a/lib/config-win32.h b/lib/config-win32.h index aa0d751338..c53aced297 100644 --- a/lib/config-win32.h +++ b/lib/config-win32.h @@ -38,17 +38,6 @@ /* Define if you have the header file. */ #define HAVE_FCNTL_H 1 -/* Define to 1 if you have the header file. */ -#if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || defined(__MINGW32__) -#define HAVE_INTTYPES_H 1 -#endif - -/* Define to 1 if you have the header file. */ -#if (defined(_MSC_VER) && (_MSC_VER >= 1600)) || defined(__MINGW32__) || \ - (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0582)) || defined(__POCC__) -#define HAVE_STDINT_H 1 -#endif - /* Define if you have the header file. */ #define HAVE_IO_H 1 diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake index e512dce45f..3297bdff51 100644 --- a/lib/curl_config.h.cmake +++ b/lib/curl_config.h.cmake @@ -319,9 +319,6 @@ /* Define to 1 if symbol `ADDRESS_FAMILY' exists */ #cmakedefine HAVE_ADDRESS_FAMILY 1 -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_INTTYPES_H 1 - /* Define to 1 if you have the ioctlsocket function. */ #cmakedefine HAVE_IOCTLSOCKET 1 @@ -503,9 +500,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STDBOOL_H 1 -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDINT_H 1 - /* Define to 1 if you have the strcasecmp function. */ #cmakedefine HAVE_STRCASECMP 1 diff --git a/lib/curl_setup_once.h b/lib/curl_setup_once.h index c1ed059070..f05e808b1a 100644 --- a/lib/curl_setup_once.h +++ b/lib/curl_setup_once.h @@ -70,11 +70,7 @@ #endif #ifdef USE_WOLFSSL -# if defined(HAVE_STDINT_H) -# include -# elif defined(HAVE_INTTYPES_H) -# include -# endif +#include #endif #ifdef USE_SCHANNEL diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4 index 1381f19b38..28f4b8b9ac 100644 --- a/m4/curl-functions.m4 +++ b/m4/curl-functions.m4 @@ -108,35 +108,6 @@ curl_includes_ifaddrs="\ ]) -dnl CURL_INCLUDES_INTTYPES -dnl ------------------------------------------------- -dnl Set up variable with list of headers that must be -dnl included when inttypes.h is to be included. - -AC_DEFUN([CURL_INCLUDES_INTTYPES], [ -curl_includes_inttypes="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -/* includes end */" - case $host_os in - irix*) - ac_cv_header_stdint_h="no" - ;; - esac - AC_CHECK_HEADERS( - sys/types.h stdint.h inttypes.h, - [], [], [$curl_includes_inttypes]) -]) - - dnl CURL_INCLUDES_LIBGEN dnl ------------------------------------------------- dnl Set up variable with list of headers that must be diff --git a/scripts/cmp-config.pl b/scripts/cmp-config.pl index b1717cded2..e36fcdd3c4 100755 --- a/scripts/cmp-config.pl +++ b/scripts/cmp-config.pl @@ -43,6 +43,7 @@ my %remove = ( '#define HAVE_DECL_GETPWUID_R 1' => 1, '#define HAVE_DLFCN_H 1' => 1, '#define HAVE_GETHOSTBYNAME 1' => 1, + '#define HAVE_INTTYPES_H 1' => 1, '#define HAVE_IOCTL 1' => 1, '#define HAVE_LDAP_SSL 1' => 1, '#define HAVE_LIBBROTLIDEC 1' => 1, @@ -57,6 +58,7 @@ my %remove = ( '#define HAVE_OPENSSL_X509_H 1' => 1, '#define HAVE_SA_FAMILY_T 1' => 1, '#define HAVE_SETJMP_H 1' => 1, + '#define HAVE_STDINT_H 1' => 1, '#define HAVE_STDIO_H 1' => 1, '#define HAVE_STDLIB_H 1' => 1, '#define HAVE_STRING_H 1' => 1,