[m-dev.] for review: automatic header file inclusion guards.

Tyson Dowd trd at cs.mu.OZ.AU
Wed Jan 24 15:15:58 AEDT 2001


On 24-Jan-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 24-Jan-2001, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> > Implement automatic header file multiple inclusion guards.
> > 
> > Note that this should not affect the LLDS backend because it doesn't
> > use header files to implement foreign_decls, so there is no chance of
> > multiple inclusions.
> > 
> > compiler/intermod.m:
> > 	Output 
> > 		:- pragma source_file("...").
> > 		#linenum
> > 	before :- pragma foreign_decl(...).
> > 
> > 	This gives us the original context for foreign_decls, which is
> > 	unique.
> 
> That fails if there is more than one `:- pragma foreign_decl'
> on the same line.

This is true.

> Also that has the problem that Simon Taylor mentioned -- his memory is
> clearly better than mine! -- about this forcing unnecessary compilation,
> due to the `.opt' files changing if you add stuff (e.g. comments)
> which changes the line numbers.

I feel that this is a cop-out.  

The re-compilation is necessary, it's just that we have managed to avoid
it so far by being buggy (incorrect term contexts given to terms that
migrate via the .opt files).

Anyway, I don't want to waste time pushing this change past people who
don't want it.  The other way to do this is to hash the contents of the
foreign_decl string -- so I will write some code to do this instead.

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list