Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/language/settings/providers/tests/GCCBuildCommandParserTest.java61
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/language/settings/providers/GCCBuildCommandParser.java2
2 files changed, 58 insertions, 5 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 be837ea7d71..6f8224a2ea4 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
@@ -511,9 +511,9 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
}
/**
- * Parse variations of -I options.
+ * Parse variations of -isystem options.
*/
- public void testCIncludePathEntry() throws Exception {
+ public void testCISystemPathEntry() throws Exception {
// Create model project and accompanied descriptions
String projectName = getName();
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
@@ -531,6 +531,57 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
parser.startup(cfgDescription, null);
parser.processLine("gcc"
// regular
+ + " -isystem/path0 "
+ // space after -isystem
+ + " -isystem /path1 "
+ // unknown option, should be ignored
+ + " -? "
+ // double-quoted path with spaces
+ + " -isystem\"/path with spaces\""
+ // single-quoted path with spaces
+ + " -isystem'/path with spaces2'"
+ // second single-quoted and space after -isystem
+ + " -isystem '/path with spaces3'"
+ + " file.cpp");
+ parser.shutdown();
+
+ // check populated entries
+ List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
+ CIncludePathEntry expected = new CIncludePathEntry("/path0", 0);
+ CIncludePathEntry entry = (CIncludePathEntry)entries.get(0);
+ assertEquals(expected.getName(), entry.getName());
+ assertEquals(expected.getValue(), entry.getValue());
+ assertEquals(expected.getKind(), entry.getKind());
+ assertEquals(expected.getFlags(), entry.getFlags());
+ assertEquals(expected, entry);
+
+ assertEquals(new CIncludePathEntry("/path1", 0), entries.get(1));
+ assertEquals(new CIncludePathEntry("/path with spaces", 0), entries.get(2));
+ assertEquals(new CIncludePathEntry("/path with spaces2", 0), entries.get(3));
+ assertEquals(new CIncludePathEntry("/path with spaces3", 0), entries.get(4));
+ }
+
+ /**
+ * Parse variations of -I options.
+ */
+ public void testCIncludePathEntry() throws Exception {
+ // Create model project and accompanied descriptions
+ String projectName = getName();
+ IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
+ ICConfigurationDescription[] cfgDescriptions = getConfigurationDescriptions(project);
+ ICConfigurationDescription cfgDescription = cfgDescriptions[0];
+
+ IFile file=ResourceHelper.createFile(project, "file.cpp");
+ ICLanguageSetting ls = cfgDescription.getLanguageSettingForFile(file.getProjectRelativePath(), true);
+ String languageId = ls.getLanguageId();
+
+ // create GCCBuildCommandParser
+ GCCBuildCommandParser parser = (GCCBuildCommandParser) LanguageSettingsManager.getExtensionProviderCopy(GCC_BUILD_COMMAND_PARSER_EXT, true);
+
+ // parse line
+ parser.startup(cfgDescription, null);
+ parser.processLine("gcc"
+ // regular
+ " -I/path0 "
// space after -I
+ " -I /path1 "
@@ -544,7 +595,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
+ " -I '/path with spaces3'"
+ " file.cpp");
parser.shutdown();
-
+
// check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
CIncludePathEntry expected = new CIncludePathEntry("/path0", 0);
@@ -554,13 +605,13 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
assertEquals(expected.getKind(), entry.getKind());
assertEquals(expected.getFlags(), entry.getFlags());
assertEquals(expected, entry);
-
+
assertEquals(new CIncludePathEntry("/path1", 0), entries.get(1));
assertEquals(new CIncludePathEntry("/path with spaces", 0), entries.get(2));
assertEquals(new CIncludePathEntry("/path with spaces2", 0), entries.get(3));
assertEquals(new CIncludePathEntry("/path with spaces3", 0), entries.get(4));
}
-
+
/**
* Parse Mac Frameworks.
*/
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 b7153966a82..d114ae5fcd6 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
@@ -33,6 +33,8 @@ public class GCCBuildCommandParser extends AbstractBuildCommandParser implements
static final AbstractOptionParser[] optionParsers = {
new IncludePathOptionParser("-I\\s*([\"'])(.*)\\1", "$2"),
new IncludePathOptionParser("-I\\s*([^\\s\"']*)", "$1"),
+ new IncludePathOptionParser("-isystem\\s*([\"'])(.*)\\1", "$2"),
+ new IncludePathOptionParser("-isystem\\s*([^\\s\"']*)", "$1"),
new IncludePathOptionParser("-(F|(iframework))\\s*([\"'])(.*)\\3", "$4", ICSettingEntry.FRAMEWORKS_MAC),
new IncludePathOptionParser("-(F|(iframework))\\s*([^\\s\"']*)", "$3", ICSettingEntry.FRAMEWORKS_MAC),
new IncludeFileOptionParser("-include\\s*([\"'])(.*)\\1", "$2"),

Back to the top