mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 19:10:14 +01:00
glcpp: Add an explicit diagnostic for #if with no expression.
This is more clear than the previously-generated diagnostic which was something confusing like "enexpected newline". This change makse test 080-if-witout-expression.c now pass.
This commit is contained in:
parent
624dd585c7
commit
253cad3f42
2 changed files with 14 additions and 1 deletions
|
|
@ -241,6 +241,16 @@ control_line:
|
|||
parser->skip_stack->type = SKIP_TO_ENDIF;
|
||||
}
|
||||
}
|
||||
| HASH_IF NEWLINE {
|
||||
/* #if without an expression is only an error if we
|
||||
* are not skipping */
|
||||
if (parser->skip_stack == NULL ||
|
||||
parser->skip_stack->type == SKIP_NO_SKIP)
|
||||
{
|
||||
glcpp_error(& @1, parser, "#if with no expression");
|
||||
}
|
||||
_glcpp_parser_skip_stack_push_if (parser, & @1, 0);
|
||||
}
|
||||
| HASH_IFDEF IDENTIFIER junk NEWLINE {
|
||||
macro_t *macro = hash_table_find (parser->defines, $2);
|
||||
talloc_free ($2);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
0:2(1): preprocessor error: #if with no expression
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue