diff --git a/.gitignore b/.gitignore index bfb7caf4..e9708d3f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,14 @@ +*.eps +*.o +*.pdf +*.png +*.stamp +*~ +.deps +.dirstamp /*.cache /*.flc /*.prj -/*~ /.tarball-version /.version /ABOUT-NLS diff --git a/NEWS b/NEWS index 07bf5a9d..bbdcc0f2 100644 --- a/NEWS +++ b/NEWS @@ -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] diff --git a/THANKS b/THANKS index 321a8b8a..2d4a6a99 100644 --- a/THANKS +++ b/THANKS @@ -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 diff --git a/configure.ac b/configure.ac index f7319a15..992e2033 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/data/glr.c b/data/glr.c index 895a69e9..1f8f0b3d 100644 --- a/data/glr.c +++ b/data/glr.c @@ -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), diff --git a/data/variant.hh b/data/variant.hh index ac4f7a78..19538f6d 100644 --- a/data/variant.hh +++ b/data/variant.hh @@ -178,8 +178,7 @@ m4_define([b4_variant_define], template void move (self_type& other) - {]b4_parse_assert_if([ - YYASSERT (!yytname_);])[ + { build (); swap (other); other.destroy (); diff --git a/examples/local.mk b/examples/local.mk index 05e28e1b..c79c8004 100644 --- a/examples/local.mk +++ b/examples/local.mk @@ -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) diff --git a/examples/variant.yy b/examples/variant.yy index 9413cbcf..fd551cc1 100644 --- a/examples/variant.yy +++ b/examples/variant.yy @@ -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 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 (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 << "}"; } } diff --git a/src/uniqstr.c b/src/uniqstr.c index 4446c0ed..37345dc7 100644 --- a/src/uniqstr.c +++ b/src/uniqstr.c @@ -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)); diff --git a/tests/atlocal.in b/tests/atlocal.in index 19ecfd7b..0184ae19 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -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. diff --git a/tests/c++.at b/tests/c++.at index 96f2ac1d..e4c527c1 100644 --- a/tests/c++.at +++ b/tests/c++.at @@ -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]) diff --git a/tests/java.at b/tests/java.at index 2b206988..58998fe7 100644 --- a/tests/java.at +++ b/tests/java.at @@ -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