[m-rev.] diff: fix --erlang option

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Jun 18 22:35:21 AEST 2012


Branches: main, 11.07

Fix a problem with the handling of the erlang grade inside the compiler.

compiler/handle_options.m:
 	Fix inconsistencies between the options that are set for
 	--target erlang and what options grade_component_table/2 expects
 	to be set for the erlang grade.  These inconsistencies meant that
 	the --erlang option did not work as expected, but --grade erlang
 	did.  The fix explicitly sets the values of all (relevant) LLDS and MLDS
 	compilation model options to known values when targeting Erlang,
 	Although these options do not affect the Erlang backend, they do
 	affect the computation of grade strings.

Julien.

Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.381
diff -u -r1.381 handle_options.m
--- compiler/handle_options.m	8 Jun 2012 15:36:55 -0000	1.381
+++ compiler/handle_options.m	18 Jun 2012 12:20:12 -0000
@@ -950,7 +950,17 @@
          globals.set_option(lexically_order_constructors, bool(yes),
              !Globals),
          globals.set_option(libgrade_install_check, bool(no), !Globals),
-        globals.set_option(cross_compiling, bool(yes), !Globals)
+        globals.set_option(cross_compiling, bool(yes), !Globals),
+
+        % The following options do not directly affect the Erlang backend,
+        % however we need to ensure they are set to values that are consistent
+        % with what the predicate grade_component_table/2 (below) expects.
+        %
+        globals.set_option(gcc_non_local_gotos, bool(no), !Globals),
+        globals.set_option(gcc_global_registers, bool(no), !Globals),
+        globals.set_option(asm_labels, bool(no), !Globals),
+        globals.set_option(highlevel_code, bool(no), !Globals),
+        globals.set_option(highlevel_data, bool(no), !Globals)
      ;
          ( Target = target_c
          ; Target = target_il
@@ -2766,7 +2776,7 @@
          Components = [],
          Grade = "none"
      ;
-        Components = [_|_],
+        Components = [_ | _],
          construct_string(Components, Grade)
      ).

@@ -2774,9 +2784,9 @@
      is det.

  construct_string([], "").
-construct_string([_ - Bit|Bits], Grade) :-
+construct_string([_ - Bit | Bits], Grade) :-
      (
-        Bits = [_|_],
+        Bits = [_ | _],
          construct_string(Bits, Grade0),
          string.append_list([Bit, ".", Grade0], Grade)
      ;
@@ -2954,8 +2964,8 @@
          gcc_non_local_gotos     - bool(no),
          gcc_global_registers    - bool(no),
          gcc_nested_functions    - bool(no),
-        highlevel_code          - bool(yes),
-        highlevel_data          - bool(yes)],
+        highlevel_code          - bool(no),
+        highlevel_data          - bool(no)],
          yes([string("erlang")]), yes).

      % Parallelism/multithreading components.

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list