mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
NEW - bug 394959: CDT GCC build output parser does not understand
-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>
This commit is contained in:
parent
c3576791fb
commit
9a654efbe3
2 changed files with 62 additions and 9 deletions
|
@ -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,17 +531,17 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
|||
parser.startup(cfgDescription, null);
|
||||
parser.processLine("gcc"
|
||||
// regular
|
||||
+ " -I/path0 "
|
||||
// space after -I
|
||||
+ " -I /path1 "
|
||||
+ " -isystem/path0 "
|
||||
// space after -isystem
|
||||
+ " -isystem /path1 "
|
||||
// unknown option, should be ignored
|
||||
+ " -? "
|
||||
// double-quoted path with spaces
|
||||
+ " -I\"/path with spaces\""
|
||||
+ " -isystem\"/path with spaces\""
|
||||
// single-quoted path with spaces
|
||||
+ " -I'/path with spaces2'"
|
||||
// second single-quoted and space after -I
|
||||
+ " -I '/path with spaces3'"
|
||||
+ " -isystem'/path with spaces2'"
|
||||
// second single-quoted and space after -isystem
|
||||
+ " -isystem '/path with spaces3'"
|
||||
+ " file.cpp");
|
||||
parser.shutdown();
|
||||
|
||||
|
@ -561,6 +561,57 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
|||
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 "
|
||||
// unknown option, should be ignored
|
||||
+ " -? "
|
||||
// double-quoted path with spaces
|
||||
+ " -I\"/path with spaces\""
|
||||
// single-quoted path with spaces
|
||||
+ " -I'/path with spaces2'"
|
||||
// second single-quoted and space after -I
|
||||
+ " -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);
|
||||
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 Mac Frameworks.
|
||||
*/
|
||||
|
|
|
@ -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"),
|
||||
|
|
Loading…
Add table
Reference in a new issue