[m-rev.] diff: fix setting goal_type bug for clauses
Peter Ross
pro at missioncriticalit.com
Tue Jun 11 20:13:16 AEST 2002
On Tue, Jun 11, 2002 at 01:23:48AM +1000, Simon Taylor wrote:
> On 10-Jun-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > Estimated hours taken: 1
> > Branches: main
> >
> > compiler/make_hlds.m:
> > Fix a bug where clauses which are defined as both a pragma foreign_code
> > and a mercury clause were incorrectly having their goal_type set to
> > clauses.
>
> What was the symptom? Test case?
>
===================================================================
Estimated hours taken: 0.25
Branches: main
tests/hard_coded/intermod_pragma_clause.exp:
tests/hard_coded/intermod_pragma_clause.m:
tests/hard_coded/intermod_pragma_clause_sub.m:
Test that intermodule optimization works when clauses are
defined as both a foreign proc and a mercury clause.
Index: tests/hard_coded/intermod_pragma_clause.exp
===================================================================
RCS file: tests/hard_coded/intermod_pragma_clause.exp
diff -N tests/hard_coded/intermod_pragma_clause.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/intermod_pragma_clause.exp 11 Jun 2002 10:10:26 -0000
@@ -0,0 +1 @@
+5
+5
Index: tests/hard_coded/intermod_pragma_clause.m
===================================================================
RCS file: tests/hard_coded/intermod_pragma_clause.m
diff -N tests/hard_coded/intermod_pragma_clause.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/intermod_pragma_clause.m 11 Jun 2002 10:10:26 -0000
@@ -0,0 +1,19 @@
+% Ensure that the foreign_decl is placed into the .opt file for procedures
+% which are defined by both a foreign proc and a mercury clause.
+
+:- module intermod_pragma_clause.
+:- interface.
+:- import_module io.
+:- pred main(io::di, io::uo) is det.
+
+:- implementation.
+
+:- import_module intermod_pragma_clause_sub.
+
+main -->
+ { f(X) },
+ io__write_int(X),
+ io__nl,
+ { g(Y) },
+ io__write_int(Y),
+ io__nl.
Index: tests/hard_coded/intermod_pragma_clause_sub.m
===================================================================
RCS file: tests/hard_coded/intermod_pragma_clause_sub.m
diff -N tests/hard_coded/intermod_pragma_clause_sub.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/intermod_pragma_clause_sub.m 11 Jun 2002 10:10:26 -0000
@@ -0,0 +1,28 @@
+% Ensure that the foreign_decl is placed into the .opt file for procedures
+% which are defined by both a foreign proc and a mercury clause.
+
+:- module intermod_pragma_clause_sub.
+
+:- interface.
+
+:- pred f(int::out) is det.
+:- pred g(int::out) is det.
+
+:- implementation.
+
+:- pragma foreign_decl("C", "
+ #define ML_NUMBER 5
+").
+
+:- pragma foreign_proc("C", f(X::out),
+ [will_not_call_mercury, promise_pure, thread_safe], "
+ X = ML_NUMBER;
+").
+f(5).
+
+g(5).
+:- pragma foreign_proc("C", g(X::out),
+ [will_not_call_mercury, promise_pure, thread_safe], "
+ X = ML_NUMBER;
+").
+
--------------------------------------------------------------------------
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