https://gcc.gnu.org/g:4b20e0de4c9a714bc229390242ddc19901783793
commit r17-5049-g4b20e0de4c9a714bc229390242ddc19901783793 Author: Sam James <[email protected]> Date: Fri Oct 9 20:16:06 2026 +0100 gcc: drop obsolete header checks <limits.h>, <locale.h>, <stdlib.h> are guaranteed by C89. I've left <string.h> for a followup because of a complication that I'll address later. gcc/ChangeLog: PR bootstrap/112422 * acinclude.m4 (gcc_AC_C_CHAR_BIT): Don't check HAVE_LIMITS_H. * config.in: Regenerate. * configure: Regenerate. * configure.ac: Don't search for limits.h, locale.h, stdlib.h. * intl.h (GCC_INTL_H): Always include locale.h. * system.h: Always include limits.h. Always include stdlib.h. Diff: --- gcc/acinclude.m4 | 4 +--- gcc/config.in | 12 ------------ gcc/configure | 11 ++++------- gcc/configure.ac | 5 ++--- gcc/intl.h | 4 +--- gcc/system.h | 8 ++------ 6 files changed, 10 insertions(+), 34 deletions(-) diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4 index 68a8c2cdea47..c72a6c9e121f 100644 --- a/gcc/acinclude.m4 +++ b/gcc/acinclude.m4 @@ -246,9 +246,7 @@ dnl AC_DEFUN([gcc_AC_C_CHAR_BIT], [AC_CACHE_CHECK(for CHAR_BIT, gcc_cv_decl_char_bit, [AC_EGREP_CPP(found, -[#ifdef HAVE_LIMITS_H -#include <limits.h> -#endif +[#include <limits.h> #ifdef CHAR_BIT found #endif], gcc_cv_decl_char_bit=yes, gcc_cv_decl_char_bit=no) diff --git a/gcc/config.in b/gcc/config.in index d4d864e858f3..8ab07d1ef2bd 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -1871,18 +1871,6 @@ #endif -/* Define to 1 if you have the <limits.h> header file. */ -#ifndef USED_FOR_TARGET -#undef HAVE_LIMITS_H -#endif - - -/* Define to 1 if you have the <locale.h> header file. */ -#ifndef USED_FOR_TARGET -#undef HAVE_LOCALE_H -#endif - - /* Define to 1 if the system has the type `long long'. */ #ifndef USED_FOR_TARGET #undef HAVE_LONG_LONG diff --git a/gcc/configure b/gcc/configure index f3df4b90e222..f509609de673 100755 --- a/gcc/configure +++ b/gcc/configure @@ -9387,10 +9387,10 @@ $as_echo "#define GWINSZ_IN_SYS_IOCTL 1" >>confdefs.h fi fi -for ac_header in limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \ +for ac_header in stddef.h string.h strings.h time.h iconv.h \ fcntl.h ftw.h unistd.h sys/auxv.h sys/file.h sys/time.h sys/mman.h \ sys/resource.h sys/param.h sys/times.h sys/stat.h sys/locking.h \ - direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h libgen.h + direct.h malloc.h langinfo.h ldfcn.h wchar.h libgen.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_cxx_check_header_preproc "$LINENO" "$ac_header" "$as_ac_Header" @@ -9419,7 +9419,6 @@ else fi -# These tests can't be done till we know if we have limits.h. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CHAR_BIT" >&5 $as_echo_n "checking for CHAR_BIT... " >&6; } if ${gcc_cv_decl_char_bit+:} false; then : @@ -9427,9 +9426,7 @@ if ${gcc_cv_decl_char_bit+:} false; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef HAVE_LIMITS_H #include <limits.h> -#endif #ifdef CHAR_BIT found #endif @@ -21875,7 +21872,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21878 "configure" +#line 21875 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -21981,7 +21978,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21984 "configure" +#line 21981 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index 77e7c09b3453..14fe4c095bde 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1352,16 +1352,15 @@ AC_HEADER_TIME ACX_HEADER_STRING AC_HEADER_SYS_WAIT AC_HEADER_TIOCGWINSZ -AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \ +AC_CHECK_HEADERS(stddef.h string.h strings.h time.h iconv.h \ fcntl.h ftw.h unistd.h sys/auxv.h sys/file.h sys/time.h sys/mman.h \ sys/resource.h sys/param.h sys/times.h sys/stat.h sys/locking.h \ - direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h libgen.h) + direct.h malloc.h langinfo.h ldfcn.h wchar.h libgen.h) # Check for thread headers. AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=]) AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=]) -# These tests can't be done till we know if we have limits.h. gcc_AC_C_CHAR_BIT AC_C_BIGENDIAN diff --git a/gcc/intl.h b/gcc/intl.h index 653471ef4c49..1c9e708d21c2 100644 --- a/gcc/intl.h +++ b/gcc/intl.h @@ -18,9 +18,7 @@ #ifndef GCC_INTL_H #define GCC_INTL_H -#ifdef HAVE_LOCALE_H -# include <locale.h> -#endif +#include <locale.h> #ifndef HAVE_SETLOCALE # define setlocale(category, locale) (locale) diff --git a/gcc/system.h b/gcc/system.h index 9a4a99a0528f..8a2cac29d5b4 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -277,9 +277,7 @@ extern int errno; # endif #endif -#ifdef HAVE_STDLIB_H -# include <stdlib.h> -#endif +#include <stdlib.h> /* When compiling C++ we need to include <cstdlib> as well as <stdlib.h> so that it is processed before we poison "malloc"; otherwise, if a source @@ -324,9 +322,7 @@ extern int errno; # undef m_slot #endif -#if HAVE_LIMITS_H -# include <limits.h> -#endif +#include <limits.h> /* A macro to determine whether a VALUE lies inclusively within a certain range without evaluating the VALUE more than once. This
