[PATCH v1 17/35] Assume that GCC is at least GCC 5

Alejandro Colomar alx@kernel.org
Sun Nov 9 21:53:29 GMT 2025


Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
 misc/sys/cdefs.h               | 13 +------------
 string/bits/string_fortified.h | 19 -------------------
 string/string.h                |  3 +--
 sysdeps/x86/bits/floatn.h      |  7 +------
 4 files changed, 3 insertions(+), 39 deletions(-)

diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index d28af8b30a..8f565acda1 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -524,12 +524,6 @@
 # define __glibc_unlikely(cond)	__builtin_expect ((cond), 0)
 # define __glibc_likely(cond)	__builtin_expect ((cond), 1)
 
-#if (!defined _Noreturn \
-     && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
-     &&  !(__GNUC_PREREQ (4,7) || defined(__clang__)))
-#  define _Noreturn __attribute__ ((__noreturn__))
-#endif
-
 #if __GNUC_PREREQ (8, 0)
 /* Describes a char array whose address can safely be passed as the first
    argument to strncpy and strncat, as the char array is not necessarily
@@ -551,8 +545,7 @@
 
 #if (!defined _Static_assert && !defined __cplusplus \
      && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
-     && (!(__GNUC_PREREQ (4, 6) || defined(__clang__)) \
-         || defined __STRICT_ANSI__))
+     && defined __STRICT_ANSI__)
 # define _Static_assert(expr, diagnostic) \
     extern int (*__Static_assert_function (void)) \
       [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
@@ -637,13 +630,9 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
 
    Note: MESSAGE must be a _single_ string; concatenation of string
    literals is not supported.  */
-#if __GNUC_PREREQ (4,8) || defined(__clang__)
 # define __glibc_macro_warning1(message) _Pragma (#message)
 # define __glibc_macro_warning(message) \
   __glibc_macro_warning1 (GCC warning message)
-#else
-# define __glibc_macro_warning(msg)
-#endif
 
 /* Generic selection (ISO C11) is a C-only feature, available in GCC
    since version 4.9.  Previous versions do not provide generic
diff --git a/string/bits/string_fortified.h b/string/bits/string_fortified.h
index c7f7cb0e35..88eb2510cd 100644
--- a/string/bits/string_fortified.h
+++ b/string/bits/string_fortified.h
@@ -114,7 +114,6 @@ __NTH (strncpy (__fortify_clang_overload_arg (char *, __restrict, __dest),
 }
 
 #ifdef __USE_XOPEN2K8
-# if __GNUC_PREREQ (4, 7) || defined(__clang__)
 __fortify_function __attribute_overloadable__ char *
 __NTH (stpncpy (__fortify_clang_overload_arg (char *, ,__dest),
 		const char *__src, size_t __n))
@@ -123,24 +122,6 @@ __NTH (stpncpy (__fortify_clang_overload_arg (char *, ,__dest),
   return __builtin___stpncpy_chk (__dest, __src, __n,
 				  __glibc_objsize (__dest));
 }
-# else
-extern char *__stpncpy_chk (char *__dest, const char *__src, size_t __n,
-			    size_t __destlen) __THROW
-  __fortified_attr_access (__write_only__, 1, 3)
-  __attr_access ((__read_only__, 2));
-extern char *__REDIRECT_NTH (__stpncpy_alias, (char *__dest, const char *__src,
-					       size_t __n), stpncpy);
-
-__fortify_function __attribute_overloadable__ char *
-__NTH (stpncpy (__fortify_clang_overload_arg (char *, ,__dest),
-		const char *__src, size_t __n))
-{
-  if (__bos (__dest) != (size_t) -1
-      && (!__builtin_constant_p (__n) || __n > __bos (__dest)))
-    return __stpncpy_chk (__dest, __src, __n, __bos (__dest));
-  return __stpncpy_alias (__dest, __src, __n);
-}
-# endif
 #endif
 
 
diff --git a/string/string.h b/string/string.h
index 03987fa352..a226c7808d 100644
--- a/string/string.h
+++ b/string/string.h
@@ -33,8 +33,7 @@ __BEGIN_DECLS
 #include <stddef.h>
 
 /* Tell the caller that we provide correct C++ prototypes.  */
-#if defined __cplusplus && (__GNUC_PREREQ (4, 4) \
-			    || defined(__clang__))
+#if defined __cplusplus
 # define __CORRECT_ISO_CPP_STRING_H_PROTO
 #endif
 
diff --git a/sysdeps/x86/bits/floatn.h b/sysdeps/x86/bits/floatn.h
index 3407874096..1099ffbb5a 100644
--- a/sysdeps/x86/bits/floatn.h
+++ b/sysdeps/x86/bits/floatn.h
@@ -28,12 +28,7 @@
    support, for x86_64 and x86.  Intel SYCL compiler doesn't support
    _Float128: https://github.com/intel/llvm/issues/16903
   */
-#if (defined __x86_64__							\
-     ? __GNUC_PREREQ (4, 3)						\
-     : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4))) \
-    || (defined(__clang__)						\
-	&& (!defined __INTEL_LLVM_COMPILER				\
-	    || !defined SYCL_LANGUAGE_VERSION))
+#if (!defined __INTEL_LLVM_COMPILER || !defined SYCL_LANGUAGE_VERSION)
 # define __HAVE_FLOAT128 1
 #else
 # define __HAVE_FLOAT128 0
-- 
2.51.0



More information about the Libc-alpha mailing list