Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Hirsl2005-04-06 18:56:59 +0000
committerVladimir Hirsl2005-04-06 18:56:59 +0000
commite465c18c3419c22b6836e33a14044f93641eed27 (patch)
treecd1f8308bdd0e3e4fd131247e023ec5b009810cc
parent7a42a70017c5f0d533620e7cc5d95acfab124f1f (diff)
downloadorg.eclipse.cdt-e465c18c3419c22b6836e33a14044f93641eed27.tar.gz
org.eclipse.cdt-e465c18c3419c22b6836e33a14044f93641eed27.tar.xz
org.eclipse.cdt-e465c18c3419c22b6836e33a14044f93641eed27.zip
Proper handling of -I- command line option and generation of two sets of include paths:
for #include <...> directives and for #include "..." directives. Additional deleta all discovered scanner info action in DiscoveredPathContainerPage.
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IDiscoveredPathManager.java29
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollectorCleaner.java10
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerInfoTypes.java11
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java6
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java46
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java64
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParserUtility.java8
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java37
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java31
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SCDOptionsEnum.java8
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java93
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java45
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java163
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveryOptionsBlock.java3
14 files changed, 304 insertions, 250 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IDiscoveredPathManager.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IDiscoveredPathManager.java
index f370f012cd6..3070870424f 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IDiscoveredPathManager.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IDiscoveredPathManager.java
@@ -32,11 +32,27 @@ public interface IDiscoveredPathManager {
*/
Map getSymbols();
+ IDiscoveredScannerInfoSerializable getSerializable();
+ }
+
+ interface IPerProjectDiscoveredPathInfo extends IDiscoveredPathInfo {
+ void setIncludeMap(LinkedHashMap map);
+ void setSymbolMap(LinkedHashMap map);
+
+ LinkedHashMap getIncludeMap();
+ LinkedHashMap getSymbolMap();
+ }
+
+ interface IPerFileDiscoveredPathInfo extends IDiscoveredPathInfo {
/**
* Get include paths for the specific path (file)
*/
IPath[] getIncludePaths(IPath path);
/**
+ * Get quote include paths (for #include "...") for the specific path (file)
+ */
+ IPath[] getQuoteIncludePaths(IPath path);
+ /**
* Get defined symbols for the specific path (file)
*/
Map getSymbols(IPath path);
@@ -49,17 +65,8 @@ public interface IDiscoveredPathManager {
* Get macro files (gcc option -imacros) for the specific path (file)
*/
IPath[] getMacroFiles(IPath path);
-
- IDiscoveredScannerInfoSerializable getSerializable();
- ScannerConfigScope getScope();
-
- void setIncludeMap(LinkedHashMap map);
- void setSymbolMap(LinkedHashMap map);
-
- LinkedHashMap getIncludeMap();
- LinkedHashMap getSymbolMap();
- }
-
+ }
+
interface IDiscoveredScannerInfoSerializable {
/**
* Serialize discovered scanner info to an XML element
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollectorCleaner.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollectorCleaner.java
index 7373366a436..1153f80544b 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollectorCleaner.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollectorCleaner.java
@@ -19,14 +19,14 @@ import org.eclipse.core.resources.IResource;
*/
public interface IScannerInfoCollectorCleaner {
/**
- * Delete all discovered paths for a resource
+ * Delete all discovered paths for the resource
*
* @param project
*/
public void deleteAllPaths(IResource resource);
/**
- * Delete all discovered symbols for a resource
+ * Delete all discovered symbols for the resource
*
* @param project
*/
@@ -48,4 +48,10 @@ public interface IScannerInfoCollectorCleaner {
*/
public void deleteSymbol(IResource resource, String symbol);
+ /**
+ * Delete all discovered scanner info for the resource
+ *
+ * @param resource
+ */
+ public void deleteAll(IResource resource);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerInfoTypes.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerInfoTypes.java
index 00f5f60fbdf..4f4c37002ba 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerInfoTypes.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerInfoTypes.java
@@ -16,11 +16,12 @@ package org.eclipse.cdt.make.core.scannerconfig;
* @author vhirsl
*/
public class ScannerInfoTypes {
- public static final ScannerInfoTypes INCLUDE_PATHS = new ScannerInfoTypes(1);
- public static final ScannerInfoTypes SYMBOL_DEFINITIONS = new ScannerInfoTypes(2);
- public static final ScannerInfoTypes TARGET_SPECIFIC_OPTION = new ScannerInfoTypes(3) ;
- public static final ScannerInfoTypes COMPILER_VERSION_INFO = new ScannerInfoTypes(4);
- public static final ScannerInfoTypes COMPILER_COMMAND = new ScannerInfoTypes(5); // CCommandDSC
+ public static final ScannerInfoTypes COMPILER_COMMAND = new ScannerInfoTypes(1); // CCommandDSC
+ public static final ScannerInfoTypes INCLUDE_PATHS = new ScannerInfoTypes(2);
+ public static final ScannerInfoTypes QUOTE_INCLUDE_PATHS = new ScannerInfoTypes(3);
+ public static final ScannerInfoTypes SYMBOL_DEFINITIONS = new ScannerInfoTypes(4);
+ public static final ScannerInfoTypes TARGET_SPECIFIC_OPTION = new ScannerInfoTypes(5) ;
+ public static final ScannerInfoTypes COMPILER_VERSION_INFO = new ScannerInfoTypes(6);
private final int _enum;
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java
index 0d1f37626f6..a0b2ef4c190 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java
@@ -12,9 +12,9 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigScope;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredInfoListener;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
+import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
import org.eclipse.core.resources.IProject;
public class DiscoveredPathContainer extends AbstractDiscoveredPathContainer {
@@ -33,14 +33,14 @@ public class DiscoveredPathContainer extends AbstractDiscoveredPathContainer {
public void infoRemoved(IDiscoveredPathInfo info) {
if (info != null &&
- ScannerConfigScope.PROJECT_SCOPE.equals(info.getScope())) {
+ info instanceof IPerProjectDiscoveredPathInfo) {
fgPathEntries.remove(info.getProject());
}
}
public void infoChanged(IDiscoveredPathInfo info) {
if (info != null &&
- ScannerConfigScope.PROJECT_SCOPE.equals(info.getScope())) {
+ info instanceof IPerProjectDiscoveredPathInfo) {
fgPathEntries.remove(info.getProject());
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java
index 5fcc75adcaf..66807689441 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java
@@ -15,9 +15,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigScope;
-import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable;
+import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
import org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector;
import org.eclipse.core.resources.IProject;
@@ -28,7 +27,7 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
-public class DiscoveredPathInfo implements IDiscoveredPathInfo, IDiscoveredScannerInfoSerializable {
+public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDiscoveredScannerInfoSerializable {
public static final String INCLUDE_PATH = "includePath"; //$NON-NLS-1$
public static final String PATH = "path"; //$NON-NLS-1$
public static final String DEFINED_SYMBOL = "definedSymbol"; //$NON-NLS-1$
@@ -199,51 +198,10 @@ public class DiscoveredPathInfo implements IDiscoveredPathInfo, IDiscoveredScann
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths(org.eclipse.core.runtime.IPath)
- */
- public IPath[] getIncludePaths(IPath path) {
- if (project.getFile(path) != null) {
- return getIncludePaths();
- }
- return new IPath[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSymbols(org.eclipse.core.runtime.IPath)
- */
- public Map getSymbols(IPath path) {
- if (project.getFile(path) != null) {
- return getSymbols();
- }
- return new HashMap(0);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludeFiles(org.eclipse.core.runtime.IPath)
- */
- public IPath[] getIncludeFiles(IPath path) {
- return new IPath[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getMacroFiles(org.eclipse.core.runtime.IPath)
- */
- public IPath[] getMacroFiles(IPath path) {
- return new IPath[0];
- }
-
- /* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSerializable()
*/
public IDiscoveredScannerInfoSerializable getSerializable() {
return this;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getScope()
- */
- public ScannerConfigScope getScope() {
- return ScannerConfigScope.PROJECT_SCOPE;
- }
-
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java
index 5a2949ea070..cdbe949a98b 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java
@@ -20,9 +20,9 @@ import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.core.model.IPathEntryContainerExtension;
import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigScope;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredInfoListener;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
+import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -46,14 +46,14 @@ public class PerFileDiscoveredPathContainer extends AbstractDiscoveredPathContai
public void infoRemoved(IDiscoveredPathInfo info) {
if (info != null &&
- ScannerConfigScope.FILE_SCOPE.equals(info.getScope())) {
+ info instanceof IPerFileDiscoveredPathInfo) {
fgPathEntries.remove(info.getProject());
}
}
public void infoChanged(IDiscoveredPathInfo info) {
if (info != null &&
- ScannerConfigScope.FILE_SCOPE.equals(info.getScope())) {
+ info instanceof IPerFileDiscoveredPathInfo) {
fgPathEntries.remove(info.getProject());
}
}
@@ -67,34 +67,42 @@ public class PerFileDiscoveredPathContainer extends AbstractDiscoveredPathContai
* @see org.eclipse.cdt.core.model.IPathEntryContainerExtension#getPathEntries(org.eclipse.core.runtime.IPath, int)
*/
public IPathEntry[] getPathEntries(IPath path, int mask) {
- IDiscoveredPathInfo info;
ArrayList entries = new ArrayList();
try {
- info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject);
- if ((mask & IPathEntry.CDT_INCLUDE) != 0) {
- // TODO: Vlad how do we differentiate local includes from system includes
- IPath[] includes = info.getIncludePaths(path);
- for (int i = 0; i < includes.length; i++) {
- entries.add(CoreModel.newIncludeEntry(path, Path.EMPTY, includes[i], true));
- }
- }
- if ((mask & IPathEntry.CDT_MACRO) != 0) {
- Map syms = info.getSymbols(path);
- for (Iterator iter = syms.entrySet().iterator(); iter.hasNext(); ) {
- Entry entry = (Entry)iter.next();
- entries.add(CoreModel.newMacroEntry(path, (String)entry.getKey(), (String)entry.getValue())); //$NON-NLS-1$
- }
- }
- if ((mask & IPathEntry.CDT_INCLUDE_FILE) != 0) {
- IPath[] includeFiles = info.getIncludeFiles(path);
- for (int i = 0; i < includeFiles.length; i++) {
- entries.add(CoreModel.newIncludeFileEntry(path, includeFiles[i]));
+ IDiscoveredPathInfo info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject);
+ if (info instanceof IPerFileDiscoveredPathInfo) {
+ IPerFileDiscoveredPathInfo filePathInfo = (IPerFileDiscoveredPathInfo) info;
+
+ if ((mask & IPathEntry.CDT_INCLUDE) != 0) {
+ IPath[] includes = filePathInfo.getIncludePaths(path);
+ for (int i = 0; i < includes.length; i++) {
+ // add as a system include path
+ entries.add(CoreModel.newIncludeEntry(path, Path.EMPTY, includes[i], true));
+ }
+ includes = filePathInfo.getQuoteIncludePaths(path);
+ for (int i = 0; i < includes.length; i++) {
+ // add as a local include path
+ entries.add(CoreModel.newIncludeEntry(path, Path.EMPTY, includes[i], false));
+ }
+ }
+ if ((mask & IPathEntry.CDT_MACRO) != 0) {
+ Map syms = filePathInfo.getSymbols(path);
+ for (Iterator iter = syms.entrySet().iterator(); iter.hasNext(); ) {
+ Entry entry = (Entry)iter.next();
+ entries.add(CoreModel.newMacroEntry(path, (String)entry.getKey(), (String)entry.getValue())); //$NON-NLS-1$
+ }
+ }
+ if ((mask & IPathEntry.CDT_INCLUDE_FILE) != 0) {
+ IPath[] includeFiles = filePathInfo.getIncludeFiles(path);
+ for (int i = 0; i < includeFiles.length; i++) {
+ entries.add(CoreModel.newIncludeFileEntry(path, includeFiles[i]));
+ }
}
- }
- if ((mask & IPathEntry.CDT_MACRO_FILE) != 0) {
- IPath[] imacrosFiles = info.getMacroFiles(path);
- for (int i = 0; i < imacrosFiles.length; i++) {
- entries.add(CoreModel.newMacroFileEntry(path, imacrosFiles[i]));
+ if ((mask & IPathEntry.CDT_MACRO_FILE) != 0) {
+ IPath[] imacrosFiles = filePathInfo.getMacroFiles(path);
+ for (int i = 0; i < imacrosFiles.length; i++) {
+ entries.add(CoreModel.newMacroFileEntry(path, imacrosFiles[i]));
+ }
}
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParserUtility.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParserUtility.java
index 7a264b33a27..ed7bb8cfde7 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParserUtility.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParserUtility.java
@@ -140,6 +140,9 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
if (option.length() > 0) {
// ex. -I/dir
}
+ else if (SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.IDASH)) {
+ // -I- has no parameter
+ }
else {
// ex. -I /dir
// take a next token
@@ -149,11 +152,12 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
}
else break;
}
- if (SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.INCLUDE) ||
+ if (option.length() > 0 && (
+ SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.INCLUDE) ||
SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.INCLUDE_FILE) ||
SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.IMACROS_FILE) ||
SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.IDIRAFTER) ||
- SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.ISYSTEM)) {
+ SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.ISYSTEM))) {
option = (getAbsolutePath(option)).toString();
}
// add the pair
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java
index 89f2721aec0..642e041db39 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java
@@ -29,17 +29,23 @@ import org.eclipse.core.runtime.IPath;
* @author vhirsl
*/
public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser {
- private final String INCLUDE = "#include"; //$NON-NLS-1$
- private final String DEFINE = "#define"; //$NON-NLS-1$
- private final String COMMAND_ID_BEGIN = "begin generating scanner info for scd_cmd_"; //$NON-NLS-1$
- private final String COMMAND_ID_END = "end generating scanner info for scd_cmd_"; //$NON-NLS-1$
+ private final static String INCLUDE_PREAMBLE = "#include <...>"; //$NON-NLS-1$
+ private final static String QUOTE_INCLUDE_PREAMBLE = "#include \"...\""; //$NON-NLS-1$
+ private final static String DEFINE_PREAMBLE = "#define"; //$NON-NLS-1$
+ private final static String COMMAND_ID_BEGIN = "begin generating scanner info for scd_cmd_"; //$NON-NLS-1$
+ private final static String COMMAND_ID_END = "end generating scanner info for scd_cmd_"; //$NON-NLS-1$
+ private final static int NO_INCLUDES = 0;
+ private final static int QUOTE_INCLUDES = 1;
+ private final static int INCLUDES = 2;
+
private IProject fProject = null;
private IScannerInfoCollector fCollector = null;
- private boolean expectingIncludes = false;
+ private int expectingIncludes = NO_INCLUDES;
private List symbols;
private List includes;
+ private List quoteIncludes;
private int commandId = -1;
/* (non-Javadoc)
@@ -61,19 +67,21 @@ public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser {
commandId = Integer.parseInt(line.substring(COMMAND_ID_BEGIN.length()));
symbols = new ArrayList();
includes = new ArrayList();
+ quoteIncludes = new ArrayList();
}
else if (line.startsWith(COMMAND_ID_END)) {
Map scannerInfo = new HashMap();
scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes);
+ scannerInfo.put(ScannerInfoTypes.QUOTE_INCLUDE_PATHS, quoteIncludes);
scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
fCollector.contributeToScannerConfig(new Integer(commandId), scannerInfo);
commandId = -1;
rc = true;
}
// contribution of -dD option
- else if (line.startsWith(DEFINE)) {
+ else if (line.startsWith(DEFINE_PREAMBLE)) {
String[] defineParts = line.split("\\s+", 3); //$NON-NLS-1$
- if (defineParts[0].equals(DEFINE)) {
+ if (defineParts[0].equals(DEFINE_PREAMBLE)) {
String symbol = null;
switch (defineParts.length) {
case 2:
@@ -89,13 +97,20 @@ public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser {
}
}
// now get all the includes
- else if (line.startsWith(INCLUDE) && line.endsWith("search starts here:")) { //$NON-NLS-1$
- expectingIncludes = true;
+ else if (line.startsWith(QUOTE_INCLUDE_PREAMBLE) && line.endsWith("search starts here:")) { //$NON-NLS-1$
+ expectingIncludes = QUOTE_INCLUDES;
+ }
+ else if (line.startsWith(INCLUDE_PREAMBLE) && line.endsWith("search starts here:")) { //$NON-NLS-1$
+ expectingIncludes = INCLUDES;
}
else if (line.startsWith("End of search list.")) { //$NON-NLS-1$
- expectingIncludes = false;
+ expectingIncludes = NO_INCLUDES;
+ }
+ else if (expectingIncludes == QUOTE_INCLUDES) {
+ if (!quoteIncludes.contains(line))
+ quoteIncludes.add(line);
}
- else if (expectingIncludes) {
+ else if (expectingIncludes == INCLUDES) {
if (!includes.contains(line))
includes.add(line);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
index 71f4db7c2bd..2f576fa349e 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
@@ -33,6 +33,7 @@ public class CCommandDSC {
private final static String SI_ITEM_ELEM = "siItem"; //$NON-NLS-1$
private final static String KEY_ATTR = "key"; //$NON-NLS-1$
private final static String VALUE_ATTR = "value"; //$NON-NLS-1$
+ private final static String QUOTE_INCLUDE_ATTR = "quote"; //$NON-NLS-1$
private final static String KIND_ATTR = "kind"; //$NON-NLS-1$
private int commandId;
@@ -42,6 +43,7 @@ public class CCommandDSC {
private List symbols;
private List includes;
+ private List quoteIncludes;
/**
* @param cppFileType2
@@ -53,6 +55,7 @@ public class CCommandDSC {
symbols = new ArrayList();
includes = new ArrayList();
+ quoteIncludes = new ArrayList();
}
public boolean appliesToCPPFileType() {
@@ -176,6 +179,18 @@ public class CCommandDSC {
this.includes = includes;
}
/**
+ * @return Returns the quote include paths (for #include "...")
+ */
+ public List getQuoteIncludes() {
+ return quoteIncludes;
+ }
+ /**
+ * @param includes. Quaote include paths (for #include "...")
+ */
+ public void setQuoteIncludes(List includes) {
+ quoteIncludes = includes;
+