mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 23:03:04 +00:00
glr2.cc: also run all the calculator tests
This revealed issues with yy_symbol_print and yy_reduce_print.
These changes, in turn, reactivated GCC10 warnings:
559. calc.at:1258: testing Calculator glr2.cc %locations %header parse.error=verbose %debug api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} ...
tests/calc.at:1258: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y
tests/calc.at:1258: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS
stderr:
calc.cc: In function 'void glr_stack::yyresolveLocations(glr_state*, int)':
calc.cc:2623:46: error: potential null pointer dereference [-Werror=null-dereference]
2623 | yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
calc.cc:2623:46: error: potential null pointer dereference [-Werror=null-dereference]
2623 | yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
calc.cc:2623:46: error: potential null pointer dereference [-Werror=null-dereference]
2623 | yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
calc.cc:1177:10: error: potential null pointer dereference [-Werror=null-dereference]
1177 | return yypred ? &(asItem (this) - yypred)->getState () : YY_NULLPTR;
| ^~~~~~
calc.cc:2623:46: error: potential null pointer dereference [-Werror=null-dereference]
2623 | yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
calc.cc:2623:46: error: potential null pointer dereference [-Werror=null-dereference]
2623 | yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
calc.cc: In member function 'YYRESULTTAG glr_stack::yyresolveValue(glr_state*)':
calc.cc:2623:46: error: potential null pointer dereference [-Werror=null-dereference]
2623 | yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
* tests/calc.at (AT_CHECK_CALC_GLR_CC): Also check glr2.cc.
* data/skeletons/glr2.cc: Don't pass the user arguments to
yy_symbol_print and yy_reduce_print, since they have it in the parser
object.
(b4_user_formals_no_comma, b4_pure_args, b4_lpure_args)
(b4_locuser_formals, b4_locuser_args): Remove, useless.
(YY_IGNORE_NULL_DEREFERENCE_BEGIN): Enable for GCC >= 10 too.
This commit is contained in:
@@ -1239,7 +1239,9 @@ AT_CHECK_CALC([%skeleton "glr.cc"])
|
||||
AT_CHECK_CALC([%skeleton "glr2.cc"])
|
||||
|
||||
m4_define([AT_CHECK_CALC_GLR_CC],
|
||||
[AT_CHECK_CALC([%language "C++" %glr-parser] $@)])
|
||||
[AT_CHECK_CALC([%language "C++" %glr-parser] $@) # glr.cc
|
||||
AT_CHECK_CALC([%skeleton "glr2.cc"] $@)
|
||||
])
|
||||
|
||||
AT_CHECK_CALC_GLR_CC([])
|
||||
AT_CHECK_CALC_GLR_CC([%locations])
|
||||
|
||||
Reference in New Issue
Block a user