[m-rev.] diff: fix bug in mmc --make

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Oct 18 01:14:46 AEST 2006


Estimated hours taken: 2.5
Branches: main

Fix a bug in mmc --make.

compiler/options_file.m:
 	Fix a bug in mmc --make that was introduced in Zoltan's recent change
 	to this file (r1.38).  The sublists of compiler flags were being
 	appended the wrong way around.

 	Add a comment pointing out that the order in which sublists of flags
 	are appended is important.

Julien.

Index: options_file.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/options_file.m,v
retrieving revision 1.38
diff -u -r1.38 options_file.m
--- options_file.m	15 Oct 2006 23:26:48 -0000	1.38
+++ options_file.m	17 Oct 2006 15:00:21 -0000
@@ -1042,9 +1042,19 @@
      ;
          ModuleFlagsResult = var_result_unset
      ),
-    Result = list.foldl(combine_var_results,
-        [DefaultFlagsResult, FlagsResult, ExtraFlagsResult, ModuleFlagsResult],
-        var_result_unset).
+    %
+    % NOTE: the order in which these lists of flags are added together is
+    %       important.  In the resulting set the flags from DefaultFlagsResult
+    %       *must* occur before those in FlagsResult, which in turn *must*
+    %       occur before those in ExtraFlagsResult ... etc.
+    %       Failing to maintain this order will result in the user being unable
+    %       to override the default value of many of the compiler's options.
+    %
+    Result =
+        DefaultFlagsResult  `combine_var_results`
+        FlagsResult         `combine_var_results`
+        ExtraFlagsResult    `combine_var_results`
+        ModuleFlagsResult.

  :- func combine_var_results(variable_result(list(T)), variable_result(list(T)))
      = variable_result(list(T)).

--------------------------------------------------------------------------
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