mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-12 18:55:38 +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:
parent
d8a4f20401
commit
039e2619d8
2 changed files with 10 additions and 0 deletions
|
@ -491,4 +491,12 @@ public class AST2CPPAttributeTests extends AST2TestBase {
|
||||||
IASTTranslationUnit tu = parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP, true);
|
IASTTranslationUnit tu = parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP, true);
|
||||||
checkAttributeRelations(getAttributeSpecifiers(tu), IASTDeclarator.class);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3559,6 +3559,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
// For member functions we need to consider virtual specifiers and pure-virtual syntax.
|
// For member functions we need to consider virtual specifiers and pure-virtual syntax.
|
||||||
if (option == DeclarationOptions.CPP_MEMBER) {
|
if (option == DeclarationOptions.CPP_MEMBER) {
|
||||||
optionalVirtSpecifierSeq((ICPPASTFunctionDeclarator) typeRelevantDtor);
|
optionalVirtSpecifierSeq((ICPPASTFunctionDeclarator) typeRelevantDtor);
|
||||||
|
List<IASTAttributeSpecifier> attributeSpecifiers = __attribute_decl_seq(supportAttributeSpecifiers, false);
|
||||||
|
addAttributeSpecifiers(attributeSpecifiers, dtor);
|
||||||
int lt1 = LTcatchEOF(1);
|
int lt1 = LTcatchEOF(1);
|
||||||
if (lt1 == IToken.tASSIGN && LTcatchEOF(2) == IToken.tINTEGER) {
|
if (lt1 == IToken.tASSIGN && LTcatchEOF(2) == IToken.tINTEGER) {
|
||||||
consume();
|
consume();
|
||||||
|
|
Loading…
Add table
Reference in a new issue