[m-rev.] for review: fix util/mfiltercc on Windows
Julien Fischer
jfischer at opturion.com
Wed Apr 8 10:51:36 AEST 2015
Hi Sebastian,
On Tue, 7 Apr 2015, Sebastian Godelet wrote:
> 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.
My only worry about that is the different support for Windows may have
been required for older versions of Windows. What version were you
using?
> --
>
> 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"])
A better solution here would be to avoid the use of the use_win32/0 predicate
at all, by just switching on the system env-type. (We should get rid
of the use_win32/0 predicate.)
Cheers,
Julien.
More information about the reviews
mailing list