summaryrefslogtreecommitdiff
path: root/glcpp-parse.y
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-06-01 11:20:18 -0700
committerCarl Worth <cworth@cworth.org>2010-06-01 11:23:08 -0700
commita771a40e2257657cbdae0eb97a7bb8733db76b91 (patch)
tree363998c5e734aea3fc40d4fff94bcf5d2646479b /glcpp-parse.y
parent96d3994881832201db7edd8a0a6f4b34655649d3 (diff)
Fix #if-skipping to *really* skip the skipped group.
Previously we were avoiding printing within a skipped group, but we were still evluating directives such as #define and #undef and still emitting diagnostics for things such as macro calls with the wrong number of arguments. Add a test for this and fix it with a high-priority rule in the lexer that consumes the skipped content.
Diffstat (limited to 'glcpp-parse.y')
-rw-r--r--glcpp-parse.y15
1 files changed, 4 insertions, 11 deletions
diff --git a/glcpp-parse.y b/glcpp-parse.y
index f4c834e038..dd8e133f55 100644
--- a/glcpp-parse.y
+++ b/glcpp-parse.y
@@ -159,19 +159,11 @@ input:
line:
control_line {
- if (parser->skip_stack == NULL ||
- parser->skip_stack->type == SKIP_NO_SKIP)
- {
- printf ("\n");
- }
+ printf ("\n");
}
| text_line {
- if (parser->skip_stack == NULL ||
- parser->skip_stack->type == SKIP_NO_SKIP)
- {
- _glcpp_parser_print_expanded_token_list (parser, $1);
- printf ("\n");
- }
+ _glcpp_parser_print_expanded_token_list (parser, $1);
+ printf ("\n");
talloc_free ($1);
}
| expanded_line
@@ -889,6 +881,7 @@ glcpp_parser_create (void)
parser->defines = hash_table_ctor (32, hash_table_string_hash,
hash_table_string_compare);
parser->active = _string_list_create (parser);
+ parser->lexing_if = 0;
parser->space_tokens = 1;
parser->newline_as_space = 0;
parser->in_control_line = 0;