Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Evoy2004-07-29 09:04:34 -0400
committerSean Evoy2004-07-29 09:04:34 -0400
commit9b08f32b17433db34a0a3b87b2f4078aa1ebc414 (patch)
tree87d35a9badeb1b8096e6528508e2250b0095fb38
parentcc96931d3e7ef989166850e1d9dc9b62e3454d79 (diff)
downloadorg.eclipse.cdt-9b08f32b17433db34a0a3b87b2f4078aa1ebc414.tar.gz
org.eclipse.cdt-9b08f32b17433db34a0a3b87b2f4078aa1ebc414.tar.xz
org.eclipse.cdt-9b08f32b17433db34a0a3b87b2f4078aa1ebc414.zip
Commit for Vlad Hirsl -- The default external scanner info collector was having problems with the output of GCC in non-utf8 locales. It now makes sure the locale is set to utf-8 when it runs GCC on *nix systems
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DefaultExternalScannerInfoProvider.java9
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerInfoCollector.java4
2 files changed, 13 insertions, 0 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DefaultExternalScannerInfoProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DefaultExternalScannerInfoProvider.java
index 68ec365c9a2..35bd88e0629 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DefaultExternalScannerInfoProvider.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DefaultExternalScannerInfoProvider.java
@@ -52,6 +52,7 @@ public class DefaultExternalScannerInfoProvider implements IExternalScannerInfoP
private static final String EXTERNAL_SI_PROVIDER_ERROR = "ExternalScannerInfoProvider.Provider_Error"; //$NON-NLS-1$
private static final String EXTERNAL_SI_PROVIDER_CONSOLE_ID = MakeCorePlugin.getUniqueIdentifier() + ".ExternalScannerInfoProviderConsole"; //$NON-NLS-1$
+ private static final String LANG_ENV_VAR = "LANG";
private IPath fWorkingDirectory;
private IPath fCompileCommand;
@@ -224,6 +225,14 @@ public class DefaultExternalScannerInfoProvider implements IExternalScannerInfoP
Properties props = launcher.getEnvironment();
props.put("CWD", fWorkingDirectory.toOSString()); //$NON-NLS-1$
props.put("PWD", fWorkingDirectory.toOSString()); //$NON-NLS-1$
+ // On POSIX (Linux, UNIX) systems reset LANG variable to English with UTF-8 encoding
+ // since GNU compilers can handle only UTF-8 characters. English language is chosen
+ // beacuse GNU compilers inconsistently handle different locales when generating
+ // output of the 'gcc -v' command. Include paths with locale characters will be
+ // handled properly regardless of the language as long as the encoding is set to UTF-8.
+ if (props.containsKey(LANG_ENV_VAR)) {
+ props.put(LANG_ENV_VAR, "en_US.UTF-8"); //$NON-NLS-1$
+ }
String[] env = null;
ArrayList envList = new ArrayList();
Enumeration names = props.propertyNames();
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerInfoCollector.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerInfoCollector.java
index ab436e7104f..16f9eb468bd 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerInfoCollector.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerInfoCollector.java
@@ -36,6 +36,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SubProgressMonitor;
@@ -372,6 +373,9 @@ public class ScannerInfoCollector implements IScannerInfoCollector {
* @param monitor
*/
public synchronized void updateScannerConfiguration(IProject project, IProgressMonitor monitor) throws CoreException {
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
currentProject = project;
String projectName = project.getName();
// check TSO for the project

Back to the top