<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 3, 2015 at 11:44 AM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Sat, Jan 3, 2015 at 2:41 PM, David Majnemer <<a href="mailto:david.majnemer@gmail.com">david.majnemer@gmail.com</a>> wrote:<br>
> Author: majnemer<br>
> Date: Sat Jan  3 13:41:00 2015<br>
> New Revision: 225118<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=225118&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=225118&view=rev</a><br>
> Log:<br>
> Parse: __attribute__((keyword)) shouldn't error<br>
><br>
> Weird constructs like __attribute__((inline)) or<br>
> __attibute__((typename)) should result in warnings, not errors.<br>
><br>
> Modified:<br>
>     cfe/trunk/lib/Parse/ParseDecl.cpp<br>
>     cfe/trunk/test/Parser/cxx-attributes.cpp<br>
>     cfe/trunk/test/Parser/namespace-alias-attr.cpp<br>
><br>
> Modified: cfe/trunk/lib/Parse/ParseDecl.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=225118&r1=225117&r2=225118&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=225118&r1=225117&r2=225118&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Parse/ParseDecl.cpp (original)<br>
> +++ cfe/trunk/lib/Parse/ParseDecl.cpp Sat Jan  3 13:41:00 2015<br>
> @@ -143,11 +143,12 @@ void Parser::ParseGNUAttributes(ParsedAt<br>
>          continue;<br>
><br>
>        // Expect an identifier or declaration specifier (const, int, etc.)<br>
> -      if (Tok.isNot(tok::identifier) && !isTypeQualifier() &&<br>
> -          !isKnownToBeTypeSpecifier(Tok))<br>
> +      if (Tok.isAnnotation())<br>
>          break;<br>
<br>
</div></div>Thanks for taking care of this!<br>
<br>
Is there a way to get a raw identifier here? getIdentifierInfo asserts<br>
on that as well as annotations, which is why I ask. We may want a<br>
comment here explaining why we break as well.<br></blockquote><div><br></div><div>AFAICT, we cannot get a raw identifier here.  Personally, I don't think a comment is needed because annotation tokens are obviously not identifier-like.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
~Aaron<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> -<br>
>        IdentifierInfo *AttrName = Tok.getIdentifierInfo();<br>
> +      if (!AttrName)<br>
> +        break;<br>
> +<br>
>        SourceLocation AttrNameLoc = ConsumeToken();<br>
><br>
>        if (Tok.isNot(tok::l_paren)) {<br>
><br>
> Modified: cfe/trunk/test/Parser/cxx-attributes.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-attributes.cpp?rev=225118&r1=225117&r2=225118&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-attributes.cpp?rev=225118&r1=225117&r2=225118&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/test/Parser/cxx-attributes.cpp (original)<br>
> +++ cfe/trunk/test/Parser/cxx-attributes.cpp Sat Jan  3 13:41:00 2015<br>
> @@ -21,4 +21,4 @@ namespace PR17666 {<br>
>    typedef int __attribute__((aligned(int))) T2; // expected-error {{expected '(' for function-style cast}}<br>
>  }<br>
><br>
> -__attribute((typename)) int x; // expected-error {{expected ')'}}<br>
> +__attribute((typename)) int x; // expected-warning {{unknown attribute 'typename' ignored}}<br>
><br>
> Modified: cfe/trunk/test/Parser/namespace-alias-attr.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/namespace-alias-attr.cpp?rev=225118&r1=225117&r2=225118&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/namespace-alias-attr.cpp?rev=225118&r1=225117&r2=225118&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/test/Parser/namespace-alias-attr.cpp (original)<br>
> +++ cfe/trunk/test/Parser/namespace-alias-attr.cpp Sat Jan  3 13:41:00 2015<br>
> @@ -4,5 +4,5 @@ namespace A<br>
>  {<br>
>  }<br>
><br>
> -namespace B __attribute__ (( const )) = A; // expected-error{{attributes cannot be specified on namespace alias}}<br>
> +namespace B __attribute__ (( static )) = A; // expected-error{{attributes cannot be specified on namespace alias}}<br>
><br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div></div>