Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2017-10-19 16:51:21 +0000
committerDoug Schaefer2017-10-19 16:52:38 +0000
commit50756f3f18138b33f0b004461503c77c12e85096 (patch)
treeb9695a9f5a299c1299a715f5712daec75dc865c6 /build/org.eclipse.cdt.build.gcc.core
parent8a45638df7e16aab861b54fee882477b3aeee4f2 (diff)
downloadorg.eclipse.cdt-50756f3f18138b33f0b004461503c77c12e85096.tar.gz
org.eclipse.cdt-50756f3f18138b33f0b004461503c77c12e85096.tar.xz
org.eclipse.cdt-50756f3f18138b33f0b004461503c77c12e85096.zip
Fix bugs with emscripten and scannerInfo.
Diffstat (limited to 'build/org.eclipse.cdt.build.gcc.core')
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java18
1 files changed, 14 insertions, 4 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 1425a4f0da8..86af92019d3 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
@@ -13,6 +13,7 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
@@ -255,12 +256,12 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
addDiscoveryOptions(commandLine);
commandLine.addAll(commandStrings.subList(1, commandStrings.size()));
- // Strip quotes from the args on Windows
+ // Strip surrounding quotes from the args on Windows
if (Platform.OS_WIN32.equals(Platform.getOS())) {
for (int i = 0; i < commandLine.size(); i++) {
String arg = commandLine.get(i);
- if (arg.contains("\"")) { //$NON-NLS-1$
- commandLine.set(i, arg.replaceAll("\"", "")); //$NON-NLS-1$ //$NON-NLS-2$
+ if (arg.startsWith("\"") && arg.endsWith("\"")) { //$NON-NLS-1$ //$NON-NLS-2$
+ commandLine.set(i, arg.substring(1, arg.length() - 1));
}
}
}
@@ -284,7 +285,12 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
for (int i = 1; i < commandLine.size(); ++i) {
if (!commandLine.get(i).startsWith("-")) { //$NON-NLS-1$
// TODO optimize by dealing with multi arg options like -o
- Path filePath = buildDirectory.resolve(commandLine.get(i));
+ Path filePath;
+ try {
+ filePath = buildDirectory.resolve(commandLine.get(i));
+ } catch (InvalidPathException e) {
+ continue;
+ }
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(filePath.toUri());
if (files.length > 0 && files[0].exists()) {
// replace it with a temp file
@@ -479,6 +485,10 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
} else if (cCommand.contains("clang")) { //$NON-NLS-1$
cppCommand = cCommand.replace("clang", "clang++"); //$NON-NLS-1$ //$NON-NLS-2$
commands = new String[] { cCommand, cppCommand };
+ } else if (cCommand.contains("emcc")) { //$NON-NLS-1$
+ // TODO Hack for emscripten. Can we generalize?
+ cppCommand = cCommand.replace("emcc", "em++"); //$NON-NLS-1$ //$NON-NLS-2$
+ commands = new String[] { cCommand, cppCommand };
} else {
commands = new String[] { cCommand };
}

Back to the top