[m-rev.] for review: emit errors about purity mismatches with foreign clauses

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Jul 6 14:14:34 AEST 2006


On Thu, 6 Jul 2006, Ian MacLarty wrote:

> On Thu, Jul 06, 2006 at 12:13:59PM +1000, Julien Fischer wrote:
> >
> > > Actually there seems to be another bug because while the compiler reports a
> > > warning, it doesn't generate an executable and a non-zero exit status is
> > > returned (even with --no-halt-at-warn).  Try compiling the following program
> > > to see what I mean:
> > >
> > > :- module pure.
> > >
> > > :- interface.
> > >
> > > :- import_module io.
> > >
> > > :- pred main(io::di, io::uo) is det.
> > >
> > > :- implementation.
> > >
> > > main(!IO) :-
> > >         nl(!IO).
> > >
> > > :- pragma promise_pure(p/0).
> > >
> > > :- impure pred p is det.
> > >
> > > :- pragma foreign_proc("C",
> > >         p,
> > >         [will_not_call_mercury],
> > > "
> > >         printf(\"hello\");
> > > ").
> >
> > That is a purity error.
> >
>
> Why does the compiler emit a warning then?
>

Hmmm ... so it does.  It appears that the code for handling that particular
error/warning (in compiler/purity.m) is a bit confused and can't decide which
one it is - it seems to have taken the approach that it is both an error *and*
a warning (at least w.r.t the exit status).

Any opinions on which it should be?

Julien.
--------------------------------------------------------------------------
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