[m-dev.] for review: automatic header file inclusion guards.
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Jan 24 14:37:43 AEDT 2001
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.
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.
So I don't think this change is a good idea.
> +++ compiler/mercury_to_mercury.m 2001/01/23 21:42:47
> @@ -227,6 +227,10 @@
> io__state).
> :- mode mercury_output_instance_methods(in, di, uo) is det.
>
> + % Output the given context
> +:- pred mercury_output_prog_context(prog_context, io__state, io__state).
> +:- mode mercury_output_prog_context(in, di, uo) is det.
The comment here should explain that it outputs a
`:- pragma source_file' and `#<LINE>' directive.
> -mlds_output_c_hdr_decl(_Indent, foreign_decl_code(Lang, Code, Context)) -->
> +mlds_output_c_hdr_decl(Indent, foreign_decl_code(Lang, Code, Context)) -->
> % only output C code in the C header file.
> ( { Lang = c } ->
> + { Context = context(File, Line) },
I'd suggest s/context/term__context/
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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