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

Sebastian Godelet sebastian.godelet at outlook.com
Wed Apr 8 21:39:37 AEST 2015


the email I sent this afternoon was occidentally in HTML format,
sorry for this. The email software of my mobile phone is rather limited.

On 08/04/2015 11:54, Julien Fischer wrote:
> Hi,
> On Wed, Apr 8, 2015 at 1:36 PM, Sebastian Godelet
> <sebastian.godelet at outlook.com <mailto:sebastian.godelet at outlook.com>>
> wrote:
>     I tested with Windows 8.1, unfortunately I've no access to anything
>     older at the moment.
>     My guess is that Windows 7 will be working as well, as the user
>     space stuff didn't change that much. Question is, will a future
>     release of Mercury still support Windows XP.
> There's no reason to drop support for it at the moment IMO.
>     Java 8 already doesn't work on Windows 8.
> I thought I'd fixed that, but apparently I hadn't :-(
I meant to say Java 8 and newer .NET versions are already unsupported on 
Windows XP.
More and more software - in the future - will not run any longer on XP.

Well I just rebuilt the compiler on my Windows 8.1 machine with Java 8
and without the the attached diff I still get the same error.
 From looking at https://www.mercurylang.org/bugs/view.php?id=339 again 
I'm sure it is a change of behaviour within the java compiler itself.
Before the -J flag was just silently discarded when supplied via an 
@options file, now it throws an exception. Strangely I could not 
reproduce this on Linux.
 From their documentation 
(http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/javac.html) I 
just could extract this information:
"you can specify one or more files that themselves contain arguments to 
the javac command (except -J options)"
>     I'll try to test for that as well, maybe use Microsoft's free
>     virtual machines
> I can take a look on XP.
> Cheers,
> Julien.
-------------- next part --------------
diff --git a/compiler/compile_target_code.m b/compiler/compile_target_code.m
index cd6f956..0722f7f 100644
--- a/compiler/compile_target_code.m
+++ b/compiler/compile_target_code.m
@@ -1125,10 +1125,18 @@ compile_java_files(ErrorStream, JavaFiles, Globals, Succeeded, !IO) :-
     % Also be careful that each option is separated by spaces.
     JoinedJavaFiles = string.join_list(" ", JavaFiles),
     string.append_list([InclOpt, DirOpts,
-        Target_DebugOpt, JAVAFLAGS, " ", JoinedJavaFiles], CommandArgs),
+        Target_DebugOpt, " ", JoinedJavaFiles], CommandArgs),
+    % The -J flags for the Java launcher called by javac must not be put into
+    % an @argument file, so iff they are set, they are added directly to
+    % the executable path.
+    ( JAVAFLAGS = "" ->
+        JavaCompilerWithFlags = JavaCompiler
+    ;
+        JavaCompilerWithFlags = JavaCompiler ++ " " ++ JAVAFLAGS
+    ),
     invoke_long_system_command_maybe_filter_output(Globals, ErrorStream,
-        cmd_verbose_commands, JavaCompiler, CommandArgs, MaybeMFilterJavac,
-        Succeeded, !IO).
+        cmd_verbose_commands, JavaCompilerWithFlags, CommandArgs,
+        MaybeMFilterJavac, Succeeded, !IO).
 :- func java_classpath_separator = string.

More information about the reviews mailing list