So there's two issues:

First of all, on amd64:

g++ -std=c++0x -dM  -E - < /dev/null | grep linux
cc1: warning: command line option "-std=c++0x" is valid for C++/ObjC++ but not 
for C
#define __linux 1
#define __linux__ 1
#define __gnu_linux__ 1
#define linux 1

Note the warning?  That means the -std=c++0x option is effectively
ignored.   When you add e.g. -x c++, you'll get instead:

g++ -std=c++0x -dM -x c++ -E - < /dev/null | grep linux
#define __linux 1
#define __linux__ 1
#define __gnu_linux__ 1

Which is how it should be; in "standard" mode, "linux" is an identifier
reserved to user code and must not be pre-defined.  However, __linux
*should* be predefined.


The second issue is that on rs6000, the linux macros are defined in a way 
that's different than on other platforms.  This has the effect that even though 
we get the warning, the std=c++0x option is still considered to be in effect 
for the preprocessor defines.  In addition, due to the bug you mention above, 
__linux is only defined in non-standard mode instead of always ...

However, given that this has been that way (unfortunately) on rs6000
forever, it is probably best not to rely on the presence of __linux in
standard mode, and use __linux__ instead.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1349907

Title:
  gcc, powerpc with C++11 standard does not define __linux

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.9/+bug/1349907/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to