Merge tag 'v2.5.1_rc2'

Bison 2.5.1_rc2.

* tag 'v2.5.1_rc2': (34 commits)
  Bison 2.5.1_rc2.
  doc: fixes.
  build: fix ChangeLog generation.
  c++: compute the header guards.
  skeletons: remove support for unused directive.
  lalr1.cc: improve Doxygen documentation.
  lalr1.cc: extract stack.hh.
  news: convert to double quotes.
  space changes.
  build: do not prototype flex-generated functions.
  build: fix ChangeLog generation.
  Bison 2.5.1_rc1.
  tests: save/restore Autotest special files when checking XML support.
  tests: AT_SAVE_SPECIAL_FILES / AT_RESTORE_SPECIAL_FILES.
  tests: honor TESTSUITEFLAGS in all the check targets.
  build: do not enable c++ warnings on 0 when nullptr is not supported.
  maint: update gnulib.
  build: config.in.h.
  build: move silent rules.
  glr.c: reduce variable scopes.
  maint: maintainer-release-check.
  maint: shush a syntax-check.
  maint: prefer "commit message" to "log entry".
  command line: fix minor leaks.
  maint: we no longer maintain the ChangeLog.
  maint: fix the generation of the synclines for bison's parser.
  maint: regen.
  maint: import the xmemdup0 gnulib module.
  maint: remove left-over gnulib modules.
  maint: ignore files imported by autopoint.
  build: AC_PROG_LEX: use more readable variable names.
  maint: regen src/parse-gram.[ch]
  maint: simplify parse-gram.y
  maint: s/strncpy/memcpy/, when equivalent

Conflicts:
	Makefile.am
	NEWS
	data/glr.c
	data/lalr1.cc
	data/stack.hh
	examples/rpcalc/local.mk
	src/flex-scanner.h
	src/getargs.c
	src/output.c
	src/parse-gram.c
	src/parse-gram.h
	src/parse-gram.y
	tests/Makefile.am
	tests/bison.in
This commit is contained in:
Akim Demaille
2012-05-24 13:37:28 +02:00
29 changed files with 530 additions and 378 deletions

View File

@@ -17,6 +17,33 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# b4_tocpp(STRING)
# ----------------
# Convert STRING into a valid C macro name.
m4_define([b4_tocpp],
[m4_toupper(m4_bpatsubst(m4_quote($1), [[^a-zA-Z0-9]+], [_]))])
# b4_cpp_guard(FILE)
# ------------------
# A valid C macro name to use as a CPP header guard for FILE.
m4_define([b4_cpp_guard],
[b4_tocpp(m4_defn([b4_prefix])/[$1])])
# b4_cpp_guard_open(FILE)
# b4_cpp_guard_close(FILE)
# ------------------------
# Open/close CPP inclusion guards for FILE.
m4_define([b4_cpp_guard_open],
[#ifndef b4_cpp_guard([$1])
# define b4_cpp_guard([$1])])
m4_define([b4_cpp_guard_close],
[#endif b4_comment([!b4_cpp_guard([$1])])])
## ---------------- ##
## Identification. ##
## ---------------- ##

View File

@@ -810,9 +810,8 @@ static void yyfillin (yyGLRStackItem *, int, int) __attribute__ ((__unused__));
static void
yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
{
yyGLRState* s;
int i;
s = yyvsp[yylow0].yystate.yypred;
yyGLRState *s = yyvsp[yylow0].yystate.yypred;
for (i = yylow0-1; i >= yylow1; i -= 1)
{
#if YYDEBUG
@@ -1147,9 +1146,9 @@ yyexpandGLRStack (yyGLRStack* yystackp)
{
yyGLRStackItem* yynewItems;
yyGLRStackItem* yyp0, *yyp1;
size_t yysize, yynewSize;
size_t yynewSize;
size_t yyn;
yysize = yystackp->yynextFree - yystackp->yyitems;
size_t yysize = yystackp->yynextFree - yystackp->yyitems;
if (YYMAXDEPTH - YYHEADROOM < yysize)
yyMemoryExhausted (yystackp);
yynewSize = 2*yysize;
@@ -1172,7 +1171,7 @@ yyexpandGLRStack (yyGLRStack* yystackp)
YYRELOC (yyp0, yyp1, yys0->yypred, yystate);
if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULL)
yys1->yysemantics.yyfirstVal =
YYRELOC(yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
YYRELOC (yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
}
else
{
@@ -1464,8 +1463,8 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULL)
{
yyGLRState* yyp, *yysplit = yystackp->yysplitPoint;
yyp = yystackp->yytops.yystates[yyi];
yyGLRState *yysplit = yystackp->yysplitPoint;
yyGLRState *yyp = yystackp->yytops.yystates[yyi];
while (yyp != yys && yyp != yysplit && yyp->yyposn >= yyposn)
{
if (yyp->yylrState == yynewLRState && yyp->yypred == yys)
@@ -1578,10 +1577,8 @@ yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
}
else
{
yySemanticOption** yyz0p;
yySemanticOption* yyz1;
yyz0p = &yys0->yysemantics.yyfirstVal;
yyz1 = yys1->yysemantics.yyfirstVal;
yySemanticOption** yyz0p = &yys0->yysemantics.yyfirstVal;
yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
while (YYID (yytrue))
{
if (yyz1 == *yyz0p || yyz1 == YY_NULL)
@@ -1663,14 +1660,9 @@ yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp,
YYSTYPE* yyvalp]b4_locuser_formals[)
{
yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
int yynrhs;
int yychar_current;
YYSTYPE yylval_current;]b4_locations_if([
YYLTYPE yylloc_current;])[
YYRESULTTAG yyflag;
yynrhs = yyrhsLength (yyopt->yyrule);
yyflag = yyresolveStates (yyopt->yystate, yynrhs, yystackp]b4_user_args[);
int yynrhs = yyrhsLength (yyopt->yyrule);
YYRESULTTAG yyflag =
yyresolveStates (yyopt->yystate, yynrhs, yystackp]b4_user_args[);
if (yyflag != yyok)
{
yyGLRState *yys;
@@ -1683,18 +1675,20 @@ yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp,
if (yynrhs == 0)
/* Set default location. */
yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yyopt->yystate->yyloc;]])[
yychar_current = yychar;
yylval_current = yylval;]b4_locations_if([
yylloc_current = yylloc;])[
yychar = yyopt->yyrawchar;
yylval = yyopt->yyval;]b4_locations_if([
yylloc = yyopt->yyloc;])[
yyflag = yyuserAction (yyopt->yyrule, yynrhs,
{
int yychar_current = yychar;
YYSTYPE yylval_current = yylval;]b4_locations_if([
YYLTYPE yylloc_current = yylloc;])[
yychar = yyopt->yyrawchar;
yylval = yyopt->yyval;]b4_locations_if([
yylloc = yyopt->yyloc;])[
yyflag = yyuserAction (yyopt->yyrule, yynrhs,
yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
yystackp, yyvalp]b4_locuser_args[);
yychar = yychar_current;
yylval = yylval_current;]b4_locations_if([
yylloc = yylloc_current;])[
yystackp, yyvalp]b4_locuser_args[);
yychar = yychar_current;
yylval = yylval_current;]b4_locations_if([
yylloc = yylloc_current;])[
}
return yyflag;
}
@@ -1778,13 +1772,9 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
yyresolveLocations (yys1->yypred, yyn1 - 1, yystackp]b4_user_args[);
if (!yys1->yyresolved)
{
yySemanticOption *yyoption;
yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
int yynrhs;
int yychar_current;
YYSTYPE yylval_current;
YYLTYPE yylloc_current;
yyoption = yys1->yysemantics.yyfirstVal;
yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
YYASSERT (yyoption != YY_NULL);
yynrhs = yyrhsLength (yyoption->yyrule);
if (yynrhs > 0)
@@ -1810,16 +1800,18 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
yyGLRState *yyprevious = yyoption->yystate;
yyrhsloc[0].yystate.yyloc = yyprevious->yyloc;
}
yychar_current = yychar;
yylval_current = yylval;
yylloc_current = yylloc;
yychar = yyoption->yyrawchar;
yylval = yyoption->yyval;
yylloc = yyoption->yyloc;
YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs);
yychar = yychar_current;
yylval = yylval_current;
yylloc = yylloc_current;
{
int yychar_current = yychar;
YYSTYPE yylval_current = yylval;
YYLTYPE yylloc_current = yylloc;
yychar = yyoption->yyrawchar;
yylval = yyoption->yyval;
yylloc = yyoption->yyloc;
YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs);
yychar = yychar_current;
yylval = yylval_current;
yylloc = yylloc_current;
}
}
}
}]])[

View File

@@ -126,8 +126,8 @@ b4_defines_if([],
b4_locations_if([b4_percent_define_ifdef([[location_type]], [],
[# Backward compatibility.
m4_define([b4_location_constructors])
m4_include(b4_pkgdatadir/[location.cc])])])
m4_define([b4_location_constructors])
m4_include(b4_pkgdatadir/[location.cc])])])
m4_include(b4_pkgdatadir/[stack.hh])
b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
@@ -136,12 +136,15 @@ m4_changecom()
m4_divert_push(0)dnl
@output(b4_spec_defines_file@)@
b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
dnl FIXME: This is wrong, we want computed header guards.
[
/**
** \file ]b4_spec_defines_file[
** Define the ]b4_namespace_ref[::parser class.
*/
/* C++ LALR(1) parser skeleton written by Akim Demaille. */
#ifndef PARSER_HEADER_H
# define PARSER_HEADER_H
]b4_cpp_guard_open([b4_spec_defines_file])[
]b4_percent_code_get([[requires]])[
@@ -358,10 +361,9 @@ b4_public_types_define])[
/* Redirection for backward compatibility. */
# define YYSTYPE b4_namespace_ref::b4_parser_class_name::semantic_type
#endif
])
b4_percent_code_get([[provides]])[]dnl
[#endif /* ! defined PARSER_HEADER_H */]
])[
]b4_percent_code_get([[provides]])[
]b4_cpp_guard_close([b4_spec_defines_file])
@output(b4_parser_file_name@)@
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++])
b4_percent_code_get([[top]])[]dnl

View File

@@ -25,12 +25,11 @@ m4_divert_push(0)dnl
b4_copyright([Positions for Bison parsers in C++])[
/**
** \file position.hh
** \file ]b4_dir_prefix[position.hh
** Define the ]b4_namespace_ref[::position class.
*/
#ifndef BISON_POSITION_HH
# define BISON_POSITION_HH
]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
# include <iostream>
# include <string>
@@ -150,17 +149,16 @@ b4_copyright([Positions for Bison parsers in C++])[
}
]b4_namespace_close[
#endif // not BISON_POSITION_HH]
]b4_cpp_guard_close([b4_dir_prefix[]position.hh])
@output(b4_dir_prefix[]location.hh@)@
b4_copyright([Locations for Bison parsers in C++])[
/**
** \file location.hh
** \file ]b4_dir_prefix[location.hh
** Define the ]b4_namespace_ref[::location class.
*/
#ifndef BISON_LOCATION_HH
# define BISON_LOCATION_HH
]b4_cpp_guard_open([b4_dir_prefix[]location.hh])[
# include <iostream>
# include <string>
@@ -296,7 +294,7 @@ b4_copyright([Locations for Bison parsers in C++])[
]b4_namespace_close[
#endif // not BISON_LOCATION_HH]
]b4_cpp_guard_close([b4_dir_prefix[]location.hh])
m4_divert_pop(0)
m4_popdef([b4_copyright_years])dnl
m4_changecom([#])

View File

@@ -24,10 +24,14 @@ m4_divert_push(0)dnl
@output(b4_dir_prefix[]stack.hh@)@
b4_copyright([Stack handling for Bison parsers in C++])[
#ifndef BISON_STACK_HH
# define BISON_STACK_HH
/**
** \file ]b4_dir_prefix[stack.hh
** Define the ]b4_namespace_ref[::stack class.
*/
#include <deque>
]b4_cpp_guard_open([b4_dir_prefix[]stack.hh])[
# include <deque>
]b4_namespace_open[
template <class T, class S = std::deque<T> >
@@ -109,8 +113,8 @@ b4_copyright([Stack handling for Bison parsers in C++])[
{
public:
slice (const S& stack, unsigned int range)
: stack_ (stack),
range_ (range)
: stack_ (stack)
, range_ (range)
{
}
@@ -127,8 +131,7 @@ b4_copyright([Stack handling for Bison parsers in C++])[
};
]b4_namespace_close[
#endif // not BISON_STACK_HH[]dnl
]
]b4_cpp_guard_close([b4_dir_prefix[]stack.hh])
m4_divert_pop(0)
m4_popdef([b4_copyright_years])dnl
m4_changecom([#])