[m-rev.] --no-line-numbers by default for us

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Dec 9 10:44:55 AEDT 2015



On Wed, 9 Dec 2015 10:32:07 +1100, Peter Wang <novalazy at gmail.com> wrote:

> On Tue, 08 Dec 2015 18:54:51 +1100 (AEDT), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> > Would anyone object to committing this diff?
> 
> Will disabling line numbers not hinder writing of foreign code?

We almost never DO write new foreign procs anymore. On the rare occasions
when we do, we tend to add only small pieces of e.g. C code, so that
if the C compiler gives you an error message, it is trivial to find out
what the problem is, since the current versions of gcc will echo the
line with the bug. (Old versions didn't do that, of course.)

> I don't know why we produce so many #line directives for high-level C
> though.  It should be enough to emit them around hand-written foreign
> code.

Mostly because a single line of Mercury code will often yield
more than one line of C code. A Mercury predicate declaration
that fits on one line will get translated into a C function declaration
with each argument on a separate line, so mmc generates a
#line directive before each line just so the C compiler will
consider every one of those lines to have the same line number.
This is for the very rare case of the argument being of a
foreign type, whose name itself may have a syntax error.

Zoltan.





More information about the reviews mailing list