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

2
.gitattributes vendored
View File

@@ -1 +1 @@
ChangeLog merge=merge-changelog

View File

@@ -88,11 +88,13 @@ update-package-copyright-year:
gen_start_date = 2012-01-16 gen_start_date = 2012-01-16
.PHONY: gen-ChangeLog .PHONY: gen-ChangeLog
gen-ChangeLog: gen-ChangeLog:
$(AM_V_GEN)if test -d .git; then \ $(AM_V_GEN)if test -d $(srcdir)/.git; then \
$(top_srcdir)/build-aux/gitlog-to-changelog \ $(top_srcdir)/build-aux/gitlog-to-changelog \
--no-cluster \ --strip-tab \
--amend=$(srcdir)/build-aux/git-log-fix \ --strip-cherry-picked \
--since=$(gen_start_date) > $(distdir)/cl-t; \ --no-cluster \
rm -f $(distdir)/ChangeLog; \ --amend=$(srcdir)/build-aux/git-log-fix \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \ --since=$(gen_start_date) > $(distdir)/cl-t; \
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi fi

303
NEWS
View File

@@ -73,7 +73,7 @@ Bison News
** Future changes: ** Future changes:
The next major release will drop support for K&R C. The next major release will drop support for generating parsers in K&R C.
** yacc.c: YYBACKUP works as expected. ** yacc.c: YYBACKUP works as expected.
@@ -81,29 +81,52 @@ Bison News
*** Location support is eliminated when not requested: *** Location support is eliminated when not requested:
GLR parsers used to include location-related code even when GLR parsers used to include location-related code even when locations were
locations were not requested, and therefore not even usable. not requested, and therefore not even usable.
*** __attribute__ is preserved: *** __attribute__ is preserved:
__attribute__ is no longer disabled when __STRICT_ANSI__ is defined __attribute__ is no longer disabled when __STRICT_ANSI__ is defined (i.e.,
(i.e., when -std is passed to GCC). when -std is passed to GCC).
** lalr1.java: several fixes: ** lalr1.java: several fixes:
The Java parser no longer throws ArrayIndexOutOfBoundsException if The Java parser no longer throws ArrayIndexOutOfBoundsException if the
the first token leads to a syntax error. Some minor clean ups. first token leads to a syntax error. Some minor clean ups.
** C++11 compatibility: ** Changes for C++:
C and C++ parsers use nullptr instead of 0 when __cplusplus is *** C++11 compatibility:
201103L or higher.
** C++ locations: C and C++ parsers use "nullptr" instead of "0" when __cplusplus is 201103L
or higher.
The position and location constructors (and their initialize *** Header guards
methods) accept new arguments for line and column. Several issues
in the documentation were fixed. The header files such as "parser.hh", "location.hh", etc. used a constant
name for preprocessor guards, for instance:
#ifndef BISON_LOCATION_HH
# define BISON_LOCATION_HH
...
#endif // !BISON_LOCATION_HH
The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
case characters are converted to upper case, and series of
non-alphanumerical characters are converted to an underscore.
With "bison -o lang++/parser.cc", "location.hh" would now include:
#ifndef YY_LANG_LOCATION_HH
# define YY_LANG_LOCATION_HH
...
#endif // !YY_LANG_LOCATION_HH
*** C++ locations:
The position and location constructors (and their initialize methods)
accept new arguments for line and column. Several issues in the
documentation were fixed.
** liby is no longer asking for "rpl_fprintf" on some platforms. ** liby is no longer asking for "rpl_fprintf" on some platforms.
@@ -111,35 +134,37 @@ Bison News
*** %printer is documented *** %printer is documented
The %printer directive, supported since at least Bison 1.50, is The "%printer" directive, supported since at least Bison 1.50, is finally
finally documented. The %mfcalc example is extended to demonstrate documented. The "mfcalc" example is extended to demonstrate it.
its use of printer.
The C++ parsers now also support yyoutput (as an alias to For consistency with the C skeletons, the C++ parsers now also support
debug_stream ()) for consistency with the C skeletons. "yyoutput" (as an alias to "debug_stream ()").
*** Several improvements have been made: *** Several improvements have been made:
The layout for grammar excerpts was changed to a more compact The layout for grammar excerpts was changed to a more compact scheme.
scheme. Named references are motivated. The description of the Named references are motivated. The description of the automaton
automaton description file (*.output) is updated to the current description file (*.output) is updated to the current format. Incorrect
format. Incorrect index entries were fixed. Some other errors were index entries were fixed. Some other errors were fixed.
fixed.
** Changes to the build system: ** Building bison:
*** Conflicting prototypes with recent/modified Flex.
Fixed build problems with the current, unreleased, version of Flex, and
some modified versions of 2.5.35, which have modified function prototypes.
*** Warnings during the build procedure have been eliminated. *** Warnings during the build procedure have been eliminated.
*** Several portability problems in the test suite have been fixed: *** Several portability problems in the test suite have been fixed:
This includes warnings with some compilers, unexpected behavior of This includes warnings with some compilers, unexpected behavior of tools
tools such as diff, warning messages from the test suite itself, such as diff, warning messages from the test suite itself, etc.
etc.
*** The install-pdf target work properly: *** The install-pdf target work properly:
Running "make install-pdf" (or -dvi, -html, -info, and -ps) no Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
longer halts in the middle of its course. halts in the middle of its course.
* Changes in version 2.5 (2011-05-14): * Changes in version 2.5 (2011-05-14):
@@ -198,8 +223,8 @@ Bison News
%define lr.type canonical-lr %define lr.type canonical-lr
The default-reduction optimization in the parser tables can also be The default-reduction optimization in the parser tables can also be
adjusted using `%define lr.default-reductions'. For details on both adjusted using "%define lr.default-reductions". For details on both
of these features, see the new section `Tuning LR' in the Bison of these features, see the new section "Tuning LR" in the Bison
manual. manual.
These features are experimental. More user feedback will help to These features are experimental. More user feedback will help to
@@ -215,7 +240,7 @@ Bison News
cause error recovery to begin in a different syntactic context than cause error recovery to begin in a different syntactic context than
the one in which the invalid token was encountered. Second, when the one in which the invalid token was encountered. Second, when
verbose error messages are enabled (with %error-verbose or the verbose error messages are enabled (with %error-verbose or the
obsolete `#define YYERROR_VERBOSE'), the expected token list in the obsolete "#define YYERROR_VERBOSE"), the expected token list in the
syntax error message can both contain invalid tokens and omit valid syntax error message can both contain invalid tokens and omit valid
tokens. tokens.
@@ -240,7 +265,7 @@ Bison News
%define parse.lac full %define parse.lac full
See the new section `LAC' in the Bison manual for additional See the new section "LAC" in the Bison manual for additional
details including a few caveats. details including a few caveats.
LAC is an experimental feature. More user feedback will help to LAC is an experimental feature. More user feedback will help to
@@ -265,7 +290,7 @@ Bison News
except that the manner in which Bison processes multiple definitions except that the manner in which Bison processes multiple definitions
for the same NAME differs. Most importantly, -F and --force-define for the same NAME differs. Most importantly, -F and --force-define
quietly override %define, but -D and --define do not. For further quietly override %define, but -D and --define do not. For further
details, see the section `Bison Options' in the Bison manual. details, see the section "Bison Options" in the Bison manual.
*** Variables renamed: *** Variables renamed:
@@ -323,8 +348,8 @@ Bison News
Similarly to the C parsers, the C++ parsers now define the YYRHSLOC Similarly to the C parsers, the C++ parsers now define the YYRHSLOC
macro and use it in the default YYLLOC_DEFAULT. You are encouraged macro and use it in the default YYLLOC_DEFAULT. You are encouraged
to use it. If, for instance, your location structure has `first' to use it. If, for instance, your location structure has "first"
and `last' members, instead of and "last" members, instead of
# define YYLLOC_DEFAULT(Current, Rhs, N) \ # define YYLLOC_DEFAULT(Current, Rhs, N) \
do \ do \
@@ -395,7 +420,7 @@ Bison News
** Verbose syntax error message fixes: ** Verbose syntax error message fixes:
When %error-verbose or the obsolete `#define YYERROR_VERBOSE' is When %error-verbose or the obsolete "#define YYERROR_VERBOSE" is
specified, syntax error messages produced by the generated parser specified, syntax error messages produced by the generated parser
include the unexpected token as well as a list of expected tokens. include the unexpected token as well as a list of expected tokens.
The effect of %nonassoc on these verbose messages has been corrected The effect of %nonassoc on these verbose messages has been corrected
@@ -406,7 +431,7 @@ Bison News
in order to detect a syntax error. Because no unexpected token or in order to detect a syntax error. Because no unexpected token or
expected tokens can then be reported, the verbose syntax error expected tokens can then be reported, the verbose syntax error
message described above is suppressed, and the parser instead message described above is suppressed, and the parser instead
reports the simpler message, `syntax error'. Previously, this reports the simpler message, "syntax error". Previously, this
suppression was sometimes erroneously triggered by %nonassoc when a suppression was sometimes erroneously triggered by %nonassoc when a
lookahead was actually required. Now verbose messages are lookahead was actually required. Now verbose messages are
suppressed only when all previous lookaheads have already been suppressed only when all previous lookaheads have already been
@@ -442,7 +467,7 @@ Bison News
** -W/--warnings fixes: ** -W/--warnings fixes:
*** Bison now properly recognizes the `no-' versions of categories: *** Bison now properly recognizes the "no-" versions of categories:
For example, given the following command line, Bison now enables all For example, given the following command line, Bison now enables all
warnings except warnings for incompatibilities with POSIX Yacc: warnings except warnings for incompatibilities with POSIX Yacc:
@@ -453,7 +478,7 @@ Bison News
Previously, conflict reports were independent of Bison's normal Previously, conflict reports were independent of Bison's normal
warning system. Now, Bison recognizes the warning categories warning system. Now, Bison recognizes the warning categories
`conflicts-sr' and `conflicts-rr'. This change has important "conflicts-sr" and "conflicts-rr". This change has important
consequences for the -W and --warnings command-line options. For consequences for the -W and --warnings command-line options. For
example: example:
@@ -467,16 +492,16 @@ Bison News
expected number of conflicts is not reported, so -W and --warning expected number of conflicts is not reported, so -W and --warning
then have no effect on the conflict report. then have no effect on the conflict report.
*** The `none' category no longer disables a preceding `error': *** The "none" category no longer disables a preceding "error":
For example, for the following command line, Bison now reports For example, for the following command line, Bison now reports
errors instead of warnings for incompatibilities with POSIX Yacc: errors instead of warnings for incompatibilities with POSIX Yacc:
bison -Werror,none,yacc gram.y bison -Werror,none,yacc gram.y
*** The `none' category now disables all Bison warnings: *** The "none" category now disables all Bison warnings:
Previously, the `none' category disabled only Bison warnings for Previously, the "none" category disabled only Bison warnings for
which there existed a specific -W/--warning category. However, which there existed a specific -W/--warning category. However,
given the following command line, Bison is now guaranteed to given the following command line, Bison is now guaranteed to
suppress all warnings: suppress all warnings:
@@ -521,7 +546,7 @@ Bison News
errors should no longer cause M4 to report a broken pipe on the errors should no longer cause M4 to report a broken pipe on the
affected platforms. affected platforms.
** `%prec IDENTIFIER' requires IDENTIFIER to be defined separately. ** "%prec IDENTIFIER" requires IDENTIFIER to be defined separately.
POSIX specifies that an error be reported for any identifier that does POSIX specifies that an error be reported for any identifier that does
not appear on the LHS of a grammar rule and that is not defined by not appear on the LHS of a grammar rule and that is not defined by
@@ -576,7 +601,7 @@ Bison News
that YYFAIL will automatically invoke yyerror to report the syntax that YYFAIL will automatically invoke yyerror to report the syntax
error so that you don't have to. However, there are several other error so that you don't have to. However, there are several other
subtle differences between YYERROR and YYFAIL, and YYFAIL suffers from subtle differences between YYERROR and YYFAIL, and YYFAIL suffers from
inherent flaws when %error-verbose or `#define YYERROR_VERBOSE' is inherent flaws when %error-verbose or "#define YYERROR_VERBOSE" is
used. For a more detailed discussion, see: used. For a more detailed discussion, see:
http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html
@@ -587,7 +612,7 @@ Bison News
Bison features compatible with it. Thus, during parser generation, Bison features compatible with it. Thus, during parser generation,
Bison 2.5 will produce a warning whenever it discovers YYFAIL in a Bison 2.5 will produce a warning whenever it discovers YYFAIL in a
rule action. In a later release, YYFAIL will be disabled for rule action. In a later release, YYFAIL will be disabled for
%error-verbose and `#define YYERROR_VERBOSE'. Eventually, YYFAIL will %error-verbose and "#define YYERROR_VERBOSE". Eventually, YYFAIL will
be removed altogether. be removed altogether.
There exists at least one case where Bison 2.5's YYFAIL warning will There exists at least one case where Bison 2.5's YYFAIL warning will
@@ -595,7 +620,7 @@ Bison News
Bison-defined macros for the sole purpose of suppressing C Bison-defined macros for the sole purpose of suppressing C
preprocessor warnings (from GCC cpp's -Wunused-macros, for example). preprocessor warnings (from GCC cpp's -Wunused-macros, for example).
To avoid Bison's future warning, such YYFAIL uses can be moved to the To avoid Bison's future warning, such YYFAIL uses can be moved to the
epilogue (that is, after the second `%%') in the Bison input file. In epilogue (that is, after the second "%%") in the Bison input file. In
this release (2.4.2), Bison already generates its own code to suppress this release (2.4.2), Bison already generates its own code to suppress
C preprocessor warnings for YYFAIL, so projects can remove their own C preprocessor warnings for YYFAIL, so projects can remove their own
phony uses of YYFAIL if compatibility with Bison releases prior to phony uses of YYFAIL if compatibility with Bison releases prior to
@@ -623,7 +648,7 @@ Bison News
exp: exp "+" exp { $$ = $1 + $3; }; exp: exp "+" exp { $$ = $1 + $3; };
Some grammars still depend on this `feature'. Bison 2.4.1 restores Some grammars still depend on this "feature". Bison 2.4.1 restores
the previous behavior in the case of C output (specifically, when the previous behavior in the case of C output (specifically, when
neither %language or %skeleton or equivalent command-line options neither %language or %skeleton or equivalent command-line options
are used) to leave more time for grammars depending on the old are used) to leave more time for grammars depending on the old
@@ -654,7 +679,7 @@ Bison News
%define NAME "VALUE" %define NAME "VALUE"
** The directive `%pure-parser' is now deprecated in favor of: ** The directive "%pure-parser" is now deprecated in favor of:
%define api.pure %define api.pure
@@ -664,15 +689,15 @@ Bison News
** Push Parsing ** Push Parsing
Bison can now generate an LALR(1) parser in C with a push interface. That Bison can now generate an LALR(1) parser in C with a push interface. That
is, instead of invoking `yyparse', which pulls tokens from `yylex', you can is, instead of invoking "yyparse", which pulls tokens from "yylex", you can
push one token at a time to the parser using `yypush_parse', which will push one token at a time to the parser using "yypush_parse", which will
return to the caller after processing each token. By default, the push return to the caller after processing each token. By default, the push
interface is disabled. Either of the following directives will enable it: interface is disabled. Either of the following directives will enable it:
%define api.push_pull "push" // Just push; does not require yylex. %define api.push_pull "push" // Just push; does not require yylex.
%define api.push_pull "both" // Push and pull; requires yylex. %define api.push_pull "both" // Push and pull; requires yylex.
See the new section `A Push Parser' in the Bison manual for details. See the new section "A Push Parser" in the Bison manual for details.
The current push parsing interface is experimental and may evolve. More user The current push parsing interface is experimental and may evolve. More user
feedback will help to stabilize it. feedback will help to stabilize it.
@@ -684,10 +709,10 @@ Bison News
** Java ** Java
Bison can now generate an LALR(1) parser in Java. The skeleton is Bison can now generate an LALR(1) parser in Java. The skeleton is
`data/lalr1.java'. Consider using the new %language directive instead of "data/lalr1.java". Consider using the new %language directive instead of
%skeleton to select it. %skeleton to select it.
See the new section `Java Parsers' in the Bison manual for details. See the new section "Java Parsers" in the Bison manual for details.
The current Java interface is experimental and may evolve. More user The current Java interface is experimental and may evolve. More user
feedback will help to stabilize it. feedback will help to stabilize it.
@@ -702,7 +727,7 @@ Bison News
** XML Automaton Report ** XML Automaton Report
Bison can now generate an XML report of the LALR(1) automaton using the new Bison can now generate an XML report of the LALR(1) automaton using the new
`--xml' option. The current XML schema is experimental and may evolve. More "--xml" option. The current XML schema is experimental and may evolve. More
user feedback will help to stabilize it. user feedback will help to stabilize it.
** The grammar file may now specify the name of the parser header file using ** The grammar file may now specify the name of the parser header file using
@@ -734,31 +759,31 @@ Bison News
%define lr.keep_unreachable_states %define lr.keep_unreachable_states
See the %define entry in the `Bison Declaration Summary' in the Bison manual See the %define entry in the "Bison Declaration Summary" in the Bison manual
for further discussion. for further discussion.
** Lookahead Set Correction in the `.output' Report ** Lookahead Set Correction in the ".output" Report
When instructed to generate a `.output' file including lookahead sets When instructed to generate a ".output" file including lookahead sets
(using `--report=lookahead', for example), Bison now prints each reduction's (using "--report=lookahead", for example), Bison now prints each reduction's
lookahead set only next to the associated state's one item that (1) is lookahead set only next to the associated state's one item that (1) is
associated with the same rule as the reduction and (2) has its dot at the end associated with the same rule as the reduction and (2) has its dot at the end
of its RHS. Previously, Bison also erroneously printed the lookahead set of its RHS. Previously, Bison also erroneously printed the lookahead set
next to all of the state's other items associated with the same rule. This next to all of the state's other items associated with the same rule. This
bug affected only the `.output' file and not the generated parser source bug affected only the ".output" file and not the generated parser source
code. code.
** --report-file=FILE is a new option to override the default `.output' file ** --report-file=FILE is a new option to override the default ".output" file
name. name.
** The `=' that used to be required in the following directives is now ** The "=" that used to be required in the following directives is now
deprecated: deprecated:
%file-prefix "parser" %file-prefix "parser"
%name-prefix "c_" %name-prefix "c_"
%output "parser.c" %output "parser.c"
** An Alternative to `%{...%}' -- `%code QUALIFIER {CODE}' ** An Alternative to "%{...%}" -- "%code QUALIFIER {CODE}"
Bison 2.3a provided a new set of directives as a more flexible alternative to Bison 2.3a provided a new set of directives as a more flexible alternative to
the traditional Yacc prologue blocks. Those have now been consolidated into the traditional Yacc prologue blocks. Those have now been consolidated into
@@ -766,14 +791,14 @@ Bison News
the purpose of the code and thus the location(s) where Bison should generate the purpose of the code and thus the location(s) where Bison should generate
it: it:
1. `%code {CODE}' replaces `%after-header {CODE}' 1. "%code {CODE}" replaces "%after-header {CODE}"
2. `%code requires {CODE}' replaces `%start-header {CODE}' 2. "%code requires {CODE}" replaces "%start-header {CODE}"
3. `%code provides {CODE}' replaces `%end-header {CODE}' 3. "%code provides {CODE}" replaces "%end-header {CODE}"
4. `%code top {CODE}' replaces `%before-header {CODE}' 4. "%code top {CODE}" replaces "%before-header {CODE}"
See the %code entries in section `Bison Declaration Summary' in the Bison See the %code entries in section "Bison Declaration Summary" in the Bison
manual for a summary of the new functionality. See the new section `Prologue manual for a summary of the new functionality. See the new section "Prologue
Alternatives' for a detailed discussion including the advantages of %code Alternatives" for a detailed discussion including the advantages of %code
over the traditional Yacc prologues. over the traditional Yacc prologues.
The prologue alternatives are experimental. More user feedback will help to The prologue alternatives are experimental. More user feedback will help to
@@ -796,24 +821,24 @@ Bison News
sometimes prove to be false alarms in existing grammars employing the Yacc sometimes prove to be false alarms in existing grammars employing the Yacc
constructs $0 or $-N (where N is some positive integer). constructs $0 or $-N (where N is some positive integer).
To enable these warnings, specify the option `--warnings=midrule-values' or To enable these warnings, specify the option "--warnings=midrule-values" or
`-W', which is a synonym for `--warnings=all'. "-W", which is a synonym for "--warnings=all".
** Default %destructor or %printer with `<*>' or `<>' ** Default %destructor or %printer with "<*>" or "<>"
Bison now recognizes two separate kinds of default %destructor's and Bison now recognizes two separate kinds of default %destructor's and
%printer's: %printer's:
1. Place `<*>' in a %destructor/%printer symbol list to define a default 1. Place "<*>" in a %destructor/%printer symbol list to define a default
%destructor/%printer for all grammar symbols for which you have formally %destructor/%printer for all grammar symbols for which you have formally
declared semantic type tags. declared semantic type tags.
2. Place `<>' in a %destructor/%printer symbol list to define a default 2. Place "<>" in a %destructor/%printer symbol list to define a default
%destructor/%printer for all grammar symbols without declared semantic %destructor/%printer for all grammar symbols without declared semantic
type tags. type tags.
Bison no longer supports the `%symbol-default' notation from Bison 2.3a. Bison no longer supports the "%symbol-default" notation from Bison 2.3a.
`<*>' and `<>' combined achieve the same effect with one exception: Bison no "<*>" and "<>" combined achieve the same effect with one exception: Bison no
longer applies any %destructor to a mid-rule value if that mid-rule value is longer applies any %destructor to a mid-rule value if that mid-rule value is
not actually ever referenced using either $$ or $n in a semantic action. not actually ever referenced using either $$ or $n in a semantic action.
@@ -821,11 +846,11 @@ Bison News
feedback will help to determine whether they should become permanent feedback will help to determine whether they should become permanent
features. features.
See the section `Freeing Discarded Symbols' in the Bison manual for further See the section "Freeing Discarded Symbols" in the Bison manual for further
details. details.
** %left, %right, and %nonassoc can now declare token numbers. This is required ** %left, %right, and %nonassoc can now declare token numbers. This is required
by POSIX. However, see the end of section `Operator Precedence' in the Bison by POSIX. However, see the end of section "Operator Precedence" in the Bison
manual for a caveat concerning the treatment of literal strings. manual for a caveat concerning the treatment of literal strings.
** The nonfunctional --no-parser, -n, and %no-parser options have been ** The nonfunctional --no-parser, -n, and %no-parser options have been
@@ -859,17 +884,17 @@ Bison News
%destructor { } <character> %destructor { } <character>
guarantees that, when the parser discards any user-defined symbol that has a guarantees that, when the parser discards any user-defined symbol that has a
semantic type tag other than `<character>', it passes its semantic value to semantic type tag other than "<character>", it passes its semantic value to
`free'. However, when the parser discards a `STRING1' or a `string1', it "free". However, when the parser discards a "STRING1" or a "string1", it
also prints its line number to `stdout'. It performs only the second also prints its line number to "stdout". It performs only the second
`%destructor' in this case, so it invokes `free' only once. "%destructor" in this case, so it invokes "free" only once.
[Although we failed to mention this here in the 2.3a release, the default [Although we failed to mention this here in the 2.3a release, the default
%destructor's and %printer's were experimental, and they were rewritten in %destructor's and %printer's were experimental, and they were rewritten in
future versions.] future versions.]
** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with `-y', ** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with "-y",
`--yacc', or `%yacc'), Bison no longer generates #define statements for "--yacc", or "%yacc"), Bison no longer generates #define statements for
associating token numbers with token names. Removing the #define statements associating token numbers with token names. Removing the #define statements
helps to sanitize the global namespace during preprocessing, but POSIX Yacc helps to sanitize the global namespace during preprocessing, but POSIX Yacc
requires them. Bison still generates an enum for token names in all cases. requires them. Bison still generates an enum for token names in all cases.
@@ -878,7 +903,7 @@ Bison News
potentially incompatible with previous releases of Bison. potentially incompatible with previous releases of Bison.
As before, you declare prologue blocks in your grammar file with the As before, you declare prologue blocks in your grammar file with the
`%{ ... %}' syntax. To generate the pre-prologue, Bison concatenates all "%{ ... %}" syntax. To generate the pre-prologue, Bison concatenates all
prologue blocks that you've declared before the first %union. To generate prologue blocks that you've declared before the first %union. To generate
the post-prologue, Bison concatenates all prologue blocks that you've the post-prologue, Bison concatenates all prologue blocks that you've
declared after the first %union. declared after the first %union.
@@ -907,7 +932,7 @@ Bison News
* the code file before the contents of the header file. It does *not* * the code file before the contents of the header file. It does *not*
* insert it into the header file. This is a good place to put * insert it into the header file. This is a good place to put
* #include's that you want at the top of your code file. A common * #include's that you want at the top of your code file. A common
* example is `#include "system.h"'. */ * example is '#include "system.h"'. */
} }
%start-header { %start-header {
/* Bison inserts this block into both the header file and the code file. /* Bison inserts this block into both the header file and the code file.
@@ -941,13 +966,13 @@ Bison News
[Although we failed to mention this here in the 2.3a release, the prologue [Although we failed to mention this here in the 2.3a release, the prologue
alternatives were experimental, and they were rewritten in future versions.] alternatives were experimental, and they were rewritten in future versions.]
** The option `--report=look-ahead' has been changed to `--report=lookahead'. ** The option "--report=look-ahead" has been changed to "--report=lookahead".
The old spelling still works, but is not documented and may be removed The old spelling still works, but is not documented and may be removed
in a future release. in a future release.
* Changes in version 2.3, 2006-06-05: * Changes in version 2.3, 2006-06-05:
** GLR grammars should now use `YYRECOVERING ()' instead of `YYRECOVERING', ** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
for compatibility with LALR(1) grammars. for compatibility with LALR(1) grammars.
** It is now documented that any definition of YYSTYPE or YYLTYPE should ** It is now documented that any definition of YYSTYPE or YYLTYPE should
@@ -1013,7 +1038,7 @@ Bison News
The %parse-params are available in the destructors (and the The %parse-params are available in the destructors (and the
experimental printers) as per the documentation. experimental printers) as per the documentation.
** Bison now warns if it finds a stray `$' or `@' in an action. ** Bison now warns if it finds a stray "$" or "@" in an action.
** %require "VERSION" ** %require "VERSION"
This specifies that the grammar file depends on features implemented This specifies that the grammar file depends on features implemented
@@ -1022,16 +1047,16 @@ Bison News
** lalr1.cc: The token and value types are now class members. ** lalr1.cc: The token and value types are now class members.
The tokens were defined as free form enums and cpp macros. YYSTYPE The tokens were defined as free form enums and cpp macros. YYSTYPE
was defined as a free form union. They are now class members: was defined as a free form union. They are now class members:
tokens are enumerations of the `yy::parser::token' struct, and the tokens are enumerations of the "yy::parser::token" struct, and the
semantic values have the `yy::parser::semantic_type' type. semantic values have the "yy::parser::semantic_type" type.
If you do not want or can update to this scheme, the directive If you do not want or can update to this scheme, the directive
`%define "global_tokens_and_yystype" "1"' triggers the global '%define "global_tokens_and_yystype" "1"' triggers the global
definition of tokens and YYSTYPE. This change is suitable both definition of tokens and YYSTYPE. This change is suitable both
for previous releases of Bison, and this one. for previous releases of Bison, and this one.
If you wish to update, then make sure older version of Bison will If you wish to update, then make sure older version of Bison will
fail using `%require "2.2"'. fail using '%require "2.2"'.
** DJGPP support added. ** DJGPP support added.
@@ -1099,10 +1124,10 @@ Bison News
- A new directive "%expect-rr N" specifies the expected number of - A new directive "%expect-rr N" specifies the expected number of
reduce/reduce conflicts in GLR parsers. reduce/reduce conflicts in GLR parsers.
- %token numbers can now be hexadecimal integers, e.g., `%token FOO 0x12d'. - %token numbers can now be hexadecimal integers, e.g., "%token FOO 0x12d".
This is a GNU extension. This is a GNU extension.
- The option `--report=lookahead' was changed to `--report=look-ahead'. - The option "--report=lookahead" was changed to "--report=look-ahead".
[However, this was changed back after 2.3.] [However, this was changed back after 2.3.]
- Experimental %destructor support has been added to lalr1.cc. - Experimental %destructor support has been added to lalr1.cc.
@@ -1150,10 +1175,10 @@ Bison News
This reverts to the behavior of Bison 1.33 and earlier, and improves This reverts to the behavior of Bison 1.33 and earlier, and improves
compatibility with Yacc. compatibility with Yacc.
- `parse error' -> `syntax error' - "parse error" -> "syntax error"
Bison now uniformly uses the term `syntax error'; formerly, the code Bison now uniformly uses the term "syntax error"; formerly, the code
and manual sometimes used the term `parse error' instead. POSIX and manual sometimes used the term "parse error" instead. POSIX
requires `syntax error' in diagnostics, and it was thought better to requires "syntax error" in diagnostics, and it was thought better to
be consistent. be consistent.
- The documentation now emphasizes that yylex and yyerror must be - The documentation now emphasizes that yylex and yyerror must be
@@ -1166,7 +1191,7 @@ Bison News
output as "foo\\bar.y". output as "foo\\bar.y".
- Yacc command and library now available - Yacc command and library now available
The Bison distribution now installs a `yacc' command, as POSIX requires. The Bison distribution now installs a "yacc" command, as POSIX requires.
Also, Bison now installs a small library liby.a containing Also, Bison now installs a small library liby.a containing
implementations of Yacc-compatible yyerror and main functions. implementations of Yacc-compatible yyerror and main functions.
This library is normally not useful, but POSIX requires it. This library is normally not useful, but POSIX requires it.
@@ -1179,20 +1204,20 @@ Bison News
** Other compatibility issues ** Other compatibility issues
- %union directives can now have a tag before the `{', e.g., the - %union directives can now have a tag before the "{", e.g., the
directive `%union foo {...}' now generates the C code directive "%union foo {...}" now generates the C code
`typedef union foo { ... } YYSTYPE;'; this is for Yacc compatibility. "typedef union foo { ... } YYSTYPE;"; this is for Yacc compatibility.
The default union tag is `YYSTYPE', for compatibility with Solaris 9 Yacc. The default union tag is "YYSTYPE", for compatibility with Solaris 9 Yacc.
For consistency, YYLTYPE's struct tag is now `YYLTYPE' not `yyltype'. For consistency, YYLTYPE's struct tag is now "YYLTYPE" not "yyltype".
This is for compatibility with both Yacc and Bison 1.35. This is for compatibility with both Yacc and Bison 1.35.
- `;' is output before the terminating `}' of an action, for - ";" is output before the terminating "}" of an action, for
compatibility with Bison 1.35. compatibility with Bison 1.35.
- Bison now uses a Yacc-style format for conflict reports, e.g., - Bison now uses a Yacc-style format for conflict reports, e.g.,
`conflicts: 2 shift/reduce, 1 reduce/reduce'. "conflicts: 2 shift/reduce, 1 reduce/reduce".
- `yystype' and `yyltype' are now obsolescent macros instead of being - "yystype" and "yyltype" are now obsolescent macros instead of being
typedefs or tags; they are no longer documented and are planned to be typedefs or tags; they are no longer documented and are planned to be
withdrawn in a future release. withdrawn in a future release.
@@ -1200,13 +1225,13 @@ Bison News
- GLR and inline - GLR and inline
Users of Bison have to decide how they handle the portability of the Users of Bison have to decide how they handle the portability of the
C keyword `inline'. C keyword "inline".
- `parsing stack overflow...' -> `parser stack overflow' - "parsing stack overflow..." -> "parser stack overflow"
GLR parsers now report `parser stack overflow' as per the Bison manual. GLR parsers now report "parser stack overflow" as per the Bison manual.
** Bison now warns if it detects conflicting outputs to the same file, ** Bison now warns if it detects conflicting outputs to the same file,
e.g., it generates a warning for `bison -d -o foo.h foo.y' since e.g., it generates a warning for "bison -d -o foo.h foo.y" since
that command outputs both code and header to foo.h. that command outputs both code and header to foo.h.
** #line in output files ** #line in output files
@@ -1263,8 +1288,8 @@ Bison News
** Output Directory ** Output Directory
When not in Yacc compatibility mode, when the output file was not When not in Yacc compatibility mode, when the output file was not
specified, running `bison foo/bar.y' created `foo/bar.c'. It specified, running "bison foo/bar.y" created "foo/bar.c". It
now creates `bar.c'. now creates "bar.c".
** Undefined token ** Undefined token
The undefined token was systematically mapped to 2 which prevented The undefined token was systematically mapped to 2 which prevented
@@ -1281,11 +1306,11 @@ Bison News
will be mapped onto another number. will be mapped onto another number.
** Verbose error messages ** Verbose error messages
They no longer report `..., expecting error or...' for states where They no longer report "..., expecting error or..." for states where
error recovery is possible. error recovery is possible.
** End token ** End token
Defaults to `$end' instead of `$'. Defaults to "$end" instead of "$".
** Error recovery now conforms to documentation and to POSIX ** Error recovery now conforms to documentation and to POSIX
When a Bison-generated parser encounters a syntax error, it now pops When a Bison-generated parser encounters a syntax error, it now pops
@@ -1322,7 +1347,7 @@ Bison News
Rules that can never be reduced because of conflicts are now Rules that can never be reduced because of conflicts are now
reported. reported.
** Incorrect `Token not used' ** Incorrect "Token not used"
On a grammar such as On a grammar such as
%token useless useful %token useless useful
@@ -1330,7 +1355,7 @@ Bison News
exp: '0' %prec useful; exp: '0' %prec useful;
where a token was used to set the precedence of the last rule, where a token was used to set the precedence of the last rule,
bison reported both `useful' and `useless' as useless tokens. bison reported both "useful" and "useless" as useless tokens.
** Revert the C++ namespace changes introduced in 1.31 ** Revert the C++ namespace changes introduced in 1.31
as they caused too many portability hassles. as they caused too many portability hassles.
@@ -1344,7 +1369,7 @@ Bison News
** Token end-of-file ** Token end-of-file
The token end of file may be specified by the user, in which case, The token end of file may be specified by the user, in which case,
the user symbol is used in the reports, the graphs, and the verbose the user symbol is used in the reports, the graphs, and the verbose
error messages instead of `$end', which remains being the default. error messages instead of "$end", which remains being the default.
For instance For instance
%token MYEOF 0 %token MYEOF 0
or or
@@ -1358,7 +1383,10 @@ Bison News
Croatian, thanks to Denis Lackovic. Croatian, thanks to Denis Lackovic.
** Incorrect token definitions ** Incorrect token definitions
When given `%token 'a' "A"', Bison used to output `#define 'a' 65'. When given
%token 'a' "A"
bison used to output
#define 'a' 65
** Token definitions as enums ** Token definitions as enums
Tokens are output both as the traditional #define's, and, provided Tokens are output both as the traditional #define's, and, provided
@@ -1370,7 +1398,7 @@ Bison News
produces additional information: produces additional information:
- itemset - itemset
complete the core item sets with their closure complete the core item sets with their closure
- lookahead [changed to `look-ahead' in 1.875e through 2.3, but changed back] - lookahead [changed to "look-ahead" in 1.875e through 2.3, but changed back]
explicitly associate lookahead tokens to items explicitly associate lookahead tokens to items
- solved - solved
describe shift/reduce conflicts solving. describe shift/reduce conflicts solving.
@@ -1408,9 +1436,9 @@ Bison News
** File name clashes are detected ** File name clashes are detected
$ bison foo.y -d -o foo.x $ bison foo.y -d -o foo.x
fatal error: header and parser would both be named `foo.x' fatal error: header and parser would both be named "foo.x"
** A missing `;' at the end of a rule triggers a warning ** A missing ";" at the end of a rule triggers a warning
In accordance with POSIX, and in agreement with other In accordance with POSIX, and in agreement with other
Yacc implementations, Bison will mandate this semicolon in the near Yacc implementations, Bison will mandate this semicolon in the near
future. This eases the implementation of a Bison parser of Bison future. This eases the implementation of a Bison parser of Bison
@@ -1449,7 +1477,7 @@ Bison News
GNU Gettext asserts 10 s/r conflicts, but there are 7. Now that GNU Gettext asserts 10 s/r conflicts, but there are 7. Now that
Bison dies on incorrect %expectations, we fear there will be Bison dies on incorrect %expectations, we fear there will be
too many bug reports for Gettext, so _for the time being_, %expect too many bug reports for Gettext, so _for the time being_, %expect
does not trigger an error when the input file is named `plural.y'. does not trigger an error when the input file is named "plural.y".
** Use of alloca in parsers ** Use of alloca in parsers
If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
@@ -1526,15 +1554,15 @@ Bison News
New. New.
** --output ** --output
New, aliasing `--output-file'. New, aliasing "--output-file".
* Changes in version 1.30, 2001-10-26: * Changes in version 1.30, 2001-10-26:
** `--defines' and `--graph' have now an optional argument which is the ** "--defines" and "--graph" have now an optional argument which is the
output file name. `-d' and `-g' do not change; they do not take any output file name. "-d" and "-g" do not change; they do not take any
argument. argument.
** `%source_extension' and `%header_extension' are removed, failed ** "%source_extension" and "%header_extension" are removed, failed
experiment. experiment.
** Portability fixes. ** Portability fixes.
@@ -1544,9 +1572,9 @@ Bison News
** The output file does not define const, as this caused problems when used ** The output file does not define const, as this caused problems when used
with common autoconfiguration schemes. If you still use ancient compilers with common autoconfiguration schemes. If you still use ancient compilers
that lack const, compile with the equivalent of the C compiler option that lack const, compile with the equivalent of the C compiler option
`-Dconst='. Autoconf's AC_C_CONST macro provides one way to do this. "-Dconst=". Autoconf's AC_C_CONST macro provides one way to do this.
** Added `-g' and `--graph'. ** Added "-g" and "--graph".
** The Bison manual is now distributed under the terms of the GNU FDL. ** The Bison manual is now distributed under the terms of the GNU FDL.
@@ -1558,18 +1586,18 @@ Bison News
** Added the old Bison reference card. ** Added the old Bison reference card.
** Added `--locations' and `%locations'. ** Added "--locations" and "%locations".
** Added `-S' and `--skeleton'. ** Added "-S" and "--skeleton".
** `%raw', `-r', `--raw' is disabled. ** "%raw", "-r", "--raw" is disabled.
** Special characters are escaped when output. This solves the problems ** Special characters are escaped when output. This solves the problems
of the #line lines with path names including backslashes. of the #line lines with path names including backslashes.
** New directives. ** New directives.
`%yacc', `%fixed_output_files', `%defines', `%no_parser', `%verbose', "%yacc", "%fixed_output_files", "%defines", "%no_parser", "%verbose",
`%debug', `%source_extension' and `%header_extension'. "%debug", "%source_extension" and "%header_extension".
** @$ ** @$
Automatic location tracking. Automatic location tracking.
@@ -1686,4 +1714,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
Local Variables: Local Variables:
mode: outline mode: outline
fill-column: 76
End: End:

View File

@@ -15,25 +15,16 @@ First, if it is a large change, you must make sure they have signed
the appropriate paperwork. Second, be sure to add their name and the appropriate paperwork. Second, be sure to add their name and
email address to THANKS. email address to THANKS.
** If a change fixes a test, mention the test in the ChangeLog entry. ** If a change fixes a test, mention the test in the commit message.
** Bug reports ** Bug reports
If somebody reports a new bug, mention his name in the ChangeLog entry If somebody reports a new bug, mention his name in the commit message
and in the test case you write. Put him into THANKS. and in the test case you write. Put him into THANKS.
The correct response to most actual bugs is to write a new test case The correct response to most actual bugs is to write a new test case
which demonstrates the bug. Then fix the bug, re-run the test suite, which demonstrates the bug. Then fix the bug, re-run the test suite,
and check everything in. and check everything in.
** You may find it useful to install the git-merge-changelog merge driver:
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/git-merge-changelog.c
When following the generic installation instructions there, keep in mind that
your clone of Bison's git repository already contains appropriate
.gitattributes files, and running Bison's bootstrap script will make the
necessary changes to .git/config.
* Hacking * Hacking
@@ -176,7 +167,7 @@ The autoconf files we use are currently:
lib/m4sugar/m4sugar.m4 lib/m4sugar/m4sugar.m4
lib/m4sugar/foreach.m4 lib/m4sugar/foreach.m4
These files don't change very often in autoconf, so it should be These files don't change very often in Autoconf, so it should be
relatively straight-forward to examine the differences in order to relatively straight-forward to examine the differences in order to
decide whether to update. decide whether to update.
@@ -196,6 +187,9 @@ release:
- Build with -DGNULIB_POSIXCHECK. It suggests gnulib modules that can - Build with -DGNULIB_POSIXCHECK. It suggests gnulib modules that can
fix portability issues. fix portability issues.
- Check with `make syntax-check' if there are issues diagnosed by
gnulib.
- run `make maintainer-check' which: - run `make maintainer-check' which:
- runs `valgrind -q bison' to run Bison under Valgrind. - runs `valgrind -q bison' to run Bison under Valgrind.
- runs the parsers under Valgrind. - runs the parsers under Valgrind.
@@ -213,6 +207,9 @@ release:
Bison's included XSLT style sheets with the output of --report=all and Bison's included XSLT style sheets with the output of --report=all and
--graph. --graph.
- running `make maintainer-release-check' takes care of running
maintainer-check, maintainer-push-check and maintainer-xml-check.
- Change tests/atlocal/CFLAGS to add your preferred options. For - Change tests/atlocal/CFLAGS to add your preferred options. For
instance, `-traditional' to check that the parsers are K&R. Note instance, `-traditional' to check that the parsers are K&R. Note
that it does not make sense for glr.c, which should be ANSI, that it does not make sense for glr.c, which should be ANSI,
@@ -260,16 +257,17 @@ occurrences of PACKAGE_COPYRIGHT_YEAR in configure.ac.
The version number, *and* the date of the release (including for The version number, *and* the date of the release (including for
betas). betas).
** Update ChangeLog ** Mention the release name in a commit message
Should have an entry similar to `Version 1.49b.'. Should have an entry similar to `Version 2.3b.'.
** Tag the release ** Tag the release
Before Bison will build with the right version number, you must tag the release Before Bison will build with the right version number, you must tag
in git. Do this after all other changes. The command is similar to: the release in git. Do this after all other changes. The command is
similar to:
git tag -a v2.3b git tag -a v2.3b
The log message can be simply: The commit message can be simply:
Bison 2.3b Bison 2.3b

1
THANKS
View File

@@ -114,6 +114,7 @@ Tys Lefering gccbison@gmail.com
Vin Shelton acs@alumni.princeton.edu Vin Shelton acs@alumni.princeton.edu
W.C.A. Wijngaards wouter@NLnetLabs.nl W.C.A. Wijngaards wouter@NLnetLabs.nl
Wayne Green wayne@infosavvy.com Wayne Green wayne@infosavvy.com
Wei Song wsong83@gmail.com
Wolfgang S. Kechel wolfgang.kechel@prs.de Wolfgang S. Kechel wolfgang.kechel@prs.de
Wolfram Wagner ww@mpi-sb.mpg.de Wolfram Wagner ww@mpi-sb.mpg.de
Wwp subscript@free.fr Wwp subscript@free.fr

4
TODO
View File

@@ -125,10 +125,6 @@ we do the same in yacc.c.
The code bw glr.c and yacc.c is really alike, we can certainly factor The code bw glr.c and yacc.c is really alike, we can certainly factor
some parts. some parts.
* Header guards
From François: should we keep the directory part in the CPP guard?
* Yacc.c: CPP Macros * Yacc.c: CPP Macros

159
bootstrap
View File

@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Print a version string. # Print a version string.
scriptversion=2012-04-16.16; # UTC scriptversion=2012-05-15.06; # UTC
# Bootstrap this package from checked-out sources. # Bootstrap this package from checked-out sources.
@@ -36,6 +36,10 @@ nl='
LC_ALL=C LC_ALL=C
export LC_ALL export LC_ALL
# Ensure that CDPATH is not set. Otherwise, the output from cd
# would cause trouble in at least one use below.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
local_gl_dir=gl local_gl_dir=gl
me=$0 me=$0
@@ -126,7 +130,7 @@ extract_package_name='
p p
} }
' '
package=`sed -n "$extract_package_name" configure.ac` || exit package=$(sed -n "$extract_package_name" configure.ac) || exit
gnulib_name=lib$package gnulib_name=lib$package
build_aux=build-aux build_aux=build-aux
@@ -252,7 +256,7 @@ do
usage usage
exit;; exit;;
--gnulib-srcdir=*) --gnulib-srcdir=*)
GNULIB_SRCDIR=`expr "X$option" : 'X--gnulib-srcdir=\(.*\)'`;; GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
--skip-po) --skip-po)
SKIP_PO=t;; SKIP_PO=t;;
--force) --force)
@@ -303,7 +307,7 @@ insert_sorted_if_absent() {
file=$1 file=$1
str=$2 str=$2
test -f $file || touch $file test -f $file || touch $file
echo "$str" | sort_patterns - $file | cmp - $file > /dev/null \ echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \
|| { echo "$str" | sort_patterns - $file > $file.bak \ || { echo "$str" | sort_patterns - $file > $file.bak \
&& mv $file.bak $file; } \ && mv $file.bak $file; } \
|| exit 1 || exit 1
@@ -319,7 +323,7 @@ insert_vc_ignore() {
# A .gitignore entry that does not start with '/' applies # A .gitignore entry that does not start with '/' applies
# recursively to subdirectories, so prepend '/' to every # recursively to subdirectories, so prepend '/' to every
# .gitignore entry. # .gitignore entry.
pattern=`echo "$pattern" | sed s,^,/,`;; pattern=$(echo "$pattern" | sed s,^,/,);;
esac esac
insert_sorted_if_absent "$vc_ignore_file" "$pattern" insert_sorted_if_absent "$vc_ignore_file" "$pattern"
} }
@@ -423,12 +427,28 @@ check_versions() {
$use_git || continue $use_git || continue
fi fi
# Honor $APP variables ($TAR, $AUTOCONF, etc.) # Honor $APP variables ($TAR, $AUTOCONF, etc.)
appvar=`echo $app | LC_ALL=C tr '[a-z]-' '[A-Z]_'` appvar=$(echo $app | LC_ALL=C tr '[a-z]-' '[A-Z]_')
test "$appvar" = TAR && appvar=AMTAR test "$appvar" = TAR && appvar=AMTAR
case $appvar in case $appvar in
GZIP) ;; # Do not use $GZIP: it contains gzip options. GZIP) ;; # Do not use $GZIP: it contains gzip options.
*) eval "app=\${$appvar-$app}" ;; *) eval "app=\${$appvar-$app}" ;;
esac esac
# Handle the still-experimental Automake-NG programs specially.
# They remain named as the mainstream Automake programs ("automake",
# and "aclocal") to avoid gratuitous incompatibilities with
# pre-existing usages (by, say, autoreconf, or custom autogen.sh
# scripts), but correctly identify themselves (as being part of
# "GNU automake-ng") when asked their version.
case $app in
automake-ng|aclocal-ng)
app=${app%-ng}
($app --version | grep '(GNU automake-ng)') >/dev/null 2>&1 || {
echo "$me: Error: '$app' not found or not from Automake-NG" >&2
ret=1
continue
} ;;
esac
if [ "$req_ver" = "-" ]; then if [ "$req_ver" = "-" ]; then
# Merely require app to exist; not all prereq apps are well-behaved # Merely require app to exist; not all prereq apps are well-behaved
# so we have to rely on $? rather than get_version. # so we have to rely on $? rather than get_version.
@@ -492,10 +512,8 @@ esac
# When we can deduce that gnulib-tool will require patch, # When we can deduce that gnulib-tool will require patch,
# and when patch is not already listed as a prerequisite, add it, too. # and when patch is not already listed as a prerequisite, add it, too.
if test ! -d "$local_gl_dir" \ if test -d "$local_gl_dir" \
|| find "$local_gl_dir" -name '*.diff' -exec false {} +; then && ! find "$local_gl_dir" -name '*.diff' -exec false {} +; then
:
else
case $buildreq in case $buildreq in
*patch*) ;; *patch*) ;;
*) buildreq="patch - *) buildreq="patch -
@@ -539,7 +557,7 @@ git_modules_config () {
test -f .gitmodules && git config --file .gitmodules "$@" test -f .gitmodules && git config --file .gitmodules "$@"
} }
gnulib_path=`git_modules_config submodule.gnulib.path` gnulib_path=$(git_modules_config submodule.gnulib.path)
test -z "$gnulib_path" && gnulib_path=gnulib test -z "$gnulib_path" && gnulib_path=gnulib
# Get gnulib files. # Get gnulib files.
@@ -612,10 +630,10 @@ download_po_files() {
subdir=$1 subdir=$1
domain=$2 domain=$2
echo "$me: getting translations into $subdir for $domain..." echo "$me: getting translations into $subdir for $domain..."
cmd=`printf "$po_download_command_format" "$domain" "$subdir"` cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
eval "$cmd" && return eval "$cmd" && return
# Fallback to HTTP. # Fallback to HTTP.
cmd=`printf "$po_download_command_format2" "$subdir" "$domain"` cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
eval "$cmd" eval "$cmd"
} }
@@ -638,7 +656,7 @@ update_po_files() {
&& ls "$ref_po_dir"/*.po 2>/dev/null | && ls "$ref_po_dir"/*.po 2>/dev/null |
sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return
langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'` langs=$(cd $ref_po_dir && echo *.po | sed 's/\.po//g')
test "$langs" = '*' && langs=x test "$langs" = '*' && langs=x
for po in $langs; do for po in $langs; do
case $po in x) continue;; esac case $po in x) continue;; esac
@@ -675,18 +693,18 @@ symlink_to_dir()
# If the destination directory doesn't exist, create it. # If the destination directory doesn't exist, create it.
# This is required at least for "lib/uniwidth/cjk.h". # This is required at least for "lib/uniwidth/cjk.h".
dst_dir=`dirname "$dst"` dst_dir=$(dirname "$dst")
if ! test -d "$dst_dir"; then if ! test -d "$dst_dir"; then
mkdir -p "$dst_dir" mkdir -p "$dst_dir"
# If we've just created a directory like lib/uniwidth, # If we've just created a directory like lib/uniwidth,
# tell version control system(s) it's ignorable. # tell version control system(s) it's ignorable.
# FIXME: for now, this does only one level # FIXME: for now, this does only one level
parent=`dirname "$dst_dir"` parent=$(dirname "$dst_dir")
for dot_ig in x $vc_ignore; do for dot_ig in x $vc_ignore; do
test $dot_ig = x && continue test $dot_ig = x && continue
ig=$parent/$dot_ig ig=$parent/$dot_ig
insert_vc_ignore $ig `echo "$dst_dir"|sed 's,.*/,,'` insert_vc_ignore $ig "${dst_dir##*/}"
done done
fi fi
@@ -710,10 +728,10 @@ symlink_to_dir()
# so that broken tools aren't confused into skipping needed builds. See # so that broken tools aren't confused into skipping needed builds. See
# <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00326.html>. # <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00326.html>.
test -h "$dst" && test -h "$dst" &&
src_ls=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i=$1 && src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
dst_ls=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i=$1 && dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
test "$src_i" = "$dst_i" && test "$src_i" = "$dst_i" &&
both_ls=`ls -dt "$src" "$dst"` && both_ls=$(ls -dt "$src" "$dst") &&
test "X$both_ls" = "X$dst$nl$src" || { test "X$both_ls" = "X$dst$nl$src" || {
dot_dots= dot_dots=
case $src in case $src in
@@ -736,6 +754,22 @@ symlink_to_dir()
} }
} }
version_controlled_file() {
parent=$1
file=$2
if test -d .git; then
git rm -n "$file" > /dev/null 2>&1
elif test -d .svn; then
svn log -r HEAD "$file" > /dev/null 2>&1
elif test -d CVS; then
grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null |
grep '^/[^/]*/[0-9]' > /dev/null
else
echo "$me: no version control for $file?" >&2
false
fi
}
# NOTE: we have to be careful to run both autopoint and libtoolize # NOTE: we have to be careful to run both autopoint and libtoolize
# before gnulib-tool, since gnulib-tool is likely to provide newer # before gnulib-tool, since gnulib-tool is likely to provide newer
# versions of files "installed" by these two programs. # versions of files "installed" by these two programs.
@@ -748,37 +782,54 @@ with_gettext=yes
grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \ grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
with_gettext=no with_gettext=no
if test $with_gettext = yes; then if test $with_gettext = yes || test $use_libtool = 1; then
# Released autopoint has the tendency to install macros that have been
# obsoleted in current gnulib, so run this before gnulib-tool.
echo "$0: $AUTOPOINT --force"
$AUTOPOINT --force || exit
fi
# Autoreconf runs aclocal before libtoolize, which causes spurious tempbase=.bootstrap$$
# warnings if the initial aclocal is confused by the libtoolized trap "rm -f $tempbase.0 $tempbase.1" 1 2 13 15
# (or worse out-of-date) macro directory.
if test $use_libtool = 1; then
echo "running: $LIBTOOLIZE --copy --install"
$LIBTOOLIZE --copy --install
fi
version_controlled_file() { > $tempbase.0 > $tempbase.1 &&
dir=$1 find . ! -type d -print | sort > $tempbase.0 || exit
file=$2
found=no if test $with_gettext = yes; then
if test -d CVS; then # Released autopoint has the tendency to install macros that have been
grep -F "/$file/" $dir/CVS/Entries 2>/dev/null | # obsoleted in current gnulib, so run this before gnulib-tool.
grep '^/[^/]*/[0-9]' > /dev/null && found=yes echo "$0: $AUTOPOINT --force"
elif test -d .git; then $AUTOPOINT --force || exit
git rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
elif test -d .svn; then
svn log -r HEAD "$dir/$file" > /dev/null 2>&1 && found=yes
else
echo "$me: no version control for $dir/$file?" >&2
fi fi
test $found = yes
} # Autoreconf runs aclocal before libtoolize, which causes spurious
# warnings if the initial aclocal is confused by the libtoolized
# (or worse out-of-date) macro directory.
# libtoolize 1.9b added the --install option; but we support back
# to libtoolize 1.5.22, where the install action was default.
if test $use_libtool = 1; then
install=
case $($LIBTOOLIZE --help) in
*--install*) install=--install ;;
esac
echo "running: $LIBTOOLIZE $install --copy"
$LIBTOOLIZE $install --copy
fi
find . ! -type d -print | sort >$tempbase.1
old_IFS=$IFS
IFS=$nl
for file in $(comm -13 $tempbase.0 $tempbase.1); do
IFS=$old_IFS
parent=${file%/*}
version_controlled_file "$parent" "$file" || {
for dot_ig in x $vc_ignore; do
test $dot_ig = x && continue
ig=$parent/$dot_ig
insert_vc_ignore "$ig" "${file##*/}"
done
}
done
IFS=$old_IFS
rm -f $tempbase.0 $tempbase.1
trap - 1 2 13 15
fi
# Import from gnulib. # Import from gnulib.
@@ -842,7 +893,7 @@ AUTOPOINT=true LIBTOOLIZE=true \
for file in $gnulib_extra_files; do for file in $gnulib_extra_files; do
case $file in case $file in
*/INSTALL) dst=INSTALL;; */INSTALL) dst=INSTALL;;
build-aux/*) dst=$build_aux/`expr "$file" : 'build-aux/\(.*\)'`;; build-aux/*) dst=$build_aux/${file#build-aux/};;
*) dst=$file;; *) dst=$file;;
esac esac
symlink_to_dir "$GNULIB_SRCDIR" $file $dst || exit symlink_to_dir "$GNULIB_SRCDIR" $file $dst || exit
@@ -863,7 +914,15 @@ if test $with_gettext = yes; then
} }
' po/Makevars.template >po/Makevars || exit 1 ' po/Makevars.template >po/Makevars || exit 1
cat $GNULIB_SRCDIR/build-aux/po/Makefile.in.in > po/Makefile.in.in || exit 1 # If the 'gettext' module is in use, grab the latest Makefile.in.in.
# If only the 'gettext-h' module is in use, assume autopoint already
# put the correct version of this file into place.
case $gnulib_modules in
*gettext-h*) ;;
*gettext*)
cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in || exit 1
;;
esac
if test -d runtime-po; then if test -d runtime-po; then
# Similarly for runtime-po/Makevars, but not quite the same. # Similarly for runtime-po/Makevars, but not quite the same.

View File

@@ -22,11 +22,12 @@ gnulib_modules='
gettext git-version-gen gitlog-to-changelog gettext git-version-gen gitlog-to-changelog
gpl-3.0 hash inttypes isnan javacomp-script gpl-3.0 hash inttypes isnan javacomp-script
javaexec-script ldexpl maintainer-makefile malloc-gnu mbschr mbsrchr javaexec-script ldexpl maintainer-makefile malloc-gnu mbschr mbsrchr
mbswidth obstack perror pipe-posix progname mbswidth obstack perror progname
quote quotearg realloc-posix quote quotearg realloc-posix
spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
unistd unistd-safer unlocked-io update-copyright unsetenv verify unistd unistd-safer unlocked-io update-copyright unsetenv verify
warnings xalloc xalloc-die xstrndup warnings
xalloc xalloc-die xmemdup0 xstrndup
fprintf-posix printf-posix snprintf-posix sprintf-posix fprintf-posix printf-posix snprintf-posix sprintf-posix
vsnprintf-posix vsprintf-posix vsnprintf-posix vsprintf-posix

View File

@@ -4,6 +4,7 @@
/compile /compile
/config.guess /config.guess
/config.rpath /config.rpath
/config.rpath~
/config.sub /config.sub
/depcomp /depcomp
/gendocs.sh /gendocs.sh

1
cfg.mk
View File

@@ -56,6 +56,7 @@ $(call exclude, \
bindtextdomain=^lib/main.c$$ \ bindtextdomain=^lib/main.c$$ \
program_name=^lib/main.c$$ \ program_name=^lib/main.c$$ \
prohibit_always-defined_macros=^data/yacc.c|^djgpp/ \ prohibit_always-defined_macros=^data/yacc.c|^djgpp/ \
prohibit_always-defined_macros+=?|^lib/timevar.c$$ \
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \ prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
prohibit_always-defined_macros+=?|^tests/regression.at$$ \ prohibit_always-defined_macros+=?|^tests/regression.at$$ \
prohibit_empty_lines_at_EOF=^src/parse-gram.h$$ \ prohibit_empty_lines_at_EOF=^src/parse-gram.h$$ \

View File

@@ -51,7 +51,7 @@ AM_INIT_AUTOMAKE([1.11.1 dist-xz nostdinc
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]], m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
[gnu], [gnits])) [gnu], [gnits]))
AM_SILENT_RULES([yes]) AM_SILENT_RULES([yes])
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin]) AC_CONFIG_HEADERS([lib/config.h:lib/config.in.h])
# Checks for the compiler. # Checks for the compiler.
AC_PROG_CC_STDC AC_PROG_CC_STDC
@@ -72,7 +72,7 @@ if test "$enable_gcc_warnings" = yes; then
-Wcast-qual -Wformat -Wpointer-arith -Wwrite-strings' -Wcast-qual -Wformat -Wpointer-arith -Wwrite-strings'
warn_c='-Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes warn_c='-Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes
-Wshadow -Wstrict-prototypes' -Wshadow -Wstrict-prototypes'
warn_cxx='-Wnoexcept -Wzero-as-null-pointer-constant' warn_cxx='-Wnoexcept'
AC_LANG_PUSH([C]) AC_LANG_PUSH([C])
for i in $warn_common $warn_c; for i in $warn_common $warn_c;
do do
@@ -89,6 +89,8 @@ if test "$enable_gcc_warnings" = yes; then
do do
gl_WARN_ADD([$i], [WARN_CXXFLAGS]) gl_WARN_ADD([$i], [WARN_CXXFLAGS])
done done
gl_WARN_ADD([ -Wzero-as-null-pointer-constant], [WARN_CXXFLAGS],
[AC_LANG_PROGRAM([], [nullptr])])
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS]) gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
# Warnings for the test suite only. # Warnings for the test suite only.
gl_WARN_ADD([-Wundef], [WARN_CXXFLAGS_TEST]) gl_WARN_ADD([-Wundef], [WARN_CXXFLAGS_TEST])
@@ -116,9 +118,7 @@ AC_SUBST([YACC_LIBRARY])
# Checks for programs. # Checks for programs.
AC_PROG_LEX AC_PROG_LEX
if test "$FLEX" != yes; then $LEX_IS_FLEX || AC_MSG_ERROR([Flex is required])
AC_MSG_ERROR([Flex is required])
fi
AC_PROG_YACC AC_PROG_YACC
AC_PROG_RANLIB AC_PROG_RANLIB
AC_PROG_GNU_M4 AC_PROG_GNU_M4

View File

@@ -17,6 +17,33 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # 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. ## ## Identification. ##
## ---------------- ## ## ---------------- ##

View File

@@ -810,9 +810,8 @@ static void yyfillin (yyGLRStackItem *, int, int) __attribute__ ((__unused__));
static void static void
yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1) yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
{ {
yyGLRState* s;
int i; int i;
s = yyvsp[yylow0].yystate.yypred; yyGLRState *s = yyvsp[yylow0].yystate.yypred;
for (i = yylow0-1; i >= yylow1; i -= 1) for (i = yylow0-1; i >= yylow1; i -= 1)
{ {
#if YYDEBUG #if YYDEBUG
@@ -1147,9 +1146,9 @@ yyexpandGLRStack (yyGLRStack* yystackp)
{ {
yyGLRStackItem* yynewItems; yyGLRStackItem* yynewItems;
yyGLRStackItem* yyp0, *yyp1; yyGLRStackItem* yyp0, *yyp1;
size_t yysize, yynewSize; size_t yynewSize;
size_t yyn; size_t yyn;
yysize = yystackp->yynextFree - yystackp->yyitems; size_t yysize = yystackp->yynextFree - yystackp->yyitems;
if (YYMAXDEPTH - YYHEADROOM < yysize) if (YYMAXDEPTH - YYHEADROOM < yysize)
yyMemoryExhausted (yystackp); yyMemoryExhausted (yystackp);
yynewSize = 2*yysize; yynewSize = 2*yysize;
@@ -1172,7 +1171,7 @@ yyexpandGLRStack (yyGLRStack* yystackp)
YYRELOC (yyp0, yyp1, yys0->yypred, yystate); YYRELOC (yyp0, yyp1, yys0->yypred, yystate);
if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULL) if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULL)
yys1->yysemantics.yyfirstVal = yys1->yysemantics.yyfirstVal =
YYRELOC(yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption); YYRELOC (yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
} }
else else
{ {
@@ -1464,8 +1463,8 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULL) if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULL)
{ {
yyGLRState* yyp, *yysplit = yystackp->yysplitPoint; yyGLRState *yysplit = yystackp->yysplitPoint;
yyp = yystackp->yytops.yystates[yyi]; yyGLRState *yyp = yystackp->yytops.yystates[yyi];
while (yyp != yys && yyp != yysplit && yyp->yyposn >= yyposn) while (yyp != yys && yyp != yysplit && yyp->yyposn >= yyposn)
{ {
if (yyp->yylrState == yynewLRState && yyp->yypred == yys) if (yyp->yylrState == yynewLRState && yyp->yypred == yys)
@@ -1578,10 +1577,8 @@ yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
} }
else else
{ {
yySemanticOption** yyz0p; yySemanticOption** yyz0p = &yys0->yysemantics.yyfirstVal;
yySemanticOption* yyz1; yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
yyz0p = &yys0->yysemantics.yyfirstVal;
yyz1 = yys1->yysemantics.yyfirstVal;
while (YYID (yytrue)) while (YYID (yytrue))
{ {
if (yyz1 == *yyz0p || yyz1 == YY_NULL) if (yyz1 == *yyz0p || yyz1 == YY_NULL)
@@ -1663,14 +1660,9 @@ yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp,
YYSTYPE* yyvalp]b4_locuser_formals[) YYSTYPE* yyvalp]b4_locuser_formals[)
{ {
yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1]; yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
int yynrhs; int yynrhs = yyrhsLength (yyopt->yyrule);
int yychar_current; YYRESULTTAG yyflag =
YYSTYPE yylval_current;]b4_locations_if([ yyresolveStates (yyopt->yystate, yynrhs, yystackp]b4_user_args[);
YYLTYPE yylloc_current;])[
YYRESULTTAG yyflag;
yynrhs = yyrhsLength (yyopt->yyrule);
yyflag = yyresolveStates (yyopt->yystate, yynrhs, yystackp]b4_user_args[);
if (yyflag != yyok) if (yyflag != yyok)
{ {
yyGLRState *yys; yyGLRState *yys;
@@ -1683,18 +1675,20 @@ yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp,
if (yynrhs == 0) if (yynrhs == 0)
/* Set default location. */ /* Set default location. */
yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yyopt->yystate->yyloc;]])[ yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yyopt->yystate->yyloc;]])[
yychar_current = yychar; {
yylval_current = yylval;]b4_locations_if([ int yychar_current = yychar;
yylloc_current = yylloc;])[ YYSTYPE yylval_current = yylval;]b4_locations_if([
yychar = yyopt->yyrawchar; YYLTYPE yylloc_current = yylloc;])[
yylval = yyopt->yyval;]b4_locations_if([ yychar = yyopt->yyrawchar;
yylloc = yyopt->yyloc;])[ yylval = yyopt->yyval;]b4_locations_if([
yyflag = yyuserAction (yyopt->yyrule, yynrhs, yylloc = yyopt->yyloc;])[
yyflag = yyuserAction (yyopt->yyrule, yynrhs,
yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
yystackp, yyvalp]b4_locuser_args[); yystackp, yyvalp]b4_locuser_args[);
yychar = yychar_current; yychar = yychar_current;
yylval = yylval_current;]b4_locations_if([ yylval = yylval_current;]b4_locations_if([
yylloc = yylloc_current;])[ yylloc = yylloc_current;])[
}
return yyflag; return yyflag;
} }
@@ -1778,13 +1772,9 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
yyresolveLocations (yys1->yypred, yyn1 - 1, yystackp]b4_user_args[); yyresolveLocations (yys1->yypred, yyn1 - 1, yystackp]b4_user_args[);
if (!yys1->yyresolved) if (!yys1->yyresolved)
{ {
yySemanticOption *yyoption;
yyGLRStackItem yyrhsloc[1 + YYMAXRHS]; yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
int yynrhs; int yynrhs;
int yychar_current; yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
YYSTYPE yylval_current;
YYLTYPE yylloc_current;
yyoption = yys1->yysemantics.yyfirstVal;
YYASSERT (yyoption != YY_NULL); YYASSERT (yyoption != YY_NULL);
yynrhs = yyrhsLength (yyoption->yyrule); yynrhs = yyrhsLength (yyoption->yyrule);
if (yynrhs > 0) if (yynrhs > 0)
@@ -1810,16 +1800,18 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
yyGLRState *yyprevious = yyoption->yystate; yyGLRState *yyprevious = yyoption->yystate;
yyrhsloc[0].yystate.yyloc = yyprevious->yyloc; yyrhsloc[0].yystate.yyloc = yyprevious->yyloc;
} }
yychar_current = yychar; {
yylval_current = yylval; int yychar_current = yychar;
yylloc_current = yylloc; YYSTYPE yylval_current = yylval;
yychar = yyoption->yyrawchar; YYLTYPE yylloc_current = yylloc;
yylval = yyoption->yyval; yychar = yyoption->yyrawchar;
yylloc = yyoption->yyloc; yylval = yyoption->yyval;
YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs); yylloc = yyoption->yyloc;
yychar = yychar_current; YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs);
yylval = yylval_current; yychar = yychar_current;
yylloc = yylloc_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]], [], b4_locations_if([b4_percent_define_ifdef([[location_type]], [],
[# Backward compatibility. [# Backward compatibility.
m4_define([b4_location_constructors]) m4_define([b4_location_constructors])
m4_include(b4_pkgdatadir/[location.cc])])]) m4_include(b4_pkgdatadir/[location.cc])])])
m4_include(b4_pkgdatadir/[stack.hh]) m4_include(b4_pkgdatadir/[stack.hh])
b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])]) b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
@@ -136,12 +136,15 @@ m4_changecom()
m4_divert_push(0)dnl m4_divert_push(0)dnl
@output(b4_spec_defines_file@)@ @output(b4_spec_defines_file@)@
b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++]) 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. */ /* C++ LALR(1) parser skeleton written by Akim Demaille. */
#ifndef PARSER_HEADER_H ]b4_cpp_guard_open([b4_spec_defines_file])[
# define PARSER_HEADER_H
]b4_percent_code_get([[requires]])[ ]b4_percent_code_get([[requires]])[
@@ -358,10 +361,9 @@ b4_public_types_define])[
/* Redirection for backward compatibility. */ /* Redirection for backward compatibility. */
# define YYSTYPE b4_namespace_ref::b4_parser_class_name::semantic_type # define YYSTYPE b4_namespace_ref::b4_parser_class_name::semantic_type
#endif #endif
]) ])[
b4_percent_code_get([[provides]])[]dnl ]b4_percent_code_get([[provides]])[
]b4_cpp_guard_close([b4_spec_defines_file])
[#endif /* ! defined PARSER_HEADER_H */]
@output(b4_parser_file_name@)@ @output(b4_parser_file_name@)@
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++]) b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++])
b4_percent_code_get([[top]])[]dnl 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++])[ b4_copyright([Positions for Bison parsers in C++])[
/** /**
** \file position.hh ** \file ]b4_dir_prefix[position.hh
** Define the ]b4_namespace_ref[::position class. ** Define the ]b4_namespace_ref[::position class.
*/ */
#ifndef BISON_POSITION_HH ]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
# define BISON_POSITION_HH
# include <iostream> # include <iostream>
# include <string> # include <string>
@@ -150,17 +149,16 @@ b4_copyright([Positions for Bison parsers in C++])[
} }
]b4_namespace_close[ ]b4_namespace_close[
#endif // not BISON_POSITION_HH] ]b4_cpp_guard_close([b4_dir_prefix[]position.hh])
@output(b4_dir_prefix[]location.hh@)@ @output(b4_dir_prefix[]location.hh@)@
b4_copyright([Locations for Bison parsers in C++])[ b4_copyright([Locations for Bison parsers in C++])[
/** /**
** \file location.hh ** \file ]b4_dir_prefix[location.hh
** Define the ]b4_namespace_ref[::location class. ** Define the ]b4_namespace_ref[::location class.
*/ */
#ifndef BISON_LOCATION_HH ]b4_cpp_guard_open([b4_dir_prefix[]location.hh])[
# define BISON_LOCATION_HH
# include <iostream> # include <iostream>
# include <string> # include <string>
@@ -296,7 +294,7 @@ b4_copyright([Locations for Bison parsers in C++])[
]b4_namespace_close[ ]b4_namespace_close[
#endif // not BISON_LOCATION_HH] ]b4_cpp_guard_close([b4_dir_prefix[]location.hh])
m4_divert_pop(0) m4_divert_pop(0)
m4_popdef([b4_copyright_years])dnl m4_popdef([b4_copyright_years])dnl
m4_changecom([#]) m4_changecom([#])

View File

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

View File

@@ -7914,7 +7914,7 @@ calls @code{yyerror} and then returns 2.
Because Bison parsers have growing stacks, hitting the upper limit Because Bison parsers have growing stacks, hitting the upper limit
usually results from using a right recursion instead of a left usually results from using a right recursion instead of a left
recursion, @xref{Recursion, ,Recursive Rules}. recursion, see @ref{Recursion, ,Recursive Rules}.
@vindex YYMAXDEPTH @vindex YYMAXDEPTH
By defining the macro @code{YYMAXDEPTH}, you can control how deep the By defining the macro @code{YYMAXDEPTH}, you can control how deep the
@@ -11105,8 +11105,8 @@ My parser returns with error with a @samp{memory exhausted}
message. What can I do? message. What can I do?
@end quotation @end quotation
This question is already addressed elsewhere, @xref{Recursion, This question is already addressed elsewhere, see @ref{Recursion, ,Recursive
,Recursive Rules}. Rules}.
@node How Can I Reset the Parser @node How Can I Reset the Parser
@section How Can I Reset the Parser @section How Can I Reset the Parser

2
gnulib

Submodule gnulib updated: 1a0e0aefd4...338dd5d436

56
lib/.gitignore vendored
View File

@@ -22,6 +22,7 @@
/c-ctype.h /c-ctype.h
/c-strcase.h /c-strcase.h
/c-strcasecmp.c /c-strcasecmp.c
/c-strcaseeq.h
/c-strncasecmp.c /c-strncasecmp.c
/calloc.c /calloc.c
/charset.alias /charset.alias
@@ -29,10 +30,14 @@
/cloexec.h /cloexec.h
/close-hook.c /close-hook.c
/close-hook.h /close-hook.h
/close-stream.c
/close-stream.h
/close.c /close.c
/closeout.c
/closeout.h
/config.charset /config.charset
/config.h /config.h
/config.hin /config.in.h
/configmake.h /configmake.h
/dirname-lgpl.c /dirname-lgpl.c
/dirname.c /dirname.c
@@ -53,19 +58,25 @@
/fcntl.c /fcntl.c
/fcntl.h /fcntl.h
/fcntl.in.h /fcntl.in.h
/fd-hook.c
/fd-hook.h
/fd-safer-flag.c /fd-safer-flag.c
/fd-safer.c /fd-safer.c
/float+.h /float+.h
/float.c
/float.h /float.h
/float.in.h /float.in.h
/fopen-safer.c /fopen-safer.c
/fopen.c /fopen.c
/fpending.c
/fpending.h
/fprintf.c /fprintf.c
/fpucw.h /fpucw.h
/frexp.c /frexp.c
/frexpl.c /frexpl.c
/fseterr.c /fseterr.c
/fseterr.h /fseterr.h
/fstat.c
/getdtablesize.c /getdtablesize.c
/getopt.c /getopt.c
/getopt.h /getopt.h
@@ -88,6 +99,7 @@
/isnanl-nolibm.h /isnanl-nolibm.h
/isnanl.c /isnanl.c
/iswblank.c /iswblank.c
/itold.c
/ldexpl.c /ldexpl.c
/localcharset.c /localcharset.c
/localcharset.h /localcharset.h
@@ -105,14 +117,18 @@
/mbuiter.h /mbuiter.h
/memchr.c /memchr.c
/memchr.valgrind /memchr.valgrind
/msvc-inval.c
/msvc-inval.h
/msvc-nothrow.c
/msvc-nothrow.h
/nonblocking.c /nonblocking.c
/nonblocking.h /nonblocking.h
/obstack.c /obstack.c
/obstack.h /obstack.h
/open.c /open.c
/pathmax.h
/perror.c /perror.c
/pipe-safer.c /pipe-safer.c
/pipe.c
/pipe2-safer.c /pipe2-safer.c
/pipe2.c /pipe2.c
/printf-args.c /printf-args.c
@@ -124,10 +140,13 @@
/printf-parse.c /printf-parse.c
/printf-parse.h /printf-parse.h
/printf.c /printf.c
/progname.c
/progname.h
/quote.c /quote.c
/quote.h /quote.h
/quotearg.c /quotearg.c
/quotearg.h /quotearg.h
/raise.c
/rawmemchr.c /rawmemchr.c
/rawmemchr.valgrind /rawmemchr.valgrind
/realloc.c /realloc.c
@@ -185,7 +204,10 @@
/strchrnul.valgrind /strchrnul.valgrind
/strdup.c /strdup.c
/streq.h /streq.h
/strerror-override.c
/strerror-override.h
/strerror.c /strerror.c
/strerror_r.c
/string.h /string.h
/string.in.h /string.in.h
/stripslash.c /stripslash.c
@@ -205,6 +227,7 @@
/sys_stat.in.h /sys_stat.in.h
/sys_wait.h /sys_wait.h
/sys_wait.in.h /sys_wait.in.h
/sysexits.in.h
/time.h /time.h
/time.in.h /time.in.h
/unistd--.h /unistd--.h
@@ -236,33 +259,12 @@
/wctype.in.h /wctype.in.h
/wcwidth.c /wcwidth.c
/xalloc-die.c /xalloc-die.c
/xalloc-oversized.h
/xalloc.h /xalloc.h
/xmalloc.c /xmalloc.c
/xsize.h /xsize.h
/xstrndup.c /xstrndup.c
/xstrndup.h /xstrndup.h
/c-strcaseeq.h /xmemdup0.c
/fd-hook.c /xmemdup0.h
/fd-hook.h /sys_types.in.h
/float.c
/fstat.c
/itold.c
/msvc-inval.c
/msvc-inval.h
/msvc-nothrow.c
/msvc-nothrow.h
/pathmax.h
/raise.c
/strerror-override.c
/strerror-override.h
/strerror_r.c
/xalloc-oversized.h
/close-stream.c
/close-stream.h
/closeout.c
/closeout.h
/fpending.c
/fpending.h
/sysexits.in.h
/progname.c
/progname.h

16
m4/.gitignore vendored
View File

@@ -38,6 +38,7 @@
/getdtablesize.m4 /getdtablesize.m4
/getopt.m4 /getopt.m4
/gettext.m4 /gettext.m4
/glibc2.m4
/glibc21.m4 /glibc21.m4
/gnulib-cache.m4 /gnulib-cache.m4
/gnulib-common.m4 /gnulib-common.m4
@@ -47,7 +48,12 @@
/iconv.m4 /iconv.m4
/include_next.m4 /include_next.m4
/inline.m4 /inline.m4
/intdiv0.m4
/intl.m4
/intl.m4~
/intldir.m4
/intlmacosx.m4 /intlmacosx.m4
/intmax.m4
/intmax_t.m4 /intmax_t.m4
/inttypes-pri.m4 /inttypes-pri.m4
/inttypes.m4 /inttypes.m4
@@ -61,6 +67,7 @@
/javacomp.m4 /javacomp.m4
/javaexec.m4 /javaexec.m4
/largefile.m4 /largefile.m4
/lcmessage.m4
/ldexp.m4 /ldexp.m4
/ldexpl.m4 /ldexpl.m4
/lib-ld.m4 /lib-ld.m4
@@ -71,6 +78,7 @@
/locale-fr.m4 /locale-fr.m4
/locale-ja.m4 /locale-ja.m4
/locale-zh.m4 /locale-zh.m4
/lock.m4
/longlong.m4 /longlong.m4
/malloc.m4 /malloc.m4
/math_h.m4 /math_h.m4
@@ -88,12 +96,13 @@
/multiarch.m4 /multiarch.m4
/nls.m4 /nls.m4
/nocrash.m4 /nocrash.m4
/off_t.m4
/open.m4 /open.m4
/pathmax.m4 /pathmax.m4
/perror.m4 /perror.m4
/pipe.m4
/pipe2.m4 /pipe2.m4
/po.m4 /po.m4
/po.m4~
/posix_spawn.m4 /posix_spawn.m4
/printf-frexp.m4 /printf-frexp.m4
/printf-frexpl.m4 /printf-frexpl.m4
@@ -144,14 +153,18 @@
/sys_ioctl_h.m4 /sys_ioctl_h.m4
/sys_socket_h.m4 /sys_socket_h.m4
/sys_stat_h.m4 /sys_stat_h.m4
/sys_types_h.m4
/sys_wait_h.m4 /sys_wait_h.m4
/sysexits.m4
/threadlib.m4 /threadlib.m4
/time_h.m4 /time_h.m4
/uintmax_t.m4
/unistd-safer.m4 /unistd-safer.m4
/unistd_h.m4 /unistd_h.m4
/unlocked-io.m4 /unlocked-io.m4
/vasnprintf.m4 /vasnprintf.m4
/vfprintf-posix.m4 /vfprintf-posix.m4
/visibility.m4
/vsnprintf-posix.m4 /vsnprintf-posix.m4
/vsnprintf.m4 /vsnprintf.m4
/vsprintf-posix.m4 /vsprintf-posix.m4
@@ -167,4 +180,3 @@
/xalloc.m4 /xalloc.m4
/xsize.m4 /xsize.m4
/xstrndup.m4 /xstrndup.m4
/sysexits.m4

View File

@@ -1,4 +1,4 @@
# flex.m4 serial 1 # flex.m4 serial 2
# Copyright (C) 2012 Free Software Foundation, Inc. # Copyright (C) 2012 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@@ -24,7 +24,7 @@ fi])
# and whether Lex declares yytext as a char * by default. # and whether Lex declares yytext as a char * by default.
m4_define([_AC_PROG_LEX_YYTEXT_DECL], m4_define([_AC_PROG_LEX_YYTEXT_DECL],
[AC_CACHE_CHECK([whether lex is flex], [AC_CACHE_CHECK([whether lex is flex],
[ac_cv_prog_flex], [ac_cv_prog_lex_is_flex],
[cat >conftest.l <<_ACEOF[ [cat >conftest.l <<_ACEOF[
%option debug nodefault noinput nounput noyywrap never-interactive %option debug nodefault noinput nounput noyywrap never-interactive
%x SC_CONF_TEST %x SC_CONF_TEST
@@ -32,15 +32,13 @@ m4_define([_AC_PROG_LEX_YYTEXT_DECL],
a { BEGIN SC_CONF_TEST; } a { BEGIN SC_CONF_TEST; }
]_ACEOF ]_ACEOF
if _AC_DO_VAR([LEX conftest.l]); then if _AC_DO_VAR([LEX conftest.l]); then
ac_cv_prog_flex=yes ac_cv_prog_lex_is_flex=yes
else else
ac_cv_prog_flex=no ac_cv_prog_lex_is_flex=no
fi fi
]) ])
FLEX= AC_SUBST([LEX_IS_FLEX],
if test $ac_cv_prog_flex = yes; then [`test "$ac_cv_prog_lex_is_flex" = yes && echo true || echo false`])dnl
AC_SUBST([FLEX], [yes])dnl
fi
cat >conftest.l <<_ACEOF[ cat >conftest.l <<_ACEOF[
%% %%

1
po/.gitignore vendored
View File

@@ -6,6 +6,7 @@
/Makefile /Makefile
/Makefile.in /Makefile.in
/Makefile.in.in /Makefile.in.in
/Makefile.in.in~
/Makevars /Makevars
/Makevars.template /Makevars.template
/POTFILES /POTFILES

View File

@@ -6,6 +6,7 @@
/Makefile /Makefile
/Makefile.in /Makefile.in
/Makefile.in.in /Makefile.in.in
/Makefile.in.in~
/Makevars /Makevars
/Makevars.template /Makevars.template
/POTFILES /POTFILES

View File

@@ -21,7 +21,20 @@
# error "FLEX_PREFIX not defined" # error "FLEX_PREFIX not defined"
#endif #endif
/* Whether this version of Flex is (strictly) greater than
Major.Minor.Subminor. */
#define FLEX_VERSION_GT(Major, Minor, Subminor) \
(defined YY_FLEX_MAJOR_VERSION \
&& (Major < YY_FLEX_MAJOR_VERSION \
|| (Major == YY_FLEX_MAJOR_VERSION \
&& (defined YY_FLEX_MINOR_VERSION \
&& (Minor < YY_FLEX_MINOR_VERSION \
|| (Minor == YY_FLEX_MINOR_VERSION \
&& defined YY_FLEX_SUBMINOR_VERSION \
&& Subminor < YY_FLEX_SUBMINOR_VERSION))))))
/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */ /* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */
#if ! FLEX_VERSION_GT (2, 5, 31)
int FLEX_PREFIX (get_lineno) (void); int FLEX_PREFIX (get_lineno) (void);
FILE *FLEX_PREFIX (get_in) (void); FILE *FLEX_PREFIX (get_in) (void);
FILE *FLEX_PREFIX (get_out) (void); FILE *FLEX_PREFIX (get_out) (void);
@@ -33,6 +46,7 @@ void FLEX_PREFIX (set_out) (FILE *);
int FLEX_PREFIX (get_debug) (void); int FLEX_PREFIX (get_debug) (void);
void FLEX_PREFIX (set_debug) (int); void FLEX_PREFIX (set_debug) (int);
int FLEX_PREFIX (lex_destroy) (void); int FLEX_PREFIX (lex_destroy) (void);
#endif
#define last_string FLEX_PREFIX (last_string) #define last_string FLEX_PREFIX (last_string)
@@ -51,12 +65,7 @@ int FLEX_PREFIX (lex_destroy) (void);
versions according to the Flex manual) leak memory if yylex_destroy is not versions according to the Flex manual) leak memory if yylex_destroy is not
invoked. However, yylex_destroy is not defined before Flex 2.5.9, so give invoked. However, yylex_destroy is not defined before Flex 2.5.9, so give
an implementation here that at least appears to work with Flex 2.5.4. */ an implementation here that at least appears to work with Flex 2.5.4. */
#if !defined YY_FLEX_MAJOR_VERSION || YY_FLEX_MAJOR_VERSION < 2 \ #if ! FLEX_VERSION_GT (2, 5, 9)
|| (YY_FLEX_MAJOR_VERSION == 2 \
&& (!defined YY_FLEX_MINOR_VERSION || YY_FLEX_MINOR_VERSION < 5 \
|| (YY_FLEX_MINOR_VERSION == 5 \
&& (!defined YY_FLEX_SUBMINOR_VERSION \
|| YY_FLEX_SUBMINOR_VERSION < 9))))
# define yylex_destroy() yy_delete_buffer (YY_CURRENT_BUFFER) # define yylex_destroy() yy_delete_buffer (YY_CURRENT_BUFFER)
#endif #endif
@@ -73,16 +82,16 @@ int FLEX_PREFIX (lex_destroy) (void);
static struct obstack obstack_for_string; static struct obstack obstack_for_string;
#define STRING_GROW \ # define STRING_GROW \
obstack_grow (&obstack_for_string, yytext, yyleng) obstack_grow (&obstack_for_string, yytext, yyleng)
#define STRING_FINISH \ # define STRING_FINISH \
do { \ do { \
obstack_1grow (&obstack_for_string, '\0'); \ obstack_1grow (&obstack_for_string, '\0'); \
last_string = obstack_finish (&obstack_for_string); \ last_string = obstack_finish (&obstack_for_string); \
} while (0) } while (0)
#define STRING_FREE \ # define STRING_FREE \
obstack_free (&obstack_for_string, last_string) obstack_free (&obstack_for_string, last_string)
#endif #endif

View File

@@ -603,13 +603,19 @@ getargs (int argc, char *argv[])
/* Here, the -d and --defines options are differentiated. */ /* Here, the -d and --defines options are differentiated. */
defines_flag = true; defines_flag = true;
if (optarg) if (optarg)
spec_defines_file = xstrdup (AS_FILE_NAME (optarg)); {
free (spec_defines_file);
spec_defines_file = xstrdup (AS_FILE_NAME (optarg));
}
break; break;
case 'g': case 'g':
graph_flag = true; graph_flag = true;
if (optarg) if (optarg)
spec_graph_file = xstrdup (AS_FILE_NAME (optarg)); {
free (spec_graph_file);
spec_graph_file = xstrdup (AS_FILE_NAME (optarg));
}
break; break;
case 'h': case 'h':
@@ -648,7 +654,10 @@ getargs (int argc, char *argv[])
case 'x': case 'x':
xml_flag = true; xml_flag = true;
if (optarg) if (optarg)
spec_xml_file = xstrdup (AS_FILE_NAME (optarg)); {
free (spec_xml_file);
spec_xml_file = xstrdup (AS_FILE_NAME (optarg));
}
break; break;
case 'y': case 'y':
@@ -669,6 +678,7 @@ getargs (int argc, char *argv[])
exit (EXIT_SUCCESS); exit (EXIT_SUCCESS);
case REPORT_FILE_OPTION: case REPORT_FILE_OPTION:
free (spec_verbose_file);
spec_verbose_file = xstrdup (AS_FILE_NAME (optarg)); spec_verbose_file = xstrdup (AS_FILE_NAME (optarg));
break; break;

View File

@@ -32,6 +32,7 @@
#include "symlist.h" #include "symlist.h"
#include "scan-gram.h" #include "scan-gram.h"
#include "scan-code.h" #include "scan-code.h"
#include "xmemdup0.h"
#define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N) #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
static YYLTYPE lloc_default (YYLTYPE const *, int); static YYLTYPE lloc_default (YYLTYPE const *, int);
@@ -353,7 +354,7 @@ prologue_declaration:
xmalloc (dir_length + 1 + strlen (skeleton_user) + 1); xmalloc (dir_length + 1 + strlen (skeleton_user) + 1);
if (dir_length > 0) if (dir_length > 0)
{ {
strncpy (skeleton_build, current_file, dir_length); memcpy (skeleton_build, current_file, dir_length);
skeleton_build[dir_length++] = '/'; skeleton_build[dir_length++] = '/';
} }
strcpy (skeleton_build + dir_length, skeleton_user); strcpy (skeleton_build + dir_length, skeleton_user);
@@ -775,17 +776,7 @@ add_param (param_type type, char *decl, location loc)
complain_at (loc, _("missing identifier in parameter declaration")); complain_at (loc, _("missing identifier in parameter declaration"));
else else
{ {
char *name; char *name = xmemdup0 (name_start, strspn (name_start, alphanum));
size_t name_len;
for (name_len = 1;
memchr (alphanum, name_start[name_len], sizeof alphanum);
name_len++)
continue;
name = xmalloc (name_len + 1);
memcpy (name, name_start, name_len);
name[name_len] = '\0';
if (type & param_lex) if (type & param_lex)
muscle_pair_list_grow ("lex_param", decl, name); muscle_pair_list_grow ("lex_param", decl, name);
if (type & param_parse) if (type & param_parse)

View File

@@ -77,7 +77,6 @@ static void fail_for_invalid_at (char const *at);
"@oline@" fprintf (yyout, "%d", out_lineno + 1); "@oline@" fprintf (yyout, "%d", out_lineno + 1);
"@ofile@" QPUTS (outname); "@ofile@" QPUTS (outname);
"@dir_prefix@" QPUTS (dir_prefix);
@[a-z_]+"(" { @[a-z_]+"(" {
yytext[yyleng-1] = '\0'; yytext[yyleng-1] = '\0';

View File

@@ -37,6 +37,33 @@ printf "$count\n";' $1], [0], [$3
])]) ])])
# AT_SAVE_SPECIAL_FILES / AT_RESTORE_SPECIAL_FILES
# ------------------------------------------------
# Don't interfere with caller's files.
m4_divert_text([PREPARE_TESTS],
[at_save_special_files ()
{
for at_save_file in stderr experr expout
do
test ! -f $at_save_file || mv $at_save_file at-bison-check-$at_save_file.bak
done
}
at_restore_special_files ()
{
for at_save_file in stderr experr expout
do
test ! -f at-bison-check-$at_save_file.bak ||
mv at-bison-check-$at_save_file.bak $at_save_file
done
}
])
m4_define([AT_SAVE_SPECIAL_FILES], [at_save_special_files])
m4_define([AT_RESTORE_SPECIAL_FILES], [at_restore_special_files])
## ------------------------------- ## ## ------------------------------- ##
## Macros decoding Bison options. ## ## Macros decoding Bison options. ##
## ------------------------------- ## ## ------------------------------- ##
@@ -288,10 +315,7 @@ m4_if(m4_bregexp([$4], [: warning: ]), [-1], [],
# are added after the grammar file name, so skip these checks # are added after the grammar file name, so skip these checks
# in that case. # in that case.
if test -z "${POSIXLY_CORRECT+set}"; then if test -z "${POSIXLY_CORRECT+set}"; then
# Don't interfere with caller's files. ]AT_SAVE_SPECIAL_FILES[
if test -f stderr; then mv stderr at-bison-check-stderr.bak; fi
if test -f experr; then mv experr at-bison-check-experr.bak; fi
if test -f expout; then mv expout at-bison-check-expout.bak; fi
# To avoid expanding it repeatedly, store specified stdout. # To avoid expanding it repeatedly, store specified stdout.
]AT_DATA([expout], [$3])[ ]AT_DATA([expout], [$3])[
@@ -343,16 +367,7 @@ m4_if(m4_bregexp([$4], [: warning: ]), [-1], [],
]AT_CHECK(AT_QUELL_VALGRIND[[ bison ]$1[ --warnings=none \ ]AT_CHECK(AT_QUELL_VALGRIND[[ bison ]$1[ --warnings=none \
-Werror]], [[0]], [expout])[ -Werror]], [[0]], [expout])[
# Restore caller's files. ]AT_RESTORE_SPECIAL_FILES[
if test -f at-bison-check-expout.bak; then
mv at-bison-check-expout.bak expout
fi
if test -f at-bison-check-experr.bak; then
mv at-bison-check-experr.bak experr
fi
if test -f at-bison-check-stderr.bak; then
mv at-bison-check-stderr.bak stderr
fi
fi fi
]]) ]])
]) ])
@@ -363,8 +378,9 @@ m4_if(m4_bregexp([$4], [: warning: ]), [-1], [],
# defined. It doesn't make sense to invoke this macro if Bison is expected to # defined. It doesn't make sense to invoke this macro if Bison is expected to
# have a non-zero exit status. # have a non-zero exit status.
m4_define([AT_BISON_CHECK_XML], m4_define([AT_BISON_CHECK_XML],
[[if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then [[if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then]
mkdir xml-tests] AT_SAVE_SPECIAL_FILES
[mkdir xml-tests]
m4_pushdef([AT_BISON_ARGS], m4_pushdef([AT_BISON_ARGS],
[m4_bpatsubsts([[$1]], [m4_bpatsubsts([[$1]],
[--report(-file)?=[^][ ]*], [], [--report(-file)?=[^][ ]*], [],
@@ -386,8 +402,9 @@ m4_define([AT_BISON_CHECK_XML],
AT_CHECK([[$XSLTPROC \ AT_CHECK([[$XSLTPROC \
`]]AT_QUELL_VALGRIND[[ bison --print-datadir`/xslt/xml2dot.xsl \ `]]AT_QUELL_VALGRIND[[ bison --print-datadir`/xslt/xml2dot.xsl \
xml-tests/test.xml]], [[0]], [expout]) xml-tests/test.xml]], [[0]], [expout])
[rm -rf xml-tests expout [rm -rf xml-tests expout]
fi]]) AT_RESTORE_SPECIAL_FILES
[fi]])
# AT_QUELL_VALGRIND # AT_QUELL_VALGRIND
# ----------------- # -----------------

View File

@@ -1258,10 +1258,12 @@ AT_SETUP([[parse-gram.y: LALR = IELR]])
# output files have the same name. # output files have the same name.
[cp $abs_top_srcdir/src/parse-gram.y input.y] [cp $abs_top_srcdir/src/parse-gram.y input.y]
AT_BISON_CHECK([[-o input.c -Dlr.type=lalr input.y]]) AT_BISON_CHECK([[-o input.c -Dlr.type=lalr input.y]])
[mv input.c expout] [mv input.c lalr.c]
AT_CAPTURE_FILE([lalr.c])
AT_BISON_CHECK([[-o input.c -Dlr.type=ielr input.y]]) AT_BISON_CHECK([[-o input.c -Dlr.type=ielr input.y]])
[mv input.c ielr.c] [mv input.c ielr.c]
AT_CHECK([[cat ielr.c]], [[0]], [[expout]]) AT_CAPTURE_FILE([ielr.c])
AT_CHECK([[diff lalr.c ielr.c]], [[0]])
AT_CLEANUP AT_CLEANUP