From: Paul Eggert Date: Thu, 14 Jul 2005 23:57:45 +0000 (+0000) Subject: More changes to pacify C++ compilers. X-Git-Tag: BISON-2_1~86 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c70fdfcd207a394121c7dac271bbd04ce2a91c98;p=platform%2Fupstream%2Fbison.git More changes to pacify C++ compilers. --- diff --git a/ChangeLog b/ChangeLog index 6343ff2..f1c3691 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,7 +6,7 @@ * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Define YYSTACKEXPANDABLE. * tests/glr-regression.at (Improper handling of embedded actions and dollar(-N) in GLR parsers): - YYSTYPE is char *, not char const *, so that strcpy ($$, ...) works. + Add casts to pacify C++ compilers. * tests/glr-regression.at (Improper merging of GLR delayed action sets): Declare yylex before using it. * tests/Makefile.am (maintainer-check-g++): Fix a stray diff --git a/tests/glr-regression.at b/tests/glr-regression.at index ae15e4c..dfe4b73 100644 --- a/tests/glr-regression.at +++ b/tests/glr-regression.at @@ -121,7 +121,7 @@ AT_DATA_GRAMMAR([glr-regr2a.y], /* Reported by S. Eken */ %{ - #define YYSTYPE char * + #define YYSTYPE char const * #define yyfalse 0 #define yytrue 1 @@ -156,10 +156,11 @@ var_list: { $$ = $1; } | var ',' var_list { - $$ = malloc (strlen ($1) + 1 + strlen ($3) + 1); - strcpy ($$, $1); - strcat ($$, ","); - strcat ($$, $3); + char *s = (char *) malloc (strlen ($1) + 1 + strlen ($3) + 1); + strcpy (s, $1); + strcat (s, ","); + strcat (s, $3); + $$ = s; } ; @@ -174,6 +175,7 @@ int yylex (void) { char buf[50]; + char *s; switch (fscanf (yyin, " %1[a-z,]", buf)) { case 1: return buf[0]; @@ -186,8 +188,9 @@ yylex (void) abort (); if (sizeof buf - 1 <= strlen (buf)) abort (); - yylval = malloc (strlen (buf) + 1); - strcpy (yylval, buf); + s = (char *) malloc (strlen (buf) + 1); + strcpy (s, buf); + yylval = s; return 'V'; }