Prefer signed types for indexes in skeletons

* NEWS: Mention this.
* data/skeletons/c.m4 (b4_int_type):
Prefer char if it will do, and prefer signed types to unsigned if
either will do.
* data/skeletons/glr.c (yy_reduce_print): No need to
convert rule line to unsigned long.
(yyrecoverSyntaxError): Put action into an int to
avoid GCC warning of using a char subscript.
* data/skeletons/lalr1.cc (yy_lac_check_, yysyntax_error_):
Prefer ptrdiff_t to size_t.
* data/skeletons/yacc.c (b4_int_type):
Prefer signed types to unsigned if either will do.
* data/skeletons/yacc.c (b4_declare_parser_state_variables):
(YYSTACK_RELOCATE, YYCOPY, yy_lac_stack_realloc, yy_lac)
(yytnamerr, yysyntax_error, yyparse): Prefer ptrdiff_t to size_t.
(YYPTRDIFF_T, YYPTRDIFF_MAXIMUM): New macros.
(YYSIZE_T): Fix "! defined YYSIZE_T" typo.
(YYSIZE_MAXIMUM): Take the minimum of PTRDIFF_MAX and SIZE_MAX.
(YYSIZEOF): New macro.
(YYSTACK_GAP_MAXIMUM, YYSTACK_BYTES, YYSTACK_RELOCATE)
(yy_lac_stack_realloc, yyparse): Use it.
(YYCOPY, yy_lac_stack_realloc): Cast to YYSIZE_T to pacify GCC.
(yy_reduce_print): Use int instead of unsigned long when int
will do.
(yy_lac_stack_realloc): Prefer long to unsigned long when
either will do.
* tests/regression.at: Adjust to these changes.
This commit is contained in:
Paul Eggert
2019-10-01 01:28:45 -07:00
committed by Akim Demaille
parent 2ca6b71967
commit 4d9ff272cf
6 changed files with 112 additions and 82 deletions

View File

@@ -661,7 +661,7 @@ AT_BISON_CHECK([-v -o input.c input.y])
[sed -n 's/ *$//;/^static const.*\[\] =/,/^}/p' input.c >tables.c]
AT_CHECK([[cat tables.c]], 0,
[[static const yytype_uint8 yytranslate[] =
[[static const yytype_int8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -691,7 +691,7 @@ AT_CHECK([[cat tables.c]], 0,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6
};
static const yytype_uint8 yyrline[] =
static const yytype_int8 yyrline[] =
{
0, 2, 2, 3, 3, 4, 5
};
@@ -700,7 +700,7 @@ static const char *const yytname[] =
"$end", "error", "$undefined", "\"if\"", "\"const\"", "\"then\"",
"\"else\"", "$accept", "statement", "struct_stat", "if", "else", YY_NULLPTR
};
static const yytype_uint16 yytoknum[] =
static const yytype_int16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261
};
@@ -709,7 +709,7 @@ static const yytype_int8 yypact[] =
-2, -1, 4, -8, 0, 2, -8, -2, -8, -2,
-8, -8
};
static const yytype_uint8 yydefact[] =
static const yytype_int8 yydefact[] =
{
3, 0, 0, 2, 0, 0, 1, 3, 4, 3,
6, 5
@@ -722,7 +722,7 @@ static const yytype_int8 yydefgoto[] =
{
-1, 2, 3, 4, 8
};
static const yytype_uint8 yytable[] =
static const yytype_int8 yytable[] =
{
10, 1, 11, 5, 6, 0, 7, 9
};
@@ -730,16 +730,16 @@ static const yytype_int8 yycheck[] =
{
7, 3, 9, 4, 0, -1, 6, 5
};
static const yytype_uint8 yystos[] =
static const yytype_int8 yystos[] =
{
0, 3, 8, 9, 10, 4, 0, 6, 11, 5,
8, 8
};
static const yytype_uint8 yyr1[] =
static const yytype_int8 yyr1[] =
{
0, 7, 8, 9, 9, 10, 11
};
static const yytype_uint8 yyr2[] =
static const yytype_int8 yyr2[] =
{
0, 2, 1, 0, 2, 4, 2
};