Fixed bug 4103 - SDL_cpuinfo.h provokes warnings with -Wundef on non-x86 hosts
authorSam Lantinga <slouken@libsdl.org>
Sat, 10 Mar 2018 21:20:25 -0800
changeset 11928a358a111ff69
parent 11927 6e61fc35c129
child 11929 b0ed2c515be0
Fixed bug 4103 - SDL_cpuinfo.h provokes warnings with -Wundef on non-x86 hosts

Felix Geyer

Forwarding from https://bugs.debian.org/892087 quoting verbatim:

The SDL2 header SDL_cpuinfo.h generates gcc warnings if the program using
it compiles with the -Wundef warning. (In particular, this means that QEMU
builds using it fail on at least sparc hosts, since QEMU dev builds
use both -Wundef and -Werror.).

/usr/include/SDL2/SDL_cpuinfo.h:63:5: warning: "HAVE_IMMINTRIN_H" is not defined, evaluates to 0 [-Wundef]
#if HAVE_IMMINTRIN_H && !defined(SDL_DISABLE_IMMINTRIN_H)
include/SDL_cpuinfo.h
     1.1 --- a/include/SDL_cpuinfo.h	Sat Mar 10 21:16:14 2018 -0800
     1.2 +++ b/include/SDL_cpuinfo.h	Sat Mar 10 21:20:25 2018 -0800
     1.3 @@ -51,7 +51,7 @@
     1.4  #include <intrin.h>
     1.5  #else
     1.6  #ifdef __ALTIVEC__
     1.7 -#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) && !defined(SDL_DISABLE_ALTIVEC_H)
     1.8 +#if defined(HAVE_ALTIVEC_H) && !defined(__APPLE_ALTIVEC__) && !defined(SDL_DISABLE_ALTIVEC_H)
     1.9  #include <altivec.h>
    1.10  #undef pixel
    1.11  #undef bool
    1.12 @@ -60,7 +60,7 @@
    1.13  #if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
    1.14  #include <mm3dnow.h>
    1.15  #endif
    1.16 -#if HAVE_IMMINTRIN_H && !defined(SDL_DISABLE_IMMINTRIN_H)
    1.17 +#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H)
    1.18  #include <immintrin.h>
    1.19  #else
    1.20  #if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)