mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
yacc.c: use casts instead of pragmas when losing integer width
For instance with Clang 4, 8, etc.:
input.c:1166:12: error: implicit conversion loses integer precision: 'int' to 'yy_state_num' (aka 'signed char') [-Werror,-Wconversion]
*yyssp = yystate;
~ ^~~~~~~
And GCC 8:
input.c:1166:12: error: implicit conversion loses integer precision: 'int' to 'yy_state_num' (aka 'signed char') [-Werror,-Wimplicit-int-conversion]
*yyssp = yystate;
~ ^~~~~~~
* data/skeletons/yacc.c (YY_CONVERT_INT_BEGIN): Remove.
Adjust callers.
This commit is contained in:
@@ -468,18 +468,6 @@ typedef ]b4_int_type(0, m4_eval(b4_states_number - 1))[ yy_state_num;
|
|||||||
|
|
||||||
]b4_attribute_define[
|
]b4_attribute_define[
|
||||||
|
|
||||||
/* Suppress bogus -Wconversion warnings from GCC. */
|
|
||||||
#if 4 < __GNUC__ + (7 <= __GNUC_MINOR__)
|
|
||||||
# define YY_CONVERT_INT_BEGIN \
|
|
||||||
_Pragma ("GCC diagnostic push") \
|
|
||||||
_Pragma ("GCC diagnostic ignored \"-Wconversion\"")
|
|
||||||
# define YY_CONVERT_INT_END \
|
|
||||||
_Pragma ("GCC diagnostic pop")
|
|
||||||
#else
|
|
||||||
# define YY_CONVERT_INT_BEGIN
|
|
||||||
# define YY_CONVERT_INT_END
|
|
||||||
#endif
|
|
||||||
|
|
||||||
]b4_parse_assert_if([[#ifdef NDEBUG
|
]b4_parse_assert_if([[#ifdef NDEBUG
|
||||||
# define YY_ASSERT(E) ((void) (0 && (E)))
|
# define YY_ASSERT(E) ((void) (0 && (E)))
|
||||||
#else
|
#else
|
||||||
@@ -1062,9 +1050,7 @@ yy_lac (yy_state_num *yyesa, yy_state_num **yyes,
|
|||||||
if (yyesp == yyes_prev)
|
if (yyesp == yyes_prev)
|
||||||
{
|
{
|
||||||
yyesp = *yyes;
|
yyesp = *yyes;
|
||||||
YY_CONVERT_INT_BEGIN
|
*yyesp = (yy_state_num) yystate;
|
||||||
*yyesp = yystate;
|
|
||||||
YY_CONVERT_INT_END
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1077,9 +1063,7 @@ yy_lac (yy_state_num *yyesa, yy_state_num **yyes,
|
|||||||
YYDPRINTF ((stderr, "\n"));
|
YYDPRINTF ((stderr, "\n"));
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
YY_CONVERT_INT_BEGIN
|
*++yyesp = (yy_state_num) yystate;
|
||||||
*++yyesp = yystate;
|
|
||||||
YY_CONVERT_INT_END
|
|
||||||
}
|
}
|
||||||
YYDPRINTF ((stderr, " G%d", yystate));
|
YYDPRINTF ((stderr, " G%d", yystate));
|
||||||
}
|
}
|
||||||
@@ -1542,9 +1526,7 @@ yynewstate:
|
|||||||
yysetstate:
|
yysetstate:
|
||||||
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
||||||
YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
|
YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
|
||||||
YY_CONVERT_INT_BEGIN
|
*yyssp = (yy_state_num) yystate;
|
||||||
*yyssp = yystate;
|
|
||||||
YY_CONVERT_INT_END
|
|
||||||
|
|
||||||
if (yyss + yystacksize - 1 <= yyssp)
|
if (yyss + yystacksize - 1 <= yyssp)
|
||||||
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
|
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
|
||||||
|
|||||||
Reference in New Issue
Block a user