[m-rev.] for review: add csharp compiler output option

Sebastian Godelet sebastian.godelet at outlook.com
Sun Apr 5 17:36:39 AEST 2015


Hi,

I hope this is sufficient:

--

Add --output-csharp-compiler option

In order to support more complicated linking scenarios linking .NET code
with Mercury in the C# grade, add the --output-csharp-compiler option
in the same way --output-c-compiler-type and --output-cc work.
This way makefiles can use something like:
CS_COMPILER := $(shell $(MMC) --output-csharp-compiler)

compiler/mercury_compile.m:
     Output the global csharp_compiler if the boolean option
     output_csharp_compiler is set.

compiler/options.m:
     Define the output_csharp_compiler option and provide the help text.

doc/user_guide.texi:
     Document the output option and fix a spelling mistake.

--

diff --git a/compiler/mercury_compile.m b/compiler/mercury_compile.m
index f60b5a6..035a325 100644
--- a/compiler/mercury_compile.m
+++ b/compiler/mercury_compile.m
@@ -372,6 +372,7 @@ main_after_setup(DetectedGradeFlags, 
OptionVariables, OptionArgs, Args,
      globals.lookup_bool_option(Globals, output_cc, OutputCC),
      globals.lookup_bool_option(Globals, output_c_compiler_type, 
OutputCCType),
      globals.lookup_bool_option(Globals, output_cflags, OutputCFlags),
+    globals.lookup_bool_option(Globals, output_csharp_compiler, OutputCSC),
      globals.lookup_bool_option(Globals, output_csharp_compiler_type,
          OutputCSCType),
      globals.lookup_bool_option(Globals, output_library_link_flags,
@@ -442,6 +443,10 @@ main_after_setup(DetectedGradeFlags, 
OptionVariables, OptionArgs, Args,
          io.stdout_stream(StdOut, !IO),
          output_c_compiler_flags(Globals, StdOut, !IO),
          io.nl(StdOut, !IO)
+    ; OutputCSC = yes ->
+        globals.lookup_string_option(Globals, csharp_compiler, CSC),
+        io.stdout_stream(StdOut, !IO),
+        io.write_string(StdOut, CSC ++ "\n", !IO)
      ; OutputCSCType = yes ->
          globals.lookup_string_option(Globals, csharp_compiler_type, 
CSC_Type),
          io.stdout_stream(StdOut, !IO),
diff --git a/compiler/options.m b/compiler/options.m
index 495aa0c..14b495b 100644
--- a/compiler/options.m
+++ b/compiler/options.m
@@ -209,6 +209,7 @@
      ;       output_libgrades
      ;       output_cc
      ;       output_c_compiler_type
+    ;       output_csharp_compiler
      ;       output_csharp_compiler_type
      ;       output_cflags
      ;       output_library_link_flags
@@ -1216,6 +1217,7 @@ option_defaults_2(output_option, [
      output_libgrades                    -   bool(no),
      output_cc                           -   bool(no),
      output_c_compiler_type              -   bool(no),
+    output_csharp_compiler              -   bool(no),
      output_csharp_compiler_type         -   bool(no),
      output_cflags                       -   bool(no),
      output_library_link_flags           -   bool(no),
@@ -2127,6 +2129,7 @@ long_option("output-libgrades", 
output_libgrades).
  long_option("output-cc",                output_cc).
  long_option("output-cc-type",           output_c_compiler_type).
  long_option("output-c-compiler-type",   output_c_compiler_type).
+long_option("output-csharp-compiler",   output_csharp_compiler).
  long_option("output-csharp-compiler-type", output_csharp_compiler_type).
  long_option("output-cflags",            output_cflags).
  long_option("output-library-link-flags",    output_library_link_flags).
@@ -3887,6 +3890,9 @@ options_help_output -->
          "--output-cflags",
          "\tPrint the flags with which the C compiler will be invoked",
          "\tto the standard output.",
+        "--output-csharp-compiler",
+        "\tPrint the command used to invoke the C# compiler to the",
+        "\tstandard output.",
          "--output-csharp-compiler-type",
          "\tPrint the C# compiler type to the standard output.",
          "--output-library-link-flags",
diff --git a/doc/user_guide.texi b/doc/user_guide.texi
index 2551c39..8cfcdee 100644
--- a/doc/user_guide.texi
+++ b/doc/user_guide.texi
@@ -7061,7 +7061,7 @@ be installed should be built to the standard output.
  @sp 1
  @item --output-cc
  @findex --output-cc
-Print the command used to invoke C compiler to the standard output.
+Print the command used to invoke the C compiler to the standard output.

  @sp 1
  @item --output-cc-type
@@ -7077,6 +7077,11 @@ Print the flags with which the C compiler will be 
invoked
  to the standard output.

  @sp 1
+ at item --output-csharp-compiler
+ at findex --output-csharp-compiler
+Print the command used to invoke the C# compiler to the standard output.
+
+ at sp 1
  @item --output-csharp-compiler-type
  @findex --output-csharp-compiler-type
  Print the C# compiler type to the standard output.

--

On 05/04/2015 13:31, Julien Fischer wrote:
> Hi,
>
> On Sat, 4 Apr 2015, Sebastian Godelet wrote:
>
>> Add --output-csharp-compiler option
>>
>> In order to support more complicated linking scenarios linking .NET
>> code with Mercury in the C# grade, add the --output-csharp-compiler
>> option in the same way --output-c-compiler-type and --output-cc work.
>> This way makefiles can use something like:
>> CS_COMPILER := $(shell $(MMC) --output-csharp-compiler)
>>
>> compiler/mercury_compile.m:
>>    Output the global csharp_compiler if the boolean option
>>    output_csharp_compiler is set.
>>
>> compiler/options.m:
>>    Define the output_csharp_compiler option and provide the help text.
>
> You also need to document the new option in the user's guide; other than
> that this looks fine.
>
> Cheers,
> Julien.



More information about the reviews mailing list