Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.linux.ppc64le/pom.xml2
-rw-r--r--core/org.eclipse.cdt.core.linux.x86_64/pom.xml2
-rw-r--r--core/org.eclipse.cdt.core.linux/pom.xml2
-rw-r--r--core/org.eclipse.cdt.core.macosx/pom.xml2
-rw-r--r--core/org.eclipse.cdt.core.native/META-INF/MANIFEST.MF2
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java19
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java12
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx17/TemplateAutoTests.java33
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/RewriteTester.java2
-rw-r--r--core/org.eclipse.cdt.core.tests/pom.xml3
-rw-r--r--core/org.eclipse.cdt.core.win32.x86_64/pom.xml2
-rw-r--r--core/org.eclipse.cdt.core.win32/pom.xml2
-rw-r--r--core/org.eclipse.cdt.core/META-INF/MANIFEST.MF2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CStringValue.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/FloatingPointValue.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/IntegralValue.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java45
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeInstantiationRequest.java2
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java49
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java6
-rw-r--r--core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/ElfParser.java11
-rw-r--r--core/org.eclipse.cdt.ui.tests/pom.xml3
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java9
-rw-r--r--core/org.eclipse.cdt.ui/.settings/.api_filters19
-rw-r--r--core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CommentsTabPage.java3
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/DeleteResConfigsAction.java236
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ExcludeFromBuildAction.java262
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/build/ToolChainPreferencePage.java21
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java2
-rw-r--r--core/pom.xml2
37 files changed, 203 insertions, 582 deletions
diff --git a/core/org.eclipse.cdt.core.linux.ppc64le/pom.xml b/core/org.eclipse.cdt.core.linux.ppc64le/pom.xml
index 9e68d5233d..9ca42a34bf 100644
--- a/core/org.eclipse.cdt.core.linux.ppc64le/pom.xml
+++ b/core/org.eclipse.cdt.core.linux.ppc64le/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
- <version>9.9.0-SNAPSHOT</version>
+ <version>9.11.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/core/org.eclipse.cdt.core.linux.x86_64/pom.xml b/core/org.eclipse.cdt.core.linux.x86_64/pom.xml
index 7cb2cdc1c2..2111ce204f 100644
--- a/core/org.eclipse.cdt.core.linux.x86_64/pom.xml
+++ b/core/org.eclipse.cdt.core.linux.x86_64/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
- <version>9.9.0-SNAPSHOT</version>
+ <version>9.11.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/core/org.eclipse.cdt.core.linux/pom.xml b/core/org.eclipse.cdt.core.linux/pom.xml
index 3341b4575d..19d317ffd6 100644
--- a/core/org.eclipse.cdt.core.linux/pom.xml
+++ b/core/org.eclipse.cdt.core.linux/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
- <version>9.9.0-SNAPSHOT</version>
+ <version>9.11.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/core/org.eclipse.cdt.core.macosx/pom.xml b/core/org.eclipse.cdt.core.macosx/pom.xml
index 60891d7c7c..fdac4bd32a 100644
--- a/core/org.eclipse.cdt.core.macosx/pom.xml
+++ b/core/org.eclipse.cdt.core.macosx/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
- <version>9.9.0-SNAPSHOT</version>
+ <version>9.11.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/core/org.eclipse.cdt.core.native/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core.native/META-INF/MANIFEST.MF
index eeab906b12..d621d34bad 100644
--- a/core/org.eclipse.cdt.core.native/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core.native/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.core.native;singleton:=true
-Bundle-Version: 5.10.100.qualifier
+Bundle-Version: 5.10.300.qualifier
Bundle-Activator: org.eclipse.cdt.internal.core.natives.CNativePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
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 bb6cb8876b..d27cea8328 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
@@ -103,6 +103,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeleteExpression;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
@@ -13407,4 +13408,22 @@ public class AST2CPPTests extends AST2CPPTestBase {
public void testClassFromInitList_549036() throws Exception {
parseAndCheckImplicitNameBindings();
}
+
+ // int a = 42, b = 42;
+ // float c = 3.14, d = 3.14;
+ // char e[] = "waldo", f[] = "waldo";
+ public void testLiteralExpressionEquivalence_551689() throws Exception {
+ BindingAssertionHelper helper = getAssertionHelper();
+ ICPPASTExpression a = helper.assertNode("a = 42", "42");
+ ICPPASTExpression b = helper.assertNode("b = 42", "42");
+ assertTrue(a.getEvaluation().isEquivalentTo(b.getEvaluation()));
+
+ ICPPASTExpression c = helper.assertNode("c = 3.14", "3.14");
+ ICPPASTExpression d = helper.assertNode("d = 3.14", "3.14");
+ assertTrue(c.getEvaluation().isEquivalentTo(d.getEvaluation()));
+
+ ICPPASTExpression e = helper.assertNode("e[] = \"waldo\"", "\"waldo\"");
+ ICPPASTExpression f = helper.assertNode("f[] = \"waldo\"", "\"waldo\"");
+ assertTrue(e.getEvaluation().isEquivalentTo(f.getEvaluation()));
+ }
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
index 242b5ed5eb..bada355b7d 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
@@ -11373,4 +11373,16 @@ public class AST2TemplateTests extends AST2CPPTestBase {
public void testGlobalConstWorksAsConstExpression_545756() throws Exception {
parseAndCheckBindings();
}
+
+ // template <class C, C... Chars>
+ // unsigned int operator""_test() {
+ // return sizeof...(Chars);
+ // }
+ //
+ // void foo() {
+ // auto len = "test"_test;
+ // }
+ public void testStringLiteralOperatorTemplate_536986() throws Exception {
+ parseAndCheckImplicitNameBindings();
+ }
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx17/TemplateAutoTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx17/TemplateAutoTests.java
index 17d86ac772..c44bce5433 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx17/TemplateAutoTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx17/TemplateAutoTests.java
@@ -75,4 +75,37 @@ public class TemplateAutoTests extends AST2CPPTestBase {
public void testTemplateNontypeParameterTypeDeductionParsing_519361_3() throws Exception {
parseAndCheckBindings();
}
+
+ // template <typename T, T>
+ // struct meta { using type = int; };
+ //
+ // template <typename T>
+ // struct remove_noexcept { using type = T; };
+ //
+ // template <typename T>
+ // using remove_noexcept_t = typename remove_noexcept<T>::type;
+ //
+ // template <auto Key>
+ // struct K : meta<remove_noexcept_t<decltype(Key)>,Key>{};
+ //
+ // template <auto Key>
+ // struct W {
+ // using type = typename K<Key>::type;
+ // };
+ //
+ // template <typename T>
+ // struct M {};
+ //
+ // struct A {
+ // int foo;
+ // };
+ // typedef M<W<&A::foo>::type> M1; // typedef #1
+ //
+ // struct B {
+ // int foo;
+ // };
+ // typedef M<W<&B::foo>::type> M2; // typedef #2
+ public void testInstantiationCacheConflict_553141() throws Exception {
+ parseAndCheckBindings();
+ }
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/RewriteTester.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/RewriteTester.java
index 544f98fe68..1d4bbdeaba 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/RewriteTester.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/RewriteTester.java
@@ -120,7 +120,7 @@ public class RewriteTester extends TestSuite {
private static RewriteBaseTest createTestClass(String className, String testName, List<TestSourceFile> files)
throws Exception {
- try {
+ try {
Class<?> refClass = Class.forName(className);
Constructor<?> ct = refClass.getConstructor(new Class[] { String.class, List.class });
RewriteBaseTest test = (RewriteBaseTest) ct.newInstance(new Object[] { testName, files });
diff --git a/core/org.eclipse.cdt.core.tests/pom.xml b/core/org.eclipse.cdt.core.tests/pom.xml
index 79303b6e09..0cf2a20bbe 100644
--- a/core/org.eclipse.cdt.core.tests/pom.xml
+++ b/core/org.eclipse.cdt.core.tests/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
- <version>9.9.0-SNAPSHOT</version>
+ <version>9.11.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@@ -43,6 +43,7 @@
<useUIHarness>false</useUIHarness>
<!-- Core tests actually use eclipse.ui classes, see CProjectHelper -->
<argLine>${tycho.testArgLine} ${base.ui.test.vmargs} ${extra.vmargs}</argLine>
+ <appArgLine>-pluginCustomization ${basedir}/../../disable_intro_in_tests.ini</appArgLine>
<includes>
<include>**/AutomatedIntegrationSuite.*</include>
</includes>
diff --git a/core/org.eclipse.cdt.core.win32.x86_64/pom.xml b/core/org.eclipse.cdt.core.win32.x86_64/pom.xml
index 0f7f8f1117..cd54180618 100644
--- a/core/org.eclipse.cdt.core.win32.x86_64/pom.xml
+++ b/core/org.eclipse.cdt.core.win32.x86_64/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
- <version>9.9.0-SNAPSHOT</version>
+ <version>9.11.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/core/org.eclipse.cdt.core.win32/pom.xml b/core/org.eclipse.cdt.core.win32/pom.xml
index d652ff912d..c1bf197fb5 100644
--- a/core/org.eclipse.cdt.core.win32/pom.xml
+++ b/core/org.eclipse.cdt.core.win32/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
- <version>9.9.0-SNAPSHOT</version>
+ <version>9.11.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
index dd68713e2c..97d1389faa 100644
--- a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.core; singleton:=true
-Bundle-Version: 6.9.0.qualifier
+Bundle-Version: 6.10.0.qualifier
Bundle-Activator: org.eclipse.cdt.core.CCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java
index 0ea597d048..60dab642d7 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java
@@ -649,8 +649,9 @@ public class ASTTypeUtil {
// requirement of appendStringReference().
if (cachedResult.length() > TYPE_STRING_LENGTH_THRESHOLD) {
appendStringReference(cachedResult, result);
+ } else {
+ result.append(cachedResult);
}
- result.append(cachedResult);
return;
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java
index 68693ca572..be5fcebaa0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java
@@ -87,7 +87,7 @@ public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfigu
}
/**
- * @since 6.9
+ * @since 6.10
*/
@SuppressWarnings("nls")
public GCCScannerExtensionConfiguration(CompilerType compiler, int version) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CStringValue.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CStringValue.java
index 6aa59fb0cf..a8b5ccf245 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CStringValue.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CStringValue.java
@@ -251,6 +251,6 @@ public final class CStringValue implements IValue {
return false;
}
CStringValue o = (CStringValue) other;
- return fFixedValue.equals(o.fFixedValue);
+ return CharArrayUtils.equals(fFixedValue, o.fFixedValue);
}
} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/FloatingPointValue.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/FloatingPointValue.java
index a083786403..cb233077d3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/FloatingPointValue.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/FloatingPointValue.java
@@ -182,6 +182,6 @@ public final class FloatingPointValue implements IValue {
return false;
}
FloatingPointValue o = (FloatingPointValue) other;
- return fFixedValue.equals(o.fFixedValue);
+ return CharArrayUtils.equals(fFixedValue, o.fFixedValue);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/IntegralValue.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/IntegralValue.java
index 1cf9d4f822..4487599727 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/IntegralValue.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/IntegralValue.java
@@ -297,6 +297,6 @@ public class IntegralValue implements IValue {
return false;
}
IntegralValue o = (IntegralValue) other;
- return fFixedValue.equals(o.fFixedValue);
+ return CharArrayUtils.equals(fFixedValue, o.fFixedValue);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java
index 88e1f9afc7..77e2f6da45 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTAlignmentSpecifier;
@@ -1748,7 +1749,9 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
consume();
n = getNodeFactory().newName(t.getCharImage());
setRange(n, t.getOffset(), t.getEndOffset());
- createCompletionNode(t).addName(n);
+ ASTCompletionNode node = createCompletionNode(t);
+ if (node != null)
+ node.addName(n);
return n;
default:
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 ebdf710df1..860cd7d20d 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2016 IBM Corporation and others.
+ * Copyright (c) 2002, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -462,7 +462,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
switch (nt.getType()) {
case IToken.tEOC:
case IToken.tCOMPLETION:
- createCompletionNode(nt).addName(name);
+ ASTCompletionNode node = createCompletionNode(nt);
+ if (node != null)
+ node.addName(name);
break;
}
return name;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
index bcb87fc8d9..02046bca74 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
@@ -231,6 +231,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPReferenceType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPScope;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateNonTypeArgument;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateParameterMap;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateTypeArgument;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPUnknownField;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPUnknownMemberClass;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPUnknownMethod;
@@ -3453,11 +3454,10 @@ public class CPPSemantics {
data.setFunctionArguments(false, createArgForType(exp, charArray));
ret = resolveFunction(data, funcs, true, false);
- //
char[] stringLiteral = exp.getValue(); // The string literal that was passed to the operator
// The string literal is passed to the operator as chars:
- // "literal"_op -> operator "" _op<'l', 'i', 't', 'e', 'r', 'a', 'l'>();
+ // 12345_op -> operator "" _op<'1', '2', '3', '4', '5'>();
ICPPTemplateArgument args[] = new ICPPTemplateArgument[stringLiteral.length];
for (int k = 0; k < stringLiteral.length; k++) {
args[k] = new CPPTemplateNonTypeArgument(
@@ -3492,13 +3492,48 @@ public class CPPSemantics {
* str (i.e., its length excluding the terminating null character).
* L is treated as operator "" X(str, len)
*/
- CPPPointerType strType = new CPPPointerType(
- new CPPBasicType(((CPPASTLiteralExpression) exp).getBasicCharKind(), 0, null), true, false,
- false);
+ IType charType = new CPPBasicType(((CPPASTLiteralExpression) exp).getBasicCharKind(), 0, null);
+ CPPPointerType strType = new CPPPointerType(charType, true, false, false);
IASTInitializerClause[] initializer = new IASTInitializerClause[] { createArgForType(exp, strType),
createArgForType(null, CPPBasicType.UNSIGNED_INT) };
data.setFunctionArguments(false, initializer);
ret = resolveFunction(data, funcs, true, false);
+
+ // GNU extension: allow literal operator templates for string literals.
+ // The implementation follows the proposed spec in
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3599.html.
+ char[] stringLiteral = exp.getValue(); // The string literal that was passed to the operator
+
+ // The operator template is expected to take the character type as its first argument,
+ // followed by the characters as non-type arguments.
+ // "literal"_op -> operator "" _op<char, 'l', 'i', 't', 'e', 'r', 'a', 'l'>();
+ ICPPTemplateArgument args[] = new ICPPTemplateArgument[stringLiteral.length + 1];
+ args[0] = new CPPTemplateTypeArgument(charType);
+ for (int k = 0; k < stringLiteral.length; k++) {
+ args[k + 1] = new CPPTemplateNonTypeArgument(
+ new EvalFixed(CPPBasicType.CHAR, PRVALUE, IntegralValue.create(stringLiteral[k])));
+ }
+
+ data = new LookupData(((CPPASTLiteralExpression) exp).getOperatorName(), args, exp);
+ IBinding litTpl = resolveFunction(data, tplFunctions, true, false);
+
+ // Do we have valid template and non-template bindings?
+ if (ret != null && !(ret instanceof IProblemBinding)) {
+ // Do we have valid template and non-template bindings?
+ if (litTpl instanceof ICPPFunctionInstance) {
+ // Ambiguity? It has two valid options, and the spec says it shouldn't
+ return new ProblemBinding(data.getLookupName(), exp, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP,
+ tplFunctions);
+ }
+ } else {
+ if (litTpl instanceof ICPPFunctionInstance) {
+ // Only the template binding is valid
+ ret = litTpl;
+ } else {
+ // Couldn't find a valid operator
+ return ret;
+ }
+ }
} else if (kind == IASTLiteralExpression.lk_char_constant) {
/*
* 2.14.8.6
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
index 37f1353c85..11cc4769f9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
@@ -1733,7 +1733,7 @@ public class CPPVisitor extends ASTQueries {
return areEquivalentBindings(candidate, target, index);
}
- private static boolean areEquivalentBindings(IBinding binding1, IBinding binding2, IIndex index) {
+ public static boolean areEquivalentBindings(IBinding binding1, IBinding binding2, IIndex index) {
if (binding1.equals(binding2)) {
return true;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeInstantiationRequest.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeInstantiationRequest.java
index e667de7196..96d652981f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeInstantiationRequest.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeInstantiationRequest.java
@@ -80,7 +80,7 @@ public class TypeInstantiationRequest {
return true;
if (type1 == null || type2 == null)
return false;
- return type1.isSameType(type1);
+ return type1.isSameType(type2);
}
private boolean equals(ICPPTemplateParameterMap map1, ICPPTemplateParameterMap map2) {
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
index 3ac5234545..00635d77df 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
@@ -34,8 +34,6 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IConsoleParser;
@@ -67,6 +65,7 @@ import org.eclipse.cdt.internal.core.build.Messages;
import org.eclipse.cdt.internal.core.model.BinaryRunner;
import org.eclipse.cdt.internal.core.model.CModelManager;
import org.eclipse.cdt.internal.core.parser.ParserSettings2;
+import org.eclipse.cdt.utils.CommandLineUtil;
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.IBuildConfiguration;
import org.eclipse.core.resources.IContainer;
@@ -840,50 +839,8 @@ public abstract class CBuildConfiguration extends PlatformObject implements ICBu
* @return List of arg Strings
*/
private List<String> stripArgs(String argString) {
- Pattern p0 = Pattern.compile("('(.*?)').*"); //$NON-NLS-1$
- Pattern p1 = Pattern.compile("([\\-](\\w|[\\-])+[=]\\\".*?\\\").*"); //$NON-NLS-1$
- Pattern p2 = Pattern.compile("([\\-](\\w|[\\-])+[=]'.*?').*"); //$NON-NLS-1$
- Pattern p3 = Pattern.compile("([\\-](\\w|[\\-])+[=][^\\s]+).*"); //$NON-NLS-1$
- Pattern p4 = Pattern.compile("([^\\s]+).*"); //$NON-NLS-1$
- boolean finished = false;
- List<String> args = new ArrayList<>();
- while (!finished) {
- Matcher m0 = p0.matcher(argString);
- if (m0.matches()) {
- argString = argString.replaceFirst("'.*?'", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$
- String s = m0.group(2).trim(); // strip single quotes
- args.add(s);
- } else {
- Matcher m1 = p1.matcher(argString);
- if (m1.matches()) {
- argString = argString.replaceFirst("[\\-](\\w|[\\-])+[=]\\\".*?\\\"", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$
- String s = m1.group(1).trim();
- args.add(s);
- } else {
- Matcher m2 = p2.matcher(argString);
- if (m2.matches()) {
- argString = argString.replaceFirst("[\\-](\\w|[\\-])+[=]'.*?'", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$
- String s = m2.group(1).trim();
- args.add(s);
- } else {
- Matcher m3 = p3.matcher(argString);
- if (m3.matches()) {
- argString = argString.replaceFirst("[\\-](\\w|[\\-])+[=][^\\s]+", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$
- args.add(m3.group(1).trim());
- } else {
- Matcher m4 = p4.matcher(argString);
- if (m4.matches()) {
- argString = argString.replaceFirst("[^\\s]+", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$
- args.add(m4.group(1).trim());
- } else {
- finished = true;
- }
- }
- }
- }
- }
- }
- return args;
+ String[] args = CommandLineUtil.argumentsToArrayUnixStyle(argString);
+ return new ArrayList<>(Arrays.asList(args));
}
private boolean infoChanged = false;
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java
index 05c2f61d5b..2506888c15 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java
@@ -2483,8 +2483,10 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
*/
private void formatList(List<?> elements, ListOptions options, boolean encloseInParen, boolean addEllipsis,
Runnable tailFormatter, Runnable prefix) {
- if (encloseInParen)
- scribe.printNextToken(options.leftToken, options.fSpaceBeforeOpeningParen);
+ if (encloseInParen) {
+ if (peekNextToken() == options.leftToken)
+ scribe.printNextToken(options.leftToken, options.fSpaceBeforeOpeningParen);
+ }
final int elementsLength = elements.size();
if (encloseInParen) {
diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/ElfParser.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/ElfParser.java
index 413295e5b3..0bcdb51465 100644
--- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/ElfParser.java
+++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/ElfParser.java
@@ -190,10 +190,19 @@ public class ElfParser extends AbstractCExtension implements IBinaryParser {
try {
/* No PHdr.PT_INTERP found in the hints meaning we need to read the file itself */
- return Arrays.stream(new Elf(path.toOSString()).getPHdrs()).anyMatch(phdr -> phdr.p_type == PHdr.PT_INTERP);
+ return Arrays.stream(getPHdrs(path)).anyMatch(phdr -> phdr.p_type == PHdr.PT_INTERP);
} catch (IOException e) {
CCorePlugin.log(e);
}
return false;
}
+
+ private static PHdr[] getPHdrs(IPath path) throws IOException {
+ Elf elf = new Elf(path.toOSString());
+ try {
+ return elf.getPHdrs();
+ } finally {
+ elf.dispose();
+ }
+ }
}
diff --git a/core/org.eclipse.cdt.ui.tests/pom.xml b/core/org.eclipse.cdt.ui.tests/pom.xml
index 8911f21273..017485f793 100644
--- a/core/org.eclipse.cdt.ui.tests/pom.xml
+++ b/core/org.eclipse.cdt.ui.tests/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
- <version>9.9.0-SNAPSHOT</version>
+ <version>9.11.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@@ -65,6 +65,7 @@
<useUIHarness>true</useUIHarness>
<useUIThread>true</useUIThread>
<argLine>${tycho.testArgLine} ${base.ui.test.vmargs} ${extra.vmargs.indexer.timeout} ${extra.vmargs.displayhelper.timeoutmultipler}</argLine>
+ <appArgLine>-pluginCustomization ${basedir}/../../disable_intro_in_tests.ini</appArgLine>
<includes>
<include>**/AutomatedSuite.*</include>
</includes>
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java
index f7f52b193a..c112ca61d8 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java
@@ -4699,4 +4699,13 @@ public class CodeFormatterTest extends BaseUITestCase {
public void testStructuredBindingInSwitchInitStatement() throws Exception {
assertFormatterResult();
}
+
+ //#define PROTO(X) X
+ //void foo PROTO((char* b));
+
+ //#define PROTO(X) X
+ //void foo PROTO((char* b));
+ public void testMacroInFunctionParameters_Bug550096() throws Exception {
+ assertFormatterResult();
+ }
}
diff --git a/core/org.eclipse.cdt.ui/.settings/.api_filters b/core/org.eclipse.cdt.ui/.settings/.api_filters
new file mode 100644
index 0000000000..736a9f302c
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/.settings/.api_filters
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.cdt.ui" version="2">
+ <resource path="META-INF/MANIFEST.MF" type="org.eclipse.cdt.ui.actions.DeleteResConfigsAction">
+ <filter comment="DeleteResConfigsAction has been deprecated since CDT 8.0" id="305324134">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.ui.actions.DeleteResConfigsAction"/>
+ <message_argument value="org.eclipse.cdt.ui_6.6.100"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="META-INF/MANIFEST.MF" type="org.eclipse.cdt.ui.actions.ExcludeFromBuildAction">
+ <filter comment="ExcludeFromBuildAction has been deprecated since CDT 8.0" id="305324134">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.ui.actions.ExcludeFromBuildAction"/>
+ <message_argument value="org.eclipse.cdt.ui_6.6.100"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF
index 892f88f210..222c320ff9 100644
--- a/core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.ui; singleton:=true
-Bundle-Version: 6.6.0.qualifier
+Bundle-Version: 6.6.200.qualifier
Bundle-Activator: org.eclipse.cdt.ui.CUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CommentsTabPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CommentsTabPage.java
index 92960a4e20..c6af215050 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CommentsTabPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CommentsTabPage.java
@@ -99,8 +99,7 @@ public class CommentsTabPage extends FormatterTabPage {
// createPrefFalseTrue(globalGroup, numColumns, FormatterMessages.CommentsTabPage_do_not_join_lines, DefaultCodeFormatterConstants.FORMATTER_JOIN_LINES_IN_COMMENTS, true);
// Line comment group
- final Group commentGroup = createGroup(numColumns, composite,
- FormatterMessages.CommentsTabPage_group1_title);
+ final Group commentGroup = createGroup(numColumns, composite, FormatterMessages.CommentsTabPage_group1_title);
// final CheckboxPreference singleLineCommentsOnFirstColumn= createPrefFalseTrue(lineCommentGroup, numColumns, FormatterMessages.CommentsTabPage_format_line_comments_on_first_column, DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_LINE_COMMENT_STARTING_ON_FIRST_COLUMN, false);
// ((GridData) singleLineCommentsOnFirstColumn.getControl().getLayoutData()).horizontalIndent= indent;
createPrefFalseTrue(commentGroup, numColumns, FormatterMessages.CommentsTabPage_block_comment,
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/DeleteResConfigsAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/DeleteResConfigsAction.java
deleted file mode 100644
index 1de2e3cfdf..0000000000
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/DeleteResConfigsAction.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2011 Intel Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Intel Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.ui.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.ICContainer;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.core.settings.model.ICProjectDescription;
-import org.eclipse.cdt.core.settings.model.ICResourceDescription;
-import org.eclipse.cdt.internal.ui.actions.ActionMessages;
-import org.eclipse.cdt.internal.ui.actions.DeleteResConfigsHandler;
-import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.cdt.ui.newui.AbstractPage;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
-import org.eclipse.ui.dialogs.ListSelectionDialog;
-
-/**
- * Action which deletes resource description. (If resource description is missing
- * one from parent is normally used)
- * @deprecated as of CDT 8.0 now using {@link DeleteResConfigsHandler}
- */
-@Deprecated
-public class DeleteResConfigsAction implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
-
- protected ArrayList<IResource> objects = null;
- private ArrayList<ResCfgData> outData = null;
-
- @Override
- public void selectionChanged(IAction action, ISelection selection) {
- objects = null;
- outData = null;
-
- if (!selection.isEmpty()) {
- // case for context menu
- if (selection instanceof IStructuredSelection) {
- Object[] obs = ((IStructuredSelection) selection).toArray();
- if (obs.length > 0) {
- for (int i = 0; i < obs.length; i++) {
- IResource res = null;
- // only folders and files may be affected by this action
- if (obs[i] instanceof ICContainer || obs[i] instanceof ITranslationUnit)
- res = ((ICElement) obs[i]).getResource();
- // project's configuration cannot be deleted
- else if (obs[i] instanceof IResource && !(obs[i] instanceof IProject))
- res = (IResource) obs[i];
- if (res != null) {
- IProject p = res.getProject();
- if (!p.isOpen())
- continue;
-
- if (!CoreModel.getDefault().isNewStyleProject(p))
- continue;
-
- IPath path = res.getProjectRelativePath();
- // getting description in read-only mode
- ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(p, false);
- if (prjd == null)
- continue;
- ICConfigurationDescription[] cfgds = prjd.getConfigurations();
- if (cfgds == null || cfgds.length == 0)
- continue;
- for (ICConfigurationDescription cfgd : cfgds) {
- ICResourceDescription rd = cfgd.getResourceDescription(path, true);
- if (rd != null) {
- if (objects == null)
- objects = new ArrayList<>();
- objects.add(res);
- break; // stop configurations scanning
- }
- }
- }
- }
- }
- }
- }
- action.setEnabled(objects != null);
- }
-
- @Override
- public void run(IAction action) {
- openDialog();
- }
-
- private void openDialog() {
- if (objects == null || objects.size() == 0)
- return;
- // create list of configurations to delete
-
- ListSelectionDialog dialog = new ListSelectionDialog(CUIPlugin.getActiveWorkbenchShell(), objects,
- createSelectionDialogContentProvider(), new LabelProvider() {
- }, ActionMessages.DeleteResConfigsAction_0);
- dialog.setTitle(ActionMessages.DeleteResConfigsAction_1);
- if (dialog.open() == Window.OK) {
- Object[] selected = dialog.getResult();
- if (selected != null && selected.length > 0) {
- for (Object element : selected) {
- ((ResCfgData) element).delete();
- AbstractPage.updateViews(((ResCfgData) element).res);
- }
- }
- }
- }
-
- // Stores data for resource description with its "parents".
- class ResCfgData {
- IResource res;
- ICProjectDescription prjd;
- ICConfigurationDescription cfgd;
- ICResourceDescription rdesc;
-
- public ResCfgData(IResource res2, ICProjectDescription prjd2, ICConfigurationDescription cfgd2,
- ICResourceDescription rdesc2) {
- res = res2;
- prjd = prjd2;
- cfgd = cfgd2;
- rdesc = rdesc2;
- }
-
- // performs deletion
- public void delete() {
- try {
- cfgd.removeResourceDescription(rdesc);
- CoreModel.getDefault().setProjectDescription(res.getProject(), prjd);
- } catch (CoreException e) {
- }
- }
-
- @Override
- public String toString() {
- return "[" + cfgd.getName() + "] for " + res.getName(); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- private IStructuredContentProvider createSelectionDialogContentProvider() {
- return new IStructuredContentProvider() {
-
- @Override
- public Object[] getElements(Object inputElement) {
- if (outData != null)
- return outData.toArray();
-
- outData = new ArrayList<>();
- List<?> ls = (List<?>) inputElement;
- Iterator<?> it = ls.iterator();
- IProject proj = null;
- ICProjectDescription prjd = null;
- ICConfigurationDescription[] cfgds = null;
-
- // creating list of all res descs for all objects
- while (it.hasNext()) {
- IResource res = (IResource) it.next();
- IPath path = res.getProjectRelativePath();
- if (res.getProject() != proj) {
- proj = res.getProject();
- prjd = CoreModel.getDefault().getProjectDescription(proj);
- cfgds = prjd.getConfigurations();
- }
- if (cfgds != null) {
- for (ICConfigurationDescription cfgd : cfgds) {
- ICResourceDescription rd = cfgd.getResourceDescription(path, true);
- if (rd != null)
- outData.add(new ResCfgData(res, prjd, cfgd, rd));
- }
- }
- }
- return outData.toArray();
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- };
- }
-
- @Override
- public void dispose() {
- objects = null;
- }
-
- // doing nothing
- @Override
- public void init(IWorkbenchWindow window) {
- }
-
- @Override
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- @Override
- public Menu getMenu(Control parent) {
- return null;
- }
-
- @Override
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- }
-
-}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ExcludeFromBuildAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ExcludeFromBuildAction.java
deleted file mode 100644
index 71ba1b511a..0000000000
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ExcludeFromBuildAction.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2011 Intel Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Intel Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.ui.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.ICContainer;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.core.settings.model.ICProjectDescription;
-import org.eclipse.cdt.core.settings.model.ICSourceEntry;
-import org.eclipse.cdt.core.settings.model.util.CDataUtil;
-import org.eclipse.cdt.internal.ui.actions.ActionMessages;
-import org.eclipse.cdt.internal.ui.actions.ExcludeFromBuildHandler;
-import org.eclipse.cdt.internal.ui.newui.Messages;
-import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.cdt.ui.newui.AbstractPage;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
-import org.eclipse.ui.dialogs.ListSelectionDialog;
-
-/**
- * Action which excludes resources from build.
- * @deprecated as of CDT 8.0 now using {@link ExcludeFromBuildHandler}
- */
-@Deprecated
-public class ExcludeFromBuildAction implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
-
- protected ArrayList<IResource> objects = null;
- protected ArrayList<String> cfgNames = null;
-
- @Override
- public void selectionChanged(IAction action, ISelection selection) {
- objects = null;
- cfgNames = null;
- boolean cfgsOK = true;
-
- if (!selection.isEmpty()) {
- // case for context menu
- if (selection instanceof IStructuredSelection) {
- Object[] obs = ((IStructuredSelection) selection).toArray();
- if (obs.length > 0) {
- for (int i = 0; i < obs.length && cfgsOK; i++) {
- // if project selected, don't do anything
- if ((obs[i] instanceof IProject) || (obs[i] instanceof ICProject)) {
- cfgsOK = false;
- break;
- }
- IResource res = null;
- // only folders and files may be affected by this action
- if (obs[i] instanceof ICContainer || obs[i] instanceof ITranslationUnit) {
- res = ((ICElement) obs[i]).getResource();
- } else if (obs[i] instanceof IResource) {
- // project's configuration cannot be deleted
- res = (IResource) obs[i];
- }
- if (res != null) {
- ICConfigurationDescription[] cfgds = getCfgsRead(res);
- if (cfgds == null || cfgds.length == 0)
- continue;
-
- if (objects == null)
- objects = new ArrayList<>();
- objects.add(res);
- if (cfgNames == null) {
- cfgNames = new ArrayList<>(cfgds.length);
- for (int j = 0; j < cfgds.length; j++) {
- if (!canExclude(res, cfgds[j])) {
- cfgNames = null;
- cfgsOK = false;
- break;
- }
- cfgNames.add(cfgds[j].getName());
- }
- } else {
- if (cfgNames.size() != cfgds.length) {
- cfgsOK = false;
- } else {
- for (int j = 0; j < cfgds.length; j++) {
- if (!canExclude(res, cfgds[j]) || !cfgNames.contains(cfgds[j].getName())) {
- cfgsOK = false;
- break;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- action.setEnabled(cfgsOK && objects != null);
- }
-
- private boolean canExclude(IResource res, ICConfigurationDescription cfg) {
- IPath p = res.getFullPath();
- ICSourceEntry[] ent = cfg.getSourceEntries();
- boolean state = CDataUtil.isExcluded(p, ent);
- return CDataUtil.canExclude(p, (res instanceof IFolder), !state, ent);
- }
-
- private void setExclude(IResource res, ICConfigurationDescription cfg, boolean exclude) {
- try {
- ICSourceEntry[] newEntries = CDataUtil.setExcluded(res.getFullPath(), (res instanceof IFolder), exclude,
- cfg.getSourceEntries());
- cfg.setSourceEntries(newEntries);
- } catch (CoreException e) {
- CUIPlugin.log(e);
- }
- }
-
- @Override
- public void run(IAction action) {
- openDialog();
- }
-
- private ICConfigurationDescription[] getCfgsRead(IResource res) {
- IProject p = res.getProject();
- if (!p.isOpen())
- return null;
- if (!CoreModel.getDefault().isNewStyleProject(p))
- return null;
- ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(p, false);
- if (prjd == null)
- return null;
- return prjd.getConfigurations();
- }
-
- private void openDialog() {
- if (objects == null || objects.size() == 0)
- return;
- // create list of configurations to delete
-
- ListSelectionDialog dialog = new ListSelectionDialog(CUIPlugin.getActiveWorkbenchShell(), cfgNames,
- createSelectionDialogContentProvider(), new LabelProvider() {
- }, ActionMessages.ExcludeFromBuildAction_0);
- dialog.setTitle(ActionMessages.ExcludeFromBuildAction_1);
-
- boolean[] status = new boolean[cfgNames.size()];
- Iterator<IResource> it = objects.iterator();
- while (it.hasNext()) {
- IResource res = it.next();
- ICConfigurationDescription[] cfgds = getCfgsRead(res);
- IPath p = res.getFullPath();
- for (int i = 0; i < cfgds.length; i++) {
- boolean b = CDataUtil.isExcluded(p, cfgds[i].getSourceEntries());
- if (b)
- status[i] = true;
- }
- }
- ArrayList<String> lst = new ArrayList<>();
- for (int i = 0; i < status.length; i++)
- if (status[i])
- lst.add(cfgNames.get(i));
- if (lst.size() > 0)
- dialog.setInitialElementSelections(lst);
-
- if (dialog.open() == Window.OK) {
- Object[] selected = dialog.getResult(); // may be empty
- Iterator<IResource> it2 = objects.iterator();
- while (it2.hasNext()) {
- IResource res = it2.next();
- IProject p = res.getProject();
- if (!p.isOpen())
- continue;
- // get writable description
- ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(p, true);
- if (prjd == null)
- continue;
- ICConfigurationDescription[] cfgds = prjd.getConfigurations();
- for (int i = 0; i < cfgds.length; i++) {
- boolean exclude = false;
- for (int j = 0; j < selected.length; j++) {
- if (cfgds[i].getName().equals(selected[j])) {
- exclude = true;
- break;
- }
- }
- setExclude(res, cfgds[i], exclude);
- }
- try {
- CoreModel.getDefault().setProjectDescription(p, prjd);
- } catch (CoreException e) {
- CUIPlugin.logError(Messages.AbstractPage_11 + e.getLocalizedMessage());
- }
- AbstractPage.updateViews(res);
- }
- }
- }
-
- private IStructuredContentProvider createSelectionDialogContentProvider() {
- return new IStructuredContentProvider() {
- @Override
- public Object[] getElements(Object inputElement) {
- return cfgNames.toArray();
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- };
- }
-
- @Override
- public void dispose() {
- objects = null;
- }
-
- // doing nothing
- @Override
- public void init(IWorkbenchWindow window) {
- }
-
- @Override
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- @Override
- public Menu getMenu(Control parent) {
- return null;
- }
-
- @Override
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- }
-}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/build/ToolChainPreferencePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/build/ToolChainPreferencePage.java
index dd465d3e4a..4920592f39 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/build/ToolChainPreferencePage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/build/ToolChainPreferencePage.java
@@ -11,6 +11,7 @@
package org.eclipse.cdt.ui.build;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import org.eclipse.cdt.core.build.IToolChain;
@@ -314,8 +315,24 @@ public class ToolChainPreferencePage extends PreferencePage implements IWorkbenc
}
try {
- if (!toolChains.equals(manager.getAllToolChains())) {
- manager.setToolChainOrder(toolChains);
+ Collection<IToolChain> latestToolchains = manager.getAllToolChains();
+ if (!toolChains.equals(latestToolchains)) {
+
+ List<IToolChain> newOrderedList = new ArrayList<>();
+ for (IToolChain toolChain : toolChains) {
+ if (latestToolchains.contains(toolChain)) { //Still there? - for example: existing user defined tool chain would have been removed
+ newOrderedList.add(toolChain);
+ }
+ }
+
+ //add the remaining list at the end - for example: newly added user defined tool chains
+ for (IToolChain toolChain : latestToolchains) {
+ if (!newOrderedList.contains(toolChain)) {
+ newOrderedList.add(toolChain);
+ }
+ }
+
+ manager.setToolChainOrder(newOrderedList);
}
} catch (CoreException e) {
CUIPlugin.log(e.getStatus());
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java
index 7d04e8e287..8de06a776f 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java
@@ -567,7 +567,7 @@ public abstract class AbstractPage extends PropertyPage implements IPreferencePa
* which do not share ICProjectDescription instance.
* But some changes may be saved wrong if they are affected
* by data from another property pages (Discovery options etc).
-
+
* To enable 2nd mode, just create the following file:
* <workspace>/.metadata/.plugins/org.eclipse.cdt.ui/apply_mode
*/
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java
index ecb71b4fe9..223c259230 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java
@@ -258,7 +258,7 @@ public abstract class CDTCommonProjectWizard extends BasicNewResourceWizard
new SubProgressMonitor(fMonitor, 40));
fMonitor.worked(10);
} catch (CoreException e) {
- CUIPlugin.log(e);
+ CUIPlugin.errorDialog(getShell(), title, message, e, true);
} finally {
fMonitor.done();
}
diff --git a/core/pom.xml b/core/pom.xml
index ea2fd52487..f8e3c166c7 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
- <version>9.9.0-SNAPSHOT</version>
+ <version>9.11.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.cdt-parent</artifactId>

Back to the top