[gcjx] RFC/RFA: Show Problematic Source Lines with Diagnostics
Tom Tromey
tromey@redhat.com
Mon Oct 3 17:14:00 GMT 2005
>>>>> "Ranjit" == Ranjit Mathew <rmathew@gmail.com> writes:
Ranjit> I have opted to just rewind and read the desired line, instead
Ranjit> of storing line number information upfront as I reckon the
Ranjit> compiler will encounter *far more* correct source files in
Ranjit> real life every time than incorrect source code - there's no
Ranjit> point in penalising the common code path for this feature.
Sounds good.
I think this patch is ok. Please check it in.
One concern I have with this approach is that we'll end up using a lot
more memory, by keeping all the file contents around. At present this
won't look so bad, since we only use mmap, but eventually we're going
to have to handle the read case as well. But, maybe the problem won't
be so bad. And anyway, if it is, we can change how this is
implemented. For instance, we could throw away the data and just keep
the file descriptor around.
Another possible concern is that, if the threading code is ever
enabled, we could have a race where two errors are emitted via a
single lexer at the same time. This is easily fixed though.
Ranjit> Note that the wrong line and column is shown here. But that's
Ranjit> not my fault - the incoming information was wrong to begin
Ranjit> with!
I have a fix for this. The lexer wasn't properly handling unget() of
a newline.
Tom
More information about the Java-patches
mailing list