Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/maint'
Browse files Browse the repository at this point in the history
* origin/maint:
  maint: update release instructions
  maint: post-release administrivia
  version 2.5.90
  build: fix gen-ChangeLog call.
  gnulib: update.
  tests: fix SKIP_IF for Java.
  api.prefix: incompatible with %name-prefix.
  api.prefix: strengthen the tests and fix push-parsers.
  skeletons: style changes.
  NEWS: minor changes.
  api.prefix: improve the documentation for YYDEBUG.
  gnulib: update.

Conflicts:
	NEWS
	cfg.mk
	data/bison.m4
	doc/bison.texi
	m4/.gitignore
	tests/calc.at
	tests/headers.at
  • Loading branch information
akimd committed Jul 6, 2012
2 parents ccdc157 + a59a6dd commit 60aa04a
Show file tree
Hide file tree
Showing 15 changed files with 228 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .prev-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.1
2.5.90
19 changes: 10 additions & 9 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,14 @@ update-package-copyright-year:
gen_start_date = 2012-01-16
.PHONY: gen-ChangeLog
gen-ChangeLog:
$(AM_V_GEN)if test -d $(srcdir)/.git; then \
$(top_srcdir)/build-aux/gitlog-to-changelog \
--strip-tab \
--strip-cherry-picked \
--no-cluster \
--amend=$(srcdir)/build-aux/git-log-fix \
--since=$(gen_start_date) > $(distdir)/cl-t; \
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
$(AM_V_GEN)if test -d $(srcdir)/.git; then \
cl=$(distdir)/ChangeLog && \
rm -f $$cl.tmp && \
$(top_srcdir)/build-aux/gitlog-to-changelog \
--strip-tab \
--strip-cherry-pick \
--no-cluster \
--amend=$(srcdir)/build-aux/git-log-fix \
--since=$(gen_start_date) > $$cl.tmp && \
mv -f $$cl.tmp $$cl; \
fi
5 changes: 3 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ GNU Bison NEWS

* Noteworthy changes in release ?.? (????-??-??) [?]

** Future changes

* Noteworthy changes in release 2.5.90 (2012-07-05) [beta]

The next major release of Bison will drop support for the following
deprecated features. Please report disagreements to bug-bison@gnu.org.
Expand Down Expand Up @@ -151,7 +152,7 @@ GNU Bison NEWS
because existing versions of ylwrap (e.g., Automake 1.12.1) do not support
it.

** Headers
** Generated Parser Headers

*** Guards (yacc.c, glr.c, glr.cc)

Expand Down
5 changes: 4 additions & 1 deletion README-hacking
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,10 @@ that the skeletons insert into generated parsers, and check all
occurrences of PACKAGE_COPYRIGHT_YEAR in configure.ac.

** Update NEWS, commit and tag.
See do-release-commit-and-tag in README-release.
See do-release-commit-and-tag in README-release. For a while, we used
beta names such as "2.6_rc1". Now that we use gnulib in the release
procedure, we must use "2.5.90", which has the additional benefit of
being properly sorted in "git tag -l".

** make alpha, beta, or stable
See README-release.
Expand Down
11 changes: 6 additions & 5 deletions bootstrap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
scriptversion=2012-05-15.06; # UTC
scriptversion=2012-07-03.20; # UTC

# Bootstrap this package from checked-out sources.

Expand Down Expand Up @@ -215,7 +215,7 @@ find_tool ()
eval "export $find_tool_envvar"
}

# Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6.
# Find sha1sum, named gsha1sum on MacPorts, and shasum on Mac OS X 10.6.
find_tool SHA1SUM sha1sum gsha1sum shasum

# Override the default configuration, if necessary.
Expand All @@ -230,7 +230,6 @@ esac
test -z "${gnulib_extra_files}" && \
gnulib_extra_files="
$build_aux/install-sh
$build_aux/missing
$build_aux/mdate-sh
$build_aux/texinfo.tex
$build_aux/depcomp
Expand Down Expand Up @@ -855,7 +854,8 @@ echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&

for file in $gnulib_files; do
symlink_to_dir "$GNULIB_SRCDIR" $file || exit
symlink_to_dir "$GNULIB_SRCDIR" $file \
|| { echo "$0: failed to symlink $file" 1>&2; exit 1; }
done

bootstrap_post_import_hook \
Expand Down Expand Up @@ -896,7 +896,8 @@ for file in $gnulib_extra_files; do
build-aux/*) dst=$build_aux/${file#build-aux/};;
*) dst=$file;;
esac
symlink_to_dir "$GNULIB_SRCDIR" $file $dst || exit
symlink_to_dir "$GNULIB_SRCDIR" $file $dst \
|| { echo "$0: failed to symlink $file" 1>&2; exit 1; }
done

if test $with_gettext = yes; then
Expand Down
2 changes: 1 addition & 1 deletion cfg.mk
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ $(call exclude, \
prohibit_strcmp=^doc/bison\.texinfo$$ \
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
space_tab=^tests/(input|c\+\+)\.at$$ \
unmarked_diagnostics=^djgpp/ \
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$) \
)
38 changes: 23 additions & 15 deletions data/bison.m4
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,6 @@ m4_define([b4_fatal_at],
m4_exit(1)])


## ---------------- ##
## Default values. ##
## ---------------- ##

# m4_define_default([b4_lex_param], []) dnl breaks other skeletons
m4_define_default([b4_pre_prologue], [])
m4_define_default([b4_post_prologue], [])
m4_define_default([b4_epilogue], [])
m4_define_default([b4_parse_param], [])

# The initial column and line.
m4_define_default([b4_location_initial_column], [1])
m4_define_default([b4_location_initial_line], [1])


## ------------ ##
## Data Types. ##
## ------------ ##
Expand Down Expand Up @@ -822,3 +807,26 @@ m4_wrap_lifo([
b4_check_user_names_wrap([[define]], [[variable]])
b4_check_user_names_wrap([[code]], [[qualifier]])
])


## ---------------- ##
## Default values. ##
## ---------------- ##

# m4_define_default([b4_lex_param], []) dnl breaks other skeletons
m4_define_default([b4_pre_prologue], [])
m4_define_default([b4_post_prologue], [])
m4_define_default([b4_epilogue], [])
m4_define_default([b4_parse_param], [])

# The initial column and line.
m4_define_default([b4_location_initial_column], [1])
m4_define_default([b4_location_initial_line], [1])

# Sanity checks.
b4_percent_define_ifdef([api.prefix],
[m4_ifdef([b4_prefix],
[b4_complain_at(b4_percent_define_get_loc([api.prefix]),
[['%s' and '%s' cannot be used together]],
[%name-prefix],
[%define api.prefix])])])
19 changes: 12 additions & 7 deletions data/yacc.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,22 +232,27 @@ m4_define([b4_declare_parser_state_variables], [b4_pure_if([[
# Declaration of yyparse (and dependencies) when using the push parser
# (including in pull mode).
m4_define([b4_declare_yyparse_push_],
[[typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;
[[#ifndef YYPUSH_MORE_DEFINED
# define YYPUSH_MORE_DEFINED
enum { YYPUSH_MORE = 4 };
#endif

typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;

]b4_pull_if([b4_c_function_decl([b4_prefix[parse]], [[int]], b4_parse_param)
])b4_c_function_decl([b4_prefix[push_parse]], [[int]],
[[b4_prefix[pstate *yyps]], [[yyps]]]b4_pure_if([,
[[[int yypushed_char]], [[yypushed_char]]],
[[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([,
[[[YYLTYPE const *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [,
[[b4_prefix[pstate *ps]], [[ps]]]b4_pure_if([,
[[[int pushed_char]], [[pushed_char]]],
[[b4_api_PREFIX[STYPE const *pushed_val]], [[pushed_val]]]b4_locations_if([,
[[b4_api_PREFIX[LTYPE const *pushed_loc]], [[pushed_loc]]]])])m4_ifset([b4_parse_param], [,
b4_parse_param]))
b4_pull_if([b4_c_function_decl([b4_prefix[pull_parse]], [[int]],
[[b4_prefix[pstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [,
[[b4_prefix[pstate *ps]], [[ps]]]m4_ifset([b4_parse_param], [,
b4_parse_param]))])
b4_c_function_decl([b4_prefix[pstate_new]], [b4_prefix[pstate *]],
[[[void]], []])
b4_c_function_decl([b4_prefix[pstate_delete]], [[void]],
[[b4_prefix[pstate *yyps]], [[yyps]]])dnl
[[b4_prefix[pstate *ps]], [[ps]]])dnl
])

# b4_declare_yyparse_
Expand Down
82 changes: 61 additions & 21 deletions doc/bison.texi
Original file line number Diff line number Diff line change
Expand Up @@ -5156,7 +5156,7 @@ default location or at the location specified by @var{qualifier}.
@end deffn

@deffn {Directive} %debug
Instrument the output parser for traces. Obsoleted by @samp{%define
Instrument the parser for traces. Obsoleted by @samp{%define
parse.trace}.
@xref{Tracing, ,Tracing Your Parser}.
@end deffn
Expand Down Expand Up @@ -5465,6 +5465,8 @@ The parser namespace is @code{foo} and @code{yylex} is referenced as
@item Accepted Values: String

@item Default Value: @code{yy}

@item History: introduced in Bison 2.6
@end itemize

@c ================================================== api.pure
Expand Down Expand Up @@ -5690,12 +5692,16 @@ syntax error handling. @xref{LAC}.
@findex %define parse.trace

@itemize
@item Languages(s): C, C++
@item Languages(s): C, C++, Java

@item Purpose: Require parser instrumentation for tracing.
In C/C++, define the macro @code{YYDEBUG} to 1 in the parser implementation
@xref{Tracing, ,Tracing Your Parser}.

In C/C++, define the macro @code{YYDEBUG} (or @code{@var{prefix}DEBUG} with
@samp{%define api.prefix @var{prefix}}), see @ref{Multiple Parsers,
,Multiple Parsers in the Same Program}) to 1 in the parser implementation
file if it is not already defined, so that the debugging facilities are
compiled. @xref{Tracing, ,Tracing Your Parser}.
compiled.

@item Accepted Values: Boolean

Expand Down Expand Up @@ -5852,20 +5858,22 @@ also need to avoid conflicts on types and macros (e.g., @code{YYSTYPE})
exported in the generated header.

The easy way to do this is to define the @code{%define} variable
@code{api.prefix} (possibly using the option
@samp{-Dapi.prefix=@var{prefix}}, see @ref{Invocation, ,Invoking Bison}).
This renames the interface functions and variables of the Bison parser to
start with @var{prefix} instead of @samp{yy}, and all the macros to start by
@var{PREFIX} (i.e., @var{prefix} upper cased) instead of @samp{YY}. You can
use this to give each parser distinct names that do not conflict.
@code{api.prefix}. With different @code{api.prefix}s it is guaranteed that
headers do not conflict when included together, and that compiled objects
can be linked together too. Specifying @samp{%define api.prefix
@var{prefix}} (or passing the option @samp{-Dapi.prefix=@var{prefix}}, see
@ref{Invocation, ,Invoking Bison}) renames the interface functions and
variables of the Bison parser to start with @var{prefix} instead of
@samp{yy}, and all the macros to start by @var{PREFIX} (i.e., @var{prefix}
upper-cased) instead of @samp{YY}.

The renamed symbols include @code{yyparse}, @code{yylex}, @code{yyerror},
@code{yynerrs}, @code{yylval}, @code{yylloc}, @code{yychar} and
@code{yydebug}. If you use a push parser, @code{yypush_parse},
@code{yypull_parse}, @code{yypstate}, @code{yypstate_new} and
@code{yypstate_delete} will also be renamed. The renamed macros include
@code{YYSTYPE}, @code{YYSTYPE_IS_TRIVIAL}, @code{YYSTYPE_IS_DECLARED},
@code{YYLTYPE}, @code{YYLTYPE_IS_TRIVIAL}, and @code{YYLTYPE_IS_DECLARED}.
@code{YYSTYPE}, @code{YYLTYPE}, and @code{YYDEBUG}, which is treated
specifically --- more about this below.

For example, if you use @samp{%define api.prefix c}, the names become
@code{cparse}, @code{clex}, @dots{}, @code{CSTYPE}, @code{CLTYPE}, and so
Expand Down Expand Up @@ -5897,9 +5905,33 @@ extern CSTYPE clval;
int cparse (void);
@end example

Previously, a similar feature was provided by the obsoleted directive
@code{%name-prefix} (@pxref{Table of Symbols, ,Bison Symbols}) and option
@code{--name-prefix} (@pxref{Bison Options}).
The macro @code{YYDEBUG} is commonly used to enable the tracing support in
parsers. To comply with this tradition, when @code{api.prefix} is used,
@code{YYDEBUG} (not renamed) is used as a default value:

@example
/* Enabling traces. */
#ifndef CDEBUG
# if defined YYDEBUG
# if YYDEBUG
# define CDEBUG 1
# else
# define CDEBUG 0
# endif
# else
# define CDEBUG 0
# endif
#endif
#if CDEBUG
extern int cdebug;
#endif
@end example

@sp 2

Prior to Bison 2.6, a feature similar to @code{api.prefix} was provided by
the obsolete directive @code{%name-prefix} (@pxref{Table of Symbols, ,Bison
Symbols}) and the option @code{--name-prefix} (@pxref{Bison Options}).

@node Interface
@chapter Parser C-Language Interface
Expand Down Expand Up @@ -6015,9 +6047,9 @@ function is available if either the @samp{%define api.push-pull push} or
@xref{Push Decl, ,A Push Parser}.

@deftypefun int yypush_parse (yypstate *yyps)
The value returned by @code{yypush_parse} is the same as for yyparse with the
following exception. @code{yypush_parse} will return YYPUSH_MORE if more input
is required to finish parsing the grammar.
The value returned by @code{yypush_parse} is the same as for yyparse with
the following exception: it returns @code{YYPUSH_MORE} if more input is
required to finish parsing the grammar.
@end deftypefun

@node Pull Parser Function
Expand Down Expand Up @@ -8788,9 +8820,17 @@ parser. This is compliant with POSIX Yacc. You could use
YYDEBUG 1} in the prologue of the grammar file (@pxref{Prologue, , The
Prologue}).

@item the option @option{-t}, @option{--debug}
Use the @samp{-t} option when you run Bison (@pxref{Invocation,
,Invoking Bison}). This is POSIX compliant too.
If the @code{%define} variable @code{api.prefix} is used (@xref{Multiple
Parsers, ,Multiple Parsers in the Same Program}), for instance @samp{%define
api.prefix x}, then if @code{CDEBUG} is defined, its value controls the
tracing feature (enabled iff nonzero); otherwise tracing is enabled iff
@code{YYDEBUG} is nonzero.

@item the option @option{-t} (POSIX Yacc compliant)
@itemx the option @option{--debug} (Bison extension)
Use the @samp{-t} option when you run Bison (@pxref{Invocation, ,Invoking
Bison}). With @samp{%define api.prefix c}, it defines @code{CDEBUG} to 1,
otherwise it defines @code{YYDEBUG} to 1.

@item the directive @samp{%debug}
@findex %debug
Expand Down
2 changes: 1 addition & 1 deletion gnulib
Submodule gnulib updated from b42157 to be2b03
3 changes: 3 additions & 0 deletions m4/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,6 @@
/xalloc.m4
/xsize.m4
/xstrndup.m4
/off_t.m4
/sys_types_h.m4
/fseterr.m4
Loading

0 comments on commit 60aa04a

Please sign in to comment.