Fixed bug 3993 - altivec.h include in SDL_cpuinfo.h breaks compilation with -std=c++11
authorSam Lantinga <slouken@libsdl.org>
Tue, 12 Dec 2017 16:25:43 -0800
changeset 1177058a69c196061
parent 11769 f0aad4dbf696
child 11771 cb68160b3ace
Fixed bug 3993 - altivec.h include in SDL_cpuinfo.h breaks compilation with -std=c++11

bastien.bouclet

According to this GCC bug report, altivec.h requires building with the gnu extensions: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78263.

As an application developer, I don't want SDL to force me to enable the gnu extensions.
include/SDL_cpuinfo.h
     1.1 --- a/include/SDL_cpuinfo.h	Tue Dec 12 16:10:20 2017 -0800
     1.2 +++ b/include/SDL_cpuinfo.h	Tue Dec 12 16:25:43 2017 -0800
     1.3 @@ -51,30 +51,28 @@
     1.4  #include <intrin.h>
     1.5  #else
     1.6  #ifdef __ALTIVEC__
     1.7 -#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__)
     1.8 +#if 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  #endif
    1.13  #endif
    1.14 -#ifdef __3dNOW__
    1.15 +#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
    1.16  #include <mm3dnow.h>
    1.17  #endif
    1.18 -#if HAVE_IMMINTRIN_H
    1.19 +#if HAVE_IMMINTRIN_H && !defined(SDL_DISABLE_IMMINTRIN_H)
    1.20  #include <immintrin.h>
    1.21  #else
    1.22 -#ifdef __MMX__
    1.23 +#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)
    1.24  #include <mmintrin.h>
    1.25  #endif
    1.26 -#ifdef __3dNOW__
    1.27 -#include <mm3dnow.h>
    1.28 -#endif
    1.29 -#ifdef __SSE__
    1.30 +#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H)
    1.31  #include <xmmintrin.h>
    1.32  #endif
    1.33 -#ifdef __SSE2__
    1.34 +#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H)
    1.35  #include <emmintrin.h>
    1.36  #endif
    1.37 -#ifdef __SSE3__
    1.38 +#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H)
    1.39  #include <pmmintrin.h>
    1.40  #endif
    1.41  #endif /* HAVE_IMMINTRIN_H */