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 - altivec.h include in SDL_cpuinfo.h breaks compilation with -std=c++11
Summary: altivec.h include in SDL_cpuinfo.h breaks compilation with -std=c++11
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: PowerPC Other
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-05 18:27 UTC by bastien.bouclet
Modified: 2017-12-13 00:27 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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