[M3devel] unused warning isn't transitive
Rodney M. Bates
rodney.m.bates at cox.net
Thu Jul 30 03:57:42 CEST 2009
Jay K wrote:
> TYPE Int32Rec = BITS 32 FOR RECORD v : Swap.Int32 END;
> (* We need v to be inside a record. Otherwise, the language would allow
> a compiler to actually allocate more than the BITS 32 for a value of
> type Swap.Int32.
> *)
> VAR Int32RecVar : Int32Rec;
> VAR CheckInt32 : [ 0 .. 0 ] := ADR(Int32RecVar) - ADR(Int32RecVar.v);
>
>
> Compiler complains that CheckInt32 isn't used.
> It should also perhaps mention Int32RecVar therefore.
>
Transitive unusedness (boy, did that blow my email client
spell checker's brains!) is a bigger issue than this example
shows. There could be a large collection of identifiers that
cyclically use each other, but no reference to the set from
outside. For example, 35 mutually recursive, top-down
parsing procedures that all call each other, but somebody
forgot the base call to procedure "Program". Would we
really want them all to come up unused, as well as everything
declared inside any of them?
It would take something like a strongly-connected graph
components algorithm or such in the compiler.
>
>
> - Jay
>
More information about the M3devel
mailing list