Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml64
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ResourceBuildCoreTests.java138
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java34
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AssignmentOperatorChecker.java2
-rw-r--r--codan/org.eclipse.cdt.codan.core.tests/src/org/eclipse/cdt/codan/core/internal/checkers/AssignmentOperatorCheckerTest.java16
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java2
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/IntegralValueTests.java66
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/TestBase.java1
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCBuiltinSymbolProvider.java42
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java98
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecBuiltin.java120
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyRulerColumn.java51
-rw-r--r--jsoncdb/org.eclipse.cdt.jsoncdb.core/plugin.properties3
-rw-r--r--jsoncdb/org.eclipse.cdt.jsoncdb.core/plugin.xml7
-rw-r--r--jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/internal/builtins/CompilerBuiltinsDetector.java31
-rw-r--r--jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/internal/builtins/Messages.java1
-rw-r--r--jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/internal/builtins/messages.properties1
-rw-r--r--pom.xml2
-rw-r--r--releng/org.eclipse.cdt.target/cdt.target12
-rw-r--r--remote/org.eclipse.remote.ui/META-INF/MANIFEST.MF3
20 files changed, 604 insertions, 90 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml b/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml
index a16c798d21c..4611ce2a8d0 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml
@@ -9779,5 +9779,69 @@
</configuration>
</projectType>
</extension>
+ <extension
+ point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
+ <tool
+ id="bug580009.tests.tool"
+ isAbstract="true"
+ isSystem="true"
+ outputs="o"
+ sources="c">
+ <option
+ category="bug580009.tests.tool.optionsCategory"
+ defaultValue="UNSET"
+ id="bug580009.tests.option.string"
+ isAbstract="false"
+ name="Test"
+ resourceFilter="all"
+ value="UNSET"
+ valueType="string">
+ </option>
+ <optionCategory
+ id="bug580009.tests.tool.optionsCategory"
+ name="name1">
+ </optionCategory>
+ </tool>
+ <projectType
+ id="bug580009.tests.ptype"
+ isAbstract="false"
+ isTest="true">
+ <configuration
+ id="bug580009.tests.cfg1"
+ name="cfg1">
+ <toolChain
+ id="bug580009.tests.cfg1.tc2"
+ isAbstract="false"
+ isSystem="false"
+ superClass="bug580009.tests.cfg1.tc">
+ </toolChain>
+ </configuration>
+ </projectType>
+ <toolChain
+ id="bug580009.tests.cfg1.tc"
+ isAbstract="true"
+ isSystem="true">
+ <tool
+ id="bug580009.tests.cfg1.tc.tool"
+ isAbstract="false"
+ superClass="bug580009.tests.tool">
+ </tool>
+ <builder
+ id="bug580009.tests.cfg1.tc.builder"
+ isAbstract="false"
+ isVariableCaseSensitive="false">
+ </builder>
+ <option
+ category="bug580009.tests.cfg1.tc.optionCategory1"
+ id="bug580009.tests.cfg1.tc.option.string"
+ isAbstract="false"
+ valueType="boolean">
+ </option>
+ <optionCategory
+ id="bug580009.tests.cfg1.tc.optionCategory1"
+ name="name">
+ </optionCategory>
+ </toolChain>
+ </extension>
</plugin>
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ResourceBuildCoreTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ResourceBuildCoreTests.java
index 5adb0f5c1ed..5124f00b814 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ResourceBuildCoreTests.java
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ResourceBuildCoreTests.java
@@ -25,10 +25,12 @@ import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
+import org.eclipse.cdt.managedbuilder.internal.core.ResourceInfo;
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
import org.eclipse.core.resources.IFile;
@@ -45,6 +47,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.junit.Assert;
import junit.framework.Test;
import junit.framework.TestCase;
@@ -68,6 +71,7 @@ public class ResourceBuildCoreTests extends TestCase {
TestSuite suite = new TestSuite(ResourceBuildCoreTests.class.getName());
suite.addTest(new ResourceBuildCoreTests("testResourceConfigurations"));
suite.addTest(new ResourceBuildCoreTests("testResourceConfigurationReset"));
+ suite.addTest(new ResourceBuildCoreTests("testResourceConfiguration_Bug580009"));
// suite.addTest(new ResourceBuildCoreTests("testResourceConfigurationBuildInfo"));
// suite.addTest(new ResourceBuildCoreTests("testResourceRename"));
return suite;
@@ -969,4 +973,138 @@ public class ResourceBuildCoreTests extends TestCase {
removeProject(renamedProjectName2);
}
+ protected IResourceInfo getResourceConfiguration(final IConfiguration config, final IResource resource) {
+
+ IResourceInfo resInfo = config.getResourceInfo(resource.getProjectRelativePath(), true); // 'true' to ensure exact path
+ if (resInfo == null) {
+ // Resource element for path may not yet exist, force-create it
+ resInfo = config.createFolderInfo(resource.getProjectRelativePath());
+ }
+ return resInfo;
+ }
+
+ /**
+ * Test that a folder level resource configuration correctly reloads from disk
+ * @throws Exception
+ */
+ public void testResourceConfiguration_Bug580009() throws Exception {
+
+ // Create a new project
+ IProject project = null;
+
+ try {
+ project = createProject(projectName);
+
+ // Now associate the builder with the project
+ ManagedBuildTestHelper.addManagedBuildNature(project);
+ IProjectDescription description = project.getDescription();
+ // Make sure it has a managed nature
+ if (description != null) {
+ assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
+ }
+
+ } catch (CoreException e) {
+ fail("Test failed on project creation: " + e.getLocalizedMessage());
+ }
+
+ // Find the base project type definition
+ IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes();
+ IProjectType projType = ManagedBuildManager.getProjectType("bug580009.tests.ptype");
+ assertNotNull(projType);
+
+ // Create the managed-project for our project
+ IManagedProject newProject = ManagedBuildManager.createManagedProject(project, projType);
+ assertEquals(newProject.getName(), projType.getName());
+ assertFalse(newProject.equals(projType));
+ ManagedBuildManager.setNewProjectVersion(project);
+
+ // Create a folder ('hello')
+ IFolder helloFolder = project.getProject().getFolder("hello");
+ if (!helloFolder.exists()) {
+ helloFolder.create(true, true, null);
+ }
+
+ // Get the configurations and make one of them as default configuration.
+ IConfiguration defaultConfig = null;
+ IConfiguration[] configs = projType.getConfigurations();
+ for (int i = 0; i < configs.length; ++i) {
+ // Make the first configuration the default
+ if (i == 0) {
+ defaultConfig = newProject.createConfiguration(configs[i], projType.getId() + "." + i);
+ } else {
+ newProject.createConfiguration(configs[i], projType.getId() + "." + i);
+ }
+ }
+ ManagedBuildManager.setDefaultConfiguration(project, defaultConfig);
+
+ //Set toolchain level option
+ IOption tcOption = defaultConfig.getToolChain().getOptionById("bug580009.tests.cfg1.tc.option.string");
+ ManagedBuildManager.setOption(defaultConfig, defaultConfig.getToolChain(), tcOption, true);
+ ManagedBuildManager.saveBuildInfo(project, true);
+ // Create Resource Configurations for hello.c
+ var resConfig = getResourceConfiguration(defaultConfig, helloFolder);
+
+ // Get the tools associated with the resource 'hello'.
+ ITool[] resTools = resConfig.getTools();
+ assertNotNull(resTools);
+ assertEquals(1, resTools.length);
+
+ // Get the build properties for the resource hello
+ ITool resTool = resTools[0];
+ String defaultResToolFlags = resTool.getToolFlags();
+
+ // Get the Test Option.
+ IOption resDebugOption = resTool.getOptionById("bug580009.tests.option.string");
+
+ // Get the default value of debug option for resource.
+ String defaultResDebugOptVal = resDebugOption.getStringValue();
+
+ // Now, override the value with "bug580009.tests.option.string"
+ IOption newResDebugOption = ManagedBuildManager.setOption(resConfig, resTool, resDebugOption, "SET");
+
+ // Get the overridden value of test option.
+ String newResDebugOptVal = newResDebugOption.getStringValue();
+ String newResToolFlags = resTool.getToolFlags();
+
+ // Make sure, default and overridden values are different.
+ assertNotSame(defaultResDebugOptVal, newResDebugOptVal);
+
+ //Check the config reports custom settings
+ Assert.assertTrue("hasCustomSettings should be true", ((ResourceInfo) resConfig).hasCustomSettings());
+
+ ManagedBuildManager.saveBuildInfo(project, true);
+
+ //Close project
+ project.close(null);
+ project.open(null);
+
+ //Reload configs
+ defaultConfig = ManagedBuildManager.getBuildInfo(project).getDefaultConfiguration();
+ var resInfo = defaultConfig.getResourceInfo(helloFolder.getProjectRelativePath(), true);
+
+ //Check the config still reports custom settings (sanity check)
+ Assert.assertTrue("hasCustomSettings should be true", ((ResourceInfo) resInfo).hasCustomSettings());
+
+ resTools = resInfo.getTools();
+ resTool = resTools[0];
+ resDebugOption = resTool.getOptionBySuperClassId("bug580009.tests.option.string");
+
+ // Set back to default value
+ IOption newResDebugOption2 = ManagedBuildManager.setOption(resInfo, resTool, resDebugOption, "UNSET");
+
+ //Check the config now reports no custom settings
+ Assert.assertFalse("hasCustomSettings should be false", ((ResourceInfo) resInfo).hasCustomSettings());
+
+ ManagedBuildManager.saveBuildInfo(project, true);
+
+ //Check the resource config no longer exists
+ resInfo = defaultConfig.getResourceInfo(helloFolder.getProjectRelativePath(), true);
+ Assert.assertNull("resInfo should be null", resInfo);
+
+ // Close and remove project.
+ ResourceHelper.joinIndexerBeforeCleanup(getName());
+ project.close(null);
+ removeProject(projectName);
+ }
+
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
index 74a02ce33ff..393df9fe958 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
@@ -17,6 +17,7 @@
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -29,6 +30,7 @@ import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IBuildPropertiesRestriction;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
@@ -511,7 +513,37 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
if (superClassId != null && superClassId.length() > 0) {
superClass = ManagedBuildManager.getExtensionOption(superClassId);
if (superClass == null) {
- // TODO: Report error
+ /*
+ * This can happen when options are set at the resource level, for a project using a toolchain definition
+ * where there are options at the toolchain level & one or more of those options is set at a
+ * non-default value.
+ *
+ * In these cases the superclass is set to the option from the parent not the extension's ID
+ * Workaround this by searching for any missing superclass IDs at on the parent configs toolchain
+ *
+ * See the "bug580009.tests.cfg1.tc" definition in org.eclipse.cdt.managedbuilder.core.tests for an example
+ */
+ IBuildObject parent = this.getParent();
+ if (parent instanceof IToolChain) {
+ IConfiguration config = ((IToolChain) parent).getParent();
+ IOption foundOption = null;
+ //In rare cases the RootFolderInfo may not have loaded & will cause an NPE
+ if (config != null && config.getRootFolderInfo() != null) {
+ IToolChain parentToolchain = config.getToolChain();
+ if (parentToolchain != null) {
+ foundOption = parentToolchain.getOptionById(superClassId);
+ }
+ }
+ if (foundOption != null) {
+ superClass = foundOption;
+ } else {
+ ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID,
+ MessageFormat.format("Missing superclass \"{0}\" for \"{1}\"", superClassId, getId()))); //$NON-NLS-1$
+ }
+ } else {
+ ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID,
+ MessageFormat.format("Missing superclass \"{0}\" for \"{1}\"", superClassId, getId()))); //$NON-NLS-1$
+ }
}
}
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AssignmentOperatorChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AssignmentOperatorChecker.java
index c3196b940fe..167b6dd0bfd 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AssignmentOperatorChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AssignmentOperatorChecker.java
@@ -112,7 +112,7 @@ public class AssignmentOperatorChecker extends AbstractIndexAstChecker {
reportProblem(MISS_SELF_CHECK_ID, info.decl);
}
info.decl = null;
- } else {
+ } else if (expression.getPropertyInParent() != ICPPASTFunctionDeclarator.NOEXCEPT_EXPRESSION) {
reportProblem(MISS_SELF_CHECK_ID, info.decl);
info.decl = null;
}
diff --git a/codan/org.eclipse.cdt.codan.core.tests/src/org/eclipse/cdt/codan/core/internal/checkers/AssignmentOperatorCheckerTest.java b/codan/org.eclipse.cdt.codan.core.tests/src/org/eclipse/cdt/codan/core/internal/checkers/AssignmentOperatorCheckerTest.java
index 3d687bd8c8c..1185530036a 100644
--- a/codan/org.eclipse.cdt.codan.core.tests/src/org/eclipse/cdt/codan/core/internal/checkers/AssignmentOperatorCheckerTest.java
+++ b/codan/org.eclipse.cdt.codan.core.tests/src/org/eclipse/cdt/codan/core/internal/checkers/AssignmentOperatorCheckerTest.java
@@ -49,6 +49,22 @@ public class AssignmentOperatorCheckerTest extends CheckerTestCase {
//class Foo {
//public:
+ //Foo& operator=(Foo& f) noexcept (false);
+ //};
+ //Foo& Foo::operator=(Foo& f) noexcept (false) {
+ // if (this != &f) {
+ // return *this;
+ // }
+ // return *this;
+ //}
+ public void testWithNoErrorNoexcept() throws Exception {
+ loadCodeAndRun(getAboveComment());
+ checkNoErrorsOfKind(MISS_REF_ID);
+ checkNoErrorsOfKind(MISS_SELF_ID);
+ }
+
+ //class Foo {
+ //public:
//Foo operator=(const Foo& f);
//};
//Foo Foo::operator=(const Foo& f) {
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java
index ee0d36b4f8b..755bf7bafea 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java
@@ -113,6 +113,7 @@ public class AST2TestBase extends SemanticTestBase {
map.put("__SIZEOF_SHORT__", "2");
map.put("__SIZEOF_INT__", "4");
map.put("__SIZEOF_LONG__", "8");
+ map.put("__SIZEOF_LONG_LONG__", "8");
map.put("__SIZEOF_DOUBLE__", "8");
map.put("__SIZEOF_POINTER__", "8");
return map;
@@ -123,6 +124,7 @@ public class AST2TestBase extends SemanticTestBase {
map.put("__SIZEOF_SHORT__", "2");
map.put("__SIZEOF_INT__", "4");
map.put("__SIZEOF_LONG__", "8");
+ map.put("__SIZEOF_LONG_LONG__", "8");
map.put("__SIZEOF_DOUBLE__", "8");
map.put("__SIZEOF_POINTER__", "8");
return map;
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/IntegralValueTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/IntegralValueTests.java
index 48160677923..226ac681328 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/IntegralValueTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/IntegralValueTests.java
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.ast2.cxx14.constexpr;
+import org.eclipse.cdt.core.testplugin.TestScannerProvider;
import org.eclipse.cdt.internal.core.dom.parser.IntegralValue;
import junit.framework.TestSuite;
@@ -36,6 +37,16 @@ public abstract class IntegralValueTests extends TestBase {
}
}
+ @Override
+ protected void setUp() throws Exception {
+ TestScannerProvider.sDefinedSymbols.put("__SIZEOF_SHORT__", "2");
+ TestScannerProvider.sDefinedSymbols.put("__SIZEOF_INT__", "4");
+ TestScannerProvider.sDefinedSymbols.put("__SIZEOF_LONG__", "8");
+ TestScannerProvider.sDefinedSymbols.put("__SIZEOF_LONG_LONG__", "8");
+ TestScannerProvider.sDefinedSymbols.put("__SIZEOF_POINTER__", "8");
+ super.setUp();
+ }
+
// constexpr auto x = int{} + int();
public void testIntDefaultValue() throws Exception {
assertEvaluationEquals(0);
@@ -274,4 +285,59 @@ public abstract class IntegralValueTests extends TestBase {
public void testBuiltinFfs() throws Exception {
assertEvaluationEquals(5);
}
+
+ // constexpr int x = __builtin_ffs(0x100000000);
+ public void testBuiltinFfsNarrowing() throws Exception {
+ assertEvaluationEquals(0);
+ }
+
+ // constexpr int x = __builtin_ffsl(0x100000000);
+ public void testBuiltinFfsl() throws Exception {
+ assertEvaluationEquals(33);
+ }
+
+ // constexpr int x = __builtin_ctz(16);
+ public void testBuiltinCtz() throws Exception {
+ assertEvaluationEquals(4);
+ }
+
+ // constexpr int x = __builtin_popcount(128 + 32 + 8 + 4 + 2);
+ public void testBuiltinPopcount() throws Exception {
+ assertEvaluationEquals(5);
+ }
+
+ // constexpr int x = __builtin_popcountl(0x80000001);
+ public void testBuiltinPopcountHighBitSet() throws Exception {
+ assertEvaluationEquals(2);
+ }
+
+ // constexpr int x = __builtin_popcountl(0x8000000000000001);
+ public void testBuiltinPopcountlHighBitSet() throws Exception {
+ assertEvaluationEquals(2);
+ }
+
+ // constexpr int x = __builtin_popcountll(0x8000000000000001);
+ public void testBuiltinPopcountllHighBitSet() throws Exception {
+ assertEvaluationEquals(2);
+ }
+
+ // constexpr int x = __builtin_parity(128 + 32 + 8 + 4 + 2) + __builtin_parity(64) + __builtin_parity(0);
+ public void testBuiltinParity() throws Exception {
+ assertEvaluationEquals(2);
+ }
+
+ // constexpr int x = __builtin_abs(700) + __builtin_abs(50);
+ public void testBuiltinAbs() throws Exception {
+ assertEvaluationEquals(750);
+ }
+
+ // constexpr int x = __builtin_abs(-1);
+ public void testBuiltinAbsNegativeInput() throws Exception {
+ assertEvaluationEquals(1);
+ }
+
+ // constexpr int x = __builtin_abs(0xFFFFFFFF);
+ public void testBuiltinAbsNarrowing() throws Exception {
+ assertEvaluationEquals(1);
+ }
} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/TestBase.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/TestBase.java
index 79badd6a337..81ef2344c50 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/TestBase.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/TestBase.java
@@ -66,6 +66,7 @@ public abstract class TestBase extends IndexBindingResolutionTestBase {
map.put("__SIZEOF_SHORT__", "2");
map.put("__SIZEOF_INT__", "4");
map.put("__SIZEOF_LONG__", "8");
+ map.put("__SIZEOF_LONG_LONG__", "8");
map.put("__SIZEOF_POINTER__", "8");
return map;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCBuiltinSymbolProvider.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCBuiltinSymbolProvider.java
index b5ab4d3b5df..407c02e1d05 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCBuiltinSymbolProvider.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCBuiltinSymbolProvider.java
@@ -191,10 +191,24 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
function("bool", "__atomic_is_lock_free", "size_t", "void*");
ICPPExecution builtinFfs = new ExecBuiltin(ExecBuiltin.BUILTIN_FFS);
+ ICPPExecution builtinFfsl = new ExecBuiltin(ExecBuiltin.BUILTIN_FFSL);
+ ICPPExecution builtinFfsll = new ExecBuiltin(ExecBuiltin.BUILTIN_FFSLL);
+ ICPPExecution builtinCtz = new ExecBuiltin(ExecBuiltin.BUILTIN_CTZ);
+ ICPPExecution builtinCtzl = new ExecBuiltin(ExecBuiltin.BUILTIN_CTZL);
+ ICPPExecution builtinCtzll = new ExecBuiltin(ExecBuiltin.BUILTIN_CTZLL);
+ ICPPExecution builtinPopcount = new ExecBuiltin(ExecBuiltin.BUILTIN_POPCOUNT);
+ ICPPExecution builtinPopcountl = new ExecBuiltin(ExecBuiltin.BUILTIN_POPCOUNTL);
+ ICPPExecution builtinPopcountll = new ExecBuiltin(ExecBuiltin.BUILTIN_POPCOUNTLL);
+ ICPPExecution builtinParity = new ExecBuiltin(ExecBuiltin.BUILTIN_PARITY);
+ ICPPExecution builtinParityl = new ExecBuiltin(ExecBuiltin.BUILTIN_PARITYL);
+ ICPPExecution builtinParityll = new ExecBuiltin(ExecBuiltin.BUILTIN_PARITYLL);
+ ICPPExecution builtinAbs = new ExecBuiltin(ExecBuiltin.BUILTIN_ABS);
+ ICPPExecution builtinLabs = new ExecBuiltin(ExecBuiltin.BUILTIN_LABS);
+ ICPPExecution builtinLlabs = new ExecBuiltin(ExecBuiltin.BUILTIN_LLABS);
// Other Builtins (https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html) [incomplete]
function("void", "__builtin_abort");
- function("int", "__builtin_abs", "int");
+ function("int", "__builtin_abs", builtinAbs, "int");
function("double", "__builtin_acos", "double");
function("float", "__builtin_acosf", "float");
function("long double", "__builtin_acosl", "long double");
@@ -251,9 +265,9 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
function("double", "__builtin_creal", "complex double");
function("float", "__builtin_crealf", "complex float");
function("long double", "__builtin_creall", "complex long double");
- function("int", "__builtin_ctz", "unsigned int");
- function("int", "__builtin_ctzl", "unsigned long");
- function("int", "__builtin_ctzll", "unsigned long long");
+ function("int", "__builtin_ctz", builtinCtz, "unsigned int");
+ function("int", "__builtin_ctzl", builtinCtzl, "unsigned long");
+ function("int", "__builtin_ctzll", builtinCtzll, "unsigned long long");
function("double", "__builtin_erf", "double");
function("float", "__builtin_erff", "float");
function("long double", "__builtin_erfl", "long double");
@@ -282,8 +296,8 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
function("float", "__builtin_fdimf", "float", "float");
function("long double", "__builtin_fdiml", "long double", "long double");
function("int", "__builtin_ffs", builtinFfs, "unsigned int");
- function("int", "__builtin_ffsl", builtinFfs, "unsigned long");
- function("int", "__builtin_ffsll", builtinFfs, "unsigned long long");
+ function("int", "__builtin_ffsl", builtinFfsl, "unsigned long");
+ function("int", "__builtin_ffsll", builtinFfsll, "unsigned long long");
function("double", "__builtin_floor", "double");
function("float", "__builtin_floorf", "float");
function("long double", "__builtin_floorl", "long double");
@@ -334,7 +348,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
function("bool", "__builtin_isnan", "double");
function("bool", "__builtin_isnormal", "double");
function("bool", "__builtin_isunordered", "float", "float");
- function("long", "__builtin_labs", "long");
+ function("long", "__builtin_labs", builtinLabs, "long");
function("double", "__builtin_ldexp", "double", "int");
function("float", "__builtin_ldexpf", "float", "int");
function("long double", "__builtin_ldexpl", "long double", "int");
@@ -344,7 +358,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
function("int", "__builtin_LINE"); //TODO: This should technically be a constant integer expression
function("const char *", "__builtin_FUNCTION");
function("const char *", "__builtin_FILE");
- function("long long", "__builtin_llabs", "long long");
+ function("long long", "__builtin_llabs", builtinLlabs, "long long");
function("long long", "__builtin_llrint", "double");
function("long long", "__builtin_llrintf", "float");
function("long long", "__builtin_llrintl", "long double");
@@ -397,12 +411,12 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
function("double", "__builtin_nexttoward", "double", "long double");
function("float", "__builtin_nexttowardf", "float", "long double");
function("long double", "__builtin_nexttowardl", "long double", "long double");
- function("int", "__builtin_parity", "unsigned int");
- function("int", "__builtin_parityl", "unsigned long");
- function("int", "__builtin_parityll", "unsigned long long");
- function("int", "__builtin_popcount", "unsigned int");
- function("int", "__builtin_popcountl", "unsigned long");
- function("int", "__builtin_popcountll", "unsigned long long");
+ function("int", "__builtin_parity", builtinParity, "unsigned int");
+ function("int", "__builtin_parityl", builtinParityl, "unsigned long");
+ function("int", "__builtin_parityll", builtinParityll, "unsigned long long");
+ function("int", "__builtin_popcount", builtinPopcount, "unsigned int");
+ function("int", "__builtin_popcountl", builtinPopcountl, "unsigned long");
+ function("int", "__builtin_popcountll", builtinPopcountll, "unsigned long long");
function("double", "__builtin_pow", "double", "double");
function("float", "__builtin_powf", "float", "float");
function("long double", "__builtin_powl", "long double", "long double");
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java
index 57c315ef531..fb3d3e4157f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java
@@ -30,6 +30,7 @@ import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUti
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getNestedType;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.isVoidType;
+import java.math.BigInteger;
import java.util.Collections;
import org.eclipse.cdt.core.dom.ast.DOMException;
@@ -60,6 +61,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.internal.core.dom.parser.ArithmeticConversion;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
+import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator;
+import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator.SizeAndAlignment;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerToMemberType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType;
@@ -1326,4 +1329,99 @@ public class Conversions {
private static boolean isNullPtr(IType t1) {
return t1 instanceof IBasicType && ((IBasicType) t1).getKind() == Kind.eNullPtr;
}
+
+ /**
+ * Narrow a numeric value to the range of a specified type.
+ * @param num the value to narrow (may be null)
+ * @param toType the type to narrow to
+ * @return a number representing the narrowed value, or null
+ */
+ public static Number narrowNumberValue(Number num, IType toType) {
+ if (num == null)
+ return null;
+
+ if (toType instanceof IBasicType) {
+ IBasicType basicType = (IBasicType) toType;
+ IBasicType.Kind basicTypeKind = basicType.getKind();
+ switch (basicTypeKind) {
+ case eFloat:
+ if (num instanceof Float)
+ return num;
+ return Float.valueOf(num.floatValue());
+ case eDouble:
+ if (num instanceof Double)
+ return num;
+ return Double.valueOf(num.doubleValue());
+ case eInt:
+ SizeAndAlignment sizeToType = SizeofCalculator.getSizeAndAlignment(toType);
+ if (sizeToType == null)
+ return null;
+ // Note in the following we don't check type.isSigned() since that checks for the
+ // explicit presence of the "signed" modifier. So instead check !type.isUnsigned().
+ if (sizeToType.size <= 8) {
+ // First, mask the value to the correct size
+ // Note that we take the longValue here which may be negative even though the
+ // original value is positive; the masking here should still be correct and we
+ // should ultimately end up with the correct narrowed value, regardless.
+ long longVal = num.longValue();
+ long maskVal = 0xFFFFFFFFFFFFFFFFL;
+ long signBit = 0x8000000000000000L;
+ // Calculate a mask to reduce the size of the value to the target width:
+ maskVal >>>= (8 - sizeToType.size) * 8;
+ signBit >>>= (8 - sizeToType.size) * 8;
+ if (!basicType.isUnsigned() && (longVal & signBit) != 0) {
+ // We need to extend the sign bit.
+ long signBits = ~maskVal;
+ longVal |= signBits;
+ } else {
+ longVal &= maskVal;
+ }
+
+ // The Java type used to store the numerical value is independent of the associated
+ // C type, but we go with a smaller type (Integer) where possible. For 4 bytes
+ // (signed) or less than 4 bytes (signed or not) we can use Integer. For 8 bytes
+ // (signed) or less than 8 bytes (signed or not) we can use Long. Any larger and we
+ // resort to BigInteger.
+ if (longVal >= 0 && longVal <= Integer.MAX_VALUE) {
+ return Integer.valueOf((int) longVal);
+ }
+ if (!basicType.isUnsigned() && longVal >= Integer.MIN_VALUE && longVal <= Integer.MAX_VALUE) {
+ return Integer.valueOf((int) longVal);
+ }
+
+ if (!basicType.isUnsigned() || longVal > 0) {
+ return Long.valueOf(longVal);
+ }
+
+ BigInteger biVal = BigInteger.valueOf(longVal);
+ // 2**64 = 18446744073709551616
+ biVal = biVal.add(new BigInteger("18446744073709551616")); //$NON-NLS-1$
+ return biVal;
+ }
+ // TODO handle larger int sizes?
+ return null;
+ case eChar:
+ // TODO don't assume signed char
+ if (num instanceof Byte)
+ return num;
+ return Byte.valueOf(num.byteValue());
+ case eChar16:
+ int intVal = num.intValue();
+ int maskedVal = intVal & 0xFFFF;
+ if (maskedVal == intVal && num instanceof Integer)
+ return num;
+ return Integer.valueOf(maskedVal);
+ case eChar32:
+ long longVal = num.longValue();
+ long maskedVal32 = longVal & 0xFFFFFFFFL;
+ if (maskedVal32 == longVal && (num instanceof Integer || num instanceof Long))
+ return num;
+ return Long.valueOf(maskedVal32);
+ default:
+ return null;
+ }
+ }
+
+ return null;
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecBuiltin.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecBuiltin.java
index 338ef00240f..86e6aab7ae2 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecBuiltin.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecBuiltin.java
@@ -31,9 +31,13 @@ import org.eclipse.core.runtime.CoreException;
* Constexpr-evaluation for compiler builtin functions.
*/
public class ExecBuiltin implements ICPPExecution {
- public final static short BUILTIN_FFS = 0;
+ public final static short BUILTIN_FFS = 0, BUILTIN_FFSL = 1, BUILTIN_FFSLL = 2, BUILTIN_CTZ = 3, BUILTIN_CTZL = 4,
+ BUILTIN_CTZLL = 5, BUILTIN_POPCOUNT = 6, BUILTIN_POPCOUNTL = 7, BUILTIN_POPCOUNTLL = 8, BUILTIN_PARITY = 9,
+ BUILTIN_PARITYL = 10, BUILTIN_PARITYLL = 11, BUILTIN_ABS = 12, BUILTIN_LABS = 13, BUILTIN_LLABS = 14;
private static IType intType = new CPPBasicType(Kind.eInt, 0);
+ private static IType longType = new CPPBasicType(Kind.eInt, CPPBasicType.IS_LONG);
+ private static IType longlongType = new CPPBasicType(Kind.eInt, CPPBasicType.IS_LONG_LONG);
private short funcId;
@@ -51,29 +55,131 @@ public class ExecBuiltin implements ICPPExecution {
switch (funcId) {
case BUILTIN_FFS:
- return executeBuiltinFfs(record, context);
+ return executeBuiltinFfs(record, context, intType);
+ case BUILTIN_FFSL:
+ return executeBuiltinFfs(record, context, longType);
+ case BUILTIN_FFSLL:
+ return executeBuiltinFfs(record, context, longlongType);
+ case BUILTIN_CTZ:
+ return executeBuiltinCtz(record, context, intType);
+ case BUILTIN_CTZL:
+ return executeBuiltinCtz(record, context, longType);
+ case BUILTIN_CTZLL:
+ return executeBuiltinCtz(record, context, longlongType);
+ case BUILTIN_POPCOUNT:
+ return executeBuiltinPopcount(record, context, intType);
+ case BUILTIN_POPCOUNTL:
+ return executeBuiltinPopcount(record, context, longType);
+ case BUILTIN_POPCOUNTLL:
+ return executeBuiltinPopcount(record, context, longlongType);
+ case BUILTIN_PARITY:
+ return executeBuiltinParity(record, context, intType);
+ case BUILTIN_PARITYL:
+ return executeBuiltinParity(record, context, longType);
+ case BUILTIN_PARITYLL:
+ return executeBuiltinParity(record, context, longlongType);
+ case BUILTIN_ABS:
+ return executeBuiltinAbs(record, context, intType);
+ case BUILTIN_LABS:
+ return executeBuiltinAbs(record, context, longType);
+ case BUILTIN_LLABS:
+ return executeBuiltinAbs(record, context, longlongType);
}
return null;
}
- private ICPPExecution executeBuiltinFfs(ActivationRecord record, ConstexprEvaluationContext context) {
+ /*
+ * Return an execution representing __builtin_ffs or __builtin_ctz
+ */
+ private ICPPExecution executeBuiltinFfsCtz(ActivationRecord record, ConstexprEvaluationContext context,
+ boolean isCtz, IType argType) {
ICPPEvaluation arg0 = record.getVariable(new CPPBuiltinParameter(null, 0));
IValue argValue = arg0.getValue();
- if (!(argValue instanceof IntegralValue))
+ Number numberVal = argValue.numberValue();
+ numberVal = Conversions.narrowNumberValue(numberVal, argType);
+ if (numberVal == null)
return null;
// __builtin_ffs returns 0 if arg is 0, or 1+count where count is the number of trailing 0 bits
- long arg = argValue.numberValue().longValue();
+ // __builtin_ctz is undefined if arg is 0, or returns count
+ long arg = numberVal.longValue();
if (arg == 0) {
- return new ExecReturn(new EvalFixed(intType, ValueCategory.PRVALUE, IntegralValue.create(0)));
+ if (isCtz) {
+ return null;
+ } else {
+ return new ExecReturn(new EvalFixed(intType, ValueCategory.PRVALUE, IntegralValue.create(0)));
+ }
}
int count = 0;
while ((arg & 1) == 0) {
arg >>= 1;
count++;
}
- return new ExecReturn(new EvalFixed(intType, ValueCategory.PRVALUE, IntegralValue.create(count + 1)));
+ int increment = isCtz ? 0 : 1;
+ return new ExecReturn(new EvalFixed(intType, ValueCategory.PRVALUE, IntegralValue.create(count + increment)));
+ }
+
+ private ICPPExecution executeBuiltinFfs(ActivationRecord record, ConstexprEvaluationContext context,
+ IType argType) {
+ return executeBuiltinFfsCtz(record, context, false /* ffs */, argType);
+ }
+
+ private ICPPExecution executeBuiltinCtz(ActivationRecord record, ConstexprEvaluationContext context,
+ IType argType) {
+ return executeBuiltinFfsCtz(record, context, true /* ctz */, argType);
+ }
+
+ /*
+ * Return an execution representing __builtin_popcount
+ */
+ private ICPPExecution executeBuiltinPopcountParity(ActivationRecord record, ConstexprEvaluationContext context,
+ boolean isParity, IType argType) {
+ ICPPEvaluation arg0 = record.getVariable(new CPPBuiltinParameter(null, 0));
+
+ IValue argValue = arg0.getValue();
+ Number numberVal = argValue.numberValue();
+ numberVal = Conversions.narrowNumberValue(numberVal, argType);
+ if (numberVal == null)
+ return null;
+
+ long arg = numberVal.longValue();
+ int count = 0;
+ while (arg != 0) {
+ if ((arg & 1) != 0)
+ count++;
+ arg >>>= 1;
+ }
+ if (isParity) {
+ count = count & 1;
+ }
+ return new ExecReturn(new EvalFixed(intType, ValueCategory.PRVALUE, IntegralValue.create(count)));
+ }
+
+ private ICPPExecution executeBuiltinPopcount(ActivationRecord record, ConstexprEvaluationContext context,
+ IType argType) {
+ return executeBuiltinPopcountParity(record, context, false, argType);
+ }
+
+ private ICPPExecution executeBuiltinParity(ActivationRecord record, ConstexprEvaluationContext context,
+ IType argType) {
+ return executeBuiltinPopcountParity(record, context, true, argType);
+ }
+
+ private ICPPExecution executeBuiltinAbs(ActivationRecord record, ConstexprEvaluationContext context,
+ IType argType) {
+ ICPPEvaluation arg0 = record.getVariable(new CPPBuiltinParameter(null, 0));
+
+ IValue argValue = arg0.getValue();
+ Number argNumber = argValue.numberValue();
+ argNumber = Conversions.narrowNumberValue(argNumber, argType);
+ if (argNumber == null)
+ return null;
+
+ long arg = argNumber.longValue();
+ long result = Math.abs(arg);
+
+ return new ExecReturn(new EvalFixed(argType, ValueCategory.PRVALUE, IntegralValue.create(result)));
}
@Override
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyRulerColumn.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyRulerColumn.java
index 35ca013667b..a8b970c1e8c 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyRulerColumn.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyRulerColumn.java
@@ -73,18 +73,12 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
*/
class InternalListener implements IViewportListener, ITextListener, ISelectionChangedListener {
- /*
- * @see IViewportListener#viewportChanged(int)
- */
@Override
public void viewportChanged(int verticalPosition) {
if (verticalPosition != fScrollPos)
redraw();
}
- /*
- * @see ITextListener#textChanged(TextEvent)
- */
@Override
public void textChanged(TextEvent event) {
@@ -102,9 +96,6 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
}
- /*
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
@Override
public void selectionChanged(SelectionChangedEvent event) {
postRedraw();
@@ -125,9 +116,6 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/** The auto scroll direction */
private int fAutoScrollDirection;
- /*
- * @see org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
- */
@Override
public void mouseUp(MouseEvent event) {
// see bug 45700
@@ -138,9 +126,6 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
}
}
- /*
- * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
- */
@Override
public void mouseDown(MouseEvent event) {
fParentRuler.setLocationOfLastMouseButtonActivity(event.x, event.y);
@@ -150,9 +135,6 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
}
}
- /*
- * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
- */
@Override
public void mouseDoubleClick(MouseEvent event) {
fParentRuler.setLocationOfLastMouseButtonActivity(event.x, event.y);
@@ -160,9 +142,6 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
stopAutoScroll();
}
- /*
- * @see org.eclipse.swt.events.MouseMoveListener#mouseMove(org.eclipse.swt.events.MouseEvent)
- */
@Override
public void mouseMove(MouseEvent event) {
if (!autoScroll(event)) {
@@ -171,23 +150,14 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
}
}
- /*
- * @see org.eclipse.swt.events.MouseTrackListener#mouseEnter(org.eclipse.swt.events.MouseEvent)
- */
@Override
public void mouseEnter(MouseEvent event) {
}
- /*
- * @see org.eclipse.swt.events.MouseTrackListener#mouseExit(org.eclipse.swt.events.MouseEvent)
- */
@Override
public void mouseExit(MouseEvent event) {
}
- /*
- * @see org.eclipse.swt.events.MouseTrackListener#mouseHover(org.eclipse.swt.events.MouseEvent)
- */
@Override
public void mouseHover(MouseEvent event) {
}
@@ -478,17 +448,11 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
return DsfUIPlugin.getDefault().getPreferenceStore();
}
- /*
- * @see IVerticalRulerColumn#getControl()
- */
@Override
public Control getControl() {
return fCanvas;
}
- /*
- * @see IVerticalRuleColumnr#getWidth
- */
@Override
public int getWidth() {
return fIndentation[0];
@@ -587,9 +551,6 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
}
}
- /*
- * @see IVerticalRulerColumn#createControl(CompositeRuler, Composite)
- */
@Override
public Control createControl(CompositeRuler parentRuler, Composite parentControl) {
@@ -932,9 +893,8 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
int widgetBaseline = fCachedTextWidget.getBaseline();
FontMetrics fm = gc.getFontMetrics();
int fontBaseline = fm.getAscent() + fm.getLeading();
- Assert.isTrue(widgetBaseline >= fontBaseline);
int baselineBias = widgetBaseline - fontBaseline;
- return baselineBias;
+ return Math.max(0, baselineBias);
}
/**
@@ -977,9 +937,6 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
}
}
- /*
- * @see IVerticalRulerColumn#redraw()
- */
@Override
public void redraw() {
@@ -995,16 +952,10 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
}
}
- /*
- * @see IVerticalRulerColumn#setModel(IAnnotationModel)
- */
@Override
public void setModel(IAnnotationModel model) {
}
- /*
- * @see IVerticalRulerColumn#setFont(Font)
- */
@Override
public void setFont(Font font) {
fFont = font;
diff --git a/jsoncdb/org.eclipse.cdt.jsoncdb.core/plugin.properties b/jsoncdb/org.eclipse.cdt.jsoncdb.core/plugin.properties
index f3692d6e606..ec44029a1bf 100644
--- a/jsoncdb/org.eclipse.cdt.jsoncdb.core/plugin.properties
+++ b/jsoncdb/org.eclipse.cdt.jsoncdb.core/plugin.properties
@@ -11,4 +11,5 @@ which is available at https://www.eclipse.org/legal/epl-2.0/\n\
\n\
SPDX-License-Identifier: EPL-2.0
extension-point.name = Tool Detection Participant
-CompileCommandsJsonParserMarker.name = JSON compilation database \ No newline at end of file
+CompileCommandsJsonParserMarker.name = JSON compilation database
+CompilerBuiltinsDetectorMarker.name=Compiler Builtins Detector Problem
diff --git a/jsoncdb/org.eclipse.cdt.jsoncdb.core/plugin.xml b/jsoncdb/org.eclipse.cdt.jsoncdb.core/plugin.xml
index aa2999e656f..a2c279069f5 100644
--- a/jsoncdb/org.eclipse.cdt.jsoncdb.core/plugin.xml
+++ b/jsoncdb/org.eclipse.cdt.jsoncdb.core/plugin.xml
@@ -2,7 +2,6 @@
<?eclipse version="3.4"?>
<plugin>
<extension-point id="detectionParticipant" name="%extension-point.name" schema="schema/participant.exsd"/>
-"org.eclipse.cdt.jsoncdb.core.internal.ui.CompileCommandsJsonParserOptionPage">
<extension
id="CompileCommandsJsonParserMarker"
name="%CompileCommandsJsonParserMarker.name"
@@ -14,4 +13,10 @@
type="org.eclipse.core.resources.problemmarker">
</super>
</extension>
+ <extension
+ id="CompilerBuiltinsDetectorMarker"
+ name="%CompilerBuiltinsDetectorMarker.name"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.cdt.jsoncdb.core.CompileCommandsJsonParserMarker"/>
+ </extension>
</plugin>
diff --git a/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/internal/builtins/CompilerBuiltinsDetector.java b/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/internal/builtins/CompilerBuiltinsDetector.java
index 818fcf36247..db4e691b050 100644
--- a/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/internal/builtins/CompilerBuiltinsDetector.java
+++ b/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/internal/builtins/CompilerBuiltinsDetector.java
@@ -130,13 +130,30 @@ public class CompilerBuiltinsDetector {
}
}
if (state != ICommandLauncher.COMMAND_CANCELED) {
- // check exit status
- final int exitValue = proc.exitValue();
- if (exitValue != 0 && !builtinsDetectionBehavior.suppressErrormessage()) {
- // compiler had errors...
- String errMsg = String.format(Messages.CompilerBuiltinsDetector_errmsg_command_failed, command,
- exitValue);
- createMarker(errMsg);
+ try {
+ // check exit status
+ final int exitValue = proc.exitValue();
+ if (exitValue != 0 && !builtinsDetectionBehavior.suppressErrormessage()) {
+ // compiler had errors...
+ String errMsg = String.format(Messages.CompilerBuiltinsDetector_errmsg_command_failed, command,
+ exitValue);
+ createMarker(errMsg);
+ }
+ } catch (IllegalThreadStateException e) {
+ // Bug 580045 - reused launcher race condition
+ String warnMsg = String.format(Messages.CompilerBuiltinsDetector_msg_unexpectedly_still_running,
+ command);
+
+ if (console != null) {
+ final ConsoleOutputStream cis = console.getInfoStream();
+ try {
+ cis.write(warnMsg.getBytes());
+ cis.write("\n".getBytes()); //$NON-NLS-1$
+ } catch (IOException ignore) {
+ }
+ }
+ createMarker(warnMsg);
+ Plugin.getDefault().getLog().log(Status.warning(warnMsg, e));
}
}
} else {
diff --git a/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/internal/builtins/Messages.java b/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/internal/builtins/Messages.java
index 70770488a18..25b703e3ef2 100644
--- a/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/internal/builtins/Messages.java
+++ b/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/internal/builtins/Messages.java
@@ -22,6 +22,7 @@ class Messages extends NLS {
public static String CompilerBuiltinsDetector_errmsg_command_failed;
public static String CompilerBuiltinsDetector_msg_detection_finished;
public static String CompilerBuiltinsDetector_msg_detection_start;
+ public static String CompilerBuiltinsDetector_msg_unexpectedly_still_running;
public static String DetectorConsole_title;
static {
// initialize resource bundle
diff --git a/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/internal/builtins/messages.properties b/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/internal/builtins/messages.properties
index 03b19c5f6cf..09a209b9b21 100644
--- a/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/internal/builtins/messages.properties
+++ b/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/internal/builtins/messages.properties
@@ -14,4 +14,5 @@
CompilerBuiltinsDetector_errmsg_command_failed=%1$s exited with status %2$d.
CompilerBuiltinsDetector_msg_detection_finished=Detecting compiler built-ins took %d ms.
CompilerBuiltinsDetector_msg_detection_start=%1$s Detecting compiler built-ins for project '%2$s'
+CompilerBuiltinsDetector_msg_unexpectedly_still_running=%1$s is unexpectedly still running. Some built-ins might not have been captured by the compiler built-ins detector.
DetectorConsole_title=Compiler Built-ins Detection Console
diff --git a/pom.xml b/pom.xml
index 66213631bda..5f9b8683187 100644
--- a/pom.xml
+++ b/pom.xml
@@ -43,7 +43,7 @@
<!-- When changing this value, consider also bumping the version numbers of all the docs plug-ins (those with build-doc profile in pom.xml)
so that compare&replace does not replace the the newly built docs because the only change is in the filtered out index/* resources. -->
- <help-docs-eclipserun-repo>https://download.eclipse.org/eclipse/updates/4.24-I-builds/</help-docs-eclipserun-repo>
+ <help-docs-eclipserun-repo>https://download.eclipse.org/eclipse/updates/4.24/</help-docs-eclipserun-repo>
<tycho.scmUrl>scm:git:https://git.eclipse.org/r/cdt/org.eclipse.cdt</tycho.scmUrl>
<base.test.vmargs>-Xms256m -Xmx512m -ea</base.test.vmargs>
diff --git a/releng/org.eclipse.cdt.target/cdt.target b/releng/org.eclipse.cdt.target/cdt.target
index 9d596bf12a0..1bdddf29813 100644
--- a/releng/org.eclipse.cdt.target/cdt.target
+++ b/releng/org.eclipse.cdt.target/cdt.target
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
-<target name="cdt" sequenceNumber="117">
+<target name="cdt" sequenceNumber="121">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/cbi/updates/license/"/>
<unit id="org.eclipse.license.feature.group" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
- <repository location="https://download.eclipse.org/eclipse/updates/4.24-I-builds/I20220519-0130/"/>
+ <repository location="https://download.eclipse.org/eclipse/updates/4.24/R-4.24-202206070700/"/>
<unit id="org.eclipse.equinox.executable.feature.group" version="0.0.0"/>
<unit id="org.eclipse.jdt.annotation" version="0.0.0"/>
<unit id="org.eclipse.sdk.feature.group" version="0.0.0"/>
@@ -19,7 +19,7 @@
<unit id="org.eclipse.egit.feature.group" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
- <repository location="https://download.eclipse.org/linuxtools/updates-docker-nightly/"/>
+ <repository location="https://download.eclipse.org/linuxtools/update-2022-06-docker-rc2"/>
<unit id="org.eclipse.linuxtools.docker.feature.feature.group" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
@@ -41,16 +41,16 @@
<unit id="org.eclipse.tm4e.feature.feature.group" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
- <repository location="https://download.eclipse.org/tools/cdt/releases/10.6/cdt-10.6.0/"/>
+ <repository location="https://download.eclipse.org/tools/cdt/releases/10.7/cdt-10.7.0/"/>
<!-- We explicitly have CDT in target platform so that developers can develop org.eclipse.cdt.core/ui without requiring all the projects from CDT in their workspace. -->
<unit id="org.eclipse.cdt.feature.group" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
- <repository location="https://download.eclipse.org/wildwebdeveloper/snapshots/"/>
+ <repository location="https://download.eclipse.org/wildwebdeveloper/releases/latest/"/>
<unit id="org.eclipse.wildwebdeveloper.embedder.node.feature.feature.group" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
- <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20220517184036/repository/"/>
+ <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20220531185310/repository/"/>
<unit id="com.google.gson" version="0.0.0"/>
<unit id="com.sun.xml.bind" version="2.3.3.v20201118-1818"/>
<unit id="javax.activation" version="1.2.2.v20201119-1642"/>
diff --git a/remote/org.eclipse.remote.ui/META-INF/MANIFEST.MF b/remote/org.eclipse.remote.ui/META-INF/MANIFEST.MF
index 90a96dc7b43..6fca78aa060 100644
--- a/remote/org.eclipse.remote.ui/META-INF/MANIFEST.MF
+++ b/remote/org.eclipse.remote.ui/META-INF/MANIFEST.MF
@@ -48,4 +48,5 @@ Import-Package: org.eclipse.core.commands,
org.eclipse.ui.navigator,
org.eclipse.ui.plugin,
org.eclipse.ui.progress,
- org.osgi.framework
+ org.osgi.framework,
+ org.osgi.service.prefs

Back to the top