Implement (and test) support for macro expansion within conditional expressions.

To do this we have split the existing "HASH_IF expression" into two
productions:

First is HASH_IF pp_tokens which simply constructs a list of tokens.

Then, with that resulting token list, we first evaluate all DEFINED
operator tokens, then expand all macros, and finally start lexing from
the resulting token list. This brings us to the second production,
IF_EXPANDED expression

This final production works just like our previous "HASH_IF
expression", evaluating a constant integer expression.

The new test (54) added for this case now passes.
This commit is contained in:
Carl Worth
2010-05-26 11:15:21 -07:00
parent 16c1e980e2
commit 8e82fcb070
3 changed files with 169 additions and 22 deletions
+2
View File
@@ -129,6 +129,8 @@ struct glcpp_parser {
string_list_t *active;
int space_tokens;
skip_node_t *skip_stack;
token_list_t *lex_from_list;
token_node_t *lex_from_node;
};
glcpp_parser_t *