cpplib: Use translation unit line numbers
Neil Booth
neil@daikokuya.demon.co.uk
Sun Aug 5 10:51:00 GMT 2001
Gabriel Dos_Reis wrote:-
> 100% agreed. I hope to eventually replace those with the
> non-_with_file_and_line versions. It seems like your patch will make
> my life eaiser. Thanks :-)
What do you think we should do with macros for diagnostics? Each
token now contains the line it was *lexed* on. So, for example, in
#define foo bar
foo
The token "bar" received by the front ends will contain the line and
column it appeared in the #define line. Some people claim they would
like diagnostics to be pointed within the macros like this.
However, like #include stack, we should have the source line that the
problem actually occurred on. e.g.
in file included from file:line:col
in macro MACRO expanded from file:line:col
file:line:col:<message>
There are as many as 3 lines associated with any given token: the line
it is originally lexed on, the line the token is output on in
preprocessed output (different for e.g. escaped newlines and funlike
macro arguments). If a token comes from a macro expansion, you also
have the line of the macro invocation (which is where diagnostics
currently point).
Juggling these, along with a few lexical and grammatical oddities,
makes this part of cpplib quite a nightmare.
Neil.
More information about the Gcc-patches
mailing list