1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

Bug 538615 - GNU-style attribute preceding standard attribute specifier

Change-Id: I8f736ab354b07fb14cba35dec10c8b6d96917d70
This commit is contained in:
Nathan Ridge 2018-09-17 01:52:22 -04:00
parent 732c4874ee
commit b803d1030c
2 changed files with 8 additions and 1 deletions

View file

@ -11666,6 +11666,11 @@ public class AST2CPPTests extends AST2CPPTestBase {
parseAndCheckBindings();
}
// __attribute__((section(".example"))) alignas(4) static int waldo;
public void testAlignasAfterAttribute_538615() throws Exception {
parseAndCheckBindings(getAboveComment(), CPP, true /* use GNU extensions */);
}
// int operator "" _A(unsigned long long i) { return 1; }
// int operator "" _B(long double d) { return 1; }
// int operator "" _C(const char* s, unsigned int sz) { return sz; }

View file

@ -2604,7 +2604,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
*/
@Override
protected IASTDeclaration declaration(DeclarationOptions option) throws EndOfFileException, BacktrackException {
List<IASTAttributeSpecifier> attributes = attributeSpecifierSeq();
// Allow GNU-style attributes both before standard attribute / alignment specifiers, and after.
List<IASTAttributeSpecifier> attributes = __attribute_decl_seq(supportAttributeSpecifiers, supportDeclspecSpecifiers);
attributes = CollectionUtils.merge(attributes, attributeSpecifierSeq());
attributes = CollectionUtils.merge(attributes, __attribute_decl_seq(supportAttributeSpecifiers, supportDeclspecSpecifiers));
switch (LT(1)) {