[m-rev.] for review: fix Java compilation of table_builtin.m
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Aug 2 18:19:59 AEST 2004
For review by Zoltan.
Estimated hours taken: 0.5
Branches: main
library/table_builtin.m:
Use univ rather than unsafe_type_cast, because using
unsafe_type_cast with an invalid type can result in compilation
errors in Java grades.
Workspace: /home/jupiter/fjh/ws-jupiter/mercury
Index: library/table_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/table_builtin.m,v
retrieving revision 1.40
diff -u -d -r1.40 table_builtin.m
--- library/table_builtin.m 2 Aug 2004 01:40:03 -0000 1.40
+++ library/table_builtin.m 2 Aug 2004 06:58:34 -0000
@@ -1043,17 +1043,17 @@
table_mmos_setup_consumer(_, _, Consumer) :-
impure private_builtin__imp,
% Required only to avoid warnings; never executed.
- private_builtin__unsafe_type_cast(0, Consumer).
+ pretend_to_generate_value(Consumer).
table_mmos_get_answer_table(_, TrieNode) :-
semipure private_builtin__semip,
% Required only to avoid warnings; never executed.
- private_builtin__unsafe_type_cast(0, TrieNode).
+ pretend_to_generate_value(TrieNode).
table_mmos_create_answer_block(_, _, AnswerBlock) :-
impure private_builtin__imp,
% Required only to avoid warnings; never executed.
- private_builtin__unsafe_type_cast(0, AnswerBlock).
+ pretend_to_generate_value(AnswerBlock).
table_mmos_return_answer(_, _) :-
impure private_builtin__imp.
@@ -1061,6 +1061,12 @@
table_mmos_completion(_) :-
impure private_builtin__imp.
+ % Required only to avoid warnings; never executed.
+:- pred pretend_to_generate_value(T::out) is det.
+pretend_to_generate_value(Bogus) :-
+ % The following code will throw an exception if executed.
+ det_univ_to_type(univ(0), Bogus).
+
%-----------------------------------------------------------------------------%
:- interface.
@@ -1183,7 +1189,7 @@
%-----------------------------------------------------------------------------%
:- implementation.
-:- import_module require.
+:- import_module require, std_util.
:- pragma foreign_decl("C", "
--
Fergus Henderson | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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