mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-22 18:53:04 +00:00
tests: fix warnings in push mode
Fix warning with GCC 8, -DNDEBUG.
422. push.at:83: testing Multiple impure instances ...
input.y: In function 'main':
input.c:1022:12: error: potential null pointer dereference [-Werror=null-dereference]
if (!yyps->yynew && yyps->yyss != yyps->yyssa)
~~~~^~~~~~~
* data/yacc.c (pstate_delete): Do nothing if called on null pointer.
This commit is contained in:
19
data/yacc.c
19
data/yacc.c
@@ -1326,16 +1326,19 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
]b4_function_define([[yypstate_delete]], [[void]],
|
]b4_function_define([[yypstate_delete]], [[void]],
|
||||||
[[[yypstate *yyps]], [[yyps]]])[
|
[[[yypstate *yyps]], [[yyps]]])[
|
||||||
{
|
{
|
||||||
|
if (yyps)
|
||||||
|
{
|
||||||
#ifndef yyoverflow
|
#ifndef yyoverflow
|
||||||
/* If the stack was reallocated but the parse did not complete, then the
|
/* If the stack was reallocated but the parse did not complete, then the
|
||||||
stack still needs to be freed. */
|
stack still needs to be freed. */
|
||||||
if (!yyps->yynew && yyps->yyss != yyps->yyssa)
|
if (!yyps->yynew && yyps->yyss != yyps->yyssa)
|
||||||
YYSTACK_FREE (yyps->yyss);
|
YYSTACK_FREE (yyps->yyss);
|
||||||
#endif]b4_lac_if([[
|
#endif]b4_lac_if([[
|
||||||
if (!yyps->yynew && yyps->yyes != yyps->yyesa)
|
if (!yyps->yynew && yyps->yyes != yyps->yyesa)
|
||||||
YYSTACK_FREE (yyps->yyes);]])[
|
YYSTACK_FREE (yyps->yyes);]])[
|
||||||
free (yyps);]b4_pure_if([], [[
|
free (yyps);]b4_pure_if([], [[
|
||||||
yypstate_allocated = 0;]])[
|
yypstate_allocated = 0;]])[
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]b4_pure_if([[
|
]b4_pure_if([[
|
||||||
#define ]b4_prefix[nerrs yyps->]b4_prefix[nerrs]])[
|
#define ]b4_prefix[nerrs yyps->]b4_prefix[nerrs]])[
|
||||||
|
|||||||
@@ -13114,7 +13114,7 @@ Obsoleted by @code{%printer}.
|
|||||||
The function to delete a parser instance, produced by Bison in push mode;
|
The function to delete a parser instance, produced by Bison in push mode;
|
||||||
call this function to delete the memory associated with a parser.
|
call this function to delete the memory associated with a parser.
|
||||||
@xref{Parser Delete Function, ,The Parser Delete Function
|
@xref{Parser Delete Function, ,The Parser Delete Function
|
||||||
@code{yypstate_delete}}.
|
@code{yypstate_delete}}. Does nothing when called with a null pointer.
|
||||||
(The current push parsing interface is experimental and may evolve.
|
(The current push parsing interface is experimental and may evolve.
|
||||||
More user feedback will help to stabilize it.)
|
More user feedback will help to stabilize it.)
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|||||||
Reference in New Issue
Block a user