Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParser.java32
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParser.java23
2 files changed, 37 insertions, 18 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParser.java
index afa509fb401..42fb0651479 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParser.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParser.java
@@ -58,21 +58,23 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
* @return String[]
*/
public String[] getCompilerCommands() {
- SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
- getSCProfileInstance(project, ScannerConfigProfileManager.NULL_PROFILE_ID);
- BuildOutputProvider boProvider = profileInstance.getProfile().getBuildOutputProviderElement();
- if (boProvider != null) {
- String compilerCommandsString = boProvider.getScannerInfoConsoleParser().getCompilerCommands();
- if (compilerCommandsString != null && compilerCommandsString.length() > 0) {
- String[] compilerCommands = compilerCommandsString.split(",\\s+"); //$NON-NLS-1$
- if (compilerCommands.length > 0) {
- String[] compilerInvocation = new String[COMPILER_INVOCATION.length + compilerCommands.length];
- System.arraycopy(COMPILER_INVOCATION, 0, compilerInvocation, 0, COMPILER_INVOCATION.length);
- System.arraycopy(compilerCommands, 0, compilerInvocation, COMPILER_INVOCATION.length, compilerCommands.length);
- return compilerInvocation;
- }
- }
- }
+ if (project != null) {
+ SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
+ getSCProfileInstance(project, ScannerConfigProfileManager.NULL_PROFILE_ID);
+ BuildOutputProvider boProvider = profileInstance.getProfile().getBuildOutputProviderElement();
+ if (boProvider != null) {
+ String compilerCommandsString = boProvider.getScannerInfoConsoleParser().getCompilerCommands();
+ if (compilerCommandsString != null && compilerCommandsString.length() > 0) {
+ String[] compilerCommands = compilerCommandsString.split(",\\s+"); //$NON-NLS-1$
+ if (compilerCommands.length > 0) {
+ String[] compilerInvocation = new String[COMPILER_INVOCATION.length + compilerCommands.length];
+ System.arraycopy(COMPILER_INVOCATION, 0, compilerInvocation, 0, COMPILER_INVOCATION.length);
+ System.arraycopy(compilerCommands, 0, compilerInvocation, COMPILER_INVOCATION.length, compilerCommands.length);
+ return compilerInvocation;
+ }
+ }
+ }
+ }
return COMPILER_INVOCATION;
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParser.java
index e2c8290d047..a365051cff6 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParser.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParser.java
@@ -125,10 +125,27 @@ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser {
if (fUtil != null) {
IPath pFilePath = fUtil.getAbsolutePath(filePath);
String shortFileName = pFilePath.removeFileExtension().lastSegment();
- String genericLine = line.replaceAll(filePath, "LONG_NAME"); //$NON-NLS-1$
- genericLine = genericLine.replaceAll(shortFileName+"\\.", "SHORT_NAME\\."); //$NON-NLS-1$ //$NON-NLS-2$
- CCommandDSC cmd = fUtil.getNewCCommandDSC(genericLine, extensionsIndex > 0);
+ // generalize occurances of the file name
+ StringBuffer genericLine = new StringBuffer();
+ for (int i = 0; i < split.length; i++) {
+ String token = split[i];
+ if (token.equals("-include") || token.equals("-imacros")) { //$NON-NLS-1$ //$NON-NLS-2$
+ ++i;
+ genericLine.append(token);
+ genericLine.append(' ');
+ }
+ else if (token.equals(filePath)) {
+ split[i] = "LONG_NAME"; //$NON-NLS-1$
+ }
+ else if (token.startsWith(shortFileName)) {
+ split[i] = token.replaceFirst(shortFileName, "SHORT_NAME"); //$NON-NLS-1$
+ }
+ genericLine.append(split[i]);
+ genericLine.append(' ');
+ }
+
+ CCommandDSC cmd = fUtil.getNewCCommandDSC(genericLine.toString(), extensionsIndex > 0);
if (getProject().getLocation().isPrefixOf(pFilePath)) {
List cmdList = new ArrayList();
cmdList.add(cmd);

Back to the top