1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +02:00

[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>
This commit is contained in:
Eric Woestman 2018-05-16 14:33:13 -05:00 committed by Nathan Ridge
parent c8b769ead2
commit 4aebc5bffc
2 changed files with 5 additions and 4 deletions

View file

@ -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());
}

View file

@ -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"),