* NEWS: Version 2.1.

* NEWS: Remove notice of yytname change, since it was never in an
official release.
* data/glr.c (yydestroyGLRState): Rename local var to avoid shadowing
diagnostic.
* src/output.c (prepare): Likewise.
* data/lalr1.cc (YYERROR_VERBOSE_IF): New macro.
(yysyntax_error_): Use it to avoid GCC warning when YYERROR_VERBOSE
is not defined.  This is an awful hack, but it's enough for now.
All callers changed.
* tests/glr-regression-at (make_value): Args are const pointers now,
to avoid GCC warning.
(Duplicated user destructor for lookahead): New test.  Currently
skipped.  It fails on my host but I'm not sure it'll always fail.
This commit is contained in:
Paul Eggert
2005-09-16 22:54:21 +00:00
parent c1432f6538
commit 1bd0dedaaa
7 changed files with 122 additions and 23 deletions

View File

@@ -338,7 +338,8 @@ AT_CLEANUP
AT_SETUP([Duplicate representation of merged trees])
AT_DATA_GRAMMAR([glr-regr4.y],
[[%union { char *ptr; }
[[
%union { char *ptr; }
%type <ptr> S A A1 A2 B
%glr-parser
@@ -347,7 +348,7 @@ AT_DATA_GRAMMAR([glr-regr4.y],
#include <stdlib.h>
#include <string.h>
static char *merge (YYSTYPE, YYSTYPE);
static char *make_value (char *, char *);
static char *make_value (char const *, char const *);
static void yyerror (char const *);
static int yylex (void);
%}
@@ -386,7 +387,7 @@ main (void)
}
static char *
make_value (char *parent, char *child)
make_value (char const *parent, char const *child)
{
char const format[] = "%s <- %s";
char *value =
@@ -433,7 +434,8 @@ AT_CLEANUP
AT_SETUP([User destructor for unresolved GLR semantic value])
AT_DATA_GRAMMAR([glr-regr5.y],
[[%{
[[
%{
#include <stdio.h>
#include <stdlib.h>
static void yyerror (char const *);
@@ -503,7 +505,8 @@ AT_CLEANUP
AT_SETUP([User destructor after an error during a split parse])
AT_DATA_GRAMMAR([glr-regr6.y],
[[%{
[[
%{
#include <stdio.h>
#include <stdlib.h>
static void yyerror (char const *);
@@ -556,3 +559,80 @@ AT_CHECK([[./glr-regr6]], 0,
])
AT_CLEANUP
## ------------------------------------------------------------------------- ##
## Duplicated user destructor for lookahead ##
## Thanks to Joel E. Denny for this test; see ##
## <http://lists.gnu.org/archive/html/bison-patches/2005-08/msg00035.html>. ##
## ------------------------------------------------------------------------- ##
AT_SETUP([Duplicated user destructor for lookahead])
AT_DATA_GRAMMAR([glr-regr7.y],
[[
%{
#include <stdio.h>
#include <stdlib.h>
static void yyerror (char const *);
static int yylex (void);
#define YYSTACKEXPANDABLE 0
%}
%glr-parser
%union { int *count; }
%type <count> 'a'
%destructor {
if ((*$$)++)
fprintf (stderr, "Destructor called on same value twice.\n");
} 'a'
%%
start:
stack1 start
| stack2 start
| /* empty */
;
stack1: 'a' ;
stack2: 'a' ;
%%
static int
yylex (void)
{
yylval.count = malloc (sizeof (int));
if (!yylval.count)
{
fprintf (stderr, "Test inconclusive.\n");
exit (EXIT_FAILURE);
}
*yylval.count = 0;
return 'a';
}
static void
yyerror (char const *msg)
{
fprintf (stderr, "%s\n", msg);
}
int
main (void)
{
return yyparse ();
}
]])
AT_CHECK([[bison -o glr-regr7.c glr-regr7.y]], 0, [],
[glr-regr7.y: conflicts: 2 reduce/reduce
])
AT_COMPILE([glr-regr7])
AT_CHECK([[exit 77; ./glr-regr7]], 2, [],
[memory exhausted
])
AT_CLEANUP