[m-dev.] diff: report errors for duplicate mode declarations

Fergus Henderson fjh at cs.mu.oz.au
Mon Nov 24 17:29:36 AEDT 1997


Peter Schachte, you wrote:
> On Sun, 23 Nov 1997, Fergus Henderson wrote:
> 
> > Report an error for duplicate mode declarations.
> 
> It might be better to make it a warning,

Maybe... but declaring duplicate modes is never useful,
and will increase code size, so it is always a mistake.
I think making it an error is not unreasonable.

> and just not add the duplicate mode to the list of modes for the predicate.

This is tricky, because in general the compiler can't tell whether two modes
are equivalent until _after_ they have been added.  I suppose that the
compiler could delete one of the modes... but which one?
Note that in general they might have different determinisms, or
different final insts -- so one of them might have a mode or determinism
error, even if the other is correct.  So in the general case it wouldn't be
right to delete one of them until after determinism analysis.

So I think the current approach is good enough.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list