From 0ec989ee3fde534d841d43a0527871a41aefaa5f Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 6 Feb 2025 14:40:46 +0100 Subject: [PATCH] gpgscm: Fix for gcc < 4.5 * tests/gpgscm/scheme.c (MY_GCC_VERSION): New. (type_to_string): Use gcc build in only when supported. -- Note that we do not wnat to use the GPGRT macro to keep this file as close to upstream as possible. --- tests/gpgscm/scheme.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 003e85037..952cf63b0 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -44,6 +44,16 @@ # endif #endif +#if __GNUC__ +# define MY_GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) +#else +# define MY_GCC_VERSION 0 +#endif + + + /* Used for documentation purposes, to signal functions in 'interface' */ #define INTERFACE @@ -169,7 +179,7 @@ type_to_string (enum scheme_types typ) case T_SINK: return "sink"; case T_FRAME: return "frame"; } -#ifdef __GNUC__ +#if MY_GCC_VERSION >= 40500 /* gcc >= 4.5.0 */ __builtin_unreachable (); #else assert (! "not reached");