https://gcc.gnu.org/g:03f6b3bd2e83db190396ddbf78337fd7746130e3
commit r17-5050-g03f6b3bd2e83db190396ddbf78337fd7746130e3 Author: Sam James <[email protected]> Date: Fri Oct 9 20:42:32 2026 +0100 libssp: drop redundant header checks Don't check for headers guaranteed by C89. libssp/ChangeLog: PR bootstrap/112422 * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Don't search for string.h, stdio.h, or limits.h. * gets-chk.c: Drop now-redundant ifdef guards. * memcpy-chk.c: Ditto. * memmove-chk.c: Ditto. * mempcpy-chk.c: Ditto. * memset-chk.c: Ditto. * snprintf-chk.c: Ditto. * sprintf-chk.c: Ditto. * ssp.c: Ditto. * stpcpy-chk.c: Ditto. * strcat-chk.c: Ditto. * strcpy-chk.c: Ditto. * strncat-chk.c: Ditto. * strncpy-chk.c: Ditto. * vsnprintf-chk.c: Ditto. * vsprintf-chk.c: Ditto. Diff: --- libssp/config.h.in | 6 ------ libssp/configure | 2 +- libssp/configure.ac | 2 +- libssp/gets-chk.c | 16 ++++------------ libssp/memcpy-chk.c | 4 +--- libssp/memmove-chk.c | 4 +--- libssp/mempcpy-chk.c | 4 +--- libssp/memset-chk.c | 4 +--- libssp/snprintf-chk.c | 4 +--- libssp/sprintf-chk.c | 8 ++------ libssp/ssp.c | 8 ++------ libssp/stpcpy-chk.c | 4 +--- libssp/strcat-chk.c | 4 +--- libssp/strcpy-chk.c | 4 +--- libssp/strncat-chk.c | 4 +--- libssp/strncpy-chk.c | 4 +--- libssp/vsnprintf-chk.c | 4 +--- libssp/vsprintf-chk.c | 8 ++------ 18 files changed, 23 insertions(+), 71 deletions(-) diff --git a/libssp/config.h.in b/libssp/config.h.in index 60315e0f4ed3..59003eb1d4a0 100644 --- a/libssp/config.h.in +++ b/libssp/config.h.in @@ -19,9 +19,6 @@ /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H -/* Define to 1 if you have the <limits.h> header file. */ -#undef HAVE_LIMITS_H - /* Define to 1 if you have the <malloc.h> header file. */ #undef HAVE_MALLOC_H @@ -40,9 +37,6 @@ /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H -/* Define to 1 if you have the <stdio.h> header file. */ -#undef HAVE_STDIO_H - /* Define to 1 if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H diff --git a/libssp/configure b/libssp/configure index aa7ea4a3a9f6..6c50c932dac3 100755 --- a/libssp/configure +++ b/libssp/configure @@ -4853,7 +4853,7 @@ fi done -for ac_header in alloca.h malloc.h paths.h syslog.h string.h unistd.h fcntl.h stdio.h limits.h +for ac_header in alloca.h malloc.h paths.h syslog.h unistd.h fcntl.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" diff --git a/libssp/configure.ac b/libssp/configure.ac index ba45339d4c5f..2bf4d928575f 100644 --- a/libssp/configure.ac +++ b/libssp/configure.ac @@ -124,7 +124,7 @@ AM_CONDITIONAL(LIBSSP_USE_SYMVER, [test "x$ssp_use_symver" != xno]) AM_CONDITIONAL(LIBSSP_USE_SYMVER_GNU, [test "x$ssp_use_symver" = xgnu]) AM_CONDITIONAL(LIBSSP_USE_SYMVER_SUN, [test "x$ssp_use_symver" = xsun]) -AC_CHECK_HEADERS(alloca.h malloc.h paths.h syslog.h string.h unistd.h fcntl.h stdio.h limits.h) +AC_CHECK_HEADERS(alloca.h malloc.h paths.h syslog.h unistd.h fcntl.h) if test x$gcc_no_link = xyes; then # Presume the ISO C functions are available; add target-specific diff --git a/libssp/gets-chk.c b/libssp/gets-chk.c index 78b4dc1a52f9..dc5b7e74be6b 100644 --- a/libssp/gets-chk.c +++ b/libssp/gets-chk.c @@ -34,22 +34,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include <ssp/ssp.h> +#include <limits.h> #include <stdarg.h> -#ifdef HAVE_STDLIB_H -# include <stdlib.h> -#endif +#include <stdlib.h> +#include <stdio.h> +#include <string.h> #ifdef HAVE_ALLOCA_H # include <alloca.h> #endif -#ifdef HAVE_LIMITS_H -# include <limits.h> -#endif -#ifdef HAVE_STDIO_H -# include <stdio.h> -#endif -#ifdef HAVE_STRING_H -# include <string.h> -#endif #if !HAVE_DECL_GETS extern char *gets (char *); diff --git a/libssp/memcpy-chk.c b/libssp/memcpy-chk.c index de2d0467a051..3b224e943a6f 100644 --- a/libssp/memcpy-chk.c +++ b/libssp/memcpy-chk.c @@ -34,9 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include <ssp/ssp.h> -#ifdef HAVE_STRING_H -# include <string.h> -#endif +#include <string.h> extern void __chk_fail (void) __attribute__((__noreturn__)); diff --git a/libssp/memmove-chk.c b/libssp/memmove-chk.c index e8a9cd9dc588..fd069796b9d3 100644 --- a/libssp/memmove-chk.c +++ b/libssp/memmove-chk.c @@ -34,9 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include <ssp/ssp.h> -#ifdef HAVE_STRING_H -# include <string.h> -#endif +#include <string.h> extern void __chk_fail (void) __attribute__((__noreturn__)); diff --git a/libssp/mempcpy-chk.c b/libssp/mempcpy-chk.c index bfa041c0da78..ed76ab9659ab 100644 --- a/libssp/mempcpy-chk.c +++ b/libssp/mempcpy-chk.c @@ -34,9 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include <ssp/ssp.h> -#ifdef HAVE_STRING_H -# include <string.h> -#endif +#include <string.h> extern void __chk_fail (void) __attribute__((__noreturn__)); diff --git a/libssp/memset-chk.c b/libssp/memset-chk.c index 5f7726893b03..f43da2625575 100644 --- a/libssp/memset-chk.c +++ b/libssp/memset-chk.c @@ -34,9 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include <ssp/ssp.h> -#ifdef HAVE_STRING_H -# include <string.h> -#endif +#include <string.h> extern void __chk_fail (void) __attribute__((__noreturn__)); diff --git a/libssp/snprintf-chk.c b/libssp/snprintf-chk.c index 031dafd0ecce..a1631f4db792 100644 --- a/libssp/snprintf-chk.c +++ b/libssp/snprintf-chk.c @@ -35,9 +35,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include <ssp/ssp.h> #include <stdarg.h> -#ifdef HAVE_STDIO_H -# include <stdio.h> -#endif +#include <stdio.h> extern void __chk_fail (void) __attribute__((__noreturn__)); diff --git a/libssp/sprintf-chk.c b/libssp/sprintf-chk.c index dfb4989c2736..745bfe1fbd38 100644 --- a/libssp/sprintf-chk.c +++ b/libssp/sprintf-chk.c @@ -35,12 +35,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include <ssp/ssp.h> #include <stdarg.h> -#ifdef HAVE_LIMITS_H -# include <limits.h> -#endif -#ifdef HAVE_STDIO_H -# include <stdio.h> -#endif +#include <limits.h> +#include <stdio.h> extern void __chk_fail (void) __attribute__((__noreturn__)); diff --git a/libssp/ssp.c b/libssp/ssp.c index 04c13e46cd70..81f300f0464e 100644 --- a/libssp/ssp.c +++ b/libssp/ssp.c @@ -33,18 +33,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" +#include <stdlib.h> +#include <string.h> #ifdef HAVE_ALLOCA_H # include <alloca.h> #endif #ifdef HAVE_MALLOC_H # include <malloc.h> #endif -#ifdef HAVE_STDLIB_H -# include <stdlib.h> -#endif -#ifdef HAVE_STRING_H -# include <string.h> -#endif #ifdef HAVE_UNISTD_H # include <unistd.h> #endif diff --git a/libssp/stpcpy-chk.c b/libssp/stpcpy-chk.c index f6302ecf968d..41b7d409d453 100644 --- a/libssp/stpcpy-chk.c +++ b/libssp/stpcpy-chk.c @@ -34,9 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include <ssp/ssp.h> -#ifdef HAVE_STRING_H -# include <string.h> -#endif +#include <string.h> extern void __chk_fail (void) __attribute__((__noreturn__)); diff --git a/libssp/strcat-chk.c b/libssp/strcat-chk.c index e4e4fd20ef64..c8c57af6f0d1 100644 --- a/libssp/strcat-chk.c +++ b/libssp/strcat-chk.c @@ -34,9 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include <ssp/ssp.h> -#ifdef HAVE_STRING_H -# include <string.h> -#endif +#include <string.h> extern void __chk_fail (void) __attribute__((__noreturn__)); diff --git a/libssp/strcpy-chk.c b/libssp/strcpy-chk.c index 995af6d69ba7..17dedd38812d 100644 --- a/libssp/strcpy-chk.c +++ b/libssp/strcpy-chk.c @@ -34,9 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include <ssp/ssp.h> -#ifdef HAVE_STRING_H -# include <string.h> -#endif +#include <string.h> extern void __chk_fail (void) __attribute__((__noreturn__)); diff --git a/libssp/strncat-chk.c b/libssp/strncat-chk.c index c9ab775d8343..676090126fba 100644 --- a/libssp/strncat-chk.c +++ b/libssp/strncat-chk.c @@ -34,9 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include <ssp/ssp.h> -#ifdef HAVE_STRING_H -# include <string.h> -#endif +#include <string.h> extern void __chk_fail (void) __attribute__((__noreturn__)); diff --git a/libssp/strncpy-chk.c b/libssp/strncpy-chk.c index 3834fbdaed0c..fd56fc43551e 100644 --- a/libssp/strncpy-chk.c +++ b/libssp/strncpy-chk.c @@ -33,9 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include <ssp/ssp.h> -#ifdef HAVE_STRING_H -# include <string.h> -#endif +#include <string.h> extern void __chk_fail (void) __attribute__((__noreturn__)); diff --git a/libssp/vsnprintf-chk.c b/libssp/vsnprintf-chk.c index 2c0fd0638c30..beebecadc969 100644 --- a/libssp/vsnprintf-chk.c +++ b/libssp/vsnprintf-chk.c @@ -34,9 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include <ssp/ssp.h> #include <stdarg.h> -#ifdef HAVE_STDIO_H -# include <stdio.h> -#endif +#include <stdio.h> extern void __chk_fail (void) __attribute__((__noreturn__)); diff --git a/libssp/vsprintf-chk.c b/libssp/vsprintf-chk.c index b57d97e4e2d6..11b1e9ecd60e 100644 --- a/libssp/vsprintf-chk.c +++ b/libssp/vsprintf-chk.c @@ -34,12 +34,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include <ssp/ssp.h> #include <stdarg.h> -#ifdef HAVE_LIMITS_H -# include <limits.h> -#endif -#ifdef HAVE_STDIO_H -# include <stdio.h> -#endif +#include <limits.h> +#include <stdio.h> extern void __chk_fail (void) __attribute__((__noreturn__));
