Boost logo

Boost Users :

From: Andreas Sæbjørnsen (andreas.saebjoernsen_at_[hidden])
Date: 2006-06-14 16:59:40


Hi,
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?

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. In order to detect this
to avoid an error it is necessary to always ask for the size of the file as
demonstrated above before asking for the line, file or column
My suggestion is that alternatively a position object could be attached to
'macro', and a Boolean flag 'is_preprocessor_generated'
could be used to find out if the position object is preprocessor generated
or not. What do you think?

Thanks
Andreas



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