X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/69ce078b8cf61eb5087b91538d79a1143ce77c46..e2a21b6f0c975927445a04a86488956af3351681:/tests/glr-regression.at diff --git a/tests/glr-regression.at b/tests/glr-regression.at index e3bdd26b..ad8f6d86 100644 --- a/tests/glr-regression.at +++ b/tests/glr-regression.at @@ -120,7 +120,7 @@ AT_DATA_GRAMMAR([glr-regr2a.y], /* Reported by S. Eken */ %{ - #define YYSTYPE char const * + #define YYSTYPE char * #include #include @@ -138,9 +138,11 @@ command: 's' var 't' { printf ("Variable: '%s'\n", $2); } 'v' 'x' 'q' + { free ($2); } | 's' var_list 't' 'e' - { printf ("Varlist: '%s'\n", $2); } + { printf ("Varlist: '%s'\n", $2); free ($2); } | 's' var 't' var_printer 'x' + { free ($2); } ; var: @@ -153,10 +155,10 @@ var_list: { $$ = $1; } | var ',' var_list { - char *s = (char *) malloc (strlen ($1) + 1 + strlen ($3) + 1); - strcpy (s, $1); + char *s = (char *) realloc ($1, strlen ($1) + 1 + strlen ($3) + 1); strcat (s, ","); strcat (s, $3); + free ($3); $$ = s; } ; @@ -744,13 +746,14 @@ AT_SETUP([No users destructors if stack 0 deleted]) AT_DATA_GRAMMAR([glr-regr9.y], [[ %{ - #include - #include +# include +# include static void yyerror (char const *); static int yylex (void); - #define YYSTACKEXPANDABLE 0 +# define YYSTACKEXPANDABLE 0 static int tokens = 0; static int destructors = 0; +# define USE(Var) %} %glr-parser @@ -764,7 +767,7 @@ AT_DATA_GRAMMAR([glr-regr9.y], %% start: - ambig0 'a' { destructors += 2; } + ambig0 'a' { destructors += 2; USE ($2); } | ambig1 start { destructors += 1; } | ambig2 start { destructors += 1; } ;