Michael McConville:

> Index: skeleton.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/yacc/skeleton.c,v
> retrieving revision 1.35
> diff -u -p -r1.35 skeleton.c
> --- skeleton.c        16 Mar 2014 18:38:30 -0000      1.35
> +++ skeleton.c        24 Dec 2015 17:34:02 -0000
> @@ -137,16 +137,14 @@ char *body[] =
>       "#endif",
>       "    if (newsize && YY_SIZE_MAX / newsize < sizeof *newss)",
>       "        goto bail;",
> -     "    newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :",
> -     "      (short *)malloc(newsize * sizeof *newss); /* overflow check 
> above */",
> +     "    newss = realloc(yyss, newsize * sizeof(*newss)); /* overflow check 
> above */",
>       "    if (newss == NULL)",
>       "        goto bail;",
>       "    yyss = newss;",
>       "    yyssp = newss + sslen;",
>       "    if (newsize && YY_SIZE_MAX / newsize < sizeof *newvs)",
>       "        goto bail;",
> -     "    newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) 
> :",
> -     "      (YYSTYPE *)malloc(newsize * sizeof *newvs); /* overflow check 
> above */",
> +     "    newvs = realloc(yyvs, newsize * sizeof(*newvs)); /* overflow check 
> above */",
>       "    if (newvs == NULL)",
>       "        goto bail;",
>       "    yyvs = newvs;",

The removal of the casts causes a problem in ports/devel/mico, where
the yacc output is used in C++:

c++  -I. -I../include  -Wall -Wwrite-strings -O2 -pipe -fno-strict-aliasing 
-D_REENTRANT -D_THREAD_SAFE    -c yacc.cc -o yacc.o
yacc.c: In function 'int yygrowstack()':
yacc.c:1183: error: invalid conversion from 'void*' to 'short int*'
yacc.c:1190: error: invalid conversion from 'void*' to 'YYSTYPE*'
yacc.c: In function 'int yyparse()':
yacc.c:1280: warning: deprecated conversion from string constant to 'char*'
yacc.c:3528: warning: deprecated conversion from string constant to 'char*'

-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to