Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2017-11-29 11:52:35 -0500
committerDoug Schaefer2017-11-29 12:18:12 -0500
commitd0e528d135360213ac35a1ec4ebd1c792d28b673 (patch)
tree49971c3071b30940ef80ed3f7c815c4cedbb13e0
parenta69ce37879c982b87b62f36e4233edacce8143a4 (diff)
downloadorg.eclipse.cdt-d0e528d135360213ac35a1ec4ebd1c792d28b673.tar.gz
org.eclipse.cdt-d0e528d135360213ac35a1ec4ebd1c792d28b673.tar.xz
org.eclipse.cdt-d0e528d135360213ac35a1ec4ebd1c792d28b673.zip
Fix manual include/macro settings handling for GCCToolChain.
We weren't passing in the base settings to the compiler for discovery. Also had a bug in the defines regex that mishandled values with spaces in them. Change-Id: I48183bfc3f61056324da009e58327cdcfed8754a
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java39
1 files changed, 31 insertions, 8 deletions
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
index 4b1bc8b16f..49ec715884 100644
--- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
@@ -252,9 +252,21 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
commandLine.add(getCommandPath(command).toString());
}
- if (baseScannerInfo != null && baseScannerInfo.getIncludePaths() != null) {
- for (String includePath : baseScannerInfo.getIncludePaths()) {
- commandLine.add("-I" + includePath); //$NON-NLS-1$
+ if (baseScannerInfo != null) {
+ if (baseScannerInfo.getIncludePaths() != null) {
+ for (String includePath : baseScannerInfo.getIncludePaths()) {
+ commandLine.add("-I" + includePath); //$NON-NLS-1$
+ }
+ }
+
+ if (baseScannerInfo.getDefinedSymbols() != null) {
+ for (Map.Entry<String, String> macro : baseScannerInfo.getDefinedSymbols().entrySet()) {
+ if (macro.getValue() != null && !macro.getValue().isEmpty()) {
+ commandLine.add("-D" + macro.getKey() + "=" + macro.getValue()); //$NON-NLS-1$
+ } else {
+ commandLine.add("-D" + macro.getKey()); //$NON-NLS-1$
+ }
+ }
}
}
@@ -358,9 +370,21 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
commandLine.add(getCommandPath(command).toString());
}
- if (baseScannerInfo != null && baseScannerInfo.getIncludePaths() != null) {
- for (String includePath : baseScannerInfo.getIncludePaths()) {
- commandLine.add("-I" + includePath); //$NON-NLS-1$
+ if (baseScannerInfo != null) {
+ if (baseScannerInfo.getIncludePaths() != null) {
+ for (String includePath : baseScannerInfo.getIncludePaths()) {
+ commandLine.add("-I" + includePath); //$NON-NLS-1$
+ }
+ }
+
+ if (baseScannerInfo.getDefinedSymbols() != null) {
+ for (Map.Entry<String, String> macro : baseScannerInfo.getDefinedSymbols().entrySet()) {
+ if (macro.getValue() != null && !macro.getValue().isEmpty()) {
+ commandLine.add("-D" + macro.getKey() + "=" + macro.getValue()); //$NON-NLS-1$
+ } else {
+ commandLine.add("-D" + macro.getKey()); //$NON-NLS-1$
+ }
+ }
}
}
@@ -405,7 +429,7 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
// Scan for the scanner info
Map<String, String> symbols = new HashMap<>();
List<String> includePath = new ArrayList<>();
- Pattern definePattern = Pattern.compile("#define (.*)\\s(.*)"); //$NON-NLS-1$
+ Pattern definePattern = Pattern.compile("#define ([^\\s]*)\\s(.*)"); //$NON-NLS-1$
boolean inIncludePaths = false;
try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
@@ -434,7 +458,6 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
Files.delete(tmpFile);
return new ExtendedScannerInfo(symbols, includePath.toArray(new String[includePath.size()]));
-
}
@Override

Back to the top