[PATCH, libcpp, rs6000]: context-sensitive Altivec keywords

Joseph S. Myers joseph@codesourcery.com
Fri Dec 7 15:38:00 GMT 2007

This breaks various testcases with -std=c99 -pedantic (together with 
-maltivec or a -mcpu option that implies -maltivec).

Test 1 (valid code):

#ifdef vector
#error "vector defined"
int x;

The conditional macros must be invisible to #ifdef/#ifndef/defined().

Test 2 (valid code):

typedef int vector;
vector pixel;

The context-sensitivity isn't restricting the conditional macros to cases 
where the code would otherwise be invalid.

Test 3 (invalid code):

vector pixel x;

This code is syntactically invalid, so requires a diagnostic with -std=c99 
-pedantic (even if you choose to compile it with the Altivec keyword rules 
after giving such a diagnostic).

Joseph S. Myers

More information about the Gcc-patches mailing list