[m-rev.] for review: fix util/mfiltercc on Windows

Sebastian Godelet sebastian.godelet at outlook.com
Wed Apr 8 00:01:29 AEST 2015


While trying to figure out why util/mfiltercc is not filtering that gcc
`used but undefined' messages on Windows using either cmd.exe or
the msys shell, I noticed that command redirection is handled
differently on the win32 platform.
So just removing the use_win32 specific code in compiler/module_cmds.m
and building the compiler itself and all other Mercury programs I did
not notice any observable difference besides the correct filtering of
that gcc warning.

--

fix util/mfiltercc on Windows

Remove Windows specific error redirection handling to enable the 
mfiltercc functionality.

compiler/module_cmds.m:
     see above.

--

diff --git a/compiler/module_cmds.m b/compiler/module_cmds.m
index e0c7770..03c3219 100644
--- a/compiler/module_cmds.m
+++ b/compiler/module_cmds.m
@@ -568,10 +568,6 @@ invoke_system_command_maybe_filter_output(Globals, 
ErrorStream, Verbosity,
          % XXX can't use Bourne shell syntax to redirect on .NET
          % XXX the output will go to the wrong place!
          CommandRedirected = Command
-    ; use_win32 ->
-        % On windows we can't in general redirect standard error in the
-        % shell.
-        CommandRedirected = Command ++ " > " ++ TmpFile
      ;
          CommandRedirected =
              string.append_list([Command, " > ", TmpFile, " 2>&1"])
@@ -608,19 +604,14 @@ invoke_system_command_maybe_filter_output(Globals, 
ErrorStream, Verbosity,
          io.make_temp(ProcessedTmpFile, !IO),

          % XXX we should get rid of use_win32
-        ( use_win32 ->
+        (
+            use_win32,
              get_system_env_type(Globals, SystemEnvType),
-            ( SystemEnvType = env_type_powershell ->
-                ProcessOutputRedirected = string.append_list(
-                    ["Get-Content ", TmpFile, " | ", ProcessOutput,
-                        " > ", ProcessedTmpFile, " 2>&1"])
-            ;
-                % On windows we can't in general redirect standard
-                % error in the shell.
-                ProcessOutputRedirected = string.append_list(
-                    [ProcessOutput, " < ", TmpFile, " > ",
-                        ProcessedTmpFile])
-            )
+            SystemEnvType = env_type_powershell
+        ->
+            ProcessOutputRedirected = string.append_list(
+                ["Get-Content ", TmpFile, " | ", ProcessOutput,
+                    " > ", ProcessedTmpFile, " 2>&1"])
          ;
              ProcessOutputRedirected = string.append_list(
                  [ProcessOutput, " < ", TmpFile, " > ",



More information about the reviews mailing list