Have the GLR tests be `warning' checked, and fix the warnings.

* data/glr.c (YYFPRINTF): Always define it, not only when YYDEBUG
(yyuserAction, yyreportAmbiguity): `Use' all the arguments.
(yyremoveDeletes): `yyi' and `yyj' are size_t.
Use YYFPRINTF when under if (YYDEBUG) to avoid empty `if' bodies.
(yyaddDeferredAction): static.
(yyglrReduce): yyi, yyk, amd yyposn are size_t.
(yyreportParseError): yyprefix is const.
yytokenp is used only when verbose.
(yy__GNUC__): Replace with __GNUC__.
(yypdumpstack): yyi is size_t.
(yypreference): Un-yy local variables and arguments, to avoid
clashes with `yyr1'.  Anyway, we are not in the user name space.
(yytname_size): be an int, as is compared with ints.
* tests/testsuite.at (AT_COMPILE, AT_PARSER_CHECK): New.
Use them.
* tests/cxx-gram.at: Use quotation to protect $1.
Use AT_COMPILE to enable warnings hunts.
Prototype yylex and yyerror.
`Use' argc.
Include `string.h', not `strings.h'.
Produce and prototype stmtMerge only when used.
yylex takes a location.
This commit is contained in:
Akim Demaille
2002-06-30 17:35:06 +00:00
parent 97650f4efc
commit 1154ccedaf
11 changed files with 238 additions and 120 deletions

View File

@@ -132,8 +132,8 @@ AT_SETUP([Big triangle])
# it gets killed too. Of course the parser is to be cleaned.
AT_DATA_TRIANGULAR_GRAMMAR([input.y], [200])
AT_CHECK([bison input.y -v -o input.c])
AT_CHECK([$CC $CFLAGS $CPPFLAGS input.c -o input], 0, [], [ignore])
AT_CHECK([./input])
AT_COMPILE([input])
AT_PARSER_CHECK([./input])
AT_CLEANUP
@@ -231,8 +231,8 @@ AT_SETUP([Big horizontal])
#
AT_DATA_HORIZONTAL_GRAMMAR([input.y], [1000])
AT_CHECK([bison input.y -v -o input.c])
AT_CHECK([$CC $CFLAGS $CPPFLAGS input.c -o input], 0, [], [ignore])
AT_CHECK([./input])
AT_COMPILE([input])
AT_PARSER_CHECK([./input])
AT_CLEANUP
@@ -350,8 +350,8 @@ AT_SETUP([Many lookaheads])
AT_DATA_LOOKAHEADS_GRAMMAR([input.y], [1000])
AT_CHECK([bison input.y -v -o input.c])
AT_CHECK([$CC $CFLAGS $CPPFLAGS input.c -o input], 0, [], [ignore])
AT_CHECK([./input])
AT_COMPILE([input])
AT_PARSER_CHECK([./input])
AT_CLEANUP
@@ -407,7 +407,7 @@ main (int argc, const char **argv)
}
]])
AT_CHECK([bison input.y -o input.c])
AT_CHECK([$CC $CFLAGS $CPPFLAGS input.c -o input], 0, [], [ignore])
AT_COMPILE([input])
])
@@ -420,12 +420,12 @@ AT_SETUP([Exploding the Stack Size with Alloca])
AT_DATA_STACK_TORTURE
# Below the limit of 200.
AT_CHECK([./input 20], 0, [], [ignore])
AT_PARSER_CHECK([./input 20], 0, [], [ignore])
# Two enlargements: 2 * 2 * 200.
AT_CHECK([./input 900], 0, [], [ignore])
AT_PARSER_CHECK([./input 900], 0, [], [ignore])
# Fails: beyond the limit of 10,000 (which we don't reach anyway since we
# multiply by two starting at 200 => 5120 is the last possible).
AT_CHECK([./input 10000], 1, [], [ignore])
AT_PARSER_CHECK([./input 10000], 1, [], [ignore])
AT_CLEANUP
@@ -441,11 +441,11 @@ AT_SETUP([Exploding the Stack Size with Malloc])
AT_DATA_STACK_TORTURE([[#define YYSTACK_USE_ALLOCA 0]])
# Below the limit of 200.
AT_CHECK([./input 20], 0, [], [ignore])
AT_PARSER_CHECK([./input 20], 0, [], [ignore])
# Two enlargements: 2 * 2 * 200.
AT_CHECK([./input 900], 0, [], [ignore])
AT_PARSER_CHECK([./input 900], 0, [], [ignore])
# Fails: beyond the limit of 10,000 (which we don't reach anyway since we
# multiply by two starting at 200 => 5120 is the possible).
AT_CHECK([./input 10000], 1, [], [ignore])
AT_PARSER_CHECK([./input 10000], 1, [], [ignore])
AT_CLEANUP