On 07/10/2010 03:56 PM, Ian Lance Taylor wrote:
Sean Hunt<ride...@gmail.com> writes:
void foo () __attribute__((noreturn)); // right per spec
void foo __attribute__((noreturn)) (); // works
__attribute__((noreturn)) void foo (); // works
It's obvious that the first example of each kind (noreturn appearing
after the function declarator) must be accepted if it's a GCC
attribute and not if it's a C++0x attributes. The later two (noreturn
appearing before the declaration or after the identifier) must be
accepted for C++0x attributes, but it's not clear if the GCC syntax
being accepted is an accident or by design.
As far as I can see they are both documenated as working at
http://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Attribute-Syntax.html , so I
think it is by design.
The problem is that it is not clear if that is intended, or merely an
accident. The spec is rather unclear about a number of things.
Is anyone currently working on C++0x attributes in GCC and, if not, is
there anyone who can help me through what we should and shouldn't
accept in clang?
I don't know the answer to this. It's clear that C++0x attributes are
not the same as GNU attributes.
Ian
Yes. I'm trying to determine which parts of GCC attributes are merely
accidents and don't really need implementation, as there are a lot of
situations where GCC attributes (as implemented) are significantly more
liberal than C++0x attributes are. This will be an issue that GCC
developers will encounter when an effort is made to implement
attributes; I would like to see what discussion can be had before I go
ahead and reimplement the attribute codepaths within clang.
Sean