We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3993

Summary: altivec.h include in SDL_cpuinfo.h breaks compilation with -std=c++11
Product: SDL Reporter: bastien.bouclet
Component: *don't know*Assignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: PowerPC   
OS: Other   

Description bastien.bouclet 2017-12-05 18:27:39 UTC
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 developper, I don't want SDL to force me to enable the gnu extensions.

Reproduction steps:
$ cat test.cpp 
#include <SDL.h>

int main() {
	bool hello = false;
	return 0;
}

$ powerpc64-ps3-elf-g++ $(/usr/local/ps3dev/portlibs/ppu/bin/sdl2-config --cflags) -std=c++11 test.cpp 
test.cpp: In function 'int main()':
test.cpp:4:15: error: cannot convert 'bool' to '__vector(4) __bool int' in initialization
  bool hello = false;
               ^~~~~

I suggest removing the include of altivec.h from SDL_cpuinfo.h, leaving the decision to include it on PowerPC to the application.
Comment 1 Sam Lantinga 2017-12-13 00:27:06 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/58a69c196061

Including SDL_cpuinfo.h shouldn't cause a compiler error anymore, and if you really need to disable altivec you can define SDL_DISABLE_ALTIVEC_H before including SDL_cpuinfo.h