This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: handling of mode attribute


On Sat, 26 Sep 2009, Kai Tietz wrote:

> This patch makes sure, that the attribute mode is getting associated
> with the base type (as described in documentation, too). So the mode
> attribute can be used as type-specifier in code, too (eg  'int
> __attribute__ ((mode(DI))) value[5];' ).
> The old attribute mode handler has treating of pointer type, but if I
> read documentation I don't find a single word about this. Also I
> searched testsuite and couldn't find any example of this. To allow
> proper association of this attribute, I removed the bogus pointer type
> handling. If this is necessary for some cases I didn't found, we could
> add a special attribute (eg. ptrmode) for handling and checking this.
> The only usecase I found in gcc's source is in vmsdbgout.c:typedef
> struct fibdef* __fibdef_ptr32 __attribute__ (( mode (SI) ));

The handling is not bogus.  There may not be tests for it, but it's a 
relevant feature for any target where pointers can have multiple widths 
(such as IA64).

Following "Attribute Syntax" in the manual will tell you how to apply the 
attribute in complex declarations.  Normally you will define a typedef of 
the simplest type to which you are applying the mode, and then define 
other types in terms of it, and if your issues is built-in typedefs then 
see bug 32187 regarding making them act more like keywords.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]