]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: delete `HAVE_STDINT_H` and `HAVE_INTTYPES_H`
authorViktor Szakats <commit@vsz.me>
Mon, 6 Nov 2023 02:17:39 +0000 (02:17 +0000)
committerViktor Szakats <commit@vsz.me>
Mon, 6 Nov 2023 17:20:39 +0000 (17:20 +0000)
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

CMake/Platforms/WindowsCache.cmake
CMakeLists.txt
lib/config-amigaos.h
lib/config-os400.h
lib/config-plan9.h
lib/config-riscos.h
lib/config-win32.h
lib/curl_config.h.cmake
lib/curl_setup_once.h
m4/curl-functions.m4
scripts/cmp-config.pl

index e4525300c414fab65aa43421e7e4fcb62d8f5030..ec09fd4bd198a65742067c1945942d95d3ac15b6 100644 (file)
@@ -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}")
index 3786c56622c46ac252773195a39754c304e12c60..e54dd989093759c41ba1c94ddf0f763b2d267796 100644 (file)
@@ -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)
index 8f4d3e6c31ae649999df292acf8aefc35c540318..d168b446b6784a5582f8850d2094ee2bc275aff0 100644 (file)
@@ -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
index e9a62886306be7dc28bba6e8381dbfd01d46f31c..357a36458b7224a17624958c6acb92fe231dc842 100644 (file)
 /* Define if you have the `timeval' struct. */
 #define HAVE_STRUCT_TIMEVAL
 
-/* Define if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H
-
 /* Define if you have the <io.h> header file. */
 #undef HAVE_IO_H
 
 /* Define if you have the `socket' function. */
 #define HAVE_SOCKET
 
-/* Define if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
 
 /* The following define is needed on OS400 to enable strcmpi(), stricmp() and
    strdup(). */
index fa4be8e6d2138b0f8454b4765733ae64919955af..aa9623f92295156916b0a8f36771daaaf5ddd12a 100644 (file)
@@ -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
 #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
index 52c279f5bf322b03fecad33efe43be65a161fc44..f3a8e68321dde3f2aec10a9c2b9bb02c7c2c247e 100644 (file)
 /* Define if you have the `timeval' struct. */
 #define HAVE_STRUCT_TIMEVAL
 
-/* Define if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H
-
 /* Define if you have the <io.h> header file. */
 #undef HAVE_IO_H
 
 /* Define if you have the `socket' function. */
 #define HAVE_SOCKET
 
-/* Define if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
 /* Define if you have the `strcasecmp' function. */
 #undef HAVE_STRCASECMP
 
index aa0d751338d58c119e83805f4aa24ae9dc4d3bd8..c53aced2979a01efd12adc3b9765132930656924 100644 (file)
 /* Define if you have the <fcntl.h> header file. */
 #define HAVE_FCNTL_H 1
 
-/* Define to 1 if you have the <inttypes.h> header file. */
-#if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || defined(__MINGW32__)
-#define HAVE_INTTYPES_H 1
-#endif
-
-/* Define to 1 if you have the <stdint.h> 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 <io.h> header file. */
 #define HAVE_IO_H 1
 
index e512dce45f099726f52cc0a7c7cbc8a97ef7f72d..3297bdff51698697d91737acf3faf2410db313ee 100644 (file)
 /* Define to 1 if symbol `ADDRESS_FAMILY' exists */
 #cmakedefine HAVE_ADDRESS_FAMILY 1
 
-/* Define to 1 if you have the <inttypes.h> header file. */
-#cmakedefine HAVE_INTTYPES_H 1
-
 /* Define to 1 if you have the ioctlsocket function. */
 #cmakedefine HAVE_IOCTLSOCKET 1
 
 /* Define to 1 if you have the <stdbool.h> header file. */
 #cmakedefine HAVE_STDBOOL_H 1
 
-/* Define to 1 if you have the <stdint.h> header file. */
-#cmakedefine HAVE_STDINT_H 1
-
 /* Define to 1 if you have the strcasecmp function. */
 #cmakedefine HAVE_STRCASECMP 1
 
index c1ed059070996cc27ba296803a87044b7786dd3e..f05e808b1a1891ed0c2b8e6eca5f40cedeb7146d 100644 (file)
 #endif
 
 #ifdef USE_WOLFSSL
-#  if defined(HAVE_STDINT_H)
-#    include <stdint.h>
-#  elif defined(HAVE_INTTYPES_H)
-#    include <inttypes.h>
-#  endif
+#include <stdint.h>
 #endif
 
 #ifdef USE_SCHANNEL
index 1381f19b38b2dcc6767ed7ab0c71ce1b380c248c..28f4b8b9acb543126d14518991d67dd008364025 100644 (file)
@@ -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 <sys/types.h>
-#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#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
index b1717cded266268578d5ea3837b5a8c7a5d78f92..e36fcdd3c40a88d472ff1dee870c9c1c5e5284f2 100755 (executable)
@@ -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,