help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

#line format


From: Akim Demaille
Subject: #line format
Date: 10 Apr 2002 19:52:19 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp)

Hi Paul,

Sorry to bug you once again :(

I have a simple question: what are the formats for #lines?  For some
time, I have believed that:


---------- foo.c ---------

#line 1 "foo.y"
#error "This is reported in line 1 of foo.y"
#line 45
#error "This is reported in line 45 of foo.c"

-------------------------

But it turns out that GCC, seeing a plain `#line NUM' with no FILE
complains in the current file, i.e., here, foo.y.

I have seen many different formats for #line, in particular GCC's has
many more fields, related to file inclusion I guess.

My problem with

        #line 45 "foo.c"

is that the name of the file is coded inside, which is very painful
when you mv the file.  I'm especially concerned by this because of
Automake which invokes bison as yacc, therefore foo.tab.c is created,
and then renamed as `foo.c'.  This results in a wrong #line.  I have
patched Automake so that it seds the proper name, but that remains a
hack.

Is there something available in the set of #line that would comply
these requirements?


Thanks a lot, and again, sorry for bugging you :(

PS/ I could not find any relevant information on the web, nor info
cpp, info gcc and so forth.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]