public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/8927: Gcc give error for wrong line of C code.
@ 2002-12-20 20:54 bangerth
0 siblings, 0 replies; 5+ messages in thread
From: bangerth @ 2002-12-20 20:54 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, gp, nobody
Synopsis: Gcc give error for wrong line of C code.
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Fri Dec 20 20:54:04 2002
State-Changed-Why:
Confirmed. This is the same problem which is reported in
another report (which I am unable to find at present,
annoyingly) where you had a token that creates an
error and immediately afterwards a #include. The error
was reported to be inside the include file.
Errors should be reported for the position of a token,
not for the position of the next one.
W.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8927
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: c/8927: Gcc give error for wrong line of C code.
@ 2003-02-16 0:16 Joseph S. Myers
0 siblings, 0 replies; 5+ messages in thread
From: Joseph S. Myers @ 2003-02-16 0:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/8927; it has been noted by GNATS.
From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: Neil Booth <neil@daikokuya.co.uk>
Cc: Steven Bosscher <s.bosscher@student.tudelft.nl>, <gcc-gnats@gcc.gnu.org>,
<gcc-bugs@gcc.gnu.org>, <gp@qnx.com>,
Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Subject: Re: c/8927: Gcc give error for wrong line of C code.
Date: Sun, 16 Feb 2003 00:09:54 +0000 (GMT)
On Sat, 15 Feb 2003, Neil Booth wrote:
> Too bad the front end separates them. This whole area is currently
> quite messy, and with bison unprofitably hard to fix. The C++ front
I'll point out again that Bison has built-in support for syntax
productions to have a location as well as a value, although no GCC front
ends currently use it. (It would at least be reasonable for example front
ends such as treelang to make use of this Bison feature.)
--
Joseph S. Myers
jsm28@cam.ac.uk
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: c/8927: Gcc give error for wrong line of C code.
@ 2003-02-16 0:16 Neil Booth
0 siblings, 0 replies; 5+ messages in thread
From: Neil Booth @ 2003-02-16 0:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/8927; it has been noted by GNATS.
From: Neil Booth <neil@daikokuya.co.uk>
To: "Joseph S. Myers" <jsm28@cam.ac.uk>
Cc: Steven Bosscher <s.bosscher@student.tudelft.nl>, gcc-gnats@gcc.gnu.org,
gcc-bugs@gcc.gnu.org, gp@qnx.com,
Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Subject: Re: c/8927: Gcc give error for wrong line of C code.
Date: Sun, 16 Feb 2003 00:14:06 +0000
Joseph S. Myers wrote:-
> On Sat, 15 Feb 2003, Neil Booth wrote:
>
> > Too bad the front end separates them. This whole area is currently
> > quite messy, and with bison unprofitably hard to fix. The C++ front
>
> I'll point out again that Bison has built-in support for syntax
> productions to have a location as well as a value, although no GCC front
> ends currently use it. (It would at least be reasonable for example front
> ends such as treelang to make use of this Bison feature.)
Hence the use of "unprofitably", which you even referred to in your
original mail. We don't want things slower or harder to understand
than they already are.
Neil.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: c/8927: Gcc give error for wrong line of C code.
@ 2003-02-16 0:06 Neil Booth
0 siblings, 0 replies; 5+ messages in thread
From: Neil Booth @ 2003-02-16 0:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/8927; it has been noted by GNATS.
From: Neil Booth <neil@daikokuya.co.uk>
To: Steven Bosscher <s.bosscher@student.tudelft.nl>
Cc: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gp@qnx.com,
nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org,
Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Subject: Re: c/8927: Gcc give error for wrong line of C code.
Date: Sat, 15 Feb 2003 23:57:37 +0000
Steven Bosscher wrote:-
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8927
>
> The same problem happens for g++, so this is not a C bug.
>
> c_lex() and c-parse.in:_yylex() return the right line number for the
> token. But bison looks ahead a bit and that causes the line number to
> advance as well. This is also why saving the line number in the
> "primary" production doesn't help: Before we parse primary:IDENTIFIER,
> we've already advanced the line number.
>
> So my guess is that this is a cpplib bug: It should not advance the line
> number until the previous token is accepted. Dunno how to attack this
> bug.
CPP doesn't control the line number; it attaches line numbers to tokens,
and is therefore never wrong 8-)
Too bad the front end separates them. This whole area is currently
quite messy, and with bison unprofitably hard to fix. The C++ front
end should be able to do a near-perfect job now; though I can imagine
the current implementation of c-lex.c (which isn't appropriate to
RD parsers) getting in the way.
Neil.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: c/8927: Gcc give error for wrong line of C code.
@ 2003-02-15 22:06 Steven Bosscher
0 siblings, 0 replies; 5+ messages in thread
From: Steven Bosscher @ 2003-02-15 22:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/8927; it has been noted by GNATS.
From: Steven Bosscher <s.bosscher@student.tudelft.nl>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gp@qnx.com,
nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Cc: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Subject: Re: c/8927: Gcc give error for wrong line of C code.
Date: 15 Feb 2003 22:56:46 +0100
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8927
The same problem happens for g++, so this is not a C bug.
c_lex() and c-parse.in:_yylex() return the right line number for the
token. But bison looks ahead a bit and that causes the line number to
advance as well. This is also why saving the line number in the
"primary" production doesn't help: Before we parse primary:IDENTIFIER,
we've already advanced the line number.
So my guess is that this is a cpplib bug: It should not advance the line
number until the previous token is accepted. Dunno how to attack this
bug.
Greetz
Steven
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-02-16 0:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-20 20:54 c/8927: Gcc give error for wrong line of C code bangerth
2003-02-15 22:06 Steven Bosscher
2003-02-16 0:06 Neil Booth
2003-02-16 0:16 Joseph S. Myers
2003-02-16 0:16 Neil Booth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).