[m-rev.] diff: Fix mmc --make not implying --use-subdirs.

Peter Wang novalazy at gmail.com
Thu Aug 10 11:25:02 AEST 2023


Commit 315fd9eb03b4afec6f6959fe600065e9a7295c70 introduced a regression
where mmc --make did not imply --use-subdirs in the compiler's global
options structure. In particular, this broke the --track-flags option
as it caused .track_flags files to be written to the current directory
instead of the Mercury/track_flagss subdirectory.

compiler/handle_options.m:
    When deciding the value for subdir_setting,
    look up the values of setting_only_use_subdirs and
    setting_only_use_grade_subdirs from the Globals variable
    (which include the implications of the --make option),
    not the original options table.
---
 compiler/handle_options.m | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/compiler/handle_options.m b/compiler/handle_options.m
index 8a1760898..6e1d500b5 100644
--- a/compiler/handle_options.m
+++ b/compiler/handle_options.m
@@ -1165,13 +1165,14 @@ convert_options_to_globals(ProgressStream, DefaultOptionTable, OptionTable0,
     postprocess_options_libgrades(!Globals, !Specs),
     globals_init_mutables(!.Globals, !IO),
 
-    lookup_bool_option(OptionTable0, setting_only_use_subdirs, UseSubdirs),
+    globals.lookup_bool_option(!.Globals, setting_only_use_subdirs,
+        UseSubdirs),
     (
         UseSubdirs = no,
         SubdirSetting = use_cur_dir
     ;
         UseSubdirs = yes,
-        lookup_bool_option(OptionTable0, setting_only_use_grade_subdirs,
+        globals.lookup_bool_option(!.Globals, setting_only_use_grade_subdirs,
             UseGradeSubdirs),
         (
             UseGradeSubdirs = no,
-- 
2.39.0



More information about the reviews mailing list