From 3b973ebf4b78d0bcd240c3c3e9d754857c6e890f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= Date: Fri, 29 Oct 2021 07:05:19 -0700 Subject: [PATCH] inttypes and stdint cleanup (#30) * cleanup: remove references to no longer used stdint.h Since 19c50b9d (Unconditionally use inttypes.h instead of trying for stdint.h (simplification) and remove the now unnecessary inclusion in pcre2_internal.h., 2018-11-14), stdint.h is no longer used. Remove checks for it in autotools and CMake and document better the expected build failures for systems that might have stdint.h (C99) and not inttypes.h (from POSIX), like old Windows. * cleanup: remove detection for inttypes.h which is a hard dependency CMake checks for standard headers are not meant to be used for hard dependencies, so will prevent a possible fallback to work. Alternatively, the header could be checked to make the configuration fail instead of breaking the build, but that was punted, as it was missing anyway from autotools. --- CMakeLists.txt | 2 -- NON-AUTOTOOLS-BUILD | 8 ++++---- config-cmake.h.in | 2 -- src/config.h.generic | 6 ------ src/config.h.in | 6 ------ src/pcre2.h.generic | 4 ++-- src/pcre2.h.in | 4 ++-- 7 files changed, 8 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f715aa5..8010497 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,8 +134,6 @@ INCLUDE(CheckTypeSize) INCLUDE(GNUInstallDirs) # for CMAKE_INSTALL_LIBDIR CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H) -CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H) -CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H) CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H) CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H) CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H) diff --git a/NON-AUTOTOOLS-BUILD b/NON-AUTOTOOLS-BUILD index 6bf6576..61d2b3e 100644 --- a/NON-AUTOTOOLS-BUILD +++ b/NON-AUTOTOOLS-BUILD @@ -343,10 +343,10 @@ cache can be deleted by selecting "File > Delete Cache". BUILDING PCRE2 ON WINDOWS WITH VISUAL STUDIO -The code currently cannot be compiled without a stdint.h header, which is -available only in relatively recent versions of Visual Studio. However, this -portable and permissively-licensed implementation of the header worked without -issue: +The code currently cannot be compiled without an inttypes.h header, which is +available only with Visual Studio 2013 or newer. However, this +portable and permissively-licensed implementation of the stdint.h header +could be used as an alternative: http://www.azillionmonkeys.com/qed/pstdint.h diff --git a/config-cmake.h.in b/config-cmake.h.in index 3adf756..f560afe 100644 --- a/config-cmake.h.in +++ b/config-cmake.h.in @@ -2,8 +2,6 @@ #cmakedefine HAVE_ATTRIBUTE_UNINITIALIZED 1 #cmakedefine HAVE_DIRENT_H 1 -#cmakedefine HAVE_INTTYPES_H 1 -#cmakedefine HAVE_STDINT_H 1 #cmakedefine HAVE_STRERROR 1 #cmakedefine HAVE_SYS_STAT_H 1 #cmakedefine HAVE_SYS_TYPES_H 1 diff --git a/src/config.h.generic b/src/config.h.generic index d07aa60..3b55ca7 100644 --- a/src/config.h.generic +++ b/src/config.h.generic @@ -73,9 +73,6 @@ sure both macros are undefined; an emulation function will then be used. */ /* Define to 1 if you have the header file. */ /* #undef HAVE_EDIT_READLINE_READLINE_H */ -/* Define to 1 if you have the header file. */ -/* #undef HAVE_INTTYPES_H */ - /* Define to 1 if you have the header file. */ /* #undef HAVE_LIMITS_H */ @@ -109,9 +106,6 @@ sure both macros are undefined; an emulation function will then be used. */ /* Define to 1 if you have the `secure_getenv' function. */ /* #undef HAVE_SECURE_GETENV */ -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STDINT_H */ - /* Define to 1 if you have the header file. */ /* #undef HAVE_STDIO_H */ diff --git a/src/config.h.in b/src/config.h.in index 99add60..303a907 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -73,9 +73,6 @@ sure both macros are undefined; an emulation function will then be used. */ /* Define to 1 if you have the header file. */ #undef HAVE_EDIT_READLINE_READLINE_H -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H @@ -109,9 +106,6 @@ sure both macros are undefined; an emulation function will then be used. */ /* Define to 1 if you have the `secure_getenv' function. */ #undef HAVE_SECURE_GETENV -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H diff --git a/src/pcre2.h.generic b/src/pcre2.h.generic index 2175caa..3a40ade 100644 --- a/src/pcre2.h.generic +++ b/src/pcre2.h.generic @@ -84,8 +84,8 @@ set, we ensure here that it has no effect. */ /* Have to include limits.h, stdlib.h, and inttypes.h to ensure that size_t and uint8_t, UCHAR_MAX, etc are defined. Some systems that do have inttypes.h do not have stdint.h, which is why we use inttypes.h, which according to the C -standard is a superset of stdint.h. If none of these headers are available, -the relevant values must be provided by some other means. */ +standard is a superset of stdint.h. If inttypes.h is not available the build +will break and the relevant values must be provided by some other means. */ #include #include diff --git a/src/pcre2.h.in b/src/pcre2.h.in index d44a311..19bd29e 100644 --- a/src/pcre2.h.in +++ b/src/pcre2.h.in @@ -84,8 +84,8 @@ set, we ensure here that it has no effect. */ /* Have to include limits.h, stdlib.h, and inttypes.h to ensure that size_t and uint8_t, UCHAR_MAX, etc are defined. Some systems that do have inttypes.h do not have stdint.h, which is why we use inttypes.h, which according to the C -standard is a superset of stdint.h. If none of these headers are available, -the relevant values must be provided by some other means. */ +standard is a superset of stdint.h. If inttypes.h is not available the build +will break and the relevant values must be provided by some other means. */ #include #include