[m-dev.] for review: new option --no-c-line-numbers

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Apr 15 17:13:21 AEST 1999


On 15-Apr-1999, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 
> Add a new option that prevents the generation of #line directives in
> the generated C code. This makes it easier to debug problems in the
> interaction of compiler-generated C code and pragma included C code
> with gdb, since the line numbers don't jump around on you.
> 
> compiler/options.m:
> 	Add a new option --c-line-numbers, to control this, which defaults
> 	to on.

Why not just use the existing option --line-numbers option for this purpose?
That's what mercury_to_c.m (the very incomplete and currently not used
high-level-C code generation module) uses when deciding whether to output
#line directives.

I suppose the issue is that --line-numbers defaults to off, whereas
you want the default for --c-line-numbers to be on.  Well, a simple
solution would be to just change the default for --line-numbers to be on;
currently it is only used for the --convert-to-mercury and --convert-to-goedel
options, and the (undocumented and very incomplete work-in-progress)
--high-level-c option, and I think it would be fine for the default to be
on in those cases.  Alternatively, if you implement your suggested
extension to the getopt module that we discussed yesterday, the default
value for --line-numbers could depend on the settings of those other
options.

> Index: compiler/mercury_compile.m

The changes to that file were not mentioned in the log message
and look to me to be unrelated.  They should be dealt with in
a separate change.  (Probably you just included them in this diff
by accident.)

> +++ user_guide.texi	1999/04/15 02:12:43
> @@ -2604,6 +2604,14 @@
>  
>  @sp 1
>  @item -n
> + at itemx --no-c-line-numbers

You should delete the `@item -n' here.

(But this is superceded by my other suggestions.)

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