This is the mail archive of the
mailing list for the GCC project.
Re: #pragma interface/implementation broken if --enable-mapped-location
- From: Per Bothner <per at bothner dot com>
- To: Zack Weinberg <zack at codesourcery dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 23 Sep 2004 19:34:38 -0700
- Subject: Re: #pragma interface/implementation broken if --enable-mapped-location
- References: <41537AFC.email@example.com> <firstname.lastname@example.org>
Zack Weinberg wrote:
We can't take out the cb.line_change call, that will mess up the C
Right - I don't suggest it as a real fix.
One option is for cpp_handle_deferred_pragma to temporarily clear
(and later restore) the cb.line_change.
Alternatively, cp_lexer_handle_pragma can do the same thing, though
that seems (even) less clean.
A third option to pass in an extra parameter or to set a flag so that
do_pragma knows that it is processing a pragma that was deferred.
My question is why is the pragma_token's location wrong? That would
seem to be the real bug.
The pragma line is saved as a string, not as tokens. Then
cp_lexer_handle_pragma calls cpp_handle_deferred_pragms which
calls run_directive. The pragma_token seen by do_pragma (the
second time) is from lexing the run_directive string.