[XEN PATCH 1/3] xen/compiler: drop alternative unreachable() definition for older GCC

nicola.vetrini@gmail.com posted 3 patches 2 months, 2 weeks ago
[XEN PATCH 1/3] xen/compiler: drop alternative unreachable() definition for older GCC
Posted by nicola.vetrini@gmail.com 2 months, 2 weeks ago
From: Nicola Vetrini <nicola.vetrini@gmail.com>

The GCC baseline version is 5.1, which supports __builtin_unreachable(),
therefore the alternative definition can be dropped

Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com>
---
Mentioned in https://gitlab.com/xen-project/xen/-/issues/201
---
 xen/include/xen/compiler.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index 735c844d2d15..88bf26bc5109 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -47,11 +47,7 @@
 # define cf_check
 #endif
 
-#if (!defined(__clang__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 5))
-#define unreachable() do {} while (1)
-#else
 #define unreachable() __builtin_unreachable()
-#endif
 
 /*
  * Compilers estimate the size of an asm() block for inlining purposes.
-- 
2.43.0
Re: [XEN PATCH 1/3] xen/compiler: drop alternative unreachable() definition for older GCC
Posted by Andrew Cooper 2 months, 2 weeks ago
On 13/08/2025 8:12 pm, nicola.vetrini@gmail.com wrote:
> From: Nicola Vetrini <nicola.vetrini@gmail.com>
>
> The GCC baseline version is 5.1, which supports __builtin_unreachable(),
> therefore the alternative definition can be dropped
>
> Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com>
> ---
> Mentioned in https://gitlab.com/xen-project/xen/-/issues/201

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>