mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
yacc.c: work around warnings from Clang++ 3.3 and 3.4
When we run the test suite with these C++ compilers to compile C code,
we get:
239. synclines.at:440: testing syncline escapes: yacc.c ...
../../tests/synclines.at:440: $CC $CFLAGS $CPPFLAGS \"\\\"\".c -o \"\\\"\" ||
exit 77
stderr:
stdout:
../../tests/synclines.at:440: COLUMNS=1000; export COLUMNS; bison --color=no -fno-caret -o \"\\\"\".c \"\\\"\".y
../../tests/synclines.at:440: $CC $CFLAGS $CPPFLAGS $LDFLAGS -o \"\\\"\" \"\\\"\".c $LIBS
stderr:
"\"".c:1102:41: error: implicit conversion loses integer precision: 'long' to 'int' [-Werror,-Wshorten-64-to-32]
YYPTRDIFF_T yysize = yyssp - yyss + 1;
~~~~~~ ~~~~~~~~~~~~~^~~
1 error generated.
193. conflicts.at:545: testing parse.error=verbose and consistent errors: lr.type=canonical-lr parse.lac=full ...
input.c:737:75: error: implicit conversion loses integer precision: 'long' to 'int'
[-Werror,-Wshorten-64-to-32]
YYPTRDIFF_T yysize_old = *yytop == yytop_empty ? 0 : *yytop - *yybottom + 1;
~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~^~~
input.c:901:48: error: implicit conversion loses integer precision: 'long' to 'int'
[-Werror,-Wshorten-64-to-32]
YYPTRDIFF_T yysize = yyesp - *yyes + 1;
~~~~~~ ~~~~~~~~~~~~~~^~~
* data/skeletons/yacc.c: Add more casts.
This commit is contained in:
@@ -856,7 +856,8 @@ yy_lac_stack_realloc (YYPTRDIFF_T *yycapacity, YYPTRDIFF_T yyadd,
|
||||
yy_state_num *yybottom_no_free,
|
||||
yy_state_num **yytop, yy_state_num *yytop_empty)
|
||||
{
|
||||
YYPTRDIFF_T yysize_old = *yytop == yytop_empty ? 0 : *yytop - *yybottom + 1;
|
||||
YYPTRDIFF_T yysize_old =
|
||||
*yytop == yytop_empty ? 0 : (YYPTRDIFF_T) (*yytop - *yybottom + 1);
|
||||
YYPTRDIFF_T yysize_new = yysize_old + yyadd;
|
||||
if (*yycapacity < yysize_new)
|
||||
{
|
||||
@@ -1023,7 +1024,7 @@ yy_lac (yy_state_num *yyesa, yy_state_num **yyes,
|
||||
YYDPRINTF ((stderr, " R%d", yyrule - 1));
|
||||
if (yyesp != yyes_prev)
|
||||
{
|
||||
YYPTRDIFF_T yysize = yyesp - *yyes + 1;
|
||||
YYPTRDIFF_T yysize = (YYPTRDIFF_T) (yyesp - *yyes + 1);
|
||||
if (yylen < yysize)
|
||||
{
|
||||
yyesp -= yylen;
|
||||
@@ -1534,7 +1535,7 @@ yysetstate:
|
||||
#else
|
||||
{
|
||||
/* Get the current used size of the three stacks, in elements. */
|
||||
YYPTRDIFF_T yysize = yyssp - yyss + 1;
|
||||
YYPTRDIFF_T yysize = (YYPTRDIFF_T) (yyssp - yyss + 1);
|
||||
|
||||
# if defined yyoverflow
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user