Merge remote-tracking branch 'origin/maint'

* origin/maint:
  glr: more assertions
  glr: shorten scopes
  glr: formatting changes
  glr: better use of tracing macros
  examples: improve the output of the "variant" example
  variant: remove useless assertion
  tests: remove stray debugging traces
  tests: do not use grep -q
  build: don't require flex for ordinary builds
  maint: update .gitignore
  build: port to pre-5.8.7 perl
  tests: minor change to make it easier to test other skeletons
  uniqstr: fix assertion
This commit is contained in:
Akim Demaille
2013-09-19 16:33:20 +02:00
12 changed files with 62 additions and 36 deletions

9
.gitignore vendored
View File

@@ -1,7 +1,14 @@
*.eps
*.o
*.pdf
*.png
*.stamp
*~
.deps
.dirstamp
/*.cache
/*.flc
/*.prj
/*~
/.tarball-version
/.version
/ABOUT-NLS

3
NEWS
View File

@@ -2,6 +2,9 @@ GNU Bison NEWS
* Noteworthy changes in release ?.? (????-??-??) [?]
** Bug fixes
Portability issues in the test suite.
* Noteworthy changes in release 3.0 (2013-07-25) [stable]

1
THANKS
View File

@@ -31,6 +31,7 @@ Cris van Pelt cris@amf03054.office.wxs.nl
Csaba Raduly csaba_22@yahoo.co.uk
Dagobert Michelsen dam@baltic-online.de
Daniel Frużyński daniel@poradnik-webmastera.com
Daniel Galloway dg1751@att.com
Daniel Hagerty hag@gnu.org
David J. MacKenzie djm@gnu.org
David Kastrup dak@gnu.org

View File

@@ -175,7 +175,10 @@ AC_SUBST([YACC_LIBRARY])
# Checks for programs.
AM_MISSING_PROG([DOT], [dot])
AC_PROG_LEX
$LEX_IS_FLEX || AC_MSG_ERROR([Flex is required])
$LEX_IS_FLEX || test "X$LEX" = X: || {
AC_MSG_WARN([bypassing lex because flex is required])
LEX=:
}
AC_PROG_YACC
AC_PROG_RANLIB
AC_PROG_GNU_M4

View File

@@ -836,12 +836,10 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
if (yydebug)
{
if (yys->yysemantics.yyfirstVal)
YYFPRINTF (stderr, "%s unresolved ", yymsg);
YYFPRINTF (stderr, "%s unresolved", yymsg);
else
YYFPRINTF (stderr, "%s incomplete ", yymsg);
yy_symbol_print (stderr, yystos[yys->yylrState],
YY_NULL]b4_locuser_args([&yys->yyloc])[);
YYFPRINTF (stderr, "\n");
YYFPRINTF (stderr, "%s incomplete", yymsg);
YY_SYMBOL_PRINT ("", yystos[yys->yylrState], YY_NULL, &yys->yyloc);
}
#endif
@@ -966,6 +964,7 @@ yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate,
{
yySemanticOption* yynewOption =
&yynewGLRStackItem (yystackp, yyfalse)->yyoption;
YYASSERT (!yynewOption->yyisState);
yynewOption->yystate = yyrhs;
yynewOption->yyrule = yyrule;
if (yystackp->yytops.yylookaheadNeeds[yyk])
@@ -1082,7 +1081,7 @@ yyexpandGLRStack (yyGLRStack* yystackp)
}
if (yystackp->yysplitPoint != YY_NULL)
yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems,
yystackp->yysplitPoint, yystate);
yystackp->yysplitPoint, yystate);
for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1)
if (yystackp->yytops.yystates[yyn] != YY_NULL)
@@ -1201,6 +1200,7 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
size_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule)
{
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
YYASSERT (yynewState->yyisState);
yynewState->yylrState = yylrState;
yynewState->yyposn = yyposn;
@@ -1320,11 +1320,10 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
if (yyforceEval || yystackp->yysplitPoint == YY_NULL)
{
YYRESULTTAG yyflag;
YYSTYPE yysval;]b4_locations_if([
YYLTYPE yyloc;])[
YYSTYPE yysval;]b4_locations_if([[
YYLTYPE yyloc;]])[
yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[);
YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[);
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULL)
{
YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n",
@@ -2493,6 +2492,8 @@ yypdumpstack (yyGLRStack* yystackp)
(unsigned long int) (yyp - yystackp->yyitems));
if (*(yybool *) yyp)
{
YYASSERT (yyp->yystate.yyisState);
YYASSERT (yyp->yyoption.yyisState);
YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
yyp->yystate.yyresolved, yyp->yystate.yylrState,
(unsigned long int) yyp->yystate.yyposn,
@@ -2504,6 +2505,8 @@ yypdumpstack (yyGLRStack* yystackp)
}
else
{
YYASSERT (!yyp->yystate.yyisState);
YYASSERT (!yyp->yyoption.yyisState);
YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld",
yyp->yyoption.yyrule - 1,
(long int) YYINDEX (yyp->yyoption.yystate),

View File

@@ -178,8 +178,7 @@ m4_define([b4_variant_define],
template <typename T>
void
move (self_type& other)
{]b4_parse_assert_if([
YYASSERT (!yytname_);])[
{
build<T> ();
swap<T> (other);
other.destroy<T> ();

View File

@@ -25,7 +25,7 @@ AM_CXXFLAGS = \
doc = $(top_srcdir)/doc/bison.texi
extexi = $(top_srcdir)/examples/extexi
extract = VERSION="$(VERSION)" $(PERL) -f $(extexi) $(doc) --
extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(doc) --
extracted =
CLEANFILES += $(extracted) examples/extracted.stamp
examples/extracted.stamp: $(doc) $(extexi)

View File

@@ -16,7 +16,7 @@
*/
%debug
%skeleton "lalr1.cc"
%language "c++"
%defines
%define api.token.constructor
%define api.value.type variant
@@ -48,11 +48,17 @@ typedef std::list<std::string> strings_type;
namespace std
{
std::ostream&
operator<< (std::ostream& o, const strings_type& s)
operator<< (std::ostream& o, const strings_type& ss)
{
std::copy (s.begin (), s.end (),
std::ostream_iterator<strings_type::value_type> (o, "\n"));
return o;
o << "(" << &ss << ") {";
const char *sep = "";
for (strings_type::const_iterator i = ss.begin(), end = ss.end();
i != end; ++i)
{
o << sep << *i;
sep = ", ";
}
return o << "}";
}
}

View File

@@ -77,7 +77,8 @@ uniqstr_vsprintf (char const *format, ...)
void
uniqstr_assert (char const *str)
{
if (!hash_lookup (uniqstrs_table, str))
uniqstr *s = hash_lookup (uniqstrs_table, str);
if (!s || s != (uniqstr *)str)
{
error (0, 0,
"not a uniqstr: %s", quotearg (str));

View File

@@ -72,13 +72,12 @@ int main ()
std::cout << "Works" << std::endl;
}
EOF
ls
$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS -o conftest conftest.cc
case $? in
0);;
*) BISON_CXX_WORKS="as_fn_error 77 cannot-compile-simple-program";;
esac
rm -f conftest*
rm -fr conftest*
fi
# Whether the compiler supports POSIXLY_CORRECT defined.

View File

@@ -174,11 +174,10 @@ AT_CLEANUP
m4_pushdef([AT_TEST],
[AT_SETUP([Variants $1])
AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc" %debug $1])
AT_BISON_OPTION_PUSHDEFS([%debug $1])
# Store strings and integers in a list of strings.
AT_DATA_GRAMMAR([list.y],
[[%debug
%skeleton "lalr1.cc"
%define api.value.type variant
]m4_bpatsubst([$1], [\\n], [
])[
@@ -320,13 +319,13 @@ AT_BISON_OPTION_POPDEFS
AT_CLEANUP
])
AT_TEST([])
AT_TEST([%define parse.assert])
AT_TEST([%locations %define parse.assert])
AT_TEST([[%define parse.assert %code {\n#define TWO_STAGE_BUILD\n}]])
AT_TEST([[%define parse.assert %define api.token.constructor]])
AT_TEST([[%define parse.assert %define api.token.constructor %define api.token.prefix {TOK_}]])
AT_TEST([[%locations %define parse.assert %define api.token.constructor %define api.token.prefix {TOK_}]])
AT_TEST([[%skeleton "lalr1.cc" ]])
AT_TEST([[%skeleton "lalr1.cc" %define parse.assert]])
AT_TEST([[%skeleton "lalr1.cc" %locations %define parse.assert]])
AT_TEST([[%skeleton "lalr1.cc" %define parse.assert %code {\n#define TWO_STAGE_BUILD\n}]])
AT_TEST([[%skeleton "lalr1.cc" %define parse.assert %define api.token.constructor]])
AT_TEST([[%skeleton "lalr1.cc" %define parse.assert %define api.token.constructor %define api.token.prefix {TOK_}]])
AT_TEST([[%skeleton "lalr1.cc" %locations %define parse.assert %define api.token.constructor %define api.token.prefix {TOK_}]])
m4_popdef([AT_TEST])

View File

@@ -725,18 +725,23 @@ AT_CLEANUP
AT_SETUP([Java constructor init and init_throws])
m4_pushdef([AT_Witness],
[super("Test Thread"); if (true) throw new InterruptedException();])
AT_CHECK_JAVA_MINIMAL([[
%define extends {Thread}
%code init { super("Test Thread"); if (true) throw new InterruptedException(); }
%code init { ]AT_Witness[ }
%define init_throws {InterruptedException}
%lex-param {int lex_param}]])
AT_CHECK([[grep -q 'super("Test Thread"); if (true) throw new InterruptedException();' YYParser.java]])
AT_CHECK([[grep ']AT_Witness[' YYParser.java]], 0, [ignore])
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
%define extends {Thread}
%code init { super("Test Thread"); if (true) throw new InterruptedException(); }
%code init { ]AT_Witness[ }
%define init_throws {InterruptedException}]], [], [[return EOF;]])
AT_CHECK([[grep -q 'super("Test Thread"); if (true) throw new InterruptedException();' YYParser.java]])
AT_CHECK([[grep ']AT_Witness[' YYParser.java]], 0, [ignore])
m4_popdef([AT_Witness])
AT_CLEANUP