[PATCH v1 19/35] Assume __has_builtin(__builtin_unreachable)

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


We already assume that GCC is at least GCC 5,
and we also assume that Clang is at least Clang 4.

Clang added support for this builtin in Clang 2.7:

llvm.git bf20638966e2 (2009-09-21; "Implement __builtin_unreachable(), a GCC 4.5 extension.")

	$ git describe --contains bf20638966e2
	llvmorg-2.7.0~11211

Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
 soft-fp/soft-fp.h  | 4 ----
 timezone/private.h | 9 ---------
 2 files changed, 13 deletions(-)

diff --git a/soft-fp/soft-fp.h b/soft-fp/soft-fp.h
index 3b8d7e2265..a949962a63 100644
--- a/soft-fp/soft-fp.h
+++ b/soft-fp/soft-fp.h
@@ -49,11 +49,7 @@
 
 /* For unreachable default cases in switch statements over bitwise OR
    of FP_CLS_* values.  */
-#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
 # define _FP_UNREACHABLE	__builtin_unreachable ()
-#else
-# define _FP_UNREACHABLE	abort ()
-#endif
 
 #if ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))	\
      || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L))
diff --git a/timezone/private.h b/timezone/private.h
index 4f430dba2c..838cfa76f1 100644
--- a/timezone/private.h
+++ b/timezone/private.h
@@ -904,16 +904,7 @@ time_t timeoff(struct tm *, long);
 # undef unreachable
 # define unreachable() abort()
 #elif !defined unreachable
-# ifdef __has_builtin
-#  if __has_builtin(__builtin_unreachable)
-#   define unreachable() __builtin_unreachable()
-#  endif
-# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__)
 #  define unreachable() __builtin_unreachable()
-# endif
-# ifndef unreachable
-#  define unreachable() ((void) 0)
-# endif
 #endif
 
 /*
-- 
2.51.0



More information about the Libc-alpha mailing list