1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Bug 413615 - GCC __attribute__ produces syntax error after "override"

Added test and implementation of recognizing GCC attributes after
override.

Change-Id: I0a6661c7be2b921658240ccebba6fbcb24780f20
Reviewed-on: https://git.eclipse.org/r/23231
Reviewed-by: Thomas Corbat <tcorbat@hsr.ch>
IP-Clean: Thomas Corbat <tcorbat@hsr.ch>
Tested-by: Thomas Corbat <tcorbat@hsr.ch>
This commit is contained in:
Thomas Corbat 2014-03-12 08:35:41 +01:00
parent d8a4f20401
commit 039e2619d8
2 changed files with 10 additions and 0 deletions

View file

@ -491,4 +491,12 @@ public class AST2CPPAttributeTests extends AST2TestBase {
IASTTranslationUnit tu = parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP, true);
checkAttributeRelations(getAttributeSpecifiers(tu), IASTDeclarator.class);
}
// struct S {
// void foo() override __attribute__((attr));
// };
public void testGCCAttributeAfterOverride_bug413615() throws Exception {
IASTTranslationUnit tu = parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP, true);
checkAttributeRelations(getAttributeSpecifiers(tu), ICPPASTFunctionDeclarator.class);
}
}

View file

@ -3559,6 +3559,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
// For member functions we need to consider virtual specifiers and pure-virtual syntax.
if (option == DeclarationOptions.CPP_MEMBER) {
optionalVirtSpecifierSeq((ICPPASTFunctionDeclarator) typeRelevantDtor);
List<IASTAttributeSpecifier> attributeSpecifiers = __attribute_decl_seq(supportAttributeSpecifiers, false);
addAttributeSpecifiers(attributeSpecifiers, dtor);
int lt1 = LTcatchEOF(1);
if (lt1 == IToken.tASSIGN && LTcatchEOF(2) == IToken.tINTEGER) {
consume();