[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: #line format
From: |
Paul Eggert |
Subject: |
Re: #line format |
Date: |
Wed, 10 Apr 2002 15:24:52 -0700 (PDT) |
> Cc: Bison Help <address@hidden>
> From: Akim Demaille <address@hidden>
> Date: 10 Apr 2002 19:52:19 +0200
>
> 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 think GCC is correct here. Sun C is the same.
> 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.
Sorry, I'm a bit lost. Why do you want the file to refer to itself?
Can't you solve the problem by having the #line directive refer
instead to some template file like bison.simple, in a well-known
location? That's what Bison 1.35 does.
> Is there something available in the set of #line that would comply
> these requirements?
Sorry, not that I can think of. Once you change the value of __FILE__
I don't see any way to refer to the previous value.
Perhaps you can rewrite the file so that the #line 45 stuff all
appears before the #line 1 "foo.y" stuff. That might solve the
problem. (But clearly I don't understand the problem, so....)
- #line format, Akim Demaille, 2002/04/10
- Re: #line format, Hans Aberg, 2002/04/10
- Re: #line format,
Paul Eggert <=
- Re: #line format, Hans Aberg, 2002/04/11
- Re: #line format, Akim Demaille, 2002/04/11
- Re: #line format, Hans Aberg, 2002/04/11
- Re: #line format, Paul Eggert, 2002/04/11
- Re: #line format, Hans Aberg, 2002/04/11
- Re: #line format, Akim Demaille, 2002/04/12
- Re: #line format, Paul Eggert, 2002/04/12