[PATCH] Add named address support to GCC 4.5

Chris Lattner clattner@apple.com
Mon Apr 20 04:26:00 GMT 2009


On Apr 19, 2009, at 9:16 PM, Ben Elliston wrote:

> On Fri, 2009-04-17 at 09:58 -0700, Chris Lattner wrote:
>
>> Out of curiosity, what is the motivation for making these actual
>> keywords?  Clang has support for address spaces as well, and clients
>> that use them just install a predefine that expands to an attribute.
>> For example, cellspu could install:
>>
>> #define __ea __attribute__((address_space(1)))
>> Which enables, stuff like:
>>
>> int __ea *P;
>
> Won't the attribute apply to the whole type?  We want to be able to  
> have
> a multiplicity of types like:
>
> 	int __ea *p;
> 	int * __ea p;

No, attribute address_space is parsed as part of type-qualifier-list  
(and apply to types, not decls), which means that things like:

int __attribute__((address_space(1))) *  
__attribute__((address_space(2))) *__attribute__((address_space(3))) P;

Do what you'd expect.

-Chris



More information about the Gcc-patches mailing list