This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/48192] New: Conditional macros should not pass #ifdef
- From: "meissner at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 18 Mar 2011 17:09:17 +0000
- Subject: [Bug preprocessor/48192] New: Conditional macros should not pass #ifdef
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48192
Summary: Conditional macros should not pass #ifdef
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
AssignedTo: meissner@gcc.gnu.org
ReportedBy: meissner@gcc.gnu.org
Host: powerpc64-linux
Target: powerpc64-linux
Build: powerpc64-linux
The PowerPC port defines 3 conditional macros, vector, bool, and pixel in
non-standards complaint mode to implement the Altivec/VSX vector keywords. The
rs6000 backend only expands these keywords if the next token is a type or
keyword that would be used for the Altivec/VSX vector support, to allow the
user to use these 'keywords' as normal identifiers. So vector int foo; would
expand vector to the vector __attribute__ to define a vector type, but int
vector = 0 would not be expanded.
The Spu also defines vector as a conditional macro.
No other port currently uses conditional macros.
The problem is if the user does:
#ifndef bool
#define bool char
#endif
static bool variable = 0;
The #ifndef case will not succeed because 'bool' is a macro, but 'bool' will
not be expanded because it was not preceded with 'vector'.