Parse: __attribute__((keyword)) shouldn't error

Weird constructs like __attribute__((inline)) or
__attibute__((typename)) should result in warnings, not errors.

llvm-svn: 225118
This commit is contained in:
David Majnemer 2015-01-03 19:41:00 +00:00
parent 5772566ed6
commit 22fe771f78
3 changed files with 6 additions and 5 deletions

View File

@ -143,11 +143,12 @@ void Parser::ParseGNUAttributes(ParsedAttributes &attrs,
continue;
// Expect an identifier or declaration specifier (const, int, etc.)
if (Tok.isNot(tok::identifier) && !isTypeQualifier() &&
!isKnownToBeTypeSpecifier(Tok))
if (Tok.isAnnotation())
break;
IdentifierInfo *AttrName = Tok.getIdentifierInfo();
if (!AttrName)
break;
IdentifierInfo *AttrName = Tok.getIdentifierInfo();
SourceLocation AttrNameLoc = ConsumeToken();
if (Tok.isNot(tok::l_paren)) {

View File

@ -21,4 +21,4 @@ namespace PR17666 {
typedef int __attribute__((aligned(int))) T2; // expected-error {{expected '(' for function-style cast}}
}
__attribute((typename)) int x; // expected-error {{expected ')'}}
__attribute((typename)) int x; // expected-warning {{unknown attribute 'typename' ignored}}

View File

@ -4,5 +4,5 @@ namespace A
{
}
namespace B __attribute__ (( const )) = A; // expected-error{{attributes cannot be specified on namespace alias}}
namespace B __attribute__ (( static )) = A; // expected-error{{attributes cannot be specified on namespace alias}}