glcpp: Clean up most empty mid-rule actions left by previous commit.

I didn't want to pollute the previous patch with all the $4 -> $3
changes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Kenneth Graunke
2016-03-04 18:47:39 -08:00
parent 639bbe3cb4
commit e816c8b54a

View File

@@ -266,13 +266,13 @@ control_line:
ralloc_asprintf_rewrite_tail (&parser->output, &parser->output_length, "\n"); ralloc_asprintf_rewrite_tail (&parser->output, &parser->output_length, "\n");
} }
| control_line_error | control_line_error
| HASH_TOKEN LINE { } pp_tokens NEWLINE { | HASH_TOKEN LINE pp_tokens NEWLINE {
if (parser->skip_stack == NULL || if (parser->skip_stack == NULL ||
parser->skip_stack->type == SKIP_NO_SKIP) parser->skip_stack->type == SKIP_NO_SKIP)
{ {
_glcpp_parser_expand_and_lex_from (parser, _glcpp_parser_expand_and_lex_from (parser,
LINE_EXPANDED, $4, LINE_EXPANDED, $3,
EXPANSION_MODE_IGNORE_DEFINED); EXPANSION_MODE_IGNORE_DEFINED);
} }
} }
@@ -280,23 +280,23 @@ control_line:
control_line_success: control_line_success:
HASH_TOKEN DEFINE_TOKEN { } define HASH_TOKEN DEFINE_TOKEN { } define
| HASH_TOKEN UNDEF { } IDENTIFIER NEWLINE { | HASH_TOKEN UNDEF IDENTIFIER NEWLINE {
macro_t *macro; macro_t *macro;
if (strcmp("__LINE__", $4) == 0 if (strcmp("__LINE__", $3) == 0
|| strcmp("__FILE__", $4) == 0 || strcmp("__FILE__", $3) == 0
|| strcmp("__VERSION__", $4) == 0 || strcmp("__VERSION__", $3) == 0
|| strncmp("GL_", $4, 3) == 0) || strncmp("GL_", $3, 3) == 0)
glcpp_error(& @1, parser, "Built-in (pre-defined)" glcpp_error(& @1, parser, "Built-in (pre-defined)"
" macro names cannot be undefined."); " macro names cannot be undefined.");
macro = hash_table_find (parser->defines, $4); macro = hash_table_find (parser->defines, $3);
if (macro) { if (macro) {
hash_table_remove (parser->defines, $4); hash_table_remove (parser->defines, $3);
ralloc_free (macro); ralloc_free (macro);
} }
ralloc_free ($4); ralloc_free ($3);
} }
| HASH_TOKEN IF { } pp_tokens NEWLINE { | HASH_TOKEN IF pp_tokens NEWLINE {
/* Be careful to only evaluate the 'if' expression if /* Be careful to only evaluate the 'if' expression if
* we are not skipping. When we are skipping, we * we are not skipping. When we are skipping, we
* simply push a new 0-valued 'if' onto the skip * simply push a new 0-valued 'if' onto the skip
@@ -308,7 +308,7 @@ control_line_success:
parser->skip_stack->type == SKIP_NO_SKIP) parser->skip_stack->type == SKIP_NO_SKIP)
{ {
_glcpp_parser_expand_and_lex_from (parser, _glcpp_parser_expand_and_lex_from (parser,
IF_EXPANDED, $4, IF_EXPANDED, $3,
EXPANSION_MODE_EVALUATE_DEFINED); EXPANSION_MODE_EVALUATE_DEFINED);
} }
else else
@@ -327,14 +327,14 @@ control_line_success:
} }
_glcpp_parser_skip_stack_push_if (parser, & @1, 0); _glcpp_parser_skip_stack_push_if (parser, & @1, 0);
} }
| HASH_TOKEN IFDEF { } IDENTIFIER junk NEWLINE { | HASH_TOKEN IFDEF IDENTIFIER junk NEWLINE {
macro_t *macro = hash_table_find (parser->defines, $4); macro_t *macro = hash_table_find (parser->defines, $3);
ralloc_free ($4); ralloc_free ($3);
_glcpp_parser_skip_stack_push_if (parser, & @1, macro != NULL); _glcpp_parser_skip_stack_push_if (parser, & @1, macro != NULL);
} }
| HASH_TOKEN IFNDEF { } IDENTIFIER junk NEWLINE { | HASH_TOKEN IFNDEF IDENTIFIER junk NEWLINE {
macro_t *macro = hash_table_find (parser->defines, $4); macro_t *macro = hash_table_find (parser->defines, $3);
ralloc_free ($4); ralloc_free ($3);
_glcpp_parser_skip_stack_push_if (parser, & @3, macro == NULL); _glcpp_parser_skip_stack_push_if (parser, & @3, macro == NULL);
} }
| HASH_TOKEN ELIF pp_tokens NEWLINE { | HASH_TOKEN ELIF pp_tokens NEWLINE {