PATCH: Altivec context-sensitive keywords (round 2)

Ben Elliston bje@au1.ibm.com
Thu Jul 24 11:10:00 GMT 2008


On Tue, 2008-07-15 at 05:22 -0700, Andrew Pinski wrote:

> This caused a regression with "g++.dg/ext/altivec-types-1.C", we no
> longer error out on "__vector bool".

I've looked into this.  Whether this is a problem is open to
interpretation (well, by my interpretation anyway).  ;-)

The Altivec PIM says, of the context-sensitive keyword method of
implementing the Altivec keywords:

  In this method, __vector and __pixel are added as keywords
  without regard to context while the new uses of vector,
  pixel, and bool are keywords only in the context of a type.
  Since vector must be first among the type specifiers, it can
  be recognized as a type specifier when a type identifier is 
  being scanned. The new uses of pixel and bool occur after
  vector has been recognized. In all other contexts, vector,
  pixel, and bool are not reserved.

We are expanding bool when it appears after vector has been recognised.
This leads the preprocessor to expand:

  __vector bool vb;
to:
  __attribute__((altivec(vector__))) __attribute__((altivec(bool__))) unsigned vb;

I'm not sure there is anything undesirable about this.  Is "vector bool"
an explicitly invalid Altivec type?

Cheers, Ben



More information about the Gcc-patches mailing list