#pragma interface/implementation broken if --enable-mapped-location

Per Bothner per@bothner.com
Fri Sep 24 02:43:00 GMT 2004


Zack Weinberg wrote:

> We can't take out the cb.line_change call, that will mess up the C
> front end.

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.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/



More information about the Gcc mailing list