include: Fix triggering of Clang's -Wexpansion-to-defined in SDL_endian.h

It doesn't like #if statements that uses a macro that uses defined(x).
This commit is contained in:
Ryan C. Gordon 2021-09-18 10:44:32 -04:00
parent 8f41412327
commit b8da02e6ef
No known key found for this signature in database
GPG key ID: FA148B892AB48044

View file

@ -93,16 +93,22 @@ extern "C" {
*/ */
/* various modern compilers may have builtin swap */ /* various modern compilers may have builtin swap */
#define HAS_BUILTIN_BSWAP16 (_SDL_HAS_BUILTIN(__builtin_bswap16)) || \ #if defined(__GNUC__)
(defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) # define HAS_BUILTIN_BSWAP16 (_SDL_HAS_BUILTIN(__builtin_bswap16)) || \
#define HAS_BUILTIN_BSWAP32 (_SDL_HAS_BUILTIN(__builtin_bswap32)) || \ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
(defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) # define HAS_BUILTIN_BSWAP32 (_SDL_HAS_BUILTIN(__builtin_bswap32)) || \
#define HAS_BUILTIN_BSWAP64 (_SDL_HAS_BUILTIN(__builtin_bswap64)) || \ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
(defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) # define HAS_BUILTIN_BSWAP64 (_SDL_HAS_BUILTIN(__builtin_bswap64)) || \
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
/* this one is broken */ /* this one is broken */
#define HAS_BROKEN_BSWAP (defined(__GNUC__) && \ # define HAS_BROKEN_BSWAP (__GNUC__ == 2 && __GNUC_MINOR__ <= 95)
(__GNUC__ == 2 && __GNUC_MINOR__ <= 95)) #else
# define HAS_BUILTIN_BSWAP16 0
# define HAS_BUILTIN_BSWAP32 0
# define HAS_BUILTIN_BSWAP64 0
# define HAS_BROKEN_BSWAP 0
#endif
#if HAS_BUILTIN_BSWAP16 #if HAS_BUILTIN_BSWAP16
#define SDL_Swap16(x) __builtin_bswap16(x) #define SDL_Swap16(x) __builtin_bswap16(x)