This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: handling of mode attribute
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Kai Tietz <ktietz70 at googlemail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 26 Sep 2009 16:49:35 +0000 (UTC)
- Subject: Re: RFA: handling of mode attribute
- References: <90baa01f0909260610v6edc9611j777d65f381f3321c@mail.gmail.com>
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