summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabrizio Iannetti2013-08-16 03:45:52 (EDT)
committerAndrew Gvozdev2013-08-19 09:43:09 (EDT)
commit9a654efbe39594d40d7ff7dbac1c0037b3521ad6 (patch)
tree9158d7f74cca8f1ce4ac3536d4522bd4c881e85a
parentc3576791fb761859636650a41ddbe9dd6f9dd51b (diff)
downloadorg.eclipse.cdt-9a654efbe39594d40d7ff7dbac1c0037b3521ad6.zip
org.eclipse.cdt-9a654efbe39594d40d7ff7dbac1c0037b3521ad6.tar.gz
org.eclipse.cdt-9a654efbe39594d40d7ff7dbac1c0037b3521ad6.tar.bz2
NEW - bug 394959: CDT GCC build output parser does not understandrefs/changes/84/15584/2
-isystem https://bugs.eclipse.org/bugs/show_bug.cgi?id=394959 Simple patch to treat -isystem as -I, so that at least the paths show up in the configuration: - added two include parse options (copied/adapted from -I) - added junit test case (copied/adapted from -I) Change-Id: Ib3f3764ad75def49f6ec180bfecc0d6f42eabb1d Signed-off-by: Fabrizio Iannetti <fabrizio.iannetti@intel.com> Reviewed-on: https://git.eclipse.org/r/15584 Reviewed-by: Andrew Gvozdev <angvoz.dev@gmail.com> IP-Clean: Andrew Gvozdev <angvoz.dev@gmail.com> Tested-by: Andrew Gvozdev <angvoz.dev@gmail.com>
-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 be837ea..6f8224a 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 b715396..d114ae5 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"),