// attributes as part of a statement in that case). That looks like a bug.
if (!getLangOpts().CPlusPlus || Tok.is(tok::semi))
attrs.takeAllFrom(TempAttrs);
- else if (isDeclarationStatement()) {
+ else {
StmtVector Stmts;
- // FIXME: We should do this whether or not we have a declaration
- // statement, but that doesn't work correctly (because ProhibitAttributes
- // can't handle GNU attributes), so only call it in the one case where
- // GNU attributes are allowed.
SubStmt = ParseStatementOrDeclarationAfterAttributes(Stmts, StmtCtx,
nullptr, TempAttrs);
if (!TempAttrs.empty() && !SubStmt.isInvalid())
SubStmt = Actions.ActOnAttributedStmt(TempAttrs, SubStmt.get());
- } else {
- Diag(Tok, diag::err_expected_after) << "__attribute__" << tok::semi;
}
}
void g() {
C: // unused label 'C' will not appear here because an error has occurred
- __attribute__((unused))
- #pragma weak unused_local_static // expected-error {{expected ';' after __attribute__}}
+ __attribute__((unused)) // expected-error {{an attribute list cannot appear here}}
+ #pragma weak unused_local_static
;
}