[cfe-dev] Patch to allow comment translators implementation
dgregor at apple.com
Thu Jan 28 15:51:32 PST 2010
On Jan 28, 2010, at 2:18 PM, Abramo Bagnara wrote:
> Il 27/01/2010 22:48, Chris Lattner ha scritto:
>>>> 1) do not call comment handlers when skipping excluded conditional block
>>>> 2) have a way inside comment handlers to know that we are inside an
>>>> excluded conditional block (so to avoid to call EnterTokenStream)
>>>> I think that 2) is better as it is more flexyble.
>>> I've not yet heard anything from you, what do you think is the proper
>>> way to fix the problem above?
>> Hi Abramo,
>> I'm sorry for the delay. I think that #1 is the best approach. Comment handles should not be invoked on things in #if 0 blocks, because #if 0 blocks should be completely skipped according to the rules of the preprocessor: not doing this would invalidate the "include once" optimization that is applied to files wrapped in the "#ifndef FOO_H / #define FOO_H ... #endif" idiom.
>> In short, I think that #1 is the right fix.
> I've attached a (trivial) patch to do that.
> However in his message, some minutes ago Douglas wrote:
>>> We have some alternative way to cope with this problem:
>>>> 1) make SkipExcludedConditionalBlock to consume also the tokens from
>> This seems like the right approach to me.
> This was my original choice that Chris thought was inappropriate and he
> removed that part of my patch in his commit.
> Personally I've no strong preference between a choice or the other,
> however I resume here the benefits I see for the two approaches:
> Chris method (avoid to call comment handler when skipping):
> - performance (we don't have to check from which lexer we are currently
> reading the tokens in SkipExcludedConditionalBlock)
Chris has far more expertise in the preprocessor than I; go with the Chris method. (I missed his e-mail).
More information about the cfe-dev