[m-rev.] for review: library grade check for `mmc --make'

Julien Fischer juliensf at csse.unimelb.edu.au
Fri May 16 17:50:30 AEST 2008


On Thu, 15 May 2008, Julien Fischer wrote:

> Estimated hours taken: 4
> Branches: main
>
> Add a check to `mmc --make' that causes it to check that any libraries
> (including the standard library) required for building an executable or
> library target are installed and accessible in the compilation grade.  Emit 
> an
> error message where they are not.  (The compiler's current behaviour varies
> from reporting .mih files are missing through to linker errors.)
>
> The check is implemented by searching for a library's .init file, which works
> since every library has a .init file and the .init file is grade dependent.
>
> compiler/options.m:
> 	Add a new option `--libgrade-install-check' to control the new check.
>
> compiler/handle_options.m:
> 	Only enable --libgrade-intall-check if --make is enabled.
>
> compiler/make.program_target.m:
> 	Implement the new check.
>
> 	When building a linked target, i.e. an executable or library,
> 	first check that all required libraries are available in the
> 	compilation grade.
>
> doc/user_guide.texi:
> 	Document the new option.

I left out the rather obvious there - this check should only be done
for the C grades since the structure of libraries with the other backends
means the above (probably) won't work.  The lack of such a check for
the non-C  backends is not likely to be a problem at the moment 
anyway, so I've modified the change to disable the check for those
backends.  (relative diff below.)

Julien.

diff -u compiler/handle_options.m compiler/handle_options.m
--- compiler/handle_options.m	16 May 2008 06:21:11 -0000
+++ compiler/handle_options.m	16 May 2008 07:41:07 -0000
@@ -505,6 +505,7 @@
          %   - dead procedure optimization
          %         intermodule optimization pulls in a lot of code which isn't
          %         needed, so ensure that this dead code is removed.
+        %   - no library grade installation check with `mmc --make'.

          (
              Target = target_il,
@@ -523,6 +524,7 @@
              globals.set_option(unboxed_no_tag_types, bool(no), !Globals),
              % globals.set_option(num_reserved_addresses, int(1), !Globals)
              globals.set_option(static_ground_terms, bool(no), !Globals),
+            globals.set_option(libgrade_install_check, bool(no), !Globals),

              (
                  HighLevelData = yes,
@@ -605,6 +607,7 @@
          %   - dead procedure optimization
          %         intermodule optimization pulls in a lot of code which isn't
          %         needed, so ensure that this dead code is removed.
+        %   - no library grade installation check with `mmc --make'.

          (
              Target = target_java,
@@ -623,7 +626,8 @@
              globals.set_option(unboxed_no_tag_types, bool(no), !Globals),
              globals.set_option(static_ground_terms, bool(no), !Globals),
              globals.set_option(put_nondet_env_on_heap, bool(yes), !Globals),
-
+            globals.set_option(libgrade_install_check, bool(no), !Globals),
+
              (
                  AutoIntermodOptimization = yes,
                  globals.set_option(intermodule_optimization, bool(yes),
@@ -649,6 +653,7 @@
          %   - no-can-compare-constants-as-ints
          %   - can-compare-compound-values
          %   - lexically-compare-constructors
+        %   - no library grade installation check with `mmc --make'

          (
              Target = target_erlang,
@@ -665,7 +670,8 @@
              globals.set_option(can_compare_compound_values, bool(yes),
                  !Globals),
              globals.set_option(lexically_order_constructors, bool(yes),
-                !Globals)
+                !Globals),
+            globals.set_option(libgrade_install_check, bool(no), !Globals)
          ;
              ( Target = target_c
              ; Target = target_il
--------------------------------------------------------------------------
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