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
This commit is contained in:
Sam James 2025-01-01 17:11:42 +00:00
parent 68388cf7f7
commit be57844b38
No known key found for this signature in database
GPG Key ID: 738409F520DF9190

View File

@ -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