mirror of
https://github.com/php/php-src.git
synced 2024-11-27 03:44:07 +08:00
Suppress unused-but-set-variable warning in parsers
This is very ugly: Bison provides a yynerrs variable, which is usually not actually used, but also not annotated with YY_MAYBE_UNUSED. Suppress this warning by adding a (void)yynerrs into the top-level reduction action. The alternative would be to disable the warning for these generated files.
This commit is contained in:
parent
04f5da4b77
commit
107ad28350
@ -308,7 +308,7 @@ static void zval_ini_dtor(zval *zv)
|
||||
|
||||
statement_list:
|
||||
statement_list statement
|
||||
| %empty
|
||||
| %empty { (void) ini_nerrs; }
|
||||
;
|
||||
|
||||
statement:
|
||||
|
@ -292,7 +292,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
|
||||
%% /* Rules */
|
||||
|
||||
start:
|
||||
top_statement_list { CG(ast) = $1; }
|
||||
top_statement_list { CG(ast) = $1; (void) zendnerrs; }
|
||||
;
|
||||
|
||||
reserved_non_modifiers:
|
||||
|
@ -80,6 +80,7 @@ start:
|
||||
{
|
||||
ZVAL_COPY_VALUE(&$$, &$1);
|
||||
ZVAL_COPY_VALUE(parser->return_value, &$1);
|
||||
(void) php_json_yynerrs;
|
||||
YYACCEPT;
|
||||
}
|
||||
;
|
||||
|
@ -66,7 +66,7 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg)
|
||||
input
|
||||
: command { $$ = $1; }
|
||||
| input T_SEPARATOR command { phpdbg_stack_separate($1.top); $$ = $3; }
|
||||
| %empty
|
||||
| %empty { (void) phpdbg_nerrs; }
|
||||
;
|
||||
|
||||
command
|
||||
|
Loading…
Reference in New Issue
Block a user