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: Prelude Patch to My Small AltiVec Patch...


On Tue, Feb 10, 2004 at 05:25:09PM -0800, Ziemowit Laski wrote:
> Here is my understanding of it:
> 
> when you have code like
> 
>    int __attribute__((mode(v4si))) foo(void);
> 
> the compiler first constructs
> 
>    int foo(void);
> 
> and only _then_ calls the attribute handler.  So, you have to have
> a way of "disassembling" the foo decl and then "reassembling" it with
> the corrected return type.  Ditto for arrays & pointers.
> 
> Anyhoo, the bootstrap is happily finishing, so I'll commit this
> shortly.

Ah, this makes sense if you take a look at the C (or C++) grammars and
the way GCC butchers them.  This is a declaration, so the attribute is
a declspec, so it applies to the function type.  Obviously for
__attribute__((mode)) the useful interpretation is to apply it to the
return type, instead.

At least, that's my understanding from the last time I had my head in
the grammar.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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