Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorNathan Ridge2018-09-17 01:52:22 -0400
committerNathan Ridge2018-09-24 21:24:11 -0400
commitb803d1030c8cc4458b31d3b796a41a43ca8c8051 (patch)
treebbfa6e4b8711d52d1bb72e21a1a3cba65fe28810 /core
parent732c4874ee94ec65bd90b12d44f55d57585471bb (diff)
downloadorg.eclipse.cdt-b803d1030c8cc4458b31d3b796a41a43ca8c8051.tar.gz
org.eclipse.cdt-b803d1030c8cc4458b31d3b796a41a43ca8c8051.tar.xz
org.eclipse.cdt-b803d1030c8cc4458b31d3b796a41a43ca8c8051.zip
Bug 538615 - GNU-style attribute preceding standard attribute specifier
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java4
2 files changed, 8 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
index f685500cbe..65c9ce2333 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
@@ -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; }
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
index 4ec263f939..b330ed8b6f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
@@ -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)) {

Back to the top