summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Woestman2018-05-16 15:33:13 -0400
committerNathan Ridge2018-05-17 21:59:02 -0400
commit4aebc5bffcd8b2772566a9636566663a670a20c4 (patch)
tree82525f710c9f089a0d01f1befaa5dc1077eefcee
parentc8b769ead2cf8df5a7584d0b503ec7dfcc4349fb (diff)
downloadorg.eclipse.cdt-4aebc5bffcd8b2772566a9636566663a670a20c4.tar.gz
org.eclipse.cdt-4aebc5bffcd8b2772566a9636566663a670a20c4.tar.xz
org.eclipse.cdt-4aebc5bffcd8b2772566a9636566663a670a20c4.zip
[534454] Fixed GCC build parser for simple defines
Changed GCC build parser to handle simple defines like "-D FOO" and defines them to 1. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=534454 Change-Id: Ic9065914bc82dafc43d0814f4fed27a26eeeeb28 Signed-off-by: Eric Woestman <woestman@ensoftcorp.com>
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/language/settings/providers/tests/GCCBuildCommandParserTest.java6
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/language/settings/providers/GCCBuildCommandParser.java3
2 files changed, 5 insertions, 4 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/language/settings/providers/tests/GCCBuildCommandParserTest.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/language/settings/providers/tests/GCCBuildCommandParserTest.java
index 73b3fe9ea0..6182e47d85 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/language/settings/providers/tests/GCCBuildCommandParserTest.java
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/language/settings/providers/tests/GCCBuildCommandParserTest.java
@@ -688,7 +688,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
- CMacroEntry expected = new CMacroEntry("MACRO0", "", 0);
+ CMacroEntry expected = new CMacroEntry("MACRO0", "1", 0);
CMacroEntry entry = (CMacroEntry)entries.get(0);
assertEquals(expected.getName(), entry.getName());
assertEquals(expected.getValue(), entry.getValue());
@@ -1979,8 +1979,8 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
assertFalse(new java.io.File("/Python1025/Include").exists());
assertEquals(new CIncludePathEntry("/Python1025/Include", 0), entries.get(1));
assertEquals(new CMacroEntry("BOOST_ALL_NO_LIB", "1", 0), entries.get(2));
- assertEquals(new CMacroEntry("BOOST_PYTHON_SOURCE", "", 0), entries.get(3));
- assertEquals(new CMacroEntry("BOOST_PYTHON_STATIC_LIB", "", 0), entries.get(4));
+ assertEquals(new CMacroEntry("BOOST_PYTHON_SOURCE", "1", 0), entries.get(3));
+ assertEquals(new CMacroEntry("BOOST_PYTHON_STATIC_LIB", "1", 0), entries.get(4));
assertEquals(5, entries.size());
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/language/settings/providers/GCCBuildCommandParser.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/language/settings/providers/GCCBuildCommandParser.java
index 87967cbd07..939d5a19e6 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/language/settings/providers/GCCBuildCommandParser.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/language/settings/providers/GCCBuildCommandParser.java
@@ -43,7 +43,8 @@ public class GCCBuildCommandParser extends AbstractBuildCommandParser implements
new MacroOptionParser("-D\\s*([^\\s=\"']*)=(\"\\\\(\")(.*?)\\\\\"\")", "$1", "$3$4$3"),
new MacroOptionParser("-D\\s*([^\\s=\"']*)=(\\\\([\"']))(.*?)\\2", "$1", "$3$4$3"),
new MacroOptionParser("-D\\s*([^\\s=\"']*)=([\"'])(.*?)\\2", "$1", "$3"),
- new MacroOptionParser("-D\\s*([^\\s=\"']*)(=([^\\s\"']*))?", "$1", "$3"),
+ new MacroOptionParser("-D\\s*([^\\s=\"']*)=([^\\s\"']*)?", "$1", "$2"),
+ new MacroOptionParser("-D\\s*([^\\s=\"']*)", "$1", "1"),
new MacroOptionParser("-U\\s*([^\\s=\"']*)", "$1", ICSettingEntry.UNDEFINED),
new MacroFileOptionParser("-imacros\\s*([\"'])(.*)\\1", "$2"),
new MacroFileOptionParser("-imacros\\s*([^\\s\"']*)", "$1"),