mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-23 03:03:02 +00:00
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:
committed by
Akim Demaille
parent
2ca6b71967
commit
4d9ff272cf
6
NEWS
6
NEWS
@@ -40,6 +40,12 @@ GNU Bison NEWS
|
|||||||
The Java backend no longer emits code and data for parser tracing if the
|
The Java backend no longer emits code and data for parser tracing if the
|
||||||
%define variable parse.trace is not defined.
|
%define variable parse.trace is not defined.
|
||||||
|
|
||||||
|
*** Templates prefer signed integer types
|
||||||
|
|
||||||
|
Bison templates now prefer signed to unsigned integer types when
|
||||||
|
either will do, as the signed types are less error-prone and allow
|
||||||
|
for better checking with 'gcc -fsanitize=undefined'.
|
||||||
|
|
||||||
* Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
|
* Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
|
|||||||
@@ -167,16 +167,16 @@ b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
|
|||||||
|
|
||||||
# b4_int_type(MIN, MAX)
|
# b4_int_type(MIN, MAX)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Return the smallest int type able to handle numbers ranging from
|
# Return a narrow int type able to handle integers ranging from MIN
|
||||||
# MIN to MAX (included).
|
# to MAX (included) in portable C code. Assume MIN and MAX fall in
|
||||||
|
# 'int' range.
|
||||||
m4_define([b4_int_type],
|
m4_define([b4_int_type],
|
||||||
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
|
[m4_if(b4_ints_in($@, [0], [127]), [1], [char],
|
||||||
b4_ints_in($@, [-128], [127]), [1], [signed char],
|
b4_ints_in($@, [-127], [127]), [1], [signed char],
|
||||||
|
b4_ints_in($@, [0], [255]), [1], [unsigned char],
|
||||||
|
|
||||||
|
b4_ints_in($@, [-32767], [32767]), [1], [short],
|
||||||
b4_ints_in($@, [0], [65535]), [1], [unsigned short],
|
b4_ints_in($@, [0], [65535]), [1], [unsigned short],
|
||||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
|
||||||
|
|
||||||
m4_eval([0 <= $1]), [1], [unsigned],
|
|
||||||
|
|
||||||
[int])])
|
[int])])
|
||||||
|
|
||||||
|
|||||||
@@ -1343,9 +1343,9 @@ yy_reduce_print (yybool yynormal, yyGLRStackItem* yyvsp, size_t yyk,
|
|||||||
int yynrhs = yyrhsLength (yyrule);]b4_locations_if([
|
int yynrhs = yyrhsLength (yyrule);]b4_locations_if([
|
||||||
int yylow = 1;])[
|
int yylow = 1;])[
|
||||||
int yyi;
|
int yyi;
|
||||||
YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n",
|
YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %d):\n",
|
||||||
(unsigned long) yyk, yyrule - 1,
|
(unsigned long) yyk, yyrule - 1,
|
||||||
(unsigned long) yyrline[yyrule]);
|
yyrline[yyrule]);
|
||||||
if (! yynormal)
|
if (! yynormal)
|
||||||
yyfillin (yyvsp, 1, -yynrhs);
|
yyfillin (yyvsp, 1, -yynrhs);
|
||||||
/* The symbols being reduced. */
|
/* The symbols being reduced. */
|
||||||
@@ -2253,14 +2253,15 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR
|
if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR
|
||||||
&& yyisShiftAction (yytable[yyj]))
|
&& yyisShiftAction (yytable[yyj]))
|
||||||
{
|
{
|
||||||
/* Shift the error token. */]b4_locations_if([[
|
/* Shift the error token. */
|
||||||
|
int yyaction = yytable[yyj];]b4_locations_if([[
|
||||||
/* First adjust its location.*/
|
/* First adjust its location.*/
|
||||||
YYLTYPE yyerrloc;
|
YYLTYPE yyerrloc;
|
||||||
yystackp->yyerror_range[2].yystate.yyloc = yylloc;
|
yystackp->yyerror_range[2].yystate.yyloc = yylloc;
|
||||||
YYLLOC_DEFAULT (yyerrloc, (yystackp->yyerror_range), 2);]])[
|
YYLLOC_DEFAULT (yyerrloc, (yystackp->yyerror_range), 2);]])[
|
||||||
YY_SYMBOL_PRINT ("Shifting", yystos[yytable[yyj]],
|
YY_SYMBOL_PRINT ("Shifting", yystos[yyaction],
|
||||||
&yylval, &yyerrloc);
|
&yylval, &yyerrloc);
|
||||||
yyglrShift (yystackp, 0, yytable[yyj],
|
yyglrShift (yystackp, 0, yyaction,
|
||||||
yys->yyposn, &yylval]b4_locations_if([, &yyerrloc])[);
|
yys->yyposn, &yylval]b4_locations_if([, &yyerrloc])[);
|
||||||
yys = yystackp->yytops.yystates[0];
|
yys = yystackp->yytops.yystates[0];
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1155,11 +1155,11 @@ b4_dollar_popdef])[]dnl
|
|||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
YYCDEBUG << "LAC: checking lookahead " << yytname_[yytoken] << ':';
|
YYCDEBUG << "LAC: checking lookahead " << yytname_[yytoken] << ':';
|
||||||
#endif
|
#endif
|
||||||
size_t lac_top = 0;
|
ptrdiff_t lac_top = 0;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
state_type top_state = (yylac_stack_.empty ()
|
state_type top_state = (yylac_stack_.empty ()
|
||||||
? yystack_[lac_top].state
|
? yystack_[(size_t) lac_top].state
|
||||||
: yylac_stack_.back ());
|
: yylac_stack_.back ());
|
||||||
int yyrule = yypact_[top_state];
|
int yyrule = yypact_[top_state];
|
||||||
if (yy_pact_value_is_default_ (yyrule)
|
if (yy_pact_value_is_default_ (yyrule)
|
||||||
@@ -1194,12 +1194,12 @@ b4_dollar_popdef])[]dnl
|
|||||||
YYCDEBUG << " R" << yyrule - 1;
|
YYCDEBUG << " R" << yyrule - 1;
|
||||||
// Pop the corresponding number of values from the stack.
|
// Pop the corresponding number of values from the stack.
|
||||||
{
|
{
|
||||||
size_t yylen = yyr2_[yyrule];
|
ptrdiff_t yylen = yyr2_[yyrule];
|
||||||
// First pop from the LAC stack as many tokens as possible.
|
// First pop from the LAC stack as many tokens as possible.
|
||||||
size_t lac_size = yylac_stack_.size ();
|
ptrdiff_t lac_size = (ptrdiff_t) yylac_stack_.size ();
|
||||||
if (yylen < lac_size)
|
if (yylen < lac_size)
|
||||||
{
|
{
|
||||||
yylac_stack_.resize (lac_size - yylen);
|
yylac_stack_.resize ((size_t) (lac_size - yylen));
|
||||||
yylen = 0;
|
yylen = 0;
|
||||||
}
|
}
|
||||||
else if (lac_size)
|
else if (lac_size)
|
||||||
@@ -1207,13 +1207,13 @@ b4_dollar_popdef])[]dnl
|
|||||||
yylac_stack_.clear ();
|
yylac_stack_.clear ();
|
||||||
yylen -= lac_size;
|
yylen -= lac_size;
|
||||||
}
|
}
|
||||||
// Only aftwerwards look at the main stack.
|
// Only afterwards look at the main stack.
|
||||||
// We simulate popping elements by incrementing lac_top.
|
// We simulate popping elements by incrementing lac_top.
|
||||||
lac_top += yylen;
|
lac_top += yylen;
|
||||||
}
|
}
|
||||||
// Keep top_state in sync with the updated stack.
|
// Keep top_state in sync with the updated stack.
|
||||||
top_state = (yylac_stack_.empty ()
|
top_state = (yylac_stack_.empty ()
|
||||||
? yystack_[lac_top].state
|
? yystack_[(size_t) lac_top].state
|
||||||
: yylac_stack_.back ());
|
: yylac_stack_.back ());
|
||||||
// Push the resulting state of the reduction.
|
// Push the resulting state of the reduction.
|
||||||
state_type state = yy_lr_goto_state_ (top_state, yyr1_[yyrule]);
|
state_type state = yy_lr_goto_state_ (top_state, yyr1_[yyrule]);
|
||||||
@@ -1292,7 +1292,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
{]b4_error_verbose_if([[
|
{]b4_error_verbose_if([[
|
||||||
// Number of reported tokens (one for the "unexpected", one per
|
// Number of reported tokens (one for the "unexpected", one per
|
||||||
// "expected").
|
// "expected").
|
||||||
size_t yycount = 0;
|
ptrdiff_t yycount = 0;
|
||||||
// Its maximum.
|
// Its maximum.
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
// Arguments of yyformat.
|
// Arguments of yyformat.
|
||||||
@@ -1387,7 +1387,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
|
|
||||||
std::string yyres;
|
std::string yyres;
|
||||||
// Argument number.
|
// Argument number.
|
||||||
size_t yyi = 0;
|
ptrdiff_t yyi = 0;
|
||||||
for (char const* yyp = yyformat; *yyp; ++yyp)
|
for (char const* yyp = yyformat; *yyp; ++yyp)
|
||||||
if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount)
|
if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount)
|
||||||
{
|
{
|
||||||
@@ -1436,7 +1436,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
void
|
void
|
||||||
]b4_parser_class[::yy_reduce_print_ (int yyrule)
|
]b4_parser_class[::yy_reduce_print_ (int yyrule)
|
||||||
{
|
{
|
||||||
unsigned yylno = yyrline_[yyrule];
|
int yylno = yyrline_[yyrule];
|
||||||
int yynrhs = yyr2_[yyrule];
|
int yynrhs = yyr2_[yyrule];
|
||||||
// Print the symbols being reduced, and their result.
|
// Print the symbols being reduced, and their result.
|
||||||
*yycdebug_ << "Reducing stack by rule " << yyrule - 1
|
*yycdebug_ << "Reducing stack by rule " << yyrule - 1
|
||||||
|
|||||||
@@ -112,18 +112,16 @@ m4_ifset([b4_parse_param], [b4_args(b4_parse_param), ])])
|
|||||||
|
|
||||||
# b4_int_type(MIN, MAX)
|
# b4_int_type(MIN, MAX)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Return the smallest int type able to handle numbers ranging from
|
# Return a narrow int type able to handle numbers ranging from
|
||||||
# MIN to MAX (included). Overwrite the version from c.m4, which
|
# MIN to MAX (included). Overwrite the version from c.m4, which
|
||||||
# uses only C89 types, so that the user can override the shorter
|
# uses only C89 types, so that the user can override the shorter
|
||||||
# types, and so that pre-C89 compilers are handled correctly.
|
# types, and so that pre-C89 compilers are handled correctly.
|
||||||
m4_define([b4_int_type],
|
m4_define([b4_int_type],
|
||||||
[m4_if(b4_ints_in($@, [0], [255]), [1], [yytype_uint8],
|
[m4_if(b4_ints_in($@, [-127], [127]), [1], [yytype_int8],
|
||||||
b4_ints_in($@, [-128], [127]), [1], [yytype_int8],
|
b4_ints_in($@, [0], [255]), [1], [yytype_uint8],
|
||||||
|
|
||||||
|
b4_ints_in($@, [-32767], [32767]), [1], [yytype_int16],
|
||||||
b4_ints_in($@, [0], [65535]), [1], [yytype_uint16],
|
b4_ints_in($@, [0], [65535]), [1], [yytype_uint16],
|
||||||
b4_ints_in($@, [-32768], [32767]), [1], [yytype_int16],
|
|
||||||
|
|
||||||
m4_eval([0 <= $1]), [1], [unsigned],
|
|
||||||
|
|
||||||
[int])])
|
[int])])
|
||||||
|
|
||||||
@@ -246,11 +244,11 @@ m4_define([b4_declare_parser_state_variables], [b4_pure_if([[
|
|||||||
/* The locations where the error started and ended. */
|
/* The locations where the error started and ended. */
|
||||||
YYLTYPE yyerror_range[3];]])[
|
YYLTYPE yyerror_range[3];]])[
|
||||||
|
|
||||||
YYSIZE_T yystacksize;]b4_lac_if([[
|
YYPTRDIFF_T yystacksize;]b4_lac_if([[
|
||||||
|
|
||||||
yy_state_num yyesa@{]b4_percent_define_get([[parse.lac.es-capacity-initial]])[@};
|
yy_state_num yyesa@{]b4_percent_define_get([[parse.lac.es-capacity-initial]])[@};
|
||||||
yy_state_num *yyes;
|
yy_state_num *yyes;
|
||||||
YYSIZE_T yyes_capacity;]])])
|
YYPTRDIFF_T yyes_capacity;]])])
|
||||||
|
|
||||||
|
|
||||||
# _b4_declare_yyparse_push
|
# _b4_declare_yyparse_push
|
||||||
@@ -427,12 +425,31 @@ typedef YYTYPE_INT16 yytype_int16;
|
|||||||
typedef short yytype_int16;
|
typedef short yytype_int16;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef YYPTRDIFF_T
|
||||||
|
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
|
||||||
|
# define YYPTRDIFF_T __PTRDIFF_TYPE__
|
||||||
|
# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
|
||||||
|
# elif defined ptrdiff_t && defined PTRDIFF_MAX
|
||||||
|
# define YYPTRDIFF_T ptrdiff_t
|
||||||
|
# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
|
||||||
|
# elif 199901 <= __STDC_VERSION__
|
||||||
|
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
|
# define YYPTRDIFF_T ptrdiff_t
|
||||||
|
# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
|
# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
|
||||||
|
# else
|
||||||
|
# define YYPTRDIFF_T int
|
||||||
|
# include <limits.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
|
# define YYPTRDIFF_MAXIMUM INT_MAX
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef YYSIZE_T
|
#ifndef YYSIZE_T
|
||||||
# ifdef __SIZE_TYPE__
|
# ifdef __SIZE_TYPE__
|
||||||
# define YYSIZE_T __SIZE_TYPE__
|
# define YYSIZE_T __SIZE_TYPE__
|
||||||
# elif defined size_t
|
# elif defined size_t
|
||||||
# define YYSIZE_T size_t
|
# define YYSIZE_T size_t
|
||||||
# elif ! defined YYSIZE_T
|
# elif 199901 <= __STDC_VERSION__
|
||||||
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
# define YYSIZE_T size_t
|
# define YYSIZE_T size_t
|
||||||
# else
|
# else
|
||||||
@@ -440,7 +457,10 @@ typedef short yytype_int16;
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
|
#define YYSIZE_MAXIMUM ((YYPTRDIFF_T) (YYPTRDIFF_MAXIMUM < (YYSIZE_T) -1 \
|
||||||
|
? YYPTRDIFF_MAXIMUM : (YYSIZE_T) -1))
|
||||||
|
|
||||||
|
#define YYSIZEOF(X) ((YYPTRDIFF_T) sizeof (X))
|
||||||
|
|
||||||
|
|
||||||
/* State numbers. */
|
/* State numbers. */
|
||||||
@@ -554,16 +574,17 @@ union yyalloc
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* The size of the maximum gap between one aligned stack and the next. */
|
/* The size of the maximum gap between one aligned stack and the next. */
|
||||||
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
|
# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
|
||||||
|
|
||||||
/* The size of an array large to enough to hold all stacks, each with
|
/* The size of an array large to enough to hold all stacks, each with
|
||||||
N elements. */
|
N elements. */
|
||||||
]b4_locations_if(
|
]b4_locations_if(
|
||||||
[# define YYSTACK_BYTES(N) \
|
[# define YYSTACK_BYTES(N) \
|
||||||
((N) * (sizeof (yy_state_num) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
|
((N) * (YYSIZEOF (yy_state_num) + YYSIZEOF (YYSTYPE) \
|
||||||
|
+ YYSIZEOF (YYLTYPE)) \
|
||||||
+ 2 * YYSTACK_GAP_MAXIMUM)],
|
+ 2 * YYSTACK_GAP_MAXIMUM)],
|
||||||
[# define YYSTACK_BYTES(N) \
|
[# define YYSTACK_BYTES(N) \
|
||||||
((N) * (sizeof (yy_state_num) + sizeof (YYSTYPE)) \
|
((N) * (YYSIZEOF (yy_state_num) + YYSIZEOF (YYSTYPE)) \
|
||||||
+ YYSTACK_GAP_MAXIMUM)])[
|
+ YYSTACK_GAP_MAXIMUM)])[
|
||||||
|
|
||||||
# define YYCOPY_NEEDED 1
|
# define YYCOPY_NEEDED 1
|
||||||
@@ -576,11 +597,11 @@ union yyalloc
|
|||||||
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
|
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
YYSIZE_T yynewbytes; \
|
YYPTRDIFF_T yynewbytes; \
|
||||||
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
|
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
|
||||||
Stack = &yyptr->Stack_alloc; \
|
Stack = &yyptr->Stack_alloc; \
|
||||||
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
|
yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
|
||||||
yyptr += yynewbytes / sizeof (*yyptr); \
|
yyptr += yynewbytes / YYSIZEOF (*yyptr); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
@@ -592,12 +613,12 @@ union yyalloc
|
|||||||
# ifndef YYCOPY
|
# ifndef YYCOPY
|
||||||
# if defined __GNUC__ && 1 < __GNUC__
|
# if defined __GNUC__ && 1 < __GNUC__
|
||||||
# define YYCOPY(Dst, Src, Count) \
|
# define YYCOPY(Dst, Src, Count) \
|
||||||
__builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
|
__builtin_memcpy (Dst, Src, (YYSIZE_T) (Count) * sizeof (*(Src)))
|
||||||
# else
|
# else
|
||||||
# define YYCOPY(Dst, Src, Count) \
|
# define YYCOPY(Dst, Src, Count) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
YYSIZE_T yyi; \
|
YYPTRDIFF_T yyi; \
|
||||||
for (yyi = 0; yyi < (Count); yyi++) \
|
for (yyi = 0; yyi < (Count); yyi++) \
|
||||||
(Dst)[yyi] = (Src)[yyi]; \
|
(Dst)[yyi] = (Src)[yyi]; \
|
||||||
} \
|
} \
|
||||||
@@ -774,10 +795,10 @@ do { \
|
|||||||
])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,
|
])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))[
|
b4_parse_param]))[
|
||||||
{
|
{
|
||||||
unsigned long yylno = yyrline[yyrule];
|
int yylno = yyrline[yyrule];
|
||||||
int yynrhs = yyr2[yyrule];
|
int yynrhs = yyr2[yyrule];
|
||||||
int yyi;
|
int yyi;
|
||||||
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
|
YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
|
||||||
yyrule - 1, yylno);
|
yyrule - 1, yylno);
|
||||||
/* The symbols being reduced. */
|
/* The symbols being reduced. */
|
||||||
for (yyi = 0; yyi < yynrhs; yyi++)
|
for (yyi = 0; yyi < yynrhs; yyi++)
|
||||||
@@ -836,7 +857,7 @@ int yydebug;
|
|||||||
using YYSTACK_FREE. Return 0 if successful or if no reallocation is
|
using YYSTACK_FREE. Return 0 if successful or if no reallocation is
|
||||||
required. Return 1 if memory is exhausted. */
|
required. Return 1 if memory is exhausted. */
|
||||||
static int
|
static int
|
||||||
yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
|
yy_lac_stack_realloc (YYPTRDIFF_T *yycapacity, YYPTRDIFF_T yyadd,
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
char const *yydebug_prefix,
|
char const *yydebug_prefix,
|
||||||
char const *yydebug_suffix,
|
char const *yydebug_suffix,
|
||||||
@@ -845,12 +866,11 @@ yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
|
|||||||
yy_state_num *yybottom_no_free,
|
yy_state_num *yybottom_no_free,
|
||||||
yy_state_num **yytop, yy_state_num *yytop_empty)
|
yy_state_num **yytop, yy_state_num *yytop_empty)
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize_old =
|
YYPTRDIFF_T yysize_old = *yytop == yytop_empty ? 0 : *yytop - *yybottom + 1;
|
||||||
(YYSIZE_T) (*yytop == yytop_empty ? 0 : *yytop - *yybottom + 1);
|
YYPTRDIFF_T yysize_new = yysize_old + yyadd;
|
||||||
YYSIZE_T yysize_new = yysize_old + yyadd;
|
|
||||||
if (*yycapacity < yysize_new)
|
if (*yycapacity < yysize_new)
|
||||||
{
|
{
|
||||||
YYSIZE_T yyalloc = 2 * yysize_new;
|
YYPTRDIFF_T yyalloc = 2 * yysize_new;
|
||||||
yy_state_num *yybottom_new;
|
yy_state_num *yybottom_new;
|
||||||
/* Use YYMAXDEPTH for maximum stack size given that the stack
|
/* Use YYMAXDEPTH for maximum stack size given that the stack
|
||||||
should never need to grow larger than the main state stack
|
should never need to grow larger than the main state stack
|
||||||
@@ -864,7 +884,8 @@ yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
|
|||||||
if (YYMAXDEPTH < yyalloc)
|
if (YYMAXDEPTH < yyalloc)
|
||||||
yyalloc = YYMAXDEPTH;
|
yyalloc = YYMAXDEPTH;
|
||||||
yybottom_new =
|
yybottom_new =
|
||||||
(yy_state_num*) YYSTACK_ALLOC (yyalloc * sizeof *yybottom_new);
|
(yy_state_num *) YYSTACK_ALLOC ((YYSIZE_T)
|
||||||
|
(yyalloc * YYSIZEOF (*yybottom_new)));
|
||||||
if (!yybottom_new)
|
if (!yybottom_new)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "%srealloc failed%s", yydebug_prefix,
|
YYDPRINTF ((stderr, "%srealloc failed%s", yydebug_prefix,
|
||||||
@@ -881,8 +902,8 @@ yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
|
|||||||
*yybottom = yybottom_new;
|
*yybottom = yybottom_new;
|
||||||
*yycapacity = yyalloc;]m4_if(b4_percent_define_get([[parse.lac.memory-trace]]),
|
*yycapacity = yyalloc;]m4_if(b4_percent_define_get([[parse.lac.memory-trace]]),
|
||||||
[full], [[
|
[full], [[
|
||||||
YYDPRINTF ((stderr, "%srealloc to %lu%s", yydebug_prefix,
|
YYDPRINTF ((stderr, "%srealloc to %ld%s", yydebug_prefix,
|
||||||
(unsigned long) yyalloc, yydebug_suffix));]])[
|
(long) yyalloc, yydebug_suffix));]])[
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -968,7 +989,7 @@ do { \
|
|||||||
any old *YYES other than YYESA. */
|
any old *YYES other than YYESA. */
|
||||||
static int
|
static int
|
||||||
yy_lac (yy_state_num *yyesa, yy_state_num **yyes,
|
yy_lac (yy_state_num *yyesa, yy_state_num **yyes,
|
||||||
YYSIZE_T *yyes_capacity, yy_state_num *yyssp, int yytoken)
|
YYPTRDIFF_T *yyes_capacity, yy_state_num *yyssp, int yytoken)
|
||||||
{
|
{
|
||||||
yy_state_num *yyes_prev = yyssp;
|
yy_state_num *yyes_prev = yyssp;
|
||||||
yy_state_num *yyesp = yyes_prev;
|
yy_state_num *yyesp = yyes_prev;
|
||||||
@@ -1008,11 +1029,11 @@ yy_lac (yy_state_num *yyesa, yy_state_num **yyes,
|
|||||||
yyrule = -yyrule;
|
yyrule = -yyrule;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
YYSIZE_T yylen = yyr2[yyrule];
|
YYPTRDIFF_T yylen = yyr2[yyrule];
|
||||||
YYDPRINTF ((stderr, " R%d", yyrule - 1));
|
YYDPRINTF ((stderr, " R%d", yyrule - 1));
|
||||||
if (yyesp != yyes_prev)
|
if (yyesp != yyes_prev)
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize = (YYSIZE_T) (yyesp - *yyes + 1);
|
YYPTRDIFF_T yysize = yyesp - *yyes + 1;
|
||||||
if (yylen < yysize)
|
if (yylen < yysize)
|
||||||
{
|
{
|
||||||
yyesp -= yylen;
|
yyesp -= yylen;
|
||||||
@@ -1064,13 +1085,13 @@ yy_lac (yy_state_num *yyesa, yy_state_num **yyes,
|
|||||||
|
|
||||||
# ifndef yystrlen
|
# ifndef yystrlen
|
||||||
# if defined __GLIBC__ && defined _STRING_H
|
# if defined __GLIBC__ && defined _STRING_H
|
||||||
# define yystrlen strlen
|
# define yystrlen(S) ((YYPTRDIFF_T) strlen (S))
|
||||||
# else
|
# else
|
||||||
/* Return the length of YYSTR. */
|
/* Return the length of YYSTR. */
|
||||||
]b4_function_define([yystrlen], [static YYSIZE_T],
|
]b4_function_define([yystrlen], [static YYPTRDIFF_T],
|
||||||
[[const char *yystr], [yystr]])[
|
[[const char *yystr], [yystr]])[
|
||||||
{
|
{
|
||||||
YYSIZE_T yylen;
|
YYPTRDIFF_T yylen;
|
||||||
for (yylen = 0; yystr[yylen]; yylen++)
|
for (yylen = 0; yystr[yylen]; yylen++)
|
||||||
continue;
|
continue;
|
||||||
return yylen;
|
return yylen;
|
||||||
@@ -1106,12 +1127,12 @@ yy_lac (yy_state_num *yyesa, yy_state_num **yyes,
|
|||||||
backslash-backslash). YYSTR is taken from yytname. If YYRES is
|
backslash-backslash). YYSTR is taken from yytname. If YYRES is
|
||||||
null, do not copy; instead, return the length of what the result
|
null, do not copy; instead, return the length of what the result
|
||||||
would have been. */
|
would have been. */
|
||||||
static YYSIZE_T
|
static YYPTRDIFF_T
|
||||||
yytnamerr (char *yyres, const char *yystr)
|
yytnamerr (char *yyres, const char *yystr)
|
||||||
{
|
{
|
||||||
if (*yystr == '"')
|
if (*yystr == '"')
|
||||||
{
|
{
|
||||||
YYSIZE_T yyn = 0;
|
YYPTRDIFF_T yyn = 0;
|
||||||
char const *yyp = yystr;
|
char const *yyp = yystr;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
@@ -1145,7 +1166,7 @@ yytnamerr (char *yyres, const char *yystr)
|
|||||||
if (! yyres)
|
if (! yyres)
|
||||||
return yystrlen (yystr);
|
return yystrlen (yystr);
|
||||||
|
|
||||||
return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
|
return yystpcpy (yyres, yystr) - yyres;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -1160,12 +1181,12 @@ yytnamerr (char *yyres, const char *yystr)
|
|||||||
required number of bytes is too large to store]b4_lac_if([[ or if
|
required number of bytes is too large to store]b4_lac_if([[ or if
|
||||||
yy_lac returned 2]])[. */
|
yy_lac returned 2]])[. */
|
||||||
static int
|
static int
|
||||||
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
||||||
]b4_lac_if([[yy_state_num *yyesa, yy_state_num **yyes,
|
]b4_lac_if([[yy_state_num *yyesa, yy_state_num **yyes,
|
||||||
YYSIZE_T *yyes_capacity, ]])[yy_state_num *yyssp, int yytoken)
|
YYPTRDIFF_T *yyes_capacity, ]])[yy_state_num *yyssp, int yytoken)
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
|
YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
|
||||||
YYSIZE_T yysize = yysize0;
|
YYPTRDIFF_T yysize = yysize0;
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
/* Internationalized format string. */
|
/* Internationalized format string. */
|
||||||
const char *yyformat = YY_NULLPTR;
|
const char *yyformat = YY_NULLPTR;
|
||||||
@@ -1244,7 +1265,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
}
|
}
|
||||||
yyarg[yycount++] = yytname[yyx];
|
yyarg[yycount++] = yytname[yyx];
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
|
YYPTRDIFF_T yysize1 = yysize + yytnamerr (YY_NULLPTR,
|
||||||
|
yytname[yyx]);
|
||||||
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
||||||
yysize = yysize1;
|
yysize = yysize1;
|
||||||
else
|
else
|
||||||
@@ -1275,7 +1297,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
|
YYPTRDIFF_T yysize1 = yysize + yystrlen (yyformat);
|
||||||
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
||||||
yysize = yysize1;
|
yysize = yysize1;
|
||||||
else
|
else
|
||||||
@@ -1456,7 +1478,7 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
/* Buffer for error messages, and its allocated size. */
|
/* Buffer for error messages, and its allocated size. */
|
||||||
char yymsgbuf[128];
|
char yymsgbuf[128];
|
||||||
char *yymsg = yymsgbuf;
|
char *yymsg = yymsgbuf;
|
||||||
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
|
YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)]b4_locations_if([, yylsp -= (N)])[)
|
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)]b4_locations_if([, yylsp -= (N)])[)
|
||||||
@@ -1522,7 +1544,7 @@ yysetstate:
|
|||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
/* Get the current used size of the three stacks, in elements. */
|
/* Get the current used size of the three stacks, in elements. */
|
||||||
YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
|
YYPTRDIFF_T yysize = yyssp - yyss + 1;
|
||||||
|
|
||||||
# if defined yyoverflow
|
# if defined yyoverflow
|
||||||
{
|
{
|
||||||
@@ -1538,9 +1560,9 @@ yysetstate:
|
|||||||
conditional around just the two extra args, but that might
|
conditional around just the two extra args, but that might
|
||||||
be undefined if yyoverflow is a macro. */
|
be undefined if yyoverflow is a macro. */
|
||||||
yyoverflow (YY_("memory exhausted"),
|
yyoverflow (YY_("memory exhausted"),
|
||||||
&yyss1, yysize * sizeof (*yyssp),
|
&yyss1, yysize * YYSIZEOF (*yyssp),
|
||||||
&yyvs1, yysize * sizeof (*yyvsp),]b4_locations_if([
|
&yyvs1, yysize * YYSIZEOF (*yyvsp),]b4_locations_if([
|
||||||
&yyls1, yysize * sizeof (*yylsp),])[
|
&yyls1, yysize * YYSIZEOF (*yylsp),])[
|
||||||
&yystacksize);
|
&yystacksize);
|
||||||
yyss = yyss1;
|
yyss = yyss1;
|
||||||
yyvs = yyvs1;]b4_locations_if([
|
yyvs = yyvs1;]b4_locations_if([
|
||||||
@@ -1557,7 +1579,8 @@ yysetstate:
|
|||||||
{
|
{
|
||||||
yy_state_num *yyss1 = yyss;
|
yy_state_num *yyss1 = yyss;
|
||||||
union yyalloc *yyptr =
|
union yyalloc *yyptr =
|
||||||
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
|
(union yyalloc *) YYSTACK_ALLOC ((YYSIZE_T)
|
||||||
|
YYSTACK_BYTES (yystacksize));
|
||||||
if (! yyptr)
|
if (! yyptr)
|
||||||
goto yyexhaustedlab;
|
goto yyexhaustedlab;
|
||||||
YYSTACK_RELOCATE (yyss_alloc, yyss);
|
YYSTACK_RELOCATE (yyss_alloc, yyss);
|
||||||
@@ -1573,8 +1596,8 @@ yysetstate:
|
|||||||
yyvsp = yyvs + yysize - 1;]b4_locations_if([
|
yyvsp = yyvs + yysize - 1;]b4_locations_if([
|
||||||
yylsp = yyls + yysize - 1;])[
|
yylsp = yyls + yysize - 1;])[
|
||||||
|
|
||||||
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
|
YYDPRINTF ((stderr, "Stack size increased to %ld\n",
|
||||||
(unsigned long) yystacksize));
|
(long) yystacksize));
|
||||||
|
|
||||||
if (yyss + yystacksize - 1 <= yyssp)
|
if (yyss + yystacksize - 1 <= yyssp)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
@@ -1788,7 +1811,7 @@ yyerrlab:
|
|||||||
{
|
{
|
||||||
if (yymsg != yymsgbuf)
|
if (yymsg != yymsgbuf)
|
||||||
YYSTACK_FREE (yymsg);
|
YYSTACK_FREE (yymsg);
|
||||||
yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
|
yymsg = (char *) YYSTACK_ALLOC ((YYSIZE_T) yymsg_alloc);
|
||||||
if (!yymsg)
|
if (!yymsg)
|
||||||
{
|
{
|
||||||
yymsg = yymsgbuf;
|
yymsg = yymsgbuf;
|
||||||
|
|||||||
@@ -661,7 +661,7 @@ AT_BISON_CHECK([-v -o input.c input.y])
|
|||||||
[sed -n 's/ *$//;/^static const.*\[\] =/,/^}/p' input.c >tables.c]
|
[sed -n 's/ *$//;/^static const.*\[\] =/,/^}/p' input.c >tables.c]
|
||||||
|
|
||||||
AT_CHECK([[cat tables.c]], 0,
|
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,
|
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
2, 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,
|
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
|
||||||
5, 6
|
5, 6
|
||||||
};
|
};
|
||||||
static const yytype_uint8 yyrline[] =
|
static const yytype_int8 yyrline[] =
|
||||||
{
|
{
|
||||||
0, 2, 2, 3, 3, 4, 5
|
0, 2, 2, 3, 3, 4, 5
|
||||||
};
|
};
|
||||||
@@ -700,7 +700,7 @@ static const char *const yytname[] =
|
|||||||
"$end", "error", "$undefined", "\"if\"", "\"const\"", "\"then\"",
|
"$end", "error", "$undefined", "\"if\"", "\"const\"", "\"then\"",
|
||||||
"\"else\"", "$accept", "statement", "struct_stat", "if", "else", YY_NULLPTR
|
"\"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
|
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,
|
-2, -1, 4, -8, 0, 2, -8, -2, -8, -2,
|
||||||
-8, -8
|
-8, -8
|
||||||
};
|
};
|
||||||
static const yytype_uint8 yydefact[] =
|
static const yytype_int8 yydefact[] =
|
||||||
{
|
{
|
||||||
3, 0, 0, 2, 0, 0, 1, 3, 4, 3,
|
3, 0, 0, 2, 0, 0, 1, 3, 4, 3,
|
||||||
6, 5
|
6, 5
|
||||||
@@ -722,7 +722,7 @@ static const yytype_int8 yydefgoto[] =
|
|||||||
{
|
{
|
||||||
-1, 2, 3, 4, 8
|
-1, 2, 3, 4, 8
|
||||||
};
|
};
|
||||||
static const yytype_uint8 yytable[] =
|
static const yytype_int8 yytable[] =
|
||||||
{
|
{
|
||||||
10, 1, 11, 5, 6, 0, 7, 9
|
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
|
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,
|
0, 3, 8, 9, 10, 4, 0, 6, 11, 5,
|
||||||
8, 8
|
8, 8
|
||||||
};
|
};
|
||||||
static const yytype_uint8 yyr1[] =
|
static const yytype_int8 yyr1[] =
|
||||||
{
|
{
|
||||||
0, 7, 8, 9, 9, 10, 11
|
0, 7, 8, 9, 9, 10, 11
|
||||||
};
|
};
|
||||||
static const yytype_uint8 yyr2[] =
|
static const yytype_int8 yyr2[] =
|
||||||
{
|
{
|
||||||
0, 2, 1, 0, 2, 4, 2
|
0, 2, 1, 0, 2, 4, 2
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user