From be57844b38dcb382d4d15c3d3f0882d0ad2903d7 Mon Sep 17 00:00:00 2001 From: Sam James Date: Wed, 1 Jan 2025 17:11:42 +0000 Subject: [PATCH] Fix GCC version detection for GUINT*_SWAP_LE_BE The #if condition as-written fails for any major >= 5 if minor < 3, e.g. GCC 14.2 and so on. Use the idiom described in the GCC docs [0] to avoid this. [0] https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html Fixes: 57878d6042366070e80a109bf113ac03abb86cfd --- glib/gtypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/gtypes.h b/glib/gtypes.h index 9d912d523..2dba92f11 100644 --- a/glib/gtypes.h +++ b/glib/gtypes.h @@ -247,7 +247,7 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str, */ #if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__) -# if __GNUC__ >= 4 && defined (__GNUC_MINOR__) && __GNUC_MINOR__ >= 3 +# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) # define GUINT32_SWAP_LE_BE(val) ((guint32) __builtin_bswap32 ((guint32) (val))) # define GUINT64_SWAP_LE_BE(val) ((guint64) __builtin_bswap64 ((guint64) (val))) # endif