[m-rev.] for review: get tests/invalid working in the il grade
Peter Ross
pro at missioncriticalit.com
Fri Nov 8 02:45:27 AEDT 2002
Hi,
For fjh or stayl to review.
===================================================================
Estimated hours taken: 3
Branches: main
Gets the tests in tests/invalid working in the il grade.
compiler/options.m:
Add a new developer option, --no-automatic-intermodule-optimization.
This is used to turn off intermodule optimization in the
tests/invalid directory so that the error messages are no
longer generated during the --make-optimization-interface
process.
compiler/handle_options.m:
Test automatic-intermodule-optimization when determining
whether to turn intermodule optimization on in the il grade.
tests/invalid/Mercury.options:
tests/invalid/purity/Mercury.options:
Add --no-automatic-intermodule-optimization.
tests/invalid/foreign_singleton.err_exp2:
tests/invalid/foreign_type_2.err_exp2:
tests/invalid/pragma_c_code_dup_var.err_exp2:
tests/invalid/pragma_c_code_no_det.err_exp2:
Add a second expected error message for non C backends.
tests/invalid/impure_method_impl.m:
tests/invalid/multimode_missing_impure.m:
tests/invalid/multimode_syntax.m:
tests/invalid/pragma_c_code_no_det.m:
tests/invalid/purity/impure_func_t2.m:
tests/invalid/purity/impure_func_t3.m:
tests/invalid/purity/impure_func_t4.m:
tests/invalid/purity/impure_func_t5.m:
tests/invalid/purity/impure_func_t7.m:
tests/invalid/purity/impure_pred_t1.m:
tests/invalid/purity/impure_pred_t2.m:
tests/invalid/purity/purity.m:
Add Mercury implementations of foreign_code predicates.
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.157
diff -u -r1.157 handle_options.m
--- compiler/handle_options.m 4 Nov 2002 05:12:52 -0000 1.157
+++ compiler/handle_options.m 7 Nov 2002 15:34:26 -0000
@@ -367,7 +367,10 @@
globals__io_set_option(static_ground_terms, bool(no)),
globals__io_lookup_bool_option(highlevel_data, HighLevelData),
- ( { HighLevelData = yes } ->
+ globals__io_lookup_bool_option(
+ automatic_intermodule_optimization,
+ AutoIntermodOptimization),
+ ( { HighLevelData = yes, AutoIntermodOptimization = yes } ->
globals__io_set_option(intermodule_optimization,
bool(yes))
;
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.393
diff -u -r1.393 options.m
--- compiler/options.m 31 Oct 2002 14:47:05 -0000 1.393
+++ compiler/options.m 7 Nov 2002 15:34:32 -0000
@@ -390,6 +390,7 @@
; opt_space % default is to optimize time
; intermodule_optimization
; read_opt_files_transitively
+ ; automatic_intermodule_optimization
; use_opt_files
; use_trans_opt_files
; transitive_optimization
@@ -907,6 +908,7 @@
opt_space - special,
intermodule_optimization - bool(no),
read_opt_files_transitively - bool(yes),
+ automatic_intermodule_optimization - bool(yes),
use_opt_files - bool(no),
use_trans_opt_files - bool(no),
transitive_optimization - bool(no),
@@ -1465,6 +1467,10 @@
long_option("intermodule-optimization", intermodule_optimization).
long_option("intermodule-optimisation", intermodule_optimization).
long_option("read-opt-files-transitively", read_opt_files_transitively).
+long_option("automatic-intermodule-optimization",
+ automatic_intermodule_optimization).
+long_option("automatic-intermodule-optimisation",
+ automatic_intermodule_optimization).
long_option("use-opt-files", use_opt_files).
long_option("use-trans-opt-files", use_trans_opt_files).
long_option("transitive-intermodule-optimization",
@@ -3117,6 +3123,11 @@
"\tOnly read the inter-module optimization information",
"\tfor directly imported modules, not the transitive",
"\tclosure of the imports.",
+ /* Developer only option
+ "--no-automatic-intermodule-optimization",
+ "\tDon't automatically enable intermodule optimization for"
+ "\tthose backends which require it.",
+ */
"--use-opt-files",
"\tPerform inter-module optimization using any",
"\t`.opt' files which are already built,",
Index: tests/invalid/Mercury.options
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/Mercury.options,v
retrieving revision 1.2
diff -u -r1.2 Mercury.options
--- tests/invalid/Mercury.options 25 Oct 2002 07:51:02 -0000 1.2
+++ tests/invalid/Mercury.options 7 Nov 2002 15:34:32 -0000
@@ -2,46 +2,70 @@
# tests (in most cases reporting diagnostics when writing the `.opt'
# file). For those tests, we just disable inter-module optimization.
-MCFLAGS-aditi_errors = --aditi --no-intermodule-optimization
-MCFLAGS-aditi_state_errors = --aditi --no-intermodule-optimization
-MCFLAGS-aditi_update_derived_relation = --aditi --no-intermodule-optimization
-MCFLAGS-aditi_update_errors = --aditi --no-intermodule-optimization
-MCFLAGS-aditi_update_mode_errors = --aditi --no-intermodule-optimization
+MCFLAGS-aditi_errors = --aditi --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-aditi_state_errors = --aditi --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-aditi_update_derived_relation = --aditi --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-aditi_update_errors = --aditi --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-aditi_update_mode_errors = --aditi --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
MCFLAGS-any_mode = --infer-types
# XXX This test should work with --intermodule-optimization, but
# the compiler doesn't know whether items imported from `.opt' files
# were imported in the interface or the implementation. The error
# is reported correctly when building the `.opt' file.
-MCFLAGS-assert_in_interface = --no-intermodule-optimization
+MCFLAGS-assert_in_interface = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
-MCFLAGS-children = --no-intermodule-optimization
+MCFLAGS-children = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
MCFLAGS-duplicate_modes = --verbose-error-messages
-MCFLAGS-exported_mode = --infer-all --no-intermodule-optimization
+MCFLAGS-exported_mode = --infer-all --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
MCFLAGS-foreign_decl_line_number = --no-errorcheck-only --line-numbers --compile-only
MCFLAGS-foreign_singleton = --halt-at-warn
MCFLAGS-foreign_type = --compile-only
-MCFLAGS-foreign_type_2 = --no-intermodule-optimization
-MCFLAGS-foreign_type_visibility = --no-intermodule-optimization
-MCFLAGS-import_in_parent = --no-intermodule-optimization
-MCFLAGS-import_in_parent.sub = --no-intermodule-optimization
-MCFLAGS-imported_mode = --infer-all --no-intermodule-optimization
+MCFLAGS-foreign_type_2 = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-foreign_type_visibility = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-import_in_parent = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-import_in_parent.sub = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-imported_mode = --infer-all --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
MCFLAGS-missing_det_decls = --no-infer-det
MCFLAGS-missing_interface_import = --make-interface
-MCFLAGS-missing_parent_import = --no-intermodule-optimization
+MCFLAGS-missing_parent_import = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
MCFLAGS-multisoln_func = --infer-types
MCFLAGS-mode_inf = --infer-all
MCFLAGS-no_exports = --halt-at-warn
MCFLAGS-nonexistent_import = --no-verbose-make --make nonexistent_import
-MCFLAGS-overloading = --no-intermodule-optimization
-MCFLAGS-sub_c = --verbose-error-messages --no-intermodule-optimization
+MCFLAGS-overloading = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-sub_c = --verbose-error-messages --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
MCFLAGS-record_syntax_errors = --verbose-error-messages
-MCFLAGS-test_nested = --no-intermodule-optimization
-MCFLAGS-transitive_import = --no-intermodule-optimization
-MCFLAGS-transitive_import2 = --no-intermodule-optimization
-MCFLAGS-transitive_import_class = --no-intermodule-optimization
-MCFLAGS-transitive_import_class2 = --no-intermodule-optimization
-MCFLAGS-transitive_import_class3 = --no-intermodule-optimization
+MCFLAGS-test_nested = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-transitive_import = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-transitive_import2 = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-transitive_import_class = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-transitive_import_class2 = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-transitive_import_class3 = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
MCFLAGS-typeclass_mode = --infer-all
-MCFLAGS-undef_mod_qual = --no-intermodule-optimization
-MCFLAGS-undef_symbol = --no-intermodule-optimization
+MCFLAGS-undef_mod_qual = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-undef_symbol = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
Index: tests/invalid/foreign_singleton.err_exp2
===================================================================
RCS file: tests/invalid/foreign_singleton.err_exp2
diff -N tests/invalid/foreign_singleton.err_exp2
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/invalid/foreign_singleton.err_exp2 7 Nov 2002 15:34:32 -0000
@@ -0,0 +1,13 @@
+foreign_singleton.m:026: In clause for predicate `foreign_singleton:f/3':
+foreign_singleton.m:026: warning: variable `X' occurs only once in this scope.
+foreign_singleton.m:030: In clause for predicate `foreign_singleton:g/3':
+foreign_singleton.m:030: warning: variable `X' occurs only once in this scope.
+foreign_singleton.m:026: In clause for `f(out, di, uo)':
+foreign_singleton.m:026: mode error: argument 1 did not get sufficiently instantiated.
+foreign_singleton.m:026: Final instantiatedness of `X' was `free',
+foreign_singleton.m:026: expected final instantiatedness was `ground'.
+foreign_singleton.m:030: In clause for `g(out, di, uo)':
+foreign_singleton.m:030: mode error: argument 1 did not get sufficiently instantiated.
+foreign_singleton.m:030: Final instantiatedness of `X' was `free',
+foreign_singleton.m:030: expected final instantiatedness was `ground'.
+For more information, try recompiling with `-E'.
Index: tests/invalid/foreign_type_2.err_exp2
===================================================================
RCS file: tests/invalid/foreign_type_2.err_exp2
diff -N tests/invalid/foreign_type_2.err_exp2
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/invalid/foreign_type_2.err_exp2 7 Nov 2002 15:34:32 -0000
@@ -0,0 +1,4 @@
+foreign_type_2.m:018: In clause for function `foreign_type_2:unwrap_foreign/1':
+foreign_type_2.m:018: in argument 1 of clause head:
+foreign_type_2.m:018: error: undefined symbol `foreign/1'.
+For more information, try recompiling with `-E'.
Index: tests/invalid/impure_method_impl.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/impure_method_impl.m,v
retrieving revision 1.1
diff -u -r1.1 impure_method_impl.m
--- tests/invalid/impure_method_impl.m 27 Mar 2000 05:08:27 -0000 1.1
+++ tests/invalid/impure_method_impl.m 7 Nov 2002 15:34:32 -0000
@@ -29,4 +29,5 @@
:- pragma c_code(foo_m1(_F::in, Val::out), "Val = foo_counter;").
:- pragma c_code(foo_m2(_F::in, Val::out), "Val = foo_counter++;").
-
+foo_m1(_, 0).
+foo_m2(_, 0).
Index: tests/invalid/multimode_missing_impure.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/multimode_missing_impure.m,v
retrieving revision 1.1
diff -u -r1.1 multimode_missing_impure.m
--- tests/invalid/multimode_missing_impure.m 16 May 2001 17:28:43 -0000 1.1
+++ tests/invalid/multimode_missing_impure.m 7 Nov 2002 15:34:32 -0000
@@ -47,3 +47,4 @@
:- pred puts(string::in) is det.
:- pragma c_code(puts(S::in), [will_not_call_mercury], "puts(S)").
+puts(_).
Index: tests/invalid/multimode_syntax.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/multimode_syntax.m,v
retrieving revision 1.1
diff -u -r1.1 multimode_syntax.m
--- tests/invalid/multimode_syntax.m 16 May 2001 17:28:43 -0000 1.1
+++ tests/invalid/multimode_syntax.m 7 Nov 2002 15:34:32 -0000
@@ -53,3 +53,4 @@
:- impure pred puts(string::in) is det.
:- pragma c_code(puts(S::in), [will_not_call_mercury], "puts(S)").
+puts(_).
Index: tests/invalid/pragma_c_code_dup_var.err_exp2
===================================================================
RCS file: tests/invalid/pragma_c_code_dup_var.err_exp2
diff -N tests/invalid/pragma_c_code_dup_var.err_exp2
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/invalid/pragma_c_code_dup_var.err_exp2 7 Nov 2002 15:34:32 -0000
@@ -0,0 +1,3 @@
+pragma_c_code_dup_var.m:014: Error: no clauses for
+pragma_c_code_dup_var.m:014: function `pragma_c_code_dup_var:bread_impl/7'.
+For more information, try recompiling with `-E'.
Index: tests/invalid/pragma_c_code_no_det.err_exp2
===================================================================
RCS file: tests/invalid/pragma_c_code_no_det.err_exp2
diff -N tests/invalid/pragma_c_code_no_det.err_exp2
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/invalid/pragma_c_code_no_det.err_exp2 7 Nov 2002 15:34:32 -0000
@@ -0,0 +1,3 @@
+pragma_c_code_no_det.m:012: Error: no clauses for
+pragma_c_code_no_det.m:012: predicate `pragma_c_code_no_det:c_code/1'.
+For more information, try recompiling with `-E'.
Index: tests/invalid/pragma_c_code_no_det.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/pragma_c_code_no_det.m,v
retrieving revision 1.1
diff -u -r1.1 pragma_c_code_no_det.m
--- tests/invalid/pragma_c_code_no_det.m 17 Nov 1997 05:48:44 -0000 1.1
+++ tests/invalid/pragma_c_code_no_det.m 7 Nov 2002 15:34:32 -0000
@@ -11,4 +11,3 @@
:- pred c_code(int::out).
:- pragma c_code(c_code(X::out), "X = 1").
-
Index: tests/invalid/purity/Mercury.options
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/purity/Mercury.options,v
retrieving revision 1.1
diff -u -r1.1 Mercury.options
--- tests/invalid/purity/Mercury.options 17 Aug 2002 13:52:21 -0000 1.1
+++ tests/invalid/purity/Mercury.options 7 Nov 2002 15:34:32 -0000
@@ -0,0 +1,20 @@
+MCFLAGS-impure_func_t2 = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-impure_func_t3 = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-impure_func_t4 = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-impure_func_t5 = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-impure_func_t7 = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-impure_pred_t1 = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-impure_pred_t2 = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-purity = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-purity_nonsense = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
+MCFLAGS-purity_type_error = --no-intermodule-optimization \
+ --no-automatic-intermodule-optimization
Index: tests/invalid/purity/impure_func_t2.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/purity/impure_func_t2.m,v
retrieving revision 1.1
diff -u -r1.1 impure_func_t2.m
--- tests/invalid/purity/impure_func_t2.m 22 Apr 2000 07:12:48 -0000 1.1
+++ tests/invalid/purity/impure_func_t2.m 7 Nov 2002 15:34:32 -0000
@@ -23,4 +23,4 @@
:- pragma c_header_code("extern Integer counter;").
:- pragma c_code("Integer counter = 0;").
:- pragma c_code(get_counter = (X::out), will_not_call_mercury, "X = counter;").
-
+get_counter = 0.
Index: tests/invalid/purity/impure_func_t3.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/purity/impure_func_t3.m,v
retrieving revision 1.1
diff -u -r1.1 impure_func_t3.m
--- tests/invalid/purity/impure_func_t3.m 22 Apr 2000 07:12:49 -0000 1.1
+++ tests/invalid/purity/impure_func_t3.m 7 Nov 2002 15:34:32 -0000
@@ -22,4 +22,5 @@
:- pragma c_header_code("extern Integer counter;").
:- pragma c_code("Integer counter = 0;").
:- pragma c_code(get_counter = (X::out), will_not_call_mercury, "X = counter;").
+get_counter = 0.
Index: tests/invalid/purity/impure_func_t4.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/purity/impure_func_t4.m,v
retrieving revision 1.1
diff -u -r1.1 impure_func_t4.m
--- tests/invalid/purity/impure_func_t4.m 22 Apr 2000 07:12:49 -0000 1.1
+++ tests/invalid/purity/impure_func_t4.m 7 Nov 2002 15:34:32 -0000
@@ -23,4 +23,4 @@
:- pragma c_header_code("extern Integer counter;").
:- pragma c_code("Integer counter = 0;").
:- pragma c_code(get_counter = (X::out), will_not_call_mercury, "X = counter;").
-
+get_counter = 0.
Index: tests/invalid/purity/impure_func_t5.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/purity/impure_func_t5.m,v
retrieving revision 1.1
diff -u -r1.1 impure_func_t5.m
--- tests/invalid/purity/impure_func_t5.m 22 Apr 2000 07:12:50 -0000 1.1
+++ tests/invalid/purity/impure_func_t5.m 7 Nov 2002 15:34:32 -0000
@@ -26,4 +26,4 @@
:- pragma c_header_code("extern Integer counter;").
:- pragma c_code("Integer counter = 0;").
:- pragma c_code(get_counter(Y::in) = (X::out), will_not_call_mercury, "X = counter + Y;").
-
+get_counter(X) = X.
Index: tests/invalid/purity/impure_func_t7.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/purity/impure_func_t7.m,v
retrieving revision 1.1
diff -u -r1.1 impure_func_t7.m
--- tests/invalid/purity/impure_func_t7.m 22 Apr 2000 07:12:50 -0000 1.1
+++ tests/invalid/purity/impure_func_t7.m 7 Nov 2002 15:34:32 -0000
@@ -39,8 +39,8 @@
:- pragma c_code("Integer counter = 0;").
:- pragma c_code(get_counter(Y::in) = (X::out), will_not_call_mercury,
"X = counter + Y;").
+get_counter(X) = X.
:- pragma c_code(some_pred(Y::in, X::out), will_not_call_mercury,
"X = counter + Y;").
-
-
+some_pred(X, X).
Index: tests/invalid/purity/impure_pred_t1.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/purity/impure_pred_t1.m,v
retrieving revision 1.1
diff -u -r1.1 impure_pred_t1.m
--- tests/invalid/purity/impure_pred_t1.m 22 Apr 2000 07:12:51 -0000 1.1
+++ tests/invalid/purity/impure_pred_t1.m 7 Nov 2002 15:34:32 -0000
@@ -29,4 +29,4 @@
:- pragma c_header_code("extern Integer counter;").
:- pragma c_code("Integer counter = 0;").
:- pragma c_code(get_counter(Y::in, X::out), will_not_call_mercury, "X = counter + Y;").
-
+get_counter(X, X).
Index: tests/invalid/purity/impure_pred_t2.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/purity/impure_pred_t2.m,v
retrieving revision 1.1
diff -u -r1.1 impure_pred_t2.m
--- tests/invalid/purity/impure_pred_t2.m 22 Apr 2000 07:12:51 -0000 1.1
+++ tests/invalid/purity/impure_pred_t2.m 7 Nov 2002 15:34:32 -0000
@@ -26,4 +26,4 @@
:- pragma c_header_code("extern Integer counter;").
:- pragma c_code("Integer counter = 0;").
:- pragma c_code(get_counter(Y::in, X::out), will_not_call_mercury, "X = counter + Y;").
-
+get_counter(X, X).
Index: tests/invalid/purity/purity.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/purity/purity.m,v
retrieving revision 1.1
diff -u -r1.1 purity.m
--- tests/invalid/purity/purity.m 22 Apr 2000 07:12:52 -0000 1.1
+++ tests/invalid/purity/purity.m 7 Nov 2002 15:34:32 -0000
@@ -117,3 +117,10 @@
e11 :-
Goal2 = lambda([] is semidet, semi),
call(Goal2).
+
+:- import_module std_util.
+imp.
+semi :- semidet_fail.
+imp1(_) :- semidet_fail.
+imp2(_, _) :- semidet_fail.
+semi2(_, _) :- semidet_fail.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list