Boost logo

Boost Users :

From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2006-06-16 20:03:04


 
Andreas Sæbjørnsen wrote:

> I have a question and a suggestion regarding Wave. First I
> have a problem when preprocessing the following file:
> #if 0
> #elif 1
> test
> #endif
>
> #if 1
> #elif 0
> int x;
> #endif
> The first '#elif' directive is registered as an
> 'evaluated_conditional_expression(...)', but the second
> '#elif' is never evaluated since the previous
> '#if' directive is true, and it is therefore not registered
> as either a 'skipped_token(...)' or an
> 'evaluated_conditional_expression(...)'. The way I
> expected it to work was to register it as a
> 'skipped_token(...)'. Do you have a suggestion to how I
> should otherwise be handling this?
> If not, could it be possible to add the non-evaluated '#elif'
> to the skipped token stream?

This is fixed now (Boost CVS::HEAD and Boost CVS::BOOST_RC_1_34). Thanks for
reporting.

> The suggestion is for preprocessor generated tokens where the
> 'macro.get_position().get_file().size() == 0'. An example
> of this is in the following code
>
> #ifdef SOME_MACRO
> //DO SOMETHING
> #endif
>
> Since 'SOME_MACRO' is not defined the
> 'expanding_object_like_macro(TokenT const &macro,....)' will
> be passed a TokentT& const& macro
> with no position object, so asking for the line or column
> number will give a hard to debug segmentation fault.

This one is really strange, because if SOME_MACRO is not defined then the
expanding_object_like_macro() pp hook shouldn't be called for this macro.
For this reason I'm not able to reproduce this issue here.

Nevertheless, I think it's a bug if 'macro.get_position().get_file().size()
== 0' in any case (any token should have some associated file/position it
was encountered at). Could you please try to isolate this problem and send
me a sample?

Regards Hartmut


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net