Compare commits

..
Author SHA1 Message Date
Paul Eggert 7347b2d316 Import of 2003-06-08 libbitset <http://mail.gnu.org/archive/html/bison-patches/2003-06/msg00005.html> 2003-06-07 23:28:20 +00:00
Paul Eggert 58f5a6af40 Import of 2003-06-08 libbitset <http://mail.gnu.org/archive/html/bison-patches/2003-06/msg00005.html> 2003-06-07 00:31:33 +00:00
Paul Eggert 888f3f0178 Import of 2003-06-08 libbitset <http://mail.gnu.org/archive/html/bison-patches/2003-06/msg00005.html> 2003-06-06 22:03:15 +00:00
Paul Eggert 692be7fef0 Import of 2003-06-08 libbitset <http://mail.gnu.org/archive/html/bison-patches/2003-06/msg00005.html> 2003-06-05 10:40:45 +00:00
Paul Eggert 4bfd57ce09 Import of 2003-06-08 libbitset <http://mail.gnu.org/archive/html/bison-patches/2003-06/msg00005.html> 2003-06-05 10:33:45 +00:00
Paul Eggert 964db18ed6 Import of 2003-06-08 libbitset <http://mail.gnu.org/archive/html/bison-patches/2003-06/msg00005.html> 2003-06-02 11:54:30 +00:00
Paul Eggert 598c90ee77 Import of 2003-06-08 libbitset <http://mail.gnu.org/archive/html/bison-patches/2003-06/msg00005.html> 2003-06-02 10:19:35 +00:00
Paul Eggert f7f37a7a0b Import of 2003-06-08 libbitset <http://mail.gnu.org/archive/html/bison-patches/2003-06/msg00005.html> 2003-06-02 10:15:50 +00:00
Paul Eggert 671dc16a4a Import of 2003-06-08 libbitset <http://mail.gnu.org/archive/html/bison-patches/2003-06/msg00005.html> 2003-06-01 05:58:20 +00:00
Paul Eggert b3be630198 Import of 2003-06-08 libbitset <http://mail.gnu.org/archive/html/bison-patches/2003-06/msg00005.html> 2003-06-01 03:37:04 +00:00
Paul Eggert 5aca537f83 Import of 2003-06-08 libbitset <http://mail.gnu.org/archive/html/bison-patches/2003-06/msg00005.html> 2003-06-01 02:47:43 +00:00
97 changed files with 2905 additions and 6081 deletions
+1 -4
View File
@@ -1,12 +1,10 @@
*.cache
*.flc
*.patch *.log log patches applied
*.prj
*~
.tarball-version
.version
ABOUT-NLS
COPYING
GNUmakefile
INSTALL
Makefile
Makefile.in
@@ -23,7 +21,6 @@ config.status
configure
configure.lineno
conftest*
gnulib
javacomp.sh
javaexec.sh
patches
-1
View File
@@ -1 +0,0 @@
ChangeLog merge=merge-changelog
-31
View File
@@ -1,31 +0,0 @@
/*.cache
/*.flc
/*.prj
/*~
/.tarball-version
/.version
/ABOUT-NLS
/COPYING
/GNUmakefile
/INSTALL
/Makefile
/Makefile.in
/_*
/a.exe
/a.out
/aclocal.m4
/b.out
/bison-*
/conf[0-9]*
/confdefs*
/config.log
/config.status
/configure
/configure.lineno
/conftest*
/gnulib
/javacomp.sh
/javaexec.sh
/patches
/releases
/stamp-h*
-3
View File
@@ -1,3 +0,0 @@
[submodule "gnulib"]
path = gnulib
url = git://git.savannah.gnu.org/gnulib.git
-1
View File
@@ -1 +0,0 @@
2.3b
+1
View File
@@ -0,0 +1 @@
@VERSION@
+3 -600
View File
@@ -1,602 +1,3 @@
2008-12-11 Joel E. Denny <[email protected]>
Version 2.4.1.
* NEWS: Set version and date.
* lib/Makefile.am: Update copyright year.
* tests/atlocal.in: Update copyright year.
2008-12-11 Joel E. Denny <[email protected]>
Semicolon feature removal is not about future language support.
* NEWS: The semicolon feature is no longer active for newer languages,
so don't claim that it causes trouble for them.
2008-12-11 Joel E. Denny <[email protected]>
* gnulib: Update submodule to HEAD.
2008-12-09 Akim Demaille <[email protected]>
Update data/README.
* data/README: Document glr.cc, lalr1.java, m4sugar and xslt.
2008-12-05 Eric Blake <[email protected]>
Build testsuite with newer autoconf.
* tests/output.at (m4_expand): Don't override in newer autoconf,
where the underlying implementation changed.
* tests/cxx-type.at (_AT_RESOLVED_GLR_OUTPUT)
(_AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_AMBIG_GLR_OUTPUT)
(_AT_AMBIG_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR)
(_AT_VERBOSE_GLR_STDERR): Expand to double-quoted strings,
since some of them contain unbalanced ')'.
2008-11-19 Joel E. Denny <[email protected]>
* NEWS: Clarify a little.
2008-11-19 Joel E. Denny <[email protected]>
* NEWS: Update for recent changes.
2008-11-18 Joel E. Denny <[email protected]>
Fix unexpanded macros in GLR defines file.
Reported by Csaba Raduly at
<http://lists.gnu.org/archive/html/bug-bison/2008-11/msg00048.html>.
* THANKS (Csaba Raduly): Add.
* data/glr.c: Fix overquoting on b4_prefix for yylval and yylloc.
* tests/calc.at (_AT_DATA_CALC_Y): If %defines is specified, generate
lexer in a separate module that includes the defines file.
(AT_CHECK_CALC): Use AT_FULL_COMPILE and request compilation of lexer
source.
* tests/local.at (_AT_BISON_OPTION_PUSHDEFS): Push AT_DEFINES_IF.
Adjust AT_LOC and AT_VAL to use AT_NAME_PREFIX.
(AT_BISON_OPTION_POPDEFS): Pop AT_DEFINES_IF.
(AT_DATA_SOURCE_PROLOGUE): New.
(AT_DATA_GRAMMAR_PROLOGUE): Use AT_DATA_SOURCE_PROLOGUE.
(AT_DATA_SOURCE): New.
(AT_FULL_COMPILE): New, copied from master branch and extended to
support an additional source file.
2008-11-17 Joel E. Denny <[email protected]>
Don't let maintainer-*-check targets force a version update.
* cfg.mk (_is-dist-target): Implement. maintainer-check* was already
handled.
2008-11-17 Di-an Jan <[email protected]>
* doc/bison.texinfo: Synchronize ``Detail Node Listing''.
Align menus. Adjust word wrapping. Use node names for menu names.
(Examples): Don't abbreviate node names.
(LocalWords): Remove abbreviations.
(Copying): Make description a sentence.
(Java Action Features): Remove period to match the rest of menu.
2008-11-11 Paolo Bonzini <[email protected]>
* bootstrap.conf: Replace m4/warning.m4 with warnings module.
* configure.ac: Adjust usage.
* lib/Makefile.am: Replace $(WARNING_CFLAGS) with $(WARN_CFLAGS).
* src/Makefile.am: Replace $(WARNING_CFLAGS) with $(WARN_CFLAGS).
* tests/atlocal.in: Replace $(WARNING_*FLAGS) with $(WARN_*FLAGS).
2008-11-07 Joel E. Denny <[email protected]>
Don't add a semicolon to actions for %skeleton or %language.
It breaks Java test cases as reported by Akim Demaille.
* src/scan-code.l: Implement.
2008-11-07 Joel E. Denny <[email protected]>
Clean up %skeleton and %language priority implementation.
* src/getargs.c (skeleton_prio): Use default_prio rather than 2, and
remove static qualifier because others will soon need to see it.
(language_prio): Likewise.
(getargs): Use command_line_prio rather than 0.
* src/getargs.h (command_line_prio, grammar_prio, default_prio): New
enum fields.
(skeleton_prio): Extern it.
(language_prio): Extern it.
* src/parse-gram.y: Use grammar_prio rather than 1.
2008-11-04 Akim Demaille <[email protected]>
* NEWS: Mention the trailing semicolon in action.
2008-11-04 Akim Demaille <[email protected]>
Reformat NEWS.
* NEWS: Use more outline-mode markup.
Suggested by Jim Meyering.
2008-11-04 Joel E. Denny <[email protected]>
Fix user actions without a trailing semicolon.
Reported by Sergei Steshenko at
<http://lists.gnu.org/archive/html/bug-bison/2008-11/msg00001.html>.
* THANKS (Sergei Steshenko): Add.
* src/scan-code.l (SC_RULE_ACTION): Fix it.
* tests/regression.at (Fix user actions without a trailing semicolon):
New test case.
2008-11-02 Joel E. Denny <[email protected]>
Initiate further development.
* NEWS: Create an empty section for new entries.
* gnulib: Update submodule to HEAD.
2008-11-02 Joel E. Denny <[email protected]>
* NEWS: Version 2.4.
2008-11-02 Joel E. Denny <[email protected]>
Prepare for next release.
* NEWS: Briefly mention changes since 2.3b.
* README: Say GNU m4 1.4.6, which we've been requiring in release
announcements already, not 1.4.3, which breaks the build.
2008-11-02 Joel E. Denny <[email protected]>
Say %language is experimental.
We're thinking of extending it's effect on output file naming. See the
thread at
<http://lists.gnu.org/archive/html/bison-patches/2008-10/msg00003.html>.
* NEWS: Say it's experimental.
* doc/bison.texinfo (Decl Summary): Say it's experimental, and so don't
recommend it over %skeleton for now.
(Bison Options): Likewise.
(C++ Bison Interface): Use %skeleton not %language.
(Calc++ Parser): Use %skeleton not %language.
* src/getargs.c (usage): Say it's experimental.
2008-11-01 Di-an Jan <[email protected]>
Paolo Bonzini <[email protected]>
Support all Java parser class modifiers.
* data/java.m4 (b4_percent_define_get3): New.
(b4_final_if, b4_strictfp_if): New.
* data/lalr1.java (final, strictfp, extends, implements): Support.
* doc/bison.texinfo (final, strictfp, extends, implements): Add
documentation.
* tests/java.at (AT_CHECK_JAVA_MINIMAL): New.
(AT_CHECK_JAVA_MINIMAL_W_LEXER): New.
(AT_CHECK_JAVA_GREP): New.
(Java parser class modifiers): New test.
(Java parser class extends and implements): New test.
Model exception propagation better with throws and lex_throws.
* data/java.m4 (b4_list2): New.
(throws): Change default.
* data/lalr1.java (yyaction): Add throws.
(parse): Add lex_throws in addition to throws.
* doc/bison.texinfo (throws, lex_throws): Add documentation.
* tests/java.at (Java throws specifications): New test.
Improve documentation for Java parsers.
* doc/bison.texinfo (Java Parsers): Add subsections.
Don't quote first argument of %define.
(Java Bison Interface): Document output files. Move documentation
of parser class and merge into Java Parser Interface. Document
features that error out. Document directives with no effect.
Move note about Javadoc higher.
(Java Semantic Values): Explicitly mention stype.
Document that generic types cannot be used.
(Java Location Values): Use @deftypeivar. Document constructors.
Correct return value for toString.
(Java Parser Interface): List undocumented constants/fields.
Move documentation of fields added by %parse-param closer to list
of members. Document that token names are added as fields.
Document constructors accurately. Remove error method.
(Java Scanner Interface): Move note on %pure-parser to Java Bison
Interface. Describe %code lexer and yylex accutately.
Remove documentation that does not match the code.
(Java Action Features): New.
(Java Differences): Add reference. Add item on semantic values.
Add note about @{ ... @}. Clarify %% epilogue placement.
(Java Declarations Summary): New.
Fix Java skeleton.
* data/java.m4 (b4_prefix): Correct quoting for m4_define_default.
(b4_remove_comma): Quote test argument.
(b4_identification): Remove "bison" field.
* tests/java.at (Java parser class and package names): New test.
(Java %parse-param and %lex-param): New test.
(Java stype, position_class and location_class): New test.
2008-10-31 Di-an Jan <[email protected]>
* data/lalr1.jave: Update copyright years.
(YYParser): Correct name of "generated from" file in Javadoc:
use b4_file_name instead of @ofile@.
(Location constructor): Correct Javadoc parameter name.
(yylloc): Add missing opening m4 quote after b4_location_if.
This removes a stray [ in the Javadoc of Lexer.getStartPos.
(Lexer.yyerror): Fix incorrect m4 and Javadoc.
(YYParser constructor): Correct Javadoc parameter name.
2008-10-30 Joel E. Denny <[email protected]>
Always put auxiliary code files in the same dir as other output files.
* src/files.c (compute_file_name_parts): When the user specifies
--output but not --file-prefix, extract the directory prefix from the
file prefix not from the grammar file name. This affects the location
of files like location.hh generated by the C++ skeleton. The includes
in the other output files require this fix.
* tests/output.at (AT_CHECK_OUTPUT): Automatically create directories
for expected output files.
(Output files): Add a test for the above.
2008-10-29 Joel E. Denny <[email protected]>
* gnulib: Update submodule to HEAD.
2008-10-28 Joel E. Denny <[email protected]>
Update copyright year.
* src/files.c: Here.
2008-10-28 Di-an Jan <[email protected]> (tiny change)
Don't overwrite the input file.
* src/files.c (output_file_name_check): Fatal error if using input file
for output.
* tests/output.at: (AT_CHECK_CONFLICTING_OUTPUT): Add return status
argument.
(Conflicting output files): Add test.
2008-10-28 Akim Demaille <[email protected]>
Space changes.
* data/lalr1.cc: Formatting changes.
2008-10-28 Akim Demaille <[email protected]>
Don't define debugging functions when !YYDEBUG.
* data/lalr1.cc (debug_stream, set_debug_stream)
(debug_level_type, debug_level, set_debug_level): Don't
declare them when YYDEBUG is not defined.
The implementation are already YYDEBUG-aware.
2008-10-28 Akim Demaille <[email protected]>
Prefer "continue" for empty loop bodies.
* etc/bench.pl.in: Use "continue" instead of {}.
2008-10-28 Akim Demaille <[email protected]>
Space and comments changes.
* data/c++.m4, data/glr.c, data/lalr1.cc: Copyright year changes.
* data/c.m4, data/lalr1.cc: Space changes.
2008-10-28 Akim Demaille <[email protected]>
Make gnulib a submodule.
* gnulib: New.
* .gitmodules (gnulib): New.
2008-10-18 Joel E. Denny <[email protected]>
Fix yyerror_range for user-defined location type in C++. Reported by
Georg Sauthoff at
<http://lists.gnu.org/archive/html/bug-bison/2008-08/msg00008.html>.
* data/lalr1.cc (parse): Change type of yyerror_range to location_type.
* THANKS (Georg Sauthoff): Add.
2008-10-18 Joel E. Denny <[email protected]>
Update several administrative files mainly to facilitate releasing.
* HACKING (Administrivia): Make the git-merge-changelog notes more
helpful.
(Test suite): Don't say lalr1.cc is not exercised in the test suite.
(Release Procedure): Update for git and add numerous details that were
previously missing.
* Makefile.am (EXTRA_DIST): Remove Makefile.cfg and Makefile.maint.
* maint.mk (announcement): Don't list bison as a bootstrap tool so
that announcements don't claim we bootstrapped with whatever bison
happened to be in PATH. Add flex as a bootstrap tool.
* Makefile.maint: Remove, previously replaced by maint.mk.
* Makefile.cfg: Remove, and migrate settings to...
* cfg.mk: ... here for the sake of `make announcement'.
* bootstrap.conf (gnulib_modules): Add announce-gen.
* README: Say GNU Bison instead of just Bison. Suggested by Karl
Berry.
2008-10-08 Di-an Jan <[email protected]> (tiny change)
Small but important bugfixes for the Java skeleton.
* data/lalr1.java (yyerror): Change Location to b4_location_type.
(yy_symbol_print): Call toString on yyvaluep.
2008-08-29 Akim Demaille <[email protected]>
Clarify UPDATED use.
* doc/bison.texinfo: It refers to the last edition of this file,
not to the release date of Bison.
Reported by Joel E. Denny.
2008-08-29 Akim Demaille <[email protected]>
* README: Update FAQ pointer.
Reported by Joel E. Denny.
2008-08-27 Eric Blake <[email protected]>
Resync m4sugar from autoconf.
* data/m4sugar/m4sugar.m4 (m4_defn, m4_popdef, m4_undefine)
(m4_init): Adjust to latest m4.git changes.
(m4_mapall_sep, _m4_list_cmp, m4_version_compare): Reduce side
effects.
* data/m4sugar/foreach.m4 (_m4_shiftn): Fix off-by-one bug.
(_m4_list_cmp): Reduce side effects.
2008-08-27 Akim Demaille <[email protected]>
Check yyerrok in calc.at.
* tests/calc.at (calc.y): Use yyerrok on "( error )".
(AT_CHECK_CALC): Add a check that ensures that yyerrok works as
expected.
2008-08-27 Akim Demaille <[email protected]>
Support yyerrok in lalr1.cc.
YYBACKUP is still to import back into lalr1.cc.
* data/lalr1.cc (yyerrork, yyclearin, YYRECOVERING): Define.
2008-08-26 Joel E. Denny <[email protected]>
For maintainer-check*, don't recompile for a $(VERSION) update.
* cfg.mk: New file.
(_is-dist-target): Override the one in GNUmakefile.
* Makefile.am (EXTRA_DIST): Add cfg.mk.
2008-08-26 Joel E. Denny <[email protected]>
Update for recent change to gnulib.
* src/parse-gram.y: Don't include strverscmp.h. It comes from
string.h now.
2008-08-15 Eric Blake <[email protected]>
Remaining m4sugar merge from autoconf.
* data/m4sugar/m4sugar.m4: Copy entire file from autoconf.
* data/m4sugar/foreach.m4: New file, copied from autoconf.
* data/Makefile.am (dist_m4sugar_DATA): Distribute it.
* src/output.c (output_skeleton): Tell m4 how to find it.
Partial m4sugar merge from autoconf: m4_map.
* data/m4sugar/m4sugar.m4 (m4_fst): Delete.
(m4_map, m4_map_sep, _m4_map): Rewrite more efficiently.
(m4_apply, _m4_apply, m4_mapall, m4_mapall_sep): New macros.
* data/java.m4 (b4_token_enums): Use more efficient short-circuit
for empty list.
* data/c.m4 (b4_token_defines, b4_token_enums, b4_c_ansi_formals):
Likewise.
(b4_parse_param_for): Avoid m4_fst, now that autoconf no longer
declares it.
2008-08-07 Joel E. Denny <[email protected]>
Keep .version and PACKAGE_VERSION in sync.
* Makefile.am ($(top_srcdir)/.version): Declare configure as a
dependency, and add comments justifying this in more detail. Discussed
starting at
<http://lists.gnu.org/archive/html/bison-patches/2008-07/msg00022.html>.
2008-08-06 Eric Blake <[email protected]>
Partial m4sugar merge from autoconf: m4_shiftn.
* data/m4sugar/m4sugar.m4 (m4_shiftn): Faster implementation.
(m4_shift2, m4_shift3): New macros.
(m4_case, m4_bmatch, m4_bpatsubsts, m4_join): Adjust clients.
* data/c.m4 (b4_c_function_def, b4_c_ansi_function_def)
(b4_c_ansi_function_decl, b4_c_function_call): Likewise.
* data/java.m4 (b4_remove_comma): Likewise.
Partial m4sugar merge from autoconf: m4_wrap vs. m4 1.6.
* data/m4sugar/m4sugar.m4 (m4_unquote, m4_wrap_lifo): New macros.
(m4_wrap): Guarantee FIFO order, in spite of m4 1.6.
(m4_init): Consolidate wrapped text into single m4_wrap.
* data/bison.m4 (b4_check_user_names_wrap): Stick with LIFO order
in wrapped text.
2008-08-05 Eric Blake <[email protected]>
Partial m4sugar merge from autoconf: builtins, version.m4.
* data/m4sugar/m4sugar.m4 (changeword): Nuke.
(m4_prepend): Remove, as it is unused and inherently quadratic,
whereas m4_append is linear in newer m4.
(m4_mkstemp): New builtin.
(m4_symbols): Make rename conditional.
(m4_version_prereq): Ensure fatal error if used in bison, which
intentionally lacks version.m4.
Fix comments in m4sugar.
* data/m4sugar/m4sugar.m4: Comment changes, borrowed from autoconf.
2008-08-02 Joel E. Denny <[email protected]>
Update for recent .gitignore fix in Gnulib.
* bootstrap: Back out 2008-07-18 hack now that gnulib-tool creates
anchored .gitignore entries.
2008-08-02 Joel E. Denny <[email protected]>
Set gnu or gnits strictness.
* configure.ac (AM_INIT_AUTOMAKE): Set gnu strictness during
development and gnits strictness for releases. Based on Eric Blake's
suggestion at
<http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00019.html>.
2008-07-31 Paolo Bonzini <[email protected]>
* NEWS: Clarify documentation of %language.
2008-07-31 Paolo Bonzini <[email protected]>
Support usage of git-merge-changelog.
* .gitattributes: New.
* HACKING: Document usage of git-merge-changelog.
* bootstrap: Install git-merge-changelog entries in .git/config
if appropriate.
2008-07-27 Joel E. Denny <[email protected]>
Remove remaining dependence on CVS Id keyword.
* ChangeLog: For the sake of people still using CVS, don't use dollars
when mentioning Id.
* data/xslt/bison.xsl: Remove Id from header comments, where it was
unusual anyway.
* data/xslt/xml2dot.xsl: Likewise.
* data/xslt/xml2text.xsl: Likewise.
* data/xslt/xml2xhtml.xsl: Likewise.
* doc/Doxyfile.in (PROJECT_NUMBER): Don't use ID.
* doc/Makefile.am (neutralize): Remove, no longer needed.
(.x.1): Don't use neutralize.
(edit): Don't substitute for ID.
(Doxyfile): Don't define Id, and thus don't depend on ChangeLog.
2008-07-27 Joel E. Denny <[email protected]>
Fix dependence on computed configure variables.
* doc/Makefile.am (common_dep): Depend on $(top_srcdir)/configure not
$(top_srcdir)/configure.ac so that changes to computed variables, such
as PACKAGE_VERSION, are seen.
* tests/Makefile.am ($(srcdir)/package.m4): Likewise.
2008-07-20 Joel E. Denny <[email protected]>
Update copyright dates for recent changes.
* Makefile.am: Here.
* src/Makefile.am: Here.
* src/reduce.c: Here.
* tests/reduce.at: Here.
2008-07-18 Joel E. Denny <[email protected]>
Use git-version-gen for version names between releases.
* .cvsignore (.tarball-version, GNUmakefile, *~): Add.
* .gitignore (/.tarball-version, /GNUmakefile, /*~): Add.
* .prev-version: New.
* .version.in: Remove.
* ChangeLog: Remove the Id previously used for capturing the CVS
revision.
* GNUmakefile: Remove, now copied from Gnulib.
* Makefile.am: Add code suggested by comments in
build-aux/git-version-gen.
(EXTRA_DIST): Remove GNUmakefile, handled by Gnulib. Add maint.mk,
.prev-version, and .version.
* NEWS (2.3b+): Rename to...
(?.?): ... this because we're dropping the "+" version naming scheme,
but, in general, we still can't be sure of our next release name.
* bootstrap: Add a quick hack to remove from .gitignore the
GNUmakefile entry that gnulib adds. We already have a /GNUmakefile
entry. This should really be fixed in gnulib instead.
* bootstrap.conf (gnulib_modules): Add gnumakefile.
* configure.ac (AC_INIT): Set version name by invoking
build-aux/git-version-gen.
(AC_CONFIG_FILES): Remove .version, now generated by
build-aux/git-version-gen.
* maint.mk: New, copied from coreutils.
* doc/.cvsignore (bison.1): Add.
* doc/.gitignore (/bison.1): Add.
* doc/bison.1: Remove, generated.
* src/.cvsignore (revision.c): Remove.
* src/.gitignore (/revision.c): Remove.
* src/Makefile.am (bison_SOURCES): Remove revision.c and revision.h.
(BUILT_SOURCES): Remove revision.c.
(revision.c): Remove.
* src/getargs.c (version): Don't print revision after the VERSION.
* src/revision.h: Remove.
2008-07-16 Joel E. Denny <[email protected]>
Fix untranslatable composition of sentences. Reported by Goran
Uddeborg at
<http://lists.gnu.org/archive/html/bug-bison/2008-06/msg00000.html>.
* THANKS (Goran Uddeborg): Add.
* src/reduce.c (reduce_print): Report the number of nonterminals and
rules useless in the grammar in separate sentences.
* tests/reduce.at (Useless Rules): Update output.
(Reduced Automaton): Likewise.
(Underivable Rules): Likewise.
(Empty Language): Likewise.
2008-07-15 Joel E. Denny <[email protected]>
Fix some .gitignore and .cvsignore problems.
* bootstrap (insert_sorted_if_absent): Replace all uses with...
(insert_vc_ignore): ... this new function, which prepends `/' to all
.gitignore entries before passing them to insert_sorted_if_absent.
* bootstrap.conf (vc_ignore): Set to '.cvsignore .gitignore' so that
.cvsignore files are maintained even though Bison developers run
bootstrap while using Git.
* .cvsignore (*.patch *.log log patches applied): Remove, apparently
unneeded by Bison.
(gnulib): Add.
* .gitignore (/*.patch *.log log patches applied): Remove, broken and
unneeded. Reported by Eric Blake.
* lib/.gitignore (/*~): Add.
* po/.cvsignore, runtime-po/.cvsignore: Sync with .gitignore.
* examples/calc++/.gitignore (/calc++.exe): Add. Reported by Eric
Blake.
* src/.gitignore (/bison.exe): Add. Reported by Eric Blake.
2008-07-15 Joel E. Denny <[email protected]>
Improve forward-compatibility with GNU M4. Reported by Eric Blake at
<http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>.
* bootstrap.conf (gnulib_modules): Add unsetenv.
* lib/.gitignore, lib/.cvsignore (/unsetenv.c): Add.
* m4/.gitignore, m4/.cvsignore (/environ.m4): Add.
(/setenv.m4): Add.
* src/output.c (output_skeleton): For the m4 invocation, pass -dV as
the first argument because it may become position-dependent, and unset
POSIXLY_CORRECT so Bison's skeletons have access to GNU M4 extensions.
Add comments explaining these issues in more detail.
2008-07-14 Joel E. Denny <[email protected]>
Add .gitignore everywhere based on .cvsignore.
* .gitignore: New.
* build-aux/.gitignore: New.
* data/.gitignore: New.
* doc/.gitignore: New.
* etc/.gitignore: New.
* examples/.gitignore: New.
* examples/calc++/.gitignore: New.
* lib/.gitignore: New.
* m4/.gitignore: New.
* po/.gitignore: New.
* runtime-po/.gitignore: New.
* src/.gitignore: New.
* tests/.gitignore: New.
2008-05-27 Joel E. Denny <[email protected]>
* NEWS (2.3b+): New section, empty for now.
* configure.ac (AC_INIT): 2.3b -> 2.3b+.
2008-05-27 Joel E. Denny <[email protected]>
* NEWS (2.3b): Update release date since there has been a delay in
getting the announcements and tarballs out.
2008-05-23 Joel E. Denny <[email protected]>
* NEWS: Version 2.3b.
* configure.ac (AC_INIT): Likewise.
(PACKAGE_COPYRIGHT_YEAR): Update to 2008.
2008-05-23 Joel E. Denny <[email protected]>
* HACKING: Don't say don't mention HACKING in the ChangeLog. We've
been doing it for years.
(Test suite): Mention maintainer-push-check and maintainer-xml-check.
(Release Procedure): Add FIXME about make alpha being unmaintained.
2008-05-13 Joel E. Denny <[email protected]>
* data/yacc.c: Reformat m4 a little for readability.
@@ -21107,9 +20508,11 @@
-----
Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996,
1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice and this
notice are preserved.
$Id$
+71
View File
@@ -0,0 +1,71 @@
# Having a separate GNUmakefile lets me `include' the dynamically
# generated rules created via Makefile.maint as well as Makefile.maint itself.
# This makefile is used only if you run GNU Make.
# It is necessary if you want to build targets usually of interest
# only to the maintainer.
# Copyright (C) 2001, 2003, 2006-2007, 2008 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Systems where /bin/sh is not the default shell need this. The $(shell)
# command below won't work with e.g. stock DOS/Windows shells.
ifeq ($(wildcard /bin/s[h]),/bin/sh)
SHELL = /bin/sh
else
# will be used only with the next shell-test line, then overwritten
# by a configured-in value
SHELL = sh
endif
have-Makefile := $(shell test -f Makefile && echo yes)
# If the user runs GNU make but has not yet run ./configure,
# give them a diagnostic.
ifeq ($(have-Makefile),yes)
# Make tar archive easier to reproduce.
export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
include Makefile
# Ensure that $(VERSION) is up to date for dist-related targets, but not
# for others: rerunning autoconf and recompiling everything isn't cheap.
ifeq (0,$(MAKELEVEL))
_is-dist-target = $(filter dist% alpha beta major,$(MAKECMDGOALS))
ifneq (,$(_is-dist-target))
_curr-ver := $(shell build-aux/git-version-gen .version)
ifneq ($(_curr-ver),$(VERSION))
$(info INFO: rerunning autoconf for new version string: $(_curr-ver))
dummy := $(shell rm -rf autom4te.cache; $(AUTOCONF))
endif
endif
endif
include $(srcdir)/Makefile.cfg
include $(srcdir)/Makefile.maint
else
all:
@echo There seems to be no Makefile in this directory. 1>&2
@echo "You must run ./configure before running \`make'." 1>&2
@exit 1
endif
# Tell version 3.79 and up of GNU make to not build goals in this
# directory in parallel. This is necessary in case someone tries to
# build multiple targets on one command line.
.NOTPARALLEL:
+9 -86
View File
@@ -1,7 +1,8 @@
-*- outline -*-
This file attempts to describe the rules to use when hacking Bison.
Don't put this file into the distribution.
Don't put this file into the distribution. Don't mention it in the
ChangeLog.
Everything related to the development of Bison is on Savannah:
@@ -25,15 +26,6 @@ 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,
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
@@ -65,22 +57,11 @@ release:
- runs the parsers under Valgrind.
- runs the test suite with G++ as C compiler...
- run `make maintainer-push-check', which runs `make maintainer-check'
while activating the push implementation and its pull interface wrappers
in many test cases that were originally written to exercise only the
pull implementation. This makes certain the push implementation can
perform every task the pull implementation can.
- run `make maintainer-xml-check', which runs `make maintainer-check'
while checking Bison's XML automaton report for every working grammar
passed to Bison in the test suite. The check just diffs the output of
Bison's included XSLT style sheets with the output of --report=all and
--graph.
- Change tests/atlocal/CFLAGS to add your preferred options. For
instance, `-traditional' to check that the parsers are K&R. Note
that it does not make sense for glr.c, which should be ANSI,
but currently is actually GNU C, nor for lalr1.cc.
but currently is actually GNU C, nor for lalr1.cc, which anyway is
not exercised yet in the test suite.
* Release Procedure
@@ -97,39 +78,15 @@ This covers PO files too. Sometimes a PO file contains problems that
causes it to be rejected by recent Gettext releases; please report
these to the Translation Project.
** Update README
Make sure the information in this file is current. Most notably, make sure it
recommends a version of GNU M4 that is compatible with the latest Bison
sources.
** Update NEWS
The version number, *and* the date of the release (including for
betas).
** Update ChangeLog
Should have an entry similar to `Version 1.49b.'.
** Update configure.ac
Be sure PACKAGE_COPYRIGHT_YEAR is up-to-date.
** Tag the release
Before Bison will build with the right version number, you must tag the release
in git. Do this after all other changes. The command is similar to:
git tag -a v2.3b
The log message can be simply:
Bison 2.3b
** Push
Once `make distcheck' passes, push your changes and the tag.
`git push' without arguments will not push the tag.
Check all this in once `make distcheck' passes.
** make alpha
FIXME: `make alpha' is not maintained and is broken. These
instructions need to be replaced or removed.
Running `make alpha' is absolutely perfect for beta releases: it makes
the tarballs, the xdeltas, and prepares (in /tmp/) a proto
announcement. It is so neat, that that's what I use anyway for
@@ -141,39 +98,13 @@ If it fails, you're on your own...
It requires GNU Make.
** Upload
The generic GNU upload procedure is at:
Put the tarballs/xdeltas where they should be. Or put it somewhere,
and send the URL to [email protected].
http://www.gnu.org/prep/maintain/maintain.html#Automated-FTP-Uploads
After following the instructions there to register your information so you're
permitted to upload, here's a brief reminder of how to roll the tarballs and
upload them:
*** make distcheck
*** gpg -b bison-2.3b.tar.gz
*** In a file named `bison-2.3b.tar.gz.directive', type:
version: 1.1
directory: bison
filename: bison-2.3b.tar.gz
*** gpg --clearsign bison-2.3b.tar.gz.directive
*** ftp ftp-upload.gnu.org # Log in as anonymous.
*** cd /incoming/alpha # cd /incoming/ftp for full release.
*** put bison-2.3b.tar.gz # This can take a while.
*** put bison-2.3b.tar.gz.sig
*** put bison-2.3b.tar.gz.directive.asc
*** Repeat all these steps for bison-2.3b.tar.bz2.
** Bump the version number
In configure.ac. Run `make', check this in.
** Announce
To generate a template announcement file:
make RELEASE_TYPE=alpha gpg_key_ID=F125BDF3 announcement
where alpha can be replaced by beta or major and F125BDF3 should be replaced
with your key ID. For an example of how to fill out the template, search the
mailing list archives for the most recent release announcement.
Complete/fix the announcement file, and send it at least to
[email protected] (if a real release, or a ``serious beta''),
[email protected], [email protected], [email protected],
@@ -184,14 +115,6 @@ email to [email protected]. Do not make any Cc as the moderator will
throw away anything cross-posted or Cc'ed. It really needs to be a
separate message.
** Bump the version number
In configure.ac. Run `make'. So that developers don't accidentally add new
items to the old NEWS entry, create a new empty NEWS entry something like:
Changes in version ?.? (????-??-??):
Push these changes.
-----
+2 -17
View File
@@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-
## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
## Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
@@ -23,7 +23,7 @@ SUBDIRS = build-aux po runtime-po lib data src doc examples tests etc
aclocaldir = @aclocaldir@
aclocal_DATA = m4/bison-i18n.m4
EXTRA_DIST = .prev-version .version cfg.mk maint.mk \
EXTRA_DIST = GNUmakefile Makefile.cfg Makefile.maint \
OChangeLog PACKAGING \
djgpp/Makefile.maint djgpp/README.in djgpp/config.bat \
djgpp/config.sed djgpp/config.site djgpp/config_h.sed \
@@ -42,18 +42,3 @@ maintainer-push-check:
.PHONY: maintainer-xml-check
maintainer-xml-check:
cd tests && $(MAKE) $(AM_MAKEFLAGS) $@
# See comments in build-aux/git-version-gen. However, we make .version depend
# on configure so that .version and VERSION/PACKAGE_VERSION stay in sync in the
# working copy (for example, when you run autoreconf && make). Allowing these
# to fall out of sync appears to have little potential to improve Bison build
# efficiency (even if we were to replace VERSION/PACKAGE_VERSION with .version
# everywhere possible). On the other hand, it could be harmful. For example,
# a developer might naively reference .version in a test case while the bison
# executable still compiles with VERSION, and so the test case might fail or
# pass incorrectly.
BUILT_SOURCES = $(top_srcdir)/.version
$(top_srcdir)/.version: configure
echo $(VERSION) > $@-t && mv $@-t $@
dist-hook:
echo $(VERSION) > $(distdir)/.tarball-version
+5 -12
View File
@@ -1,26 +1,19 @@
# Customize maint.mk -*- makefile -*-
# Copyright (C) 2008 Free Software Foundation, Inc.
# Customize Makefile.maint. -*- makefile -*-
# Copyright (C) 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# It's useful to run maintainer-*check* targets during development, but we
# don't want to wait on a recompile because of an update to $(VERSION). Thus,
# override the _is-dist-target from GNUmakefile so that maintainer-*check*
# targets are filtered out.
_is-dist-target = $(filter-out %clean maintainer-check% maintainer-%-check, \
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
# Use alpha.gnu.org for alpha and beta releases.
# Use ftp.gnu.org for major releases.
gnu_ftp_host-alpha = alpha.gnu.org
@@ -39,4 +32,4 @@ local-checks-to-skip = changelog-check
# The local directory containing the checked-out copy of gnulib used in
# this release. Used solely to get a date for the "announcement" target.
gnulib_dir = $(srcdir)/../../gnulib
gnulib_dir = /gnulib
+637
View File
@@ -0,0 +1,637 @@
# -*-Makefile-*-
# This Makefile fragment is shared between the coreutils,
# CPPI, Bison, and Autoconf.
## Copyright (C) 2001-2006 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This is reported not to work with make-3.79.1
# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
ME := Makefile.maint
# Do not save the original name or timestamp in the .tar.gz file.
# Use --rsyncable if available.
gzip_rsyncable = \
(gzip --help|grep rsyncable) >/dev/null 2>&1 && echo --rsyncable
GZIP_ENV = "--no-name --best `$(gzip_rsyncable)`"
CVS = cvs
# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
CVS_LIST = sh -c ' \
if test -x $(srcdir)/build-aux/cvsu; then \
$(srcdir)/build-aux/cvsu --find --types=AFGM $$*; \
else \
awk -F/ '\''{ \
if (!$$1 && $$3 !~ /^-/) { \
f=FILENAME; \
sub(/CVS\/Entries/, "", f); \
print f $$2; \
}}'\'' \
$$(find $${*-*} -name Entries -print) /dev/null; \
fi \
' dummy
CVS_LIST_EXCEPT = \
$(CVS_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi
ifeq ($(origin prev_version_file), undefined)
prev_version_file = .prev-version
endif
PREV_VERSION := $(shell cat $(prev_version_file))
VERSION_REGEXP = $(subst .,\.,$(VERSION))
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
tag-this-version = $(subst .,_,$(VERSION))
this-cvs-tag = $(tag-package)-$(tag-this-version)
my_distdir = $(PACKAGE)-$(VERSION)
# Old releases are stored here.
# Used for diffs and xdeltas.
release_archive_dir ?= ../release
# Prevent programs like 'sort' from considering distinct strings to be equal.
# Doing it here saves us from having to set LC_ALL elsewhere in this file.
export LC_ALL = C
## --------------- ##
## Sanity checks. ##
## --------------- ##
# FIXME: add a check to prohibit definition in src/*.c of symbols defined
# in system.h. E.g. today I removed from tail.c a useless definition of
# ENOSYS. It was useless because system.h ensures it's defined.
# Checks that don't require cvs.
# Run `changelog-check' last, as previous test may reveal problems requiring
# new ChangeLog entries.
local-checks-available = \
po-check copyright-check writable-files m4-check author_mark_check \
changelog-check strftime-check $(syntax-check-rules) \
makefile_path_separator_check \
makefile-check
.PHONY: $(local-checks-available)
local-check = $(filter-out $(local-checks-to-skip), $(local-checks-available))
.PHONY: $(syntax-check-rules)
syntax-check-rules = \
sc_cast_of_argument_to_free \
sc_cast_of_x_alloc_return_value \
sc_cast_of_alloca_return_value \
sc_changelog \
sc_dd_max_sym_length \
sc_error_exit_success \
sc_file_system \
sc_no_if_have_config_h \
sc_obsolete_symbols \
sc_prohibit_atoi_atof \
sc_prohibit_jm_in_m4 \
sc_prohibit_assert_without_use \
sc_require_config_h \
sc_root_tests \
sc_space_tab \
sc_sun_os_names \
sc_system_h_headers \
sc_tight_scope \
sc_trailing_blank \
sc_two_space_separator_in_usage \
sc_unmarked_diagnostics \
sc_useless_cpp_parens
syntax-check: $(syntax-check-rules)
# @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \
# $$(find -type f -name '*.[chly]') && \
# { echo '$(ME): found conditional include' 1>&2; \
# exit 1; } || :
# grep -nE '^# *include <(string|stdlib)\.h>' \
# $(srcdir)/{lib,src}/*.[chy] && \
# { echo '$(ME): FIXME' 1>&2; \
# exit 1; } || :
# FIXME: don't allow `#include .strings\.h' anywhere
sc_cast_of_argument_to_free:
@grep -nE '\<free \(\(' $(srcdir)/{lib,src}/*.[chly] && \
{ echo '$(ME): don'\''t cast free argument' 1>&2; \
exit 1; } || :
sc_cast_of_x_alloc_return_value:
@grep -nE --exclude=$(srcdir)/lib/regex.c \
'\*\) *x(m|c|re)alloc\>' \
$(srcdir)/{lib,src}/*.[chy] && \
{ echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \
exit 1; } || :
sc_cast_of_alloca_return_value:
@grep -nE '\*\) *alloca\>' \
$(srcdir)/src/*.[chy] && \
{ echo '$(ME): don'\''t cast alloca return value' 1>&2; \
exit 1; } || :
sc_space_tab:
@grep -n '[ ] ' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
1>&2; exit 1; } || :
# Don't use the old ato* functions in `real' code.
# They provide no error checking mechanism.
# Instead, use strto* functions.
sc_prohibit_atoi_atof:
@grep -nE '\<ato([filq]|ll)\>' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): do not use ato''f, ato''i, ato''l, ato''ll, or ato''q' \
1>&2; exit 1; } || :
# Using EXIT_SUCCESS as the first argument to error is misleading,
# since when that parameter is 0, error does not exit. Use `0' instead.
sc_error_exit_success:
@grep -nF 'error (EXIT_SUCCESS,' \
$$(find -type f -name '*.[chly]') && \
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \
exit 1; } || :
sc_file_system:
@grep -ni 'file''system' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found use of "file''system";' \
'rewrite to use "file system"' 1>&2; \
exit 1; } || :
sc_no_if_have_config_h:
@grep -n '^# *if HAVE_CONFIG_H' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found use of #if HAVE_CONFIG_H; use #ifdef' \
1>&2; exit 1; } || :
# Nearly all .c files must include <config.h>.
sc_require_config_h:
@grep -L '^# *include <config\.h>' \
$$($(CVS_LIST_EXCEPT) | grep '\.c$$') \
| grep . && \
{ echo '$(ME): the above files do not include <config.h>' \
1>&2; exit 1; } || :
# Prohibit the inclusion of assert.h without an actual use of assert.
sc_prohibit_assert_without_use:
@files=$$(grep -l '# *include <assert\.h>' \
$$($(CVS_LIST_EXCEPT) | grep '\.c$$')) && \
grep -L '\<assert (' $$files \
| grep . && \
{ echo "$(ME): the above files include <assert.h> but don't use it" \
1>&2; exit 1; } || :
sc_obsolete_symbols:
@grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
$$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
1>&2; exit 1; } || :
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
# Each nonempty line must start with a year number, or a TAB.
sc_changelog:
@grep -n '^[^12 ]' $$(find . -maxdepth 2 -name ChangeLog) && \
{ echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
exit 1; } || :
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
# with the strings from the two affected variables.
dd_c = $(srcdir)/src/dd.c
sc_dd_max_sym_length:
ifneq ($(wildcard $(dd_c)),)
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
|sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
| wc --max-line-length); \
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|tr -d '"' | wc --max-line-length); \
if test "$$len" = "$$max"; then :; else \
echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
exit 1; \
fi
endif
# Many m4 macros names once began with `jm_'.
# On 2004-04-13, they were all changed to start with gl_ instead.
# Make sure that none are inadvertently reintroduced.
sc_prohibit_jm_in_m4:
@grep -nE 'jm_[A-Z]' \
$$($(CVS_LIST) $(srcdir)/m4 |grep '\.m4$$') && \
{ echo '$(ME): do not use jm_ in m4 macro names' \
1>&2; exit 1; } || :
sc_root_tests:
@t1=sc-root.expected; t2=sc-root.actual; \
grep -nl '^PRIV_CHECK_ARG=require-root' \
$$($(CVS_LIST) tests) |sed s,tests,., |sort > $$t1; \
sed -n 's, cd \([^ ]*\) .*MAKE..check TESTS=\(.*\),./\1/\2,p' \
$(srcdir)/tests/Makefile.am |sort > $$t2; \
diff -u $$t1 $$t2 || diff=1; \
rm -f $$t1 $$t2; \
test "$$diff" \
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
exit 1; } || :
# Create a list of regular expressions matching the names
# of files included from system.h. Exclude a couple.
.re-list:
@sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
| grep -Ev 'sys/(param|file)\.h' \
| sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
> $@-t
@mv $@-t $@
# Files in src/ should not include directly any of
# the headers already included via system.h.
sc_system_h_headers: .re-list
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
grep -nE -f .re-list \
$$($(CVS_LIST) src | \
grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
&& { echo '$(ME): the above are already included via system.h'\
1>&2; exit 1; } || :; \
fi
sc_sun_os_names:
@grep -nEi \
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
$$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
exit 1; } || :
sc_tight_scope:
$(MAKE) -C src $@
sc_trailing_blank:
@grep -n '[ ]$$' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found trailing blank(s)' \
1>&2; exit 1; } || :
sc_two_space_separator_in_usage:
@grep -n '^ *--[a-z][0-9A-Za-z-]* [^ ].*\\$$' \
$$($(CVS_LIST_EXCEPT)) && \
{ echo "$(ME): help2man requires at least two spaces between"; \
echo "$(ME): an option and its description"; \
1>&2; exit 1; } || :
# Look for diagnostics that aren't marked for translation.
# This won't find any for which error's format string is on a separate line.
sc_unmarked_diagnostics:
@grep -nE \
'\<error \([^"]*"[^"]*[a-z]{3}' $$($(CVS_LIST_EXCEPT)) \
| grep -v '_''(' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
exit 1; } || :
# Avoid useless parentheses like those in this example:
# #if defined (SYMBOL) || defined (SYM2)
sc_useless_cpp_parens:
@grep -n '^# *if .*defined *(' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found useless parentheses in cpp directive' \
1>&2; exit 1; } || :
# Ensure that date's --help output stays in sync with the info
# documentation for GNU strftime. The only exception is %N,
# which date accepts but GNU strftime does not.
extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
strftime-check:
if test -f $(srcdir)/src/date.c; then \
grep '^ %. ' $(srcdir)/src/date.c | sort \
| $(extract_char) > $@-src; \
{ echo N; \
info libc date calendar format | grep '^ `%.'\' \
| $(extract_char); } | sort > $@-info; \
diff -u $@-src $@-info || exit 1; \
rm -f $@-src $@-info; \
fi
# Ensure that we use only the standard $(VAR) notation,
# not @...@ in Makefile.am, now that we can rely on automake
# to emit a definition for each substituted variable.
makefile-check:
grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \
&& { echo 'Makefile.maint: use $$(...), not @...@' 1>&2; exit 1; } || :
news-date-check: NEWS
today=`date +%Y-%m-%d`; \
if head NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
>/dev/null; then \
:; \
else \
echo "version or today's date is not in NEWS" 1>&2; \
exit 1; \
fi
changelog-check:
if head ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \
>/dev/null; then \
:; \
else \
echo "$(VERSION) not in ChangeLog" 1>&2; \
exit 1; \
fi
m4-check:
@grep -n 'AC_DEFUN([^[]' m4/*.m4 \
&& { echo 'Makefile.maint: quote the first arg to AC_DEFUN' 1>&2; \
exit 1; } || :
# Verify that all source files using _() are listed in po/POTFILES.in.
# FIXME: don't hard-code file names below; use a more general mechanism.
po-check:
if test -f po/POTFILES.in; then \
grep -E -v '^(#|$$)' po/POTFILES.in \
| grep -v '^src/false\.c$$' | sort > $@-1; \
files=; \
for file in $$($(CVS_LIST_EXCEPT)) lib/*.[ch]; do \
case $$file in \
djgpp/* | man/*) continue;; \
esac; \
case $$file in \
*.[ch]) \
base=`expr " $$file" : ' \(.*\)\..'`; \
{ test -f $$base.l || test -f $$base.y; } && continue;; \
esac; \
files="$$files $$file"; \
done; \
grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort -u > $@-2; \
diff -u $@-1 $@-2 || exit 1; \
rm -f $@-1 $@-2; \
fi
# In a definition of #define AUTHORS "... and ..." where the RHS contains
# the English word `and', the string must be marked with `N_ (...)' so that
# gettext recognizes it as a string requiring translation.
author_mark_check:
@grep -n '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \
{ echo 'Makefile.maint: enclose the above strings in N_ (...)' 1>&2; \
exit 1; } || :
# Sometimes it is useful to change the PATH environment variable
# in Makefiles. When doing so, it's better not to use the Unix-centric
# path separator of `:', but rather the automake-provided `@PATH_SEPARATOR@'.
# It'd be better to use `find -print0 ...|xargs -0 ...', but less portable,
# and there probably aren't many projects with so many Makefile.am files
# that we'd have to worry about limits on command line length.
msg = 'Makefile.maint: Do not use `:'\'' above; use @PATH_SEPARATOR@ instead'
makefile_path_separator_check:
@grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \
&& { echo $(msg) 1>&2; exit 1; } || :
# Check that `make alpha' will not fail at the end of the process.
writable-files:
if test -d $(release_archive_dir); then :; else \
mkdir $(release_archive_dir); \
fi
for file in $(distdir).tar.gz $(xd-delta) \
$(release_archive_dir)/$(distdir).tar.gz \
$(release_archive_dir)/$(xd-delta); do \
test -e $$file || continue; \
test -w $$file \
|| { echo ERROR: $$file is not writable; fail=1; }; \
done; \
test "$$fail" && exit 1 || :
v_etc_file = lib/version-etc.c
# Make sure that the copyright date in $(v_etc_file) is up to date.
copyright-check:
@if test -f $(v_etc_file); then \
grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
>/dev/null \
|| { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
exit 1; }; \
fi
# Sanity checks with the CVS repository.
cvs-tag-check:
echo $(this-cvs-tag); \
if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
exit 1; \
else :; fi
cvs-diff-check:
if $(CVS) diff >cvs-diffs; then \
rm cvs-diffs; \
else \
echo "Some files are locally modified:" 1>&2; \
cat cvs-diffs; \
exit 1; \
fi
cvs-check: cvs-diff-check cvs-tag-check
maintainer-distcheck: changelog-check
$(MAKE) distcheck
$(MAKE) my-distcheck
# Tag before making distribution. Also, don't make a distribution if
# checks fail. Also, make sure the NEWS file is up-to-date.
# FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
cvs-dist: $(local-check) cvs-check maintainer-distcheck
$(CVS) update po
$(CVS) tag -c $(this-cvs-tag)
$(MAKE) dist
# Use this to make sure we don't run these programs when building
# from a virgin tgz file, below.
null_AM_MAKEFLAGS = \
ACLOCAL=false \
AUTOCONF=false \
AUTOMAKE=false \
AUTOHEADER=false \
MAKEINFO=false
# Detect format-string/arg-list mismatches that would normally be obscured
# by the use of _(). The --disable-nls effectively defines away that macro,
# and building with CFLAGS='-Wformat -Werror' causes any format warning to be
# treated as a failure. Also, check for shadowing problems with -Wshadow.
# These CFLAGS are pretty strict. If you build this target, you probably
# have to have a recent version of gcc and glibc headers.
TMPDIR ?= /tmp
t=$(TMPDIR)/$(PACKAGE)/test
my-distcheck: $(local-check) $(release_archive_dir)/$(prev-tgz)
-rm -rf $(t)
mkdir -p $(t)
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
cd $(t)/$(distdir) \
&& ./configure --disable-nls \
&& $(MAKE) CFLAGS='-Werror -Wall -Wformat -Wshadow' \
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
&& $(MAKE) dvi \
&& $(MAKE) check \
&& $(MAKE) distclean
(cd $(t) && mv $(distdir) $(distdir).old \
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
-rm -rf $(t)
@echo "========================"; \
echo "$(distdir).tar.gz is ready for distribution"; \
echo "========================"
WGET = wget
WGETFLAGS = -C off
rel-check:
tarz=/tmp/rel-check-tarz-$$$$; \
md5_tmp=/tmp/rel-check-md5-$$$$; \
set -e; \
trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
$(WGET) $(WGETFLAGS) -q --output-document=$$tarz $(url); \
echo "$(md5) -" > $$md5_tmp; \
md5sum -c $$md5_tmp < $$tarz
prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
rel-files = $(xd-delta) $(DIST_ARCHIVES)
announcement: NEWS ChangeLog $(rel-files)
@./announce-gen \
--release-type=$(RELEASE_TYPE) \
--package=$(PACKAGE) \
--prev=$(PREV_VERSION) \
--curr=$(VERSION) \
--release-archive-directory=$(release_archive_dir) \
--gpg-key-id=$(gpg_key_ID) \
--news=NEWS \
$(addprefix --url-dir=, $(url_dir_list)) \
## ---------------- ##
## Updating files. ##
## ---------------- ##
ftp-gnu = ftp://ftp.gnu.org/gnu
www-gnu = http://www.gnu.org
# Use mv, if you don't have/want move-if-change.
move_if_change ?= move-if-change
# --------------------- #
# Updating everything. #
# --------------------- #
.PHONY: update
local_updates ?= wget-update cvs-update po-update
update: $(local_updates)
# ------------------- #
# Updating PO files. #
# ------------------- #
po_repo = http://www.iro.umontreal.ca/contrib/po/maint/$(PACKAGE)
.PHONY: do-po-update po-update
do-po-update:
tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
rm -rf $$tmppo && \
mkdir $$tmppo && \
(cd $$tmppo && \
$(WGET) $(WGETFLAGS) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
cp $$tmppo/*.po po
cd po && $(MAKE) update-po
$(MAKE) po-check
po-update:
if test -d "po"; then \
$(MAKE) do-po-update; \
fi
# -------------------------- #
# Updating GNU build tools. #
# -------------------------- #
# The following pseudo table associates a local directory and a URL
# with each of the files that belongs to some other package and is
# regularly updated from the specified URL.
wget_files ?= \
$(srcdir)/build-aux/config.guess \
$(srcdir)/build-aux/config.sub \
$(srcdir)/build-aux/texinfo.tex \
$(srcdir)/src/ansi2knr.c
get-targets = $(patsubst %, get-%, $(wget_files))
config.guess-url_prefix = $(ftp-gnu)/build-aux/
config.sub-url_prefix = $(ftp-gnu)/build-aux/
ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
standards.texi-url_prefix = $(www-gnu)/prep/
make-stds.texi-url_prefix = $(standards.texi-url_prefix)
target = $(patsubst get-%, %, $@)
url = $($(notdir $(target))-url_prefix)$(notdir $(target))
.PHONY: $(get-targets)
$(get-targets):
$(WGET) $(WGETFLAGS) $(url) -O $(target).t \
&& $(move_if_change) $(target).t $(target)
cvs_files ?= \
$(srcdir)/build-aux/depcomp \
$(srcdir)/build-aux/install-sh \
$(srcdir)/build-aux/missing \
$(srcdir)/build-aux/mkinstalldirs \
$(srcdir)/src/ansi2knr.c
automake_repo=:pserver:anoncvs:[email protected]:/cvs/automake
.PHONY: wget-update
wget-update: $(get-targets)
.PHONY: cvs-update
cvs-update:
fail=; \
for f in $(cvs_files); do \
test -f $$f || { echo "*** skipping $$f" 1>&2; continue; }; \
cvs diff $$f > /dev/null \
|| { echo "*** $$f is locally modified; skipping it" 1>&2; \
fail=yes; continue; }; \
file=$$(basename $$f); \
echo checking out $$file...; \
$(CVS) -d $(automake_repo) co -p automake/lib/$$file> $$f.t \
&& $(move_if_change) $$f.t $$f; \
done; \
test "$$fail" && exit 1
emit_upload_commands:
@echo =====================================
@echo =====================================
@echo "$(srcdir)/gnupload $(GNUPLOADFLAGS) \\"
@echo " --to $(gnu_rel_host):coreutils \\"
@echo " $(rel-files)"
@echo '# send the /tmp/announcement e-mail'
@echo =====================================
@echo =====================================
$(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
xdelta delta -9 $^ $@ || :
.PHONY: alpha beta major
alpha beta major: news-date-check $(local-check)
$(MAKE) cvs-dist
$(MAKE) $(xd-delta)
$(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir)
ln $(rel-files) $(release_archive_dir)
chmod a-w $(rel-files)
$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
echo $(VERSION) > $(prev_version_file)
$(CVS) ci -m. $(prev_version_file)
+183 -223
View File
@@ -1,61 +1,21 @@
Bison News
----------
* Changes in version 2.4.1 (2008-12-11):
Changes in version 2.3a+ (????-??-??):
** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
declarations have been fixed.
** Temporary hack for adding a semicolon to the user action.
Bison used to prepend a trailing semicolon at the end of the user
action for reductions. This allowed actions such as
exp: exp "+" exp { $$ = $1 + $3 };
instead of
exp: exp "+" exp { $$ = $1 + $3; };
Some grammars still depend on this `feature'. Bison 2.4.1 restores
the previous behavior in the case of C output (specifically, when
neither %language or %skeleton or equivalent command-line options
are used) to leave more time for grammars depending on the old
behavior to be adjusted. Future releases of Bison will disable this
feature.
** A few minor improvements to the Bison manual.
* Changes in version 2.4 (2008-11-02):
** %language is an experimental feature.
We first introduced this feature in test release 2.3b as a cleaner
alternative to %skeleton. Since then, we have discussed the possibility of
modifying its effect on Bison's output file names. Thus, in this release,
we consider %language to be an experimental feature that will likely evolve
in future releases.
** Forward compatibility with GNU M4 has been improved.
** Several bugs in the C++ skeleton and the experimental Java skeleton have been
fixed.
* Changes in version 2.3b (2008-05-27):
** The quotes around NAME that used to be required in the following directive
* The quotes around NAME that used to be required in the following directive
are now deprecated:
%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
which has the same effect except that Bison is more careful to warn about
unreasonable usage in the latter case.
** Push Parsing
* Push Parsing
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
@@ -71,11 +31,11 @@ Bison News
The current push parsing interface is experimental and may evolve. More user
feedback will help to stabilize it.
** The -g and --graph options now output graphs in Graphviz DOT format,
* The -g and --graph options now output graphs in Graphviz DOT format,
not VCG format. Like --graph, -g now also takes an optional FILE argument
and thus cannot be bundled with other short options.
** Java
* Java
Bison can now generate an LALR(1) parser in Java. The skeleton is
`data/lalr1.java'. Consider using the new %language directive instead of
@@ -86,30 +46,30 @@ Bison News
The current Java interface is experimental and may evolve. More user
feedback will help to stabilize it.
** %language
* %language
This new directive specifies the programming language of the generated
parser, which can be C (the default), C++, or Java. Besides the skeleton
that Bison uses, the directive affects the names of the generated files if
the grammar file's name ends in ".y".
parser, which can be C (the default), C++, or Java. This directive affects
the skeleton used and the names of the generated files if the grammar file's
name ends in ".y".
** XML Automaton Report
* XML Automaton Report
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
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
%defines. For example:
%defines "parser.h"
** When reporting useless rules, useless nonterminals, and unused terminals,
* When reporting useless rules, useless nonterminals, and unused terminals,
Bison now employs the terms "useless in grammar" instead of "useless",
"useless in parser" instead of "never reduced", and "unused in grammar"
instead of "unused".
** Unreachable State Removal
* Unreachable State Removal
Previously, Bison sometimes generated parser tables containing unreachable
states. A state can become unreachable during conflict resolution if Bison
@@ -131,7 +91,7 @@ Bison News
See the %define entry in the `Bison Declaration Summary' in the Bison manual
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
(using `--report=lookahead', for example), Bison now prints each reduction's
@@ -142,17 +102,17 @@ Bison News
bug affected only the `.output' file and not the generated parser source
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.
** 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:
%file-prefix "parser"
%name-prefix "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
the traditional Yacc prologue blocks. Those have now been consolidated into
@@ -173,7 +133,7 @@ Bison News
The prologue alternatives are experimental. More user feedback will help to
determine whether they should become permanent features.
** Revised warning: unset or unused mid-rule values
* Revised warning: unset or unused mid-rule values
Since Bison 2.2, Bison has warned about mid-rule values that are set but not
used within any of the actions of the parent rule. For example, Bison warns
@@ -193,7 +153,7 @@ Bison News
To enable these warnings, specify the option `--warnings=midrule-values' or
`-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
%printer's:
@@ -218,25 +178,25 @@ Bison News
See the section `Freeing Discarded Symbols' in the Bison manual for further
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
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
completely removed from Bison.
* Changes in version 2.3a, 2006-09-13:
Changes in version 2.3a, 2006-09-13:
** Instead of %union, you can define and use your own union type
* Instead of %union, you can define and use your own union type
YYSTYPE if your grammar contains at least one <type> tag.
Your YYSTYPE need not be a macro; it can be a typedef.
This change is for compatibility with other Yacc implementations,
and is required by POSIX.
** Locations columns and lines start at 1.
* Locations columns and lines start at 1.
In accordance with the GNU Coding Standards and Emacs.
** You may now declare per-type and default %destructor's and %printer's:
* You may now declare per-type and default %destructor's and %printer's:
For example:
@@ -262,13 +222,13 @@ Bison News
%destructor's and %printer's were experimental, and they were rewritten in
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
associating token numbers with token names. Removing the #define statements
helps to sanitize the global namespace during preprocessing, but POSIX Yacc
requires them. Bison still generates an enum for token names in all cases.
** Handling of traditional Yacc prologue blocks is now more consistent but
* Handling of traditional Yacc prologue blocks is now more consistent but
potentially incompatible with previous releases of Bison.
As before, you declare prologue blocks in your grammar file with the
@@ -287,7 +247,7 @@ Bison News
Now, Bison never inserts the pre-prologue into the header file. In the code
file, it always inserts it before the token definitions.
** Bison now provides a more flexible alternative to the traditional Yacc
* Bison now provides a more flexible alternative to the traditional Yacc
prologue blocks: %before-header, %start-header, %end-header, and
%after-header.
@@ -335,32 +295,32 @@ Bison News
[Although we failed to mention this here in the 2.3a release, the prologue
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
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.
** It is now documented that any definition of YYSTYPE or YYLTYPE should
* It is now documented that any definition of YYSTYPE or YYLTYPE should
be to a type name that does not contain parentheses or brackets.
* Changes in version 2.2, 2006-05-19:
Changes in version 2.2, 2006-05-19:
** The distribution terms for all Bison-generated parsers now permit
* The distribution terms for all Bison-generated parsers now permit
using the parsers in nonfree programs. Previously, this permission
was granted only for Bison-generated LALR(1) parsers in C.
** %name-prefix changes the namespace name in C++ outputs.
* %name-prefix changes the namespace name in C++ outputs.
** The C++ parsers export their token_type.
* The C++ parsers export their token_type.
** Bison now allows multiple %union declarations, and concatenates
* Bison now allows multiple %union declarations, and concatenates
their contents together.
** New warning: unused values
* New warning: unused values
Right-hand side symbols whose values are not used are reported,
if the symbols have destructors. For instance:
@@ -394,26 +354,26 @@ Bison News
The warning is intended to help catching lost values and memory leaks.
If a value is ignored, its associated memory typically is not reclaimed.
** %destructor vs. YYABORT, YYACCEPT, and YYERROR.
* %destructor vs. YYABORT, YYACCEPT, and YYERROR.
Destructors are now called when user code invokes YYABORT, YYACCEPT,
and YYERROR, for all objects on the stack, other than objects
corresponding to the right-hand side of the current rule.
** %expect, %expect-rr
* %expect, %expect-rr
Incorrect numbers of expected conflicts are now actual errors,
instead of warnings.
** GLR, YACC parsers.
* GLR, YACC parsers.
The %parse-params are available in the destructors (and the
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
in Bison version VERSION or higher.
** 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
was defined as a free form union. They are now class members:
tokens are enumerations of the `yy::parser::token' struct, and the
@@ -427,37 +387,37 @@ Bison News
If you wish to update, then make sure older version of Bison will
fail using `%require "2.2"'.
** DJGPP support added.
* DJGPP support added.
* Changes in version 2.1, 2005-09-16:
Changes in version 2.1, 2005-09-16:
** The C++ lalr1.cc skeleton supports %lex-param.
* The C++ lalr1.cc skeleton supports %lex-param.
** Bison-generated parsers now support the translation of diagnostics like
* Bison-generated parsers now support the translation of diagnostics like
"syntax error" into languages other than English. The default
language is still English. For details, please see the new
Internationalization section of the Bison manual. Software
distributors should also see the new PACKAGING file. Thanks to
Bruno Haible for this new feature.
** Wording in the Bison-generated parsers has been changed slightly to
* Wording in the Bison-generated parsers has been changed slightly to
simplify translation. In particular, the message "memory exhausted"
has replaced "parser stack overflow", as the old message was not
always accurate for modern Bison-generated parsers.
** Destructors are now called when the parser aborts, for all symbols left
* Destructors are now called when the parser aborts, for all symbols left
behind on the stack. Also, the start symbol is now destroyed after a
successful parse. In both cases, the behavior was formerly inconsistent.
** When generating verbose diagnostics, Bison-generated parsers no longer
* When generating verbose diagnostics, Bison-generated parsers no longer
quote the literal strings associated with tokens. For example, for
a syntax error associated with '%token NUM "number"' they might
print 'syntax error, unexpected number' instead of 'syntax error,
unexpected "number"'.
* Changes in version 2.0, 2004-12-25:
Changes in version 2.0, 2004-12-25:
** Possibly-incompatible changes
* Possibly-incompatible changes
- Bison-generated parsers no longer default to using the alloca function
(when available) to extend the parser stack, due to widespread
@@ -482,7 +442,7 @@ Bison News
- NUL bytes are no longer allowed in Bison string literals, unfortunately.
** New features
* New features
- GLR grammars now support locations.
@@ -504,7 +464,7 @@ Bison News
- New configure option --disable-yacc, to disable installation of the
yacc command and -ly library introduced in 1.875 for POSIX conformance.
** Bug fixes
* Bug fixes
- For now, %expect-count violations are now just warnings, not errors.
This is for compatibility with Bison 1.75 and earlier (when there are
@@ -518,12 +478,12 @@ Bison News
- Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
* Changes in version 1.875, 2003-01-01:
Changes in version 1.875, 2003-01-01:
** The documentation license has been upgraded to version 1.2
* The documentation license has been upgraded to version 1.2
of the GNU Free Documentation License.
** syntax error processing
* syntax error processing
- In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error
locations too. This fixes bugs in error-location computation.
@@ -538,7 +498,7 @@ Bison News
- #defining yyerror to steal internal variables is discouraged.
It is not guaranteed to work forever.
** POSIX conformance
* POSIX conformance
- Semicolons are once again optional at the end of grammar rules.
This reverts to the behavior of Bison 1.33 and earlier, and improves
@@ -571,7 +531,7 @@ Bison News
using typedef instead of defining it as a macro.
For consistency, YYLTYPE is also declared instead of defined.
** Other compatibility issues
* Other compatibility issues
- %union directives can now have a tag before the `{', e.g., the
directive `%union foo {...}' now generates the C code
@@ -590,7 +550,7 @@ Bison News
typedefs or tags; they are no longer documented and are planned to be
withdrawn in a future release.
** GLR parser notes
* GLR parser notes
- GLR and inline
Users of Bison have to decide how they handle the portability of the
@@ -599,32 +559,32 @@ Bison News
- `parsing stack overflow...' -> `parser stack overflow'
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
that command outputs both code and header to foo.h.
** #line in output files
* #line in output files
- --no-line works properly.
** Bison can no longer be built by a K&R C compiler; it requires C89 or
* Bison can no longer be built by a K&R C compiler; it requires C89 or
later to be built. This change originally took place a few versions
ago, but nobody noticed until we recently asked someone to try
building Bison with a K&R C compiler.
* Changes in version 1.75, 2002-10-14:
Changes in version 1.75, 2002-10-14:
** Bison should now work on 64-bit hosts.
* Bison should now work on 64-bit hosts.
** Indonesian translation thanks to Tedi Heriyanto.
* Indonesian translation thanks to Tedi Heriyanto.
** GLR parsers
* GLR parsers
Fix spurious parse errors.
** Pure parsers
* Pure parsers
Some people redefine yyerror to steal yyparse' private variables.
Reenable this trick until an official feature replaces it.
** Type Clashes
* Type Clashes
In agreement with POSIX and with other Yaccs, leaving a default
action is valid when $$ is untyped, and $1 typed:
@@ -634,7 +594,7 @@ Bison News
typed: ... untyped;
** Values of mid-rule actions
* Values of mid-rule actions
The following code:
foo: { ... } { $$ = $1; } ...
@@ -642,9 +602,9 @@ Bison News
was incorrectly rejected: $1 is defined in the second mid-rule
action, and is equal to the $$ of the first mid-rule action.
* Changes in version 1.50, 2002-10-04:
Changes in version 1.50, 2002-10-04:
** GLR parsing
* GLR parsing
The declaration
%glr-parser
causes Bison to produce a Generalized LR (GLR) parser, capable of handling
@@ -655,33 +615,33 @@ Bison News
Unfortunately Bison 1.50 does not work properly on 64-bit hosts
like the Alpha, so please stick to 32-bit hosts for now.
** Output Directory
* Output Directory
When not in Yacc compatibility mode, when the output file was not
specified, running `bison foo/bar.y' created `foo/bar.c'. It
now creates `bar.c'.
** Undefined token
* Undefined token
The undefined token was systematically mapped to 2 which prevented
the use of 2 by the user. This is no longer the case.
** Unknown token numbers
* Unknown token numbers
If yylex returned an out of range value, yyparse could die. This is
no longer the case.
** Error token
* Error token
According to POSIX, the error token must be 256.
Bison extends this requirement by making it a preference: *if* the
user specified that one of her tokens is numbered 256, then error
will be mapped onto another number.
** Verbose error messages
* Verbose error messages
They no longer report `..., expecting error or...' for states where
error recovery is possible.
** End token
* End token
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
the stack until it finds a state that allows shifting the error
token. Formerly, it popped the stack until it found a state that
@@ -691,32 +651,32 @@ Bison News
Paul Eggert, "Reductions during Bison error handling" (2002-05-20)
<http://lists.gnu.org/archive/html/bug-bison/2002-05/msg00038.html>.
** Traces
* Traces
Popped tokens and nonterminals are now reported.
** Larger grammars
* Larger grammars
Larger grammars are now supported (larger token numbers, larger grammar
size (= sum of the LHS and RHS lengths), larger LALR tables).
Formerly, many of these numbers ran afoul of 16-bit limits;
now these limits are 32 bits on most hosts.
** Explicit initial rule
* Explicit initial rule
Bison used to play hacks with the initial rule, which the user does
not write. It is now explicit, and visible in the reports and
graphs as rule 0.
** Useless rules
* Useless rules
Before, Bison reported the useless rules, but, although not used,
included them in the parsers. They are now actually removed.
** Useless rules, useless nonterminals
* Useless rules, useless nonterminals
They are now reported, as a warning, with their locations.
** Rules never reduced
* Rules never reduced
Rules that can never be reduced because of conflicts are now
reported.
** Incorrect `Token not used'
* Incorrect `Token not used'
On a grammar such as
%token useless useful
@@ -726,16 +686,16 @@ Bison News
where a token was used to set the precedence of the last rule,
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.
** Default locations
* Default locations
By an accident of design, the default computation of @$ was
performed after another default computation was performed: @$ = @1.
The latter is now removed: YYLLOC_DEFAULT is fully responsible of
the computation of @$.
** Token end-of-file
* Token end-of-file
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
error messages instead of `$end', which remains being the default.
@@ -744,22 +704,22 @@ Bison News
or
%token MYEOF 0 "end of file"
** Semantic parser
* Semantic parser
This old option, which has been broken for ages, is removed.
** New translations
* New translations
Brazilian Portuguese, thanks to Alexandre Folle de Menezes.
Croatian, thanks to Denis Lackovic.
** Incorrect token definitions
* Incorrect token definitions
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
the compiler supports ANSI C or is a C++ compiler, as enums.
This lets debuggers display names instead of integers.
** Reports
* Reports
In addition to --verbose, bison supports --report=THINGS, which
produces additional information:
- itemset
@@ -771,7 +731,7 @@ Bison News
Bison used to systematically output this information on top of
the report. Solved conflicts are now attached to their states.
** Type clashes
* Type clashes
Previous versions don't complain when there is a type clash on
the default action if the rule has a mid-rule action, such as in:
@@ -781,11 +741,11 @@ Bison News
This is fixed.
** GNU M4 is now required when using Bison.
* GNU M4 is now required when using Bison.
* Changes in version 1.35, 2002-03-25:
Changes in version 1.35, 2002-03-25:
** C Skeleton
* C Skeleton
Some projects use Bison's C parser with C++ compilers, and define
YYSTYPE as a class. The recent adjustment of C parsers for data
alignment and 64 bit architectures made this impossible.
@@ -798,234 +758,234 @@ Bison News
This kludge also addresses some C++ problems when the stack was
extended.
* Changes in version 1.34, 2002-03-12:
Changes in version 1.34, 2002-03-12:
** File name clashes are detected
* File name clashes are detected
$ bison foo.y -d -o 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
Yacc implementations, Bison will mandate this semicolon in the near
future. This eases the implementation of a Bison parser of Bison
grammars by making this grammar LALR(1) instead of LR(2). To
facilitate the transition, this release introduces a warning.
** Revert the C++ namespace changes introduced in 1.31, as they caused too
* Revert the C++ namespace changes introduced in 1.31, as they caused too
many portability hassles.
** DJGPP support added.
* DJGPP support added.
** Fix test suite portability problems.
* Fix test suite portability problems.
* Changes in version 1.33, 2002-02-07:
Changes in version 1.33, 2002-02-07:
** Fix C++ issues
* Fix C++ issues
Groff could not be compiled for the definition of size_t was lacking
under some conditions.
** Catch invalid @n
* Catch invalid @n
As is done with $n.
* Changes in version 1.32, 2002-01-23:
Changes in version 1.32, 2002-01-23:
** Fix Yacc output file names
* Fix Yacc output file names
** Portability fixes
* Portability fixes
** Italian, Dutch translations
* Italian, Dutch translations
* Changes in version 1.31, 2002-01-14:
Changes in version 1.31, 2002-01-14:
** Many Bug Fixes
* Many Bug Fixes
** GNU Gettext and %expect
* GNU Gettext and %expect
GNU Gettext asserts 10 s/r conflicts, but there are 7. Now that
Bison dies on incorrect %expectations, we fear there will be
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'.
** Use of alloca in parsers
* Use of alloca in parsers
If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
malloc exclusively. Since 1.29, but was not NEWS'ed.
alloca is used only when compiled with GCC, to avoid portability
problems as on AIX.
** yyparse now returns 2 if memory is exhausted; formerly it dumped core.
* yyparse now returns 2 if memory is exhausted; formerly it dumped core.
** When the generated parser lacks debugging code, YYDEBUG is now 0
* When the generated parser lacks debugging code, YYDEBUG is now 0
(as POSIX requires) instead of being undefined.
** User Actions
* User Actions
Bison has always permitted actions such as { $$ = $1 }: it adds the
ending semicolon. Now if in Yacc compatibility mode, the semicolon
is no longer output: one has to write { $$ = $1; }.
** Better C++ compliance
* Better C++ compliance
The output parsers try to respect C++ namespaces.
[This turned out to be a failed experiment, and it was reverted later.]
** Reduced Grammars
* Reduced Grammars
Fixed bugs when reporting useless nonterminals.
** 64 bit hosts
* 64 bit hosts
The parsers work properly on 64 bit hosts.
** Error messages
* Error messages
Some calls to strerror resulted in scrambled or missing error messages.
** %expect
* %expect
When the number of shift/reduce conflicts is correct, don't issue
any warning.
** The verbose report includes the rule line numbers.
* The verbose report includes the rule line numbers.
** Rule line numbers are fixed in traces.
* Rule line numbers are fixed in traces.
** Swedish translation
* Swedish translation
** Parse errors
* Parse errors
Verbose parse error messages from the parsers are better looking.
Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
Now: parse error: unexpected '/', expecting "number" or '-' or '('
** Fixed parser memory leaks.
* Fixed parser memory leaks.
When the generated parser was using malloc to extend its stacks, the
previous allocations were not freed.
** Fixed verbose output file.
* Fixed verbose output file.
Some newlines were missing.
Some conflicts in state descriptions were missing.
** Fixed conflict report.
* Fixed conflict report.
Option -v was needed to get the result.
** %expect
* %expect
Was not used.
Mismatches are errors, not warnings.
** Fixed incorrect processing of some invalid input.
* Fixed incorrect processing of some invalid input.
** Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
* Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
** Fixed some typos in the documentation.
* Fixed some typos in the documentation.
** %token MY_EOF 0 is supported.
* %token MY_EOF 0 is supported.
Before, MY_EOF was silently renumbered as 257.
** doc/refcard.tex is updated.
* doc/refcard.tex is updated.
** %output, %file-prefix, %name-prefix.
* %output, %file-prefix, %name-prefix.
New.
** --output
* --output
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
argument.
** `%source_extension' and `%header_extension' are removed, failed
* `%source_extension' and `%header_extension' are removed, failed
experiment.
** Portability fixes.
* Portability fixes.
* Changes in version 1.29, 2001-09-07:
Changes in version 1.29, 2001-09-07:
** 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
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.
** 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.
** The input and the output files has automatically a similar extension.
* The input and the output files has automatically a similar extension.
** Russian translation added.
* Russian translation added.
** NLS support updated; should hopefully be less troublesome.
* NLS support updated; should hopefully be less troublesome.
** 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.
** New directives.
* New directives.
`%yacc', `%fixed_output_files', `%defines', `%no_parser', `%verbose',
`%debug', `%source_extension' and `%header_extension'.
** @$
* @$
Automatic location tracking.
* Changes in version 1.28, 1999-07-06:
Changes in version 1.28, 1999-07-06:
** Should compile better now with K&R compilers.
* Should compile better now with K&R compilers.
** Added NLS.
* Added NLS.
** Fixed a problem with escaping the double quote character.
* Fixed a problem with escaping the double quote character.
** There is now a FAQ.
* There is now a FAQ.
* Changes in version 1.27:
Changes in version 1.27:
** The make rule which prevented bison.simple from being created on
* The make rule which prevented bison.simple from being created on
some systems has been fixed.
* Changes in version 1.26:
Changes in version 1.26:
** Bison now uses automake.
* Bison now uses automake.
** New mailing lists: <[email protected]> and <[email protected]>.
* New mailing lists: <[email protected]> and <[email protected]>.
** Token numbers now start at 257 as previously documented, not 258.
* Token numbers now start at 257 as previously documented, not 258.
** Bison honors the TMPDIR environment variable.
* Bison honors the TMPDIR environment variable.
** A couple of buffer overruns have been fixed.
* A couple of buffer overruns have been fixed.
** Problems when closing files should now be reported.
* Problems when closing files should now be reported.
** Generated parsers should now work even on operating systems which do
* Generated parsers should now work even on operating systems which do
not provide alloca().
* Changes in version 1.25, 1995-10-16:
Changes in version 1.25, 1995-10-16:
** Errors in the input grammar are not fatal; Bison keeps reading
* Errors in the input grammar are not fatal; Bison keeps reading
the grammar file, and reports all the errors found in it.
** Tokens can now be specified as multiple-character strings: for
* Tokens can now be specified as multiple-character strings: for
example, you could use "<=" for a token which looks like <=, instead
of chosing a name like LESSEQ.
** The %token_table declaration says to write a table of tokens (names
* The %token_table declaration says to write a table of tokens (names
and numbers) into the parser file. The yylex function can use this
table to recognize multiple-character string tokens, or for other
purposes.
** The %no_lines declaration says not to generate any #line preprocessor
* The %no_lines declaration says not to generate any #line preprocessor
directives in the parser file.
** The %raw declaration says to use internal Bison token numbers, not
* The %raw declaration says to use internal Bison token numbers, not
Yacc-compatible token numbers, when token names are defined as macros.
** The --no-parser option produces the parser tables without including
* The --no-parser option produces the parser tables without including
the parser engine; a project can now use its own parser engine.
The actions go into a separate file called NAME.act, in the form of
a switch statement body.
* Changes in version 1.23:
Changes in version 1.23:
The user can define YYPARSE_PARAM as the name of an argument to be
passed into yyparse. The argument should have type void *. It should
@@ -1034,11 +994,11 @@ by casting it to the proper pointer type.
Line numbers in output file corrected.
* Changes in version 1.22:
Changes in version 1.22:
--help option added.
* Changes in version 1.20:
Changes in version 1.20:
Output file does not redefine const for C++.
+7 -11
View File
@@ -1,20 +1,16 @@
This package contains the GNU Bison parser generator.
This directory contains the Bison parser generator.
See the file INSTALL for generic compilation and installation instructions.
See the file doc/FAQ for frequently asked questions.
See the section FAQ in the documentation (doc/bison.info) for
frequently asked questions. The documentation is also available in
PDF and HTML, provided you have a recent version of Texinfo installed:
run "make pdf" or "make html".
Bison requires GNU m4 1.4.3 or later. See:
Bison requires GNU m4 1.4.6 or later. See:
ftp://ftp.gnu.org/gnu/m4/m4-1.4.3.tar.gz
ftp://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz
Bison can work with pre-1.4.6 distributions of GNU m4 if they are
Bison can work with pre-1.4.3 distributions of GNU m4 if they are
sufficiently patched, but if you encounter a bug with an older
distribution and report a bug we will probably suggest that you
upgrade to 1.4.6 as the first step in trying to fix it.
upgrade to 1.4.3 as the first step in trying to fix it.
Please send bug reports to <[email protected]>. Please include the
version number from `bison --version', and a complete, self-contained
@@ -25,7 +21,7 @@ not answer them, please send mail to <[email protected]>.
-----
Copyright (C) 1992, 1998, 1999, 2003, 2004, 2005, 2008 Free Software Foundation, Inc.
Copyright (C) 1992, 1998, 1999, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
-5
View File
@@ -22,11 +22,9 @@ Charles-Henri de Boysson [email protected]
Christian Burger [email protected]
Cris Bailiff [email protected]
Cris van Pelt [email protected]
Csaba Raduly [email protected]
Daniel Hagerty [email protected]
David J. MacKenzie [email protected]
Derek M. Jones [email protected]
Di-an Jan [email protected]
Dick Streefland [email protected]
Enrico Scholz [email protected]
Eric Blake [email protected]
@@ -35,8 +33,6 @@ Fabrice Bauzac [email protected]
Florian Krohm [email protected]
Frank Heckenbach [email protected]
Frans Englich [email protected]
Georg Sauthoff [email protected]
Goran Uddeborg [email protected]
Guido Trentalancia [email protected]
H. Merijn Brand [email protected]
Hans Aberg [email protected]
@@ -80,7 +76,6 @@ Robert Anisko [email protected]
Satya Kiran Popuri [email protected]
Sebastien Fricker [email protected]
Sebastian Setzer [email protected]
Sergei Steshenko [email protected]
Shura [email protected]
Steve Murphy [email protected]
Tim Josling [email protected]
+6 -35
View File
@@ -211,7 +211,7 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
exit 1
fi
# If each line in $STR is not already on a line by itself in $FILE, insert it,
# If $STR is not already on a line by itself in $FILE, insert it,
# sorting the new contents of the file and replacing $FILE with the result.
insert_sorted_if_absent() {
file=$1
@@ -222,21 +222,6 @@ insert_sorted_if_absent() {
|| exit 1
}
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
# insert_sorted_if_absent.
insert_vc_ignore() {
vc_ignore_file="$1"
case $vc_ignore_file in
*.gitignore)
# A .gitignore entry that does not start with `/' applies recursively to
# subdirectories, so prepend `/' to every .gitignore entry.
pattern=`echo "$2" | sed s,^,/,`;;
*)
pattern="$2";;
esac
insert_sorted_if_absent "$vc_ignore_file" "$pattern"
}
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
found_aux_dir=no
grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
@@ -255,7 +240,7 @@ if test ! -d $build_aux; then
mkdir $build_aux
for dot_ig in x $vc_ignore; do
test $dot_ig = x && continue
insert_vc_ignore $dot_ig $build_aux
insert_sorted_if_absent $dot_ig $build_aux
done
fi
@@ -267,20 +252,6 @@ cleanup_gnulib() {
exit $status
}
# See if we can use gnulib's git-merge-changelog merge driver.
if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
if git config merge.merge-changelog.driver >/dev/null ; then
:
elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
echo "initializing git-merge-changelog driver"
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
else
echo "consider installing git-merge-changelog from gnulib"
fi
fi
# Get gnulib files.
case ${GNULIB_SRCDIR--} in
@@ -379,7 +350,7 @@ check_dst_dir()
for dot_ig in x $vc_ignore; do
test $dot_ig = x && continue
ig=$parent/$dot_ig
insert_vc_ignore $ig `echo "$dst_dir"|sed 's,.*/,,'`
insert_sorted_if_absent $ig `echo "$dst_dir"|sed 's,.*/,,'`
done
fi
}
@@ -536,18 +507,18 @@ slurp() {
test $dot_ig = x && continue
ig=$dir/$dot_ig
if test -n "$copied"; then
insert_vc_ignore $ig "$copied"
insert_sorted_if_absent $ig "$copied"
# If an ignored file name ends with _.h, then also add
# the name with just ".h". Many gnulib headers are generated,
# e.g., stdint_.h -> stdint.h, dirent_.h ->..., etc.
# Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
f=`echo "$copied"|sed 's/_\.h$/.h/;s/\.sin$/.sed/;s/\.y$/.c/;s/\.gperf$/.h/'`
insert_vc_ignore $ig "$f"
insert_sorted_if_absent $ig "$f"
# For files like sys_stat_.h and sys_time_.h, record as
# ignorable the directory we might eventually create: sys/.
f=`echo "$copied"|sed 's/sys_.*_\.h$/sys/'`
insert_vc_ignore $ig "$f"
insert_sorted_if_absent $ig "$f"
fi
done
done
+10 -9
View File
@@ -17,12 +17,17 @@
# gnulib modules used by this package.
gnulib_modules='
announce-gen argmatch config-h c-strcase configmake
dirname error extensions fopen-safer getopt gettext git-version-gen
gnumakefile hash inttypes javacomp-script javaexec-script malloc
argmatch config-h c-strcase configmake
dirname error extensions fopen-safer git-version-gen
getopt gettext hash inttypes javacomp-script javaexec-script malloc
mbswidth obstack quote quotearg stdbool stpcpy strerror strtoul
strverscmp unistd unistd-safer unlocked-io unsetenv verify
warnings xalloc xalloc-die xstrndup
strverscmp unistd unistd-safer unlocked-io verify xalloc xalloc-die
xstrndup
'
# Any gnulib files needed that are not in modules.
gnulib_files='
m4/warning.m4
'
# Additional xgettext options to use. Use "\\\newline" to break lines.
@@ -60,7 +65,3 @@ excluded_files='
m4/visibility.m4
m4/xsize.m4
'
# In directories like lib/, m4/, and po/, generate both these files because we
# still try to support CVS emulation.
vc_ignore='.cvsignore .gitignore'
-1
View File
@@ -1,6 +1,5 @@
Makefile
Makefile.in
announce-gen
compile
config.guess
config.rpath
-17
View File
@@ -1,17 +0,0 @@
/Makefile
/Makefile.in
/announce-gen
/compile
/config.guess
/config.rpath
/config.sub
/depcomp
/git-version-gen
/install-sh
/javacomp.sh.in
/javaexec.sh.in
/link-warning.h
/mdate-sh
/missing
/texinfo.tex
/ylwrap
+22 -27
View File
@@ -19,22 +19,16 @@
# We have strange test case titles, so we need Autoconf 2.61 or better.
AC_PREREQ(2.61)
AC_INIT([GNU Bison],
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
[[email protected]])
AC_DEFINE([PACKAGE_COPYRIGHT_YEAR], [2008],
AC_INIT([GNU Bison], [2.3a+], [[email protected]])
AC_DEFINE([PACKAGE_COPYRIGHT_YEAR], [2007],
[The copyright year for this package])
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2008])
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2007])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
# We don't have a file m4/Makefile.am, so we need Automake 1.8 or later.
# We want gnits strictness only when rolling a formal release so that we can,
# for example, run make dist at other times without being required to add a
# bogus NEWS entry.
AM_INIT_AUTOMAKE([1.8 dist-bzip2]
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [-], [gnu], [gnits]))
AM_INIT_AUTOMAKE([1.8 check-news readme-alpha dist-bzip2])
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
# Checks for the compiler.
@@ -51,23 +45,23 @@ AC_ARG_ENABLE(gcc-warnings,
esac],
[enableval=no])
if test "${enableval}" = yes; then
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
AC_SUBST([WERROR_CFLAGS])
gl_WARN_ADD([-Wall])
gl_WARN_ADD([-Wextra -Wno-sign-compare])
gl_WARN_ADD([-Wcast-align])
gl_WARN_ADD([-Wcast-qual])
gl_WARN_ADD([-Wformat])
gl_WARN_ADD([-Wpointer-arith])
gl_WARN_ADD([-Wwrite-strings])
AC_SUBST([WARN_CXXFLAGS], [$WARN_CFLAGS])
gl_WARNING_CFLAGS([-Werror])
AC_SUBST([WERROR_CFLAGS], [$WARNING_CFLAGS])
WARNING_CFLAGS=
gl_WARNING_CFLAGS([-Wall])
gl_WARNING_CFLAGS([-Wextra -Wno-sign-compare])
gl_WARNING_CFLAGS([-Wcast-align])
gl_WARNING_CFLAGS([-Wcast-qual])
gl_WARNING_CFLAGS([-Wformat])
gl_WARNING_CFLAGS([-Wpointer-arith])
gl_WARNING_CFLAGS([-Wwrite-strings])
AC_SUBST([WARNING_CXXFLAGS], [$WARNING_CFLAGS])
# The following warnings are not suitable for C++.
gl_WARN_ADD([-Wbad-function-cast])
gl_WARN_ADD([-Wmissing-declarations])
gl_WARN_ADD([-Wmissing-prototypes])
gl_WARN_ADD([-Wshadow])
gl_WARN_ADD([-Wstrict-prototypes])
AC_SUBST([WARN_CFLAGS])
gl_WARNING_CFLAGS([-Wbad-function-cast])
gl_WARNING_CFLAGS([-Wmissing-declarations])
gl_WARNING_CFLAGS([-Wmissing-prototypes])
gl_WARNING_CFLAGS([-Wshadow])
gl_WARNING_CFLAGS([-Wstrict-prototypes])
AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
fi
@@ -148,7 +142,8 @@ AC_SUBST([O0CXXFLAGS], [`echo $CXXFLAGS | sed 's/-O[[0-9]] *//'`])
gt_JAVACOMP([1.3])
gt_JAVAEXEC
AC_CONFIG_FILES([Makefile
AC_CONFIG_FILES([.version
Makefile
build-aux/Makefile
po/Makefile.in
data/Makefile
-2
View File
@@ -1,2 +0,0 @@
/Makefile.in
/Makefile
+1 -1
View File
@@ -19,7 +19,7 @@ dist_pkgdata_DATA = README bison.m4 \
java-skel.m4 java.m4 lalr1.java
m4sugardir = $(pkgdatadir)/m4sugar
dist_m4sugar_DATA = m4sugar/m4sugar.m4 m4sugar/foreach.m4
dist_m4sugar_DATA = m4sugar/m4sugar.m4
xsltdir = $(pkgdatadir)/xslt
dist_xslt_DATA = \
+7 -34
View File
@@ -1,58 +1,31 @@
-*- outline -*-
This directory contains data needed by Bison.
This directory contains Bison skeletons: the general shapes of the
different parser kinds, that are specialized for specific grammars by
the bison program.
* Skeletons
Bison skeletons: the general shapes of the different parser kinds,
that are specialized for specific grammars by the bison program.
Currently, the supported skeletons are:
Currently, there are only three supported skeletons:
- yacc.c
It used to be named bison.simple: it corresponds to C Yacc
compatible LALR(1) parsers.
- lalr1.cc
Produces a C++ parser class.
- lalr1.java
Produces a Java parser class.
Produces a C++ parser class. It is still very experimental, and not
yet supported. Please, subscribe to [email protected].
- glr.c
A Generalized LR C parser based on Bison's LALR(1) tables.
- glr.cc
A Generalized LR C++ parser. Actually a C++ wrapper around glr.c.
These skeletons are the only ones supported by the Bison team.
Because the interface between skeletons and the bison program is not
finished, *we are not bound to it*. In particular, Bison is not
mature enough for us to consider that ``foreign skeletons'' are
supported.
* m4sugar
This directory contains M4sugar, sort of an extended library for M4,
which is used by Bison to instantiate the skeletons.
* xslt
This directory contains XSLT programs that transform Bison's XML output
into various formats.
- bison.xsl
A library of routines used by the other XSLT programs.
- xml2dot.xsl
Conversion into GraphViz's dot format.
- xml2text.xsl
Conversion into text.
- xml2xhtml.xsl
Conversion into XHTML.
-----
Copyright (C) 2002, 2008 Free Software Foundation, Inc.
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Bison.
+1 -1
View File
@@ -550,7 +550,7 @@ m4_define([b4_check_user_names_wrap],
[b4_percent_]$1[_user_]$2[s],
[[b4_percent_]$1[_bison_]$2[s]])])])
m4_wrap_lifo([
m4_wrap([
b4_check_user_names_wrap([[define]], [[variable]])
b4_check_user_names_wrap([[code]], [[qualifier]])
])
+1 -1
View File
@@ -2,7 +2,7 @@
# C++ skeleton for Bison
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
# Inc.
# This program is free software: you can redistribute it and/or modify
+12 -16
View File
@@ -1,8 +1,7 @@
-*- Autoconf -*-
# C M4 Macros for Bison.
# Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008 Free Software
# Foundation, Inc.
# Copyright (C) 2002, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -90,7 +89,7 @@ b4_parse_param)
# the formal name to FORMAL, and evaluating the BODY.
m4_define([b4_parse_param_for],
[m4_foreach([$1_$2], m4_defn([b4_parse_param]),
[m4_pushdef([$1], m4_unquote(m4_car($1_$2)))dnl
[m4_pushdef([$1], m4_fst($1_$2))dnl
m4_pushdef([$2], m4_shift($1_$2))dnl
$3[]dnl
m4_popdef([$2])dnl
@@ -133,8 +132,6 @@ m4_define([b4_int_type],
m4_define([b4_int_type_for],
[b4_int_type($1_min, $1_max)])
## ---------##
## Values. ##
## ---------##
@@ -146,8 +143,6 @@ m4_define([b4_int_type_for],
m4_define([b4_null], [0])
## ------------------------- ##
## Assigning token numbers. ##
## ------------------------- ##
@@ -164,7 +159,7 @@ m4_define([b4_token_define],
# -------------------------------------------------------
# Output the definition of the tokens (if there are) as #defines.
m4_define([b4_token_defines],
[m4_if([$#$1], [1], [],
[m4_if([$@], [[]], [],
[/* Tokens. */
m4_map([b4_token_define], [$@])])
])
@@ -181,7 +176,7 @@ m4_define([b4_token_enum],
# -----------------------------------------------------
# Output the definition of the tokens (if there are) as enums.
m4_define([b4_token_enums],
[m4_if([$#$1], [1], [],
[m4_if([$@], [[]], [],
[/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
@@ -233,8 +228,8 @@ m4_define([b4_c_function_def],
b4_c_ansi_function_def($@)
#else
$2
$1 (b4_c_knr_formal_names(m4_shift2($@)))
b4_c_knr_formal_decls(m4_shift2($@))
$1 (b4_c_knr_formal_names(m4_shiftn(2, $@)))
b4_c_knr_formal_decls(m4_shiftn(2, $@))
#endif[]dnl
])
@@ -244,7 +239,7 @@ b4_c_knr_formal_decls(m4_shift2($@))
# Declare the function NAME in ANSI.
m4_define([b4_c_ansi_function_def],
[$2
$1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl
$1 (b4_c_ansi_formals(m4_shiftn(2, $@)))[]dnl
])
@@ -252,8 +247,9 @@ $1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl
# --------------------------------------
# Output the arguments ANSI-C definition.
m4_define([b4_c_ansi_formals],
[m4_if([$#], [0], [void],
[$#$1], [1], [void],
[m4_case([$@],
[], [void],
[[]], [void],
[m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
m4_define([b4_c_ansi_formal],
@@ -305,7 +301,7 @@ $2 $1 ();
# ----------------------------------------------------------------
# Declare the function NAME.
m4_define([b4_c_ansi_function_decl],
[$2 $1 (b4_c_ansi_formals(m4_shift2($@)));[]dnl
[$2 $1 (b4_c_ansi_formals(m4_shiftn(2, $@)));[]dnl
])
@@ -320,7 +316,7 @@ m4_define([b4_c_ansi_function_decl],
# -----------------------------------------------------------
# Call the function NAME with arguments NAME1, NAME2 etc.
m4_define([b4_c_function_call],
[$1 (b4_c_args(m4_shift2($@)))[]dnl
[$1 (b4_c_args(m4_shiftn(2, $@)))[]dnl
])
+4 -4
View File
@@ -1,8 +1,8 @@
-*- C -*-
# GLR skeleton for Bison
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
# Foundation, Inc.
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
# Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -2644,10 +2644,10 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C],
b4_shared_declarations
b4_pure_if([],
[[extern YYSTYPE ]b4_prefix[lval;]])
[[extern YYSTYPE b4_prefix][lval;]])
b4_locations_if([b4_pure_if([],
[extern YYLTYPE ]b4_prefix[lloc;])
[extern YYLTYPE b4_prefix[]lloc;])
])
])])
m4_divert_pop(0)
+10 -40
View File
@@ -2,7 +2,7 @@
# Java language support for Bison
# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
# Copyright (C) 2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,23 +25,6 @@ m4_define([b4_comment], [/* m4_bpatsubst([$1], [
]) */])
# b4_list2(LIST1, LIST2)
# --------------------------
# Join two lists with a comma if necessary.
m4_define([b4_list2],
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
# b4_percent_define_get3(DEF, PRE, POST, NOT)
# -------------------------------------------
# Expand to the value of DEF surrounded by PRE and POST if it's %define'ed,
# otherwise NOT.
m4_define([b4_percent_define_get3],
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
[$2[]b4_percent_define_get([$1])[]$3], [$4])])
# b4_flag_value(BOOLEAN-FLAG)
# ---------------------------
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
@@ -61,20 +44,6 @@ m4_define([b4_abstract_if],
[b4_percent_define_flag_if([abstract], [$1], [$2])])
# b4_final_if(TRUE, FALSE)
# ---------------------------
b4_percent_define_default([[final]], [[false]])
m4_define([b4_final_if],
[b4_percent_define_flag_if([final], [$1], [$2])])
# b4_strictfp_if(TRUE, FALSE)
# ---------------------------
b4_percent_define_default([[strictfp]], [[false]])
m4_define([b4_strictfp_if],
[b4_percent_define_flag_if([strictfp], [$1], [$2])])
# b4_lexer_if(TRUE, FALSE)
# ------------------------
m4_define([b4_lexer_if],
@@ -84,7 +53,10 @@ m4_define([b4_lexer_if],
# b4_identification
# -----------------
m4_define([b4_identification],
[ /** Version number for the Bison executable that generated this parser. */
[/** Always <tt>true</tt>, identifies Bison output. */
public static final boolean bison = true;
/** Version number for the Bison executable that generated this parser. */
public static final String bisonVersion = "b4_version";
/** Name of the skeleton that generated this parser. */
@@ -103,7 +75,7 @@ m4_define([b4_identification],
m4_define([b4_int_type],
[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte],
b4_ints_in($@, [-32768], [32767]), [1], [short],
[int])])
[int])])
# b4_int_type_for(NAME)
# ---------------------
@@ -134,7 +106,7 @@ m4_define([b4_token_enum],
# -----------------------------------------------------
# Output the definition of the tokens (if there are) as enums.
m4_define([b4_token_enums],
[m4_if([$#$1], [1], [],
[m4_if([$@], [[]], [],
[/* Tokens. */
m4_map([b4_token_enum], [$@])])
])
@@ -156,16 +128,14 @@ m4_define([b4_case], [ case $1:
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
b4_percent_define_default([[stype]], [[Object]])])
# %name-prefix
m4_define_default([b4_prefix], [[YY]])
m4_define_default([[b4_prefix]], [[YY]])])
b4_percent_define_default([[parser_class_name]], [b4_prefix[]Parser])])
m4_define([b4_parser_class_name], [b4_percent_define_get([[parser_class_name]])])
b4_percent_define_default([[lex_throws]], [[java.io.IOException]])])
m4_define([b4_lex_throws], [b4_percent_define_get([[lex_throws]])])
b4_percent_define_default([[throws]], [])])
b4_percent_define_default([[throws]], [b4_lex_throws])])
m4_define([b4_throws], [b4_percent_define_get([[throws]])])
b4_percent_define_default([[location_type]], [Location])])
@@ -235,7 +205,7 @@ m4_define([b4_param_decls],
[m4_map([b4_param_decl], [$@])])
m4_define([b4_param_decl], [, $1])
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
m4_define([b4_remove_comma], [m4_ifval($1, [$1, ], [])m4_shiftn(2, $@)])
+9 -17
View File
@@ -1,7 +1,7 @@
# C++ skeleton for Bison
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
# Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ m4_divert_push(0)dnl
b4_defines_if(
[@output(b4_spec_defines_file@)
b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++],
[2002, 2003, 2004, 2005, 2006, 2007, 2008])
[2002, 2003, 2004, 2005, 2006])
dnl FIXME: This is wrong, we want computed header guards.
[
/* C++ LALR(1) parser skeleton written by Akim Demaille. */
@@ -130,7 +130,6 @@ b4_user_stype
/// \returns 0 iff parsing succeeded.
virtual int parse ();
#if YYDEBUG
/// The current debugging stream.
std::ostream& debug_stream () const;
/// Set the current debugging stream.
@@ -142,7 +141,6 @@ b4_user_stype
debug_level_type debug_level () const;
/// Set the current debugging level.
void set_debug_level (debug_level_type l);
#endif
private:
/// Report a syntax error.
@@ -300,7 +298,7 @@ b4_percent_code_get([[provides]])[]dnl
])dnl
@output(b4_parser_file_name@)
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++],
[2002, 2003, 2004, 2005, 2006, 2007, 2008])
[2002, 2003, 2004, 2005, 2006])
b4_percent_code_get([[top]])[]dnl
m4_if(b4_prefix, [yy], [],
[
@@ -369,13 +367,9 @@ do { \
#endif /* !YYDEBUG */
#define yyerrok (yyerrstatus_ = 0)
#define yyclearin (yychar = yyempty_)
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab
#define YYRECOVERING() (!!yyerrstatus_)
]b4_namespace_open[
#if YYERROR_VERBOSE
@@ -539,7 +533,7 @@ do { \
/// Location of the lookahead.
location_type yylloc;
/// The locations where the error started and ended.
location_type yyerror_range[2];
location yyerror_range[2];
/// $$.
semantic_type yyval;
@@ -676,8 +670,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
switch (yyn)
{
]b4_user_actions[
default:
break;
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
@@ -795,7 +788,7 @@ b4_error_verbose_if([, yytoken])[));
/* Shift the error token. */
YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
&yysemantic_stack_[0], &yylocation_stack_[0]);
&yysemantic_stack_[0], &yylocation_stack_[0]);
yystate = yyn;
goto yynewstate;
@@ -1057,7 +1050,7 @@ b4_error_verbose_if([, int tok])[)
dnl
@output(b4_dir_prefix[]stack.hh@)
b4_copyright([Stack handling for Bison parsers in C++],
[2002, 2003, 2004, 2005, 2006, 2007, 2008])[
[2002, 2003, 2004, 2005, 2006])[
#ifndef BISON_STACK_HH
# define BISON_STACK_HH
@@ -1152,6 +1145,5 @@ b4_copyright([Stack handling for Bison parsers in C++],
};
]b4_namespace_close[
#endif // not BISON_STACK_HH[]dnl
]
#endif // not BISON_STACK_HH]
m4_divert_pop(0)
+15 -20
View File
@@ -1,6 +1,6 @@
# Java skeleton for Bison -*- autoconf -*-
# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
# Copyright (C) 2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,24 +25,18 @@ m4_ifval(m4_defn([b4_symbol_destructors]),
m4_divert_push(0)dnl
@output(b4_parser_file_name@)
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
[2007, 2008])
[2007])
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
])[/* First part of user declarations. */
]b4_pre_prologue
b4_percent_code_get([[imports]])
[/**
* A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
* A Bison parser, automatically generated from <tt>@ofile@</tt>.
*
* @@author LALR (1) parser skeleton written by Paolo Bonzini.
*/
]b4_public_if([public ])dnl
b4_abstract_if([abstract ])dnl
b4_final_if([final ])dnl
b4_strictfp_if([strictfp ])dnl
[class ]b4_parser_class_name[]dnl
b4_percent_define_get3([extends], [ extends ])dnl
b4_percent_define_get3([implements], [ implements ])[
]b4_public_if([public ])b4_abstract_if([abstract ])[class ]b4_parser_class_name[
{
]b4_identification[
@@ -63,7 +57,7 @@ b4_locations_if([[
public ]b4_position_type[ end;
/**
* Create a <code>]b4_location_type[</code> denoting an empty range located at
* Create a ]b4_location_type[ denoting an empty range located at
* a given point.
* @@param loc The position at which the range is anchored. */
public ]b4_location_type[ (]b4_position_type[ loc) {
@@ -73,7 +67,7 @@ b4_locations_if([[
/**
* Create a <code>]b4_location_type[</code> from the endpoints of the range.
* @@param begin The first position included in the range.
* @@param end The first position beyond the range. */
* @@param begin The first position beyond the range. */
public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
this.begin = begin;
this.end = end;
@@ -105,7 +99,7 @@ b4_token_enums(b4_tokens)
return new ]b4_location_type[ (rhs.locationAt (1).begin, rhs.locationAt (n).end);
else
return new ]b4_location_type[ (rhs.locationAt (0).end);
}]])[
}]])
/**
* Communication interface between the scanner and the Bison-generated
@@ -136,9 +130,10 @@ b4_token_enums(b4_tokens)
/**
* Entry point for error reporting. Emits an error
* ]b4_locations_if([referring to the given location ])[in a user-defined way.
* ]b4_locations_if([ referring to the given location])[in a user-defined
* way.
*
* ]b4_locations_if([[@@param loc The location of the element to which the
* ]b4_locations_if([loc], [[The location of the element to which the
* error message is related]])[
* @@param s The string for the error message. */
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String s);]
@@ -165,7 +160,7 @@ b4_lexer_if([[
/**
* Instantiates the Bison-generated parser.
* @@param yylexer The scanner that will supply tokens to the parser.
* @@param yylex The scanner that will supply tokens to the parser.
*/
b4_lexer_if([[protected]], [[public]]) b4_parser_class_name[ (]b4_parse_param_decl([[Lexer yylexer]])[) {
this.yylexer = yylexer;
@@ -210,7 +205,7 @@ b4_lexer_if([[
]b4_locations_if([
protected final void yyerror (String s) {
yylexer.yyerror ((]b4_location_type[)null, s);
yylexer.yyerror ((Location)null, s);
}
protected final void yyerror (]b4_position_type[ loc, String s) {
yylexer.yyerror (new ]b4_location_type[ (loc), s);
@@ -330,7 +325,7 @@ b4_lexer_if([[
return yyerrstatus_ == 0;
}
private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
private int yyaction (int yyn, YYStack yystack, int yylen)
{
]b4_yystype[ yyval;
]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[
@@ -419,7 +414,7 @@ b4_lexer_if([[
yycdebug (s + (yytype < yyntokens_ ? " token " : " nterm ")
+ yytname_[yytype] + " ("]b4_locations_if([
+ yylocationp + ": "])[
+ (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")");
+ (yyvaluep == null ? "(null)" : yyvaluep) + ")");
}
/**
@@ -429,7 +424,7 @@ b4_lexer_if([[
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
* imply that there were no syntax errors.
*/
public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[
public boolean parse () ]b4_maybe_throws([b4_throws])[
{
/// Lookahead and lookahead in internal form.
int yychar = yyempty_;
-400
View File
@@ -1,400 +0,0 @@
# -*- Autoconf -*-
# This file is part of Autoconf.
# foreach-based replacements for recursive functions.
# Speeds up GNU M4 1.4.x by avoiding quadratic $@ recursion, but penalizes
# GNU M4 1.6 by requiring more memory and macro expansions.
#
# Copyright (C) 2008 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception, the Free Software Foundation gives unlimited
# permission to copy, distribute and modify the configure scripts that
# are the output of Autoconf. You need not follow the terms of the GNU
# General Public License when using or distributing such scripts, even
# though portions of the text of Autoconf appear in them. The GNU
# General Public License (GPL) does govern all other use of the material
# that constitutes the Autoconf program.
#
# Certain portions of the Autoconf source text are designed to be copied
# (in certain cases, depending on the input) into the output of
# Autoconf. We call these the "data" portions. The rest of the Autoconf
# source text consists of comments plus executable code that decides which
# of the data portions to output in any given case. We call these
# comments and executable code the "non-data" portions. Autoconf never
# copies any of the non-data portions into its output.
#
# This special exception to the GPL applies to versions of Autoconf
# released by the Free Software Foundation. When you make and
# distribute a modified version of Autoconf, you may extend this special
# exception to the GPL to apply to your modified version as well, *unless*
# your modified version has the potential to copy into its output some
# of the text that was the non-data portion of the version that you started
# with. (In other words, unless your change moves or copies text from
# the non-data portions to the data portions.) If your modification has
# such potential, you must delete any notice of this special exception
# to the GPL from your modified version.
#
# Written by Eric Blake.
#
# In M4 1.4.x, every byte of $@ is rescanned. This means that an
# algorithm on n arguments that recurses with one less argument each
# iteration will scan n * (n + 1) / 2 arguments, for O(n^2) time. In
# M4 1.6, this was fixed so that $@ is only scanned once, then
# back-references are made to information stored about the scan.
# Thus, n iterations need only scan n arguments, for O(n) time.
# Additionally, in M4 1.4.x, recursive algorithms did not clean up
# memory very well, requiring O(n^2) memory rather than O(n) for n
# iterations.
#
# This file is designed to overcome the quadratic nature of $@
# recursion by writing a variant of m4_foreach that uses m4_for rather
# than $@ recursion to operate on the list. This involves more macro
# expansions, but avoids the need to rescan a quadratic number of
# arguments, making these replacements very attractive for M4 1.4.x.
# On the other hand, in any version of M4, expanding additional macros
# costs additional time; therefore, in M4 1.6, where $@ recursion uses
# fewer macros, these replacements actually pessimize performance.
# Additionally, the use of $10 to mean the tenth argument violates
# POSIX; although all versions of m4 1.4.x support this meaning, a
# future m4 version may switch to take it as the first argument
# concatenated with a literal 0, so the implementations in this file
# are not future-proof. Thus, this file is conditionally included as
# part of m4_init(), only when it is detected that M4 probably has
# quadratic behavior (ie. it lacks the macro __m4_version__).
#
# Please keep this file in sync with m4sugar.m4.
# m4_foreach(VARIABLE, LIST, EXPRESSION)
# --------------------------------------
# Expand EXPRESSION assigning each value of the LIST to VARIABLE.
# LIST should have the form `item_1, item_2, ..., item_n', i.e. the
# whole list must *quoted*. Quote members too if you don't want them
# to be expanded.
#
# This version minimizes the number of times that $@ is evaluated by
# using m4_for to generate a boilerplate into VARIABLE then passing $@
# to that temporary macro. Thus, the recursion is done in m4_for
# without reparsing any user input, and is not quadratic. For an idea
# of how this works, note that m4_foreach(i,[1,2],[i]) defines i to be
# m4_define([$1],[$3])$2[]m4_define([$1],[$4])$2[]m4_popdef([i])
# then calls i([i],[i],[1],[2]).
m4_define([m4_foreach],
[m4_if([$2], [], [], [_$0([$1], [$3], $2)])])
m4_define([_m4_foreach],
[m4_define([$1], m4_pushdef([$1])_m4_for([$1], [3], [$#], [1],
[$0_([1], [2], _m4_defn([$1]))])[m4_popdef([$1])])m4_indir([$1], $@)])
m4_define([_m4_foreach_],
[[m4_define([$$1], [$$3])$$2[]]])
# m4_case(SWITCH, VAL1, IF-VAL1, VAL2, IF-VAL2, ..., DEFAULT)
# -----------------------------------------------------------
# Find the first VAL that SWITCH matches, and expand the corresponding
# IF-VAL. If there are no matches, expand DEFAULT.
#
# Use m4_for to create a temporary macro in terms of a boilerplate
# m4_if with final cleanup. If $# is even, we have DEFAULT; if it is
# odd, then rounding the last $# up in the temporary macro is
# harmless. For example, both m4_case(1,2,3,4,5) and
# m4_case(1,2,3,4,5,6) result in the intermediate _m4_case being
# m4_if([$1],[$2],[$3],[$1],[$4],[$5],_m4_popdef([_m4_case])[$6])
m4_define([m4_case],
[m4_if(m4_eval([$# <= 2]), [1], [$2],
[m4_pushdef([_$0], [m4_if(]m4_for([_m4_count], [2], m4_decr([$#]), [2],
[_$0_([1], _m4_count, m4_incr(_m4_count))])[_m4_popdef(
[_$0])]m4_dquote($m4_eval([($# + 1) & ~1]))[)])_$0($@)])])
m4_define([_m4_case_],
[[[$$1],[$$2],[$$3],]])
# m4_bmatch(SWITCH, RE1, VAL1, RE2, VAL2, ..., DEFAULT)
# -----------------------------------------------------
# m4 equivalent of
#
# if (SWITCH =~ RE1)
# VAL1;
# elif (SWITCH =~ RE2)
# VAL2;
# elif ...
# ...
# else
# DEFAULT
#
# We build the temporary macro _m4_b:
# m4_define([_m4_b], _m4_defn([_m4_bmatch]))_m4_b([$1], [$2], [$3])...
# _m4_b([$1], [$m-1], [$m])_m4_b([], [], [$m+1]_m4_popdef([_m4_b]))
# then invoke m4_unquote(_m4_b($@)), for concatenation with later text.
m4_define([m4_bmatch],
[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
[$#], 1, [m4_fatal([$0: too few arguments: $#: $1])],
[$#], 2, [$2],
[m4_define([_m4_b], m4_pushdef([_m4_b])[m4_define([_m4_b],
_m4_defn([_$0]))]_m4_for([_m4_b], [3], m4_eval([($# + 1) / 2 * 2 - 1]),
[2], [_$0_([1], m4_decr(_m4_b), _m4_b)])[_m4_b([], [],]m4_dquote(
[$]m4_incr(_m4_b))[_m4_popdef([_m4_b]))])m4_unquote(_m4_b($@))])])
m4_define([_m4_bmatch],
[m4_if(m4_bregexp([$1], [$2]), [-1], [], [[$3]m4_define([$0])])])
m4_define([_m4_bmatch_],
[[_m4_b([$$1], [$$2], [$$3])]])
# m4_cond(TEST1, VAL1, IF-VAL1, TEST2, VAL2, IF-VAL2, ..., [DEFAULT])
# -------------------------------------------------------------------
# Similar to m4_if, except that each TEST is expanded when encountered.
# If the expansion of TESTn matches the string VALn, the result is IF-VALn.
# The result is DEFAULT if no tests passed. This macro allows
# short-circuiting of expensive tests, where it pays to arrange quick
# filter tests to run first.
#
# m4_cond already guarantees either 3*n or 3*n + 1 arguments, 1 <= n.
# We only have to speed up _m4_cond, by building the temporary _m4_c:
# m4_define([_m4_c], _m4_defn([m4_unquote]))_m4_c([m4_if(($1), [($2)],
# [[$3]m4_define([_m4_c])])])_m4_c([m4_if(($4), [($5)],
# [[$6]m4_define([_m4_c])])])..._m4_c([m4_if(($m-2), [($m-1)],
# [[$m]m4_define([_m4_c])])])_m4_c([[$m+1]]_m4_popdef([_m4_c]))
# We invoke m4_unquote(_m4_c($@)), for concatenation with later text.
m4_define([_m4_cond],
[m4_define([_m4_c], m4_pushdef([_m4_c])[m4_define([_m4_c],
_m4_defn([m4_unquote]))]_m4_for([_m4_c], [2], m4_eval([$# / 3 * 3 - 1]), [3],
[$0_(m4_decr(_m4_c), _m4_c, m4_incr(_m4_c))])[_m4_c(]m4_dquote(m4_dquote(
[$]m4_eval([$# / 3 * 3 + 1])))[_m4_popdef([_m4_c]))])m4_unquote(_m4_c($@))])
m4_define([_m4_cond_],
[[_m4_c([m4_if(($$1), [($$2)], [[$$3]m4_define([_m4_c])])])]])
# m4_bpatsubsts(STRING, RE1, SUBST1, RE2, SUBST2, ...)
# ----------------------------------------------------
# m4 equivalent of
#
# $_ = STRING;
# s/RE1/SUBST1/g;
# s/RE2/SUBST2/g;
# ...
#
# m4_bpatsubsts already validated an odd number of arguments; we only
# need to speed up _m4_bpatsubsts. To avoid nesting, we build the
# temporary _m4_p:
# m4_define([_m4_p], [$1])m4_define([_m4_p],
# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$2], [$3]))m4_define([_m4_p],
# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$4], [$5]))m4_define([_m4_p],...
# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$m-1], [$m]))m4_unquote(
# _m4_defn([_m4_p])_m4_popdef([_m4_p]))
m4_define([_m4_bpatsubsts],
[m4_define([_m4_p], m4_pushdef([_m4_p])[m4_define([_m4_p],
]m4_dquote([$]1)[)]_m4_for([_m4_p], [3], [$#], [2], [$0_(m4_decr(_m4_p),
_m4_p)])[m4_unquote(_m4_defn([_m4_p])_m4_popdef([_m4_p]))])_m4_p($@)])
m4_define([_m4_bpatsubsts_],
[[m4_define([_m4_p],
m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$$1], [$$2]))]])
# m4_shiftn(N, ...)
# -----------------
# Returns ... shifted N times. Useful for recursive "varargs" constructs.
#
# m4_shiftn already validated arguments; we only need to speed up
# _m4_shiftn. If N is 3, then we build the temporary _m4_s, defined as
# ,[$5],[$6],...,[$m]_m4_popdef([_m4_s])
# before calling m4_shift(_m4_s($@)).
m4_define([_m4_shiftn],
[m4_if(m4_incr([$1]), [$#], [], [m4_define([_m4_s],
m4_pushdef([_m4_s])_m4_for([_m4_s], m4_eval([$1 + 2]), [$#], [1],
[[,]m4_dquote([$]_m4_s)])[_m4_popdef([_m4_s])])m4_shift(_m4_s($@))])])
# m4_do(STRING, ...)
# ------------------
# This macro invokes all its arguments (in sequence, of course). It is
# useful for making your macros more structured and readable by dropping
# unnecessary dnl's and have the macros indented properly.
#
# Here, we use the temporary macro _m4_do, defined as
# $1[]$2[]...[]$n[]_m4_popdef([_m4_do])
m4_define([m4_do],
[m4_if([$#], [0], [],
[m4_define([_$0], m4_pushdef([_$0])_m4_for([_$0], [1], [$#], [1],
[$_$0[[]]])[_m4_popdef([_$0])])_$0($@)])])
# m4_dquote_elt(ARGS)
# -------------------
# Return ARGS as an unquoted list of double-quoted arguments.
#
# m4_foreach to the rescue. It's easier to shift off the leading comma.
m4_define([m4_dquote_elt],
[m4_shift(m4_foreach([_m4_elt], [$@], [,m4_dquote(_m4_defn([_m4_elt]))]))])
# m4_reverse(ARGS)
# ----------------
# Output ARGS in reverse order.
#
# Invoke _m4_r($@) with the temporary _m4_r built as
# [$m], [$m-1], ..., [$2], [$1]_m4_popdef([_m4_r])
m4_define([m4_reverse],
[m4_if([$#], [0], [], [$#], [1], [[$1]],
[m4_define([_m4_r], m4_dquote([$$#])m4_pushdef([_m4_r])_m4_for([_m4_r],
m4_decr([$#]), [1], [-1],
[[, ]m4_dquote([$]_m4_r)])[_m4_popdef([_m4_r])])_m4_r($@)])])
# m4_map(MACRO, LIST)
# -------------------
# Invoke MACRO($1), MACRO($2) etc. where $1, $2... are the elements
# of LIST. $1, $2... must in turn be lists, appropriate for m4_apply.
#
# m4_map/m4_map_sep only execute once; the speedup comes in fixing
# _m4_map. The mismatch in () is intentional, since $1 supplies the
# opening `(' (but it sure looks odd!). Build the temporary _m4_m:
# $1, [$3])$1, [$4])...$1, [$m])_m4_popdef([_m4_m])
m4_define([_m4_map],
[m4_if([$#], [2], [],
[m4_define([_m4_m], m4_pushdef([_m4_m])_m4_for([_m4_m], [3], [$#], [1],
[$0_([1], _m4_m)])[_m4_popdef([_m4_m])])_m4_m($@)])])
m4_define([_m4_map_],
[[$$1, [$$2])]])
# m4_transform(EXPRESSION, ARG...)
# --------------------------------
# Expand EXPRESSION([ARG]) for each argument. More efficient than
# m4_foreach([var], [ARG...], [EXPRESSION(m4_defn([var]))])
#
# Invoke the temporary macro _m4_transform, defined as:
# $1([$2])[]$1([$3])[]...$1([$m])[]_m4_popdef([_m4_transform])
m4_define([m4_transform],
[m4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])],
[$#], [1], [],
[m4_define([_$0], m4_pushdef([_$0])_m4_for([_$0], [2], [$#], [1],
[_$0_([1], _$0)])[_m4_popdef([_$0])])_$0($@)])])
m4_define([_m4_transform_],
[[$$1([$$2])[]]])
# m4_transform_pair(EXPRESSION, [END-EXPR = EXPRESSION], ARG...)
# --------------------------------------------------------------
# Perform a pairwise grouping of consecutive ARGs, by expanding
# EXPRESSION([ARG1], [ARG2]). If there are an odd number of ARGs, the
# final argument is expanded with END-EXPR([ARGn]).
#
# Build the temporary macro _m4_transform_pair, with the $2([$m+1])
# only output if $# is odd:
# $1([$3], [$4])[]$1([$5], [$6])[]...$1([$m-1],
# [$m])[]m4_default([$2], [$1])([$m+1])[]_m4_popdef([_m4_transform_pair])
m4_define([m4_transform_pair],
[m4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])],
[$#], [1], [m4_fatal([$0: too few arguments: $#: $1])],
[$#], [2], [],
[$#], [3], [m4_default([$2], [$1])([$3])[]],
[m4_define([_$0], m4_pushdef([_$0])_m4_for([_$0], [3],
m4_eval([$# / 2 * 2 - 1]), [2], [_$0_([1], _$0, m4_incr(_$0))])_$0_end(
[1], [2], [$#])[_m4_popdef([_$0])])_$0($@)])])
m4_define([_m4_transform_pair_],
[[$$1([$$2], [$$3])[]]])
m4_define([_m4_transform_pair_end],
[m4_if(m4_eval([$3 & 1]), [1], [[m4_default([$$2], [$$1])([$$3])[]]])])
# m4_join(SEP, ARG1, ARG2...)
# ---------------------------
# Produce ARG1SEPARG2...SEPARGn. Avoid back-to-back SEP when a given ARG
# is the empty string. No expansion is performed on SEP or ARGs.
#
# Use a self-modifying separator, since we don't know how many
# arguments might be skipped before a separator is first printed, but
# be careful if the separator contains $. m4_foreach to the rescue.
m4_define([m4_join],
[m4_pushdef([_m4_sep], [m4_define([_m4_sep], _m4_defn([m4_echo]))])]dnl
[m4_foreach([_m4_arg], [m4_shift($@)],
[m4_ifset([_m4_arg], [_m4_sep([$1])_m4_defn([_m4_arg])])])]dnl
[_m4_popdef([_m4_sep])])
# m4_joinall(SEP, ARG1, ARG2...)
# ------------------------------
# Produce ARG1SEPARG2...SEPARGn. An empty ARG results in back-to-back SEP.
# No expansion is performed on SEP or ARGs.
#
# A bit easier than m4_join. m4_foreach to the rescue.
m4_define([m4_joinall],
[[$2]m4_if(m4_eval([$# <= 2]), [1], [],
[m4_foreach([_m4_arg], [m4_shift2($@)],
[[$1]_m4_defn([_m4_arg])])])])
# m4_list_cmp(A, B)
# -----------------
# Compare the two lists of integer expressions A and B.
#
# m4_list_cmp takes care of any side effects; we only override
# _m4_list_cmp_raw, where we can safely expand lists multiple times.
# First, insert padding so that both lists are the same length; the
# trailing +0 is necessary to handle a missing list. Next, create a
# temporary macro to perform pairwise comparisons until an inequality
# is found. For example, m4_list_cmp([1], [1,2]) creates _m4_cmp as
# m4_if(m4_eval([($1) != ($3)]), [1], [m4_cmp([$1], [$3])],
# m4_eval([($2) != ($4)]), [1], [m4_cmp([$2], [$4])],
# [0]_m4_popdef([_m4_cmp], [_m4_size]))
# then calls _m4_cmp([1+0], [0], [1], [2+0])
m4_define([_m4_list_cmp_raw],
[m4_if([$1], [$2], 0, [m4_pushdef(
[_m4_size])_m4_list_cmp($1+0_m4_list_pad(m4_count($1), m4_count($2)),
$2+0_m4_list_pad(m4_count($2), m4_count($1)))])])
m4_define([_m4_list_pad],
[m4_if(m4_eval($1 < $2), [1],
[_m4_for([_m4_size], m4_incr([$1]), [$2], [1], [,0])])])
m4_define([_m4_list_cmp],
[m4_define([_m4_size], m4_eval([$# >> 1]))]dnl
[m4_define([_m4_cmp], m4_pushdef([_m4_cmp])[m4_if(]_m4_for([_m4_cmp],
[1], _m4_size, [1], [$0_(_m4_cmp, m4_eval(_m4_cmp + _m4_size))])[
[0]_m4_popdef([_m4_cmp], [_m4_size]))])_m4_cmp($@)])
m4_define([_m4_list_cmp_],
[[m4_eval([($$1) != ($$2)]), [1], [m4_cmp([$$1], [$$2])],
]])
# m4_max(EXPR, ...)
# m4_min(EXPR, ...)
# -----------------
# Return the decimal value of the maximum (or minimum) in a series of
# integer expressions.
#
# m4_foreach to the rescue; we only need to replace _m4_minmax. Here,
# we need a temporary macro to track the best answer so far, so that
# the foreach expression is tractable.
m4_define([_m4_minmax],
[m4_pushdef([_m4_best], m4_eval([$2]))m4_foreach([_m4_arg], [m4_shift2($@)],
[m4_define([_m4_best], $1(_m4_best, _m4_defn([_m4_arg])))])]dnl
[_m4_best[]_m4_popdef([_m4_best])])
# m4_set_add_all(SET, VALUE...)
# -----------------------------
# Add each VALUE into SET. This is O(n) in the number of VALUEs, and
# can be faster than calling m4_set_add for each VALUE.
#
# m4_foreach to the rescue. If no deletions have occurred, then avoid
# the speed penalty of m4_set_add.
m4_define([m4_set_add_all],
[m4_if([$#], [0], [], [$#], [1], [],
[m4_define([_m4_set_size($1)], m4_eval(m4_set_size([$1])
+ m4_len(m4_foreach([_m4_arg], [m4_shift($@)],
m4_ifdef([_m4_set_cleanup($1)],
[[m4_set_add([$1], _m4_defn([_m4_arg]))]],
[[m4_ifdef([_m4_set([$1],]_m4_defn([_m4_arg])[)], [],
[m4_define([_m4_set([$1],]_m4_defn([_m4_arg])[)],
[1])m4_pushdef([_m4_set([$1])],
_m4_defn([_m4_arg]))-])]])))))])])
+373 -1388
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -2,8 +2,9 @@
<!--
bison.xsl - common templates for Bison XSLT.
$Id$
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+2 -1
View File
@@ -2,8 +2,9 @@
<!--
xml2dot.xsl - transform Bison XML Report into DOT.
$Id$
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+2 -1
View File
@@ -2,8 +2,9 @@
<!--
xml2text.xsl - transform Bison XML Report into plain text.
$Id$
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+1
View File
@@ -2,6 +2,7 @@
<!--
xml2html.xsl - transform Bison XML Report into XHTML.
$Id$
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
-1
View File
@@ -1,5 +1,4 @@
Makefile
bison.1
bison.aux
bison.cp
bison.cps
-25
View File
@@ -1,25 +0,0 @@
/Makefile
/bison.1
/bison.aux
/bison.cp
/bison.cps
/bison.dvi
/bison.fn
/bison.html
/bison.ky
/bison.log
/bison.pdf
/bison.pg
/bison.ps
/bison.toc
/bison.tp
/bison.vr
/cross-options.texi
/Makefile.in
/refcard.dvi
/refcard.log
/refcard.ps
/*.info*
/stamp-vti
/version.texi
/yacc.1
+1 -1
View File
@@ -23,7 +23,7 @@ PROJECT_NAME = "@PACKAGE_NAME@"
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = "@PACKAGE_VERSION@"
PROJECT_NUMBER = "@PACKAGE_VERSION@ @ID@"
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
+14 -6
View File
@@ -1,6 +1,5 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-
## Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007, 2008 Free Software
## Foundation, Inc.
## Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -54,11 +53,15 @@ dist_man_MANS = $(srcdir)/bison.1
EXTRA_DIST += $(dist_man_MANS:.1=.x) common.x
MAINTAINERCLEANFILES += $(dist_man_MANS)
# Depend on configure to get version number changes.
common_dep = $(top_srcdir)/configure $(srcdir)/common.x
# Depend on configure.ac to get version number changes.
common_dep = $(top_srcdir)/configure.ac $(srcdir)/common.x
srcsrcdir = $(top_srcdir)/bin
$(srcdir)/bison.1: $(common_dep) $(top_srcdir)/src/getargs.c
# Output from --help and --version that must not appear in the man page.
neutralize = \
perl -0777 -pi -e 's/\.PP\nId:.*\n//g'
# Differences to ignore when comparing the man page (the date).
remove_time_stamp = \
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
@@ -84,6 +87,7 @@ PREPATH = $(top_builddir)/src
--include=$*.x \
--include=$(srcdir)/common.x \
--output=$@.t `echo '$*' | sed 's,.*/,,'`
$(neutralize) $@.t
if $(remove_time_stamp) $@ >$@a.t 2>/dev/null && \
$(remove_time_stamp) $@.t | cmp $@a.t - >/dev/null 2>&1; then \
touch $@; \
@@ -107,7 +111,8 @@ doc: html
html-local: Doxyfile
$(DOXYGEN)
edit = sed -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
edit = sed -e "s|@ID@|$$Id|" \
-e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
-e 's,@top_builddir\@,$(top_builddir),g' \
-e 's,@top_srcdir\@,$(top_srcdir),g'
@@ -116,7 +121,10 @@ EXTRA_DIST += Doxyfile.in
CLEANFILES += Doxyfile
# Sed is used to generate Doxyfile from Doxyfile.in instead of
# configure, because the former is way faster than the latter.
Doxyfile: $(srcdir)/Doxyfile.in
# Moreover, this file is updated whenever ChangeLog is touched: using
# sed instead of configure saves us a lot of time.
Doxyfile: $(top_srcdir)/ChangeLog $(srcdir)/Doxyfile.in
Id=`grep '^\$$Id' $(top_srcdir)/ChangeLog`; \
$(edit) $(srcdir)/Doxyfile.in >Doxyfile
CLEANDIRS += html latex
+197
View File
@@ -0,0 +1,197 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
.TH BISON "1" "March 2008" "bison 2.3a+" "User Commands"
.SH NAME
bison \- GNU Project parser generator (yacc replacement)
.SH SYNOPSIS
.B bison
[\fIOPTION\fR]... \fIFILE\fR
.SH DESCRIPTION
.I Bison
is a parser generator in the style of
.IR yacc (1).
It should be upwardly compatible with input files designed
for
.IR yacc .
.PP
Input files should follow the
.I yacc
convention of ending in
.BR .y .
Unlike
.IR yacc ,
the generated files do not have fixed names, but instead use the prefix
of the input file.
Moreover, if you need to put
.I C++
code in the input file, you can end his name by a C++-like extension
(.ypp or .y++), then bison will follow your extension to name the
output file (.cpp or .c++).
For instance, a grammar description file named
.B parse.yxx
would produce the generated parser in a file named
.BR parse.tab.cxx ,
instead of
.IR yacc 's
.B y.tab.c
or old
.I Bison
version's
.BR parse.tab.c .
.PP
This description of the options that can be given to
.I bison
is adapted from the node
.B Invocation
in the
.B bison.texinfo
manual, which should be taken as authoritative.
.PP
.I Bison
supports both traditional single-letter options and mnemonic long
option names. Long option names are indicated with
.B \-\-
instead of
.BR \- .
Abbreviations for option names are allowed as long as they
are unique. When a long option takes an argument, like
.BR \-\-file-prefix ,
connect the option name and the argument with
.BR = .
.PP
Generate LALR(1) and GLR parsers.
.PP
Mandatory arguments to long options are mandatory for short options too.
The same is true for optional arguments.
.SS "Operation modes:"
.TP
\fB\-h\fR, \fB\-\-help\fR
display this help and exit
.TP
\fB\-V\fR, \fB\-\-version\fR
output version information and exit
.TP
\fB\-\-print\-localedir\fR
output directory containing locale\-dependent data
.TP
\fB\-\-print\-datadir\fR
output directory containing skeletons and XSLT
.TP
\fB\-y\fR, \fB\-\-yacc\fR
emulate POSIX Yacc
.TP
\fB\-W\fR, \fB\-\-warnings\fR=\fI[CATEGORY]\fR
report the warnings falling in CATEGORY
.SS "Parser:"
.TP
\fB\-L\fR, \fB\-\-language\fR=\fILANGUAGE\fR
specify the output programming language
.TP
\fB\-S\fR, \fB\-\-skeleton\fR=\fIFILE\fR
specify the skeleton to use
.TP
\fB\-t\fR, \fB\-\-debug\fR
instrument the parser for debugging
.TP
\fB\-\-locations\fR
enable locations computation
.TP
\fB\-p\fR, \fB\-\-name\-prefix\fR=\fIPREFIX\fR
prepend PREFIX to the external symbols
.TP
\fB\-l\fR, \fB\-\-no\-lines\fR
don't generate `#line' directives
.TP
\fB\-k\fR, \fB\-\-token\-table\fR
include a table of token names
.SS "Output:"
.TP
\fB\-\-defines\fR[=\fIFILE\fR]
also produce a header file
.TP
\fB\-d\fR
likewise but cannot specify FILE (for POSIX Yacc)
.TP
\fB\-r\fR, \fB\-\-report\fR=\fITHINGS\fR
also produce details on the automaton
.TP
\fB\-\-report\-file\fR=\fIFILE\fR
write report to FILE
.TP
\fB\-v\fR, \fB\-\-verbose\fR
same as `\-\-report=state'
.TP
\fB\-b\fR, \fB\-\-file\-prefix\fR=\fIPREFIX\fR
specify a PREFIX for output files
.TP
\fB\-o\fR, \fB\-\-output\fR=\fIFILE\fR
leave output to FILE
.TP
\fB\-g\fR, \fB\-\-graph\fR[=\fIFILE\fR]
also output a graph of the automaton
.TP
\fB\-x\fR, \fB\-\-xml\fR[=\fIFILE\fR]
also output an XML report of the automaton
(the XML schema is experimental)
.SS "Warning categories include:"
.TP
`midrule\-values'
unset or unused midrule values
.TP
`yacc'
incompatibilities with POSIX YACC
.TP
`all'
all the warnings
.TP
`no\-CATEGORY'
turn off warnings in CATEGORY
.TP
`none'
turn off all the warnings
.TP
`error'
treat warnings as errors
.SS "THINGS is a list of comma separated words that can include:"
.TP
`state'
describe the states
.TP
`itemset'
complete the core item sets with their closure
.TP
`lookahead'
explicitly associate lookahead tokens to items
.TP
`solved'
describe shift/reduce conflicts solving
.TP
`all'
include all the above information
.TP
`none'
disable the report
.SH AUTHOR
Written by Robert Corbett and Richard Stallman.
.SH "REPORTING BUGS"
Report bugs to <bug\-[email protected]>.
.SH COPYRIGHT
Copyright \(co 2007 Free Software Foundation, Inc.
.br
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
.SH "SEE ALSO"
.BR lex (1),
.BR flex (1),
.BR yacc (1).
.PP
The full documentation for
.B bison
is maintained as a Texinfo manual. If the
.B info
and
.B bison
programs are properly installed at your site, the command
.IP
.B info bison
.PP
should give you access to the complete manual.
+303 -558
View File
File diff suppressed because it is too large Load Diff
-3
View File
@@ -1,3 +0,0 @@
/Makefile
/Makefile.in
/bench.pl
+3 -1
View File
@@ -270,7 +270,9 @@ yylex (void)
/* Skip white space. */
while ((c = get_char ()) == ' ' || c == '\t')
continue;
{
}
/* process numbers */
if (c == '.' || isdigit (c))
-2
View File
@@ -1,2 +0,0 @@
/Makefile
/Makefile.in
-13
View File
@@ -1,13 +0,0 @@
/*.cc
/*.hh
/*.ll
/*.o
/*.output
/*.stamp
/*.tmp
/*.yy
/.deps
/Makefile
/Makefile.in
/calc++
/calc++.exe
-1
View File
@@ -1 +0,0 @@
external: gnulib
Submodule gnulib deleted from 58fe6dca7b
-2
View File
@@ -17,7 +17,6 @@ configmake.h
dirname.c
dirname.h
dup-safer.c
errno.in.h
error.c
error.h
exitfail.c
@@ -88,7 +87,6 @@ unitypes.h
uniwidth
uniwidth.h
unlocked-io.h
unsetenv.c
verify.h
wchar.h
wchar.in.h
-108
View File
@@ -1,108 +0,0 @@
/*.a
/*.o
/*~
/.deps
/Makefile
/Makefile.in
/argmatch.c
/argmatch.h
/basename.c
/c-ctype.c
/c-ctype.h
/c-strcase.h
/c-strcasecmp.c
/c-strncasecmp.c
/charset.alias
/config.charset
/config.h
/config.hin
/configmake.h
/dirname.c
/dirname.h
/dup-safer.c
/errno.in.h
/error.c
/error.h
/exitfail.c
/exitfail.h
/fd-safer.c
/fopen-safer.c
/getopt.c
/getopt.h
/getopt.in.h
/getopt1.c
/getopt_.h
/getopt_int.h
/gettext.h
/gnulib.mk
/hash.c
/hash.h
/intprops.h
/inttypes.h
/inttypes.in.h
/inttypes_.h
/localcharset.c
/localcharset.h
/malloc.c
/mbswidth.c
/mbswidth.h
/obstack.c
/obstack.h
/pipe-safer.c
/quote.c
/quote.h
/quotearg.c
/quotearg.h
/ref-add.sed
/ref-add.sin
/ref-del.sed
/ref-del.sin
/stamp-h1
/stdbool.h
/stdbool.in.h
/stdbool_.h
/stdint.h
/stdint.in.h
/stdint_.h
/stdio--.h
/stdio-safer.h
/stdlib.h
/stdlib.in.h
/stdlib_.h
/stpcpy.c
/streq.h
/strerror.c
/string.h
/string.in.h
/string_.h
/stripslash.c
/strndup.c
/strnlen.c
/strtol.c
/strtoul.c
/strverscmp.c
/strverscmp.h
/unistd--.h
/unistd-safer.h
/unistd.h
/unistd.in.h
/unistd_.h
/unitypes.h
/uniwidth
/uniwidth.h
/unlocked-io.h
/unsetenv.c
/verify.h
/wchar.h
/wchar.in.h
/wchar_.h
/wctype.h
/wctype.in.h
/wctype_.h
/wcwidth.c
/wcwidth.h
/xalloc-die.c
/xalloc.h
/xmalloc.c
/xstrndup.c
/xstrndup.h
+2 -3
View File
@@ -1,7 +1,6 @@
# Make bison/lib.
# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2008 Free Software Foundation,
# Inc.
# Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,7 +17,7 @@
include gnulib.mk
AM_CFLAGS = $(WARN_CFLAGS)
AM_CFLAGS = $(WARNING_CFLAGS)
# Implementation of bitsets.
bitsets_sources = \
+15 -10
View File
@@ -1,10 +1,10 @@
/* Array bitsets.
Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software: you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -13,9 +13,13 @@
GNU General Public License for more details.
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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "abitset.h"
#include <stddef.h>
@@ -30,13 +34,14 @@
static bitset_bindex
abitset_resize (bitset src, bitset_bindex size)
abitset_resize (bitset src ATTRIBUTE_UNUSED,
bitset_bindex size ATTRIBUTE_UNUSED)
{
/* These bitsets have a fixed size. */
if (BITSET_SIZE_ (src) != size)
abort ();
if (BITSET_SIZE_ (src) == size)
return size;
return size;
/* These bitsets have a fixed size. */
abort ();
}
/* Find list of up to NUM bits set in BSET starting from and including
+15 -14
View File
@@ -1,27 +1,28 @@
/* Functions to support abitsets.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _ABITSET_H
#define _ABITSET_H
#define _ABITSET_H
#include "bitset.h"
extern size_t abitset_bytes (bitset_bindex);
extern size_t abitset_bytes PARAMS ((bitset_bindex));
extern bitset abitset_init (bitset, bitset_bindex);
extern bitset abitset_init PARAMS ((bitset, bitset_bindex));
#endif
+66 -63
View File
@@ -1,28 +1,30 @@
/* Base bitset stuff.
Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _BBITSET_H
#define _BBITSET_H
#include "config.h"
#include "libiberty.h"
#include <stdbool.h>
#include <limits.h>
#include <stddef.h>
#include <sys/types.h>
/* Currently we support five flavours of bitsets:
BITSET_ARRAY: Array of bits (fixed size, fast for dense bitsets).
@@ -33,7 +35,7 @@
BITSET_TABLE: Expandable table of pointers to arrays of bits
(variable size, less storage for large sparse sets).
Faster than BITSET_LIST for random access.
BITSET_VARRAY: Variable array of bits (variable size, fast for
BITSET_VARRAY: Variable array of bits (variable size, fast for
dense bitsets).
BITSET_STATS: Wrapper bitset for internal use only. Used for gathering
statistics and/or better run-time checking.
@@ -47,8 +49,8 @@ extern const char * const bitset_type_names[];
enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC};
/* Data type used to store a word of bits. */
typedef unsigned long int bitset_word;
#define BITSET_WORD_BITS ((unsigned int) (CHAR_BIT * sizeof (bitset_word)))
typedef unsigned long bitset_word;
#define BITSET_WORD_BITS ((unsigned) (CHAR_BIT * sizeof (bitset_word)))
/* Bit index. In theory we might need a type wider than size_t, but
in practice we lose at most a factor of CHAR_BIT by going with
@@ -110,45 +112,46 @@ typedef union bitset_union *bitset;
/* The contents of this structure should be considered private. */
struct bitset_vtable
{
void (*set) (bitset, bitset_bindex);
void (*reset) (bitset, bitset_bindex);
bool (*toggle) (bitset, bitset_bindex);
bool (*test) (bitset, bitset_bindex);
bitset_bindex (*resize) (bitset, bitset_bindex);
bitset_bindex (*size) (bitset);
bitset_bindex (*count) (bitset);
void (*set) PARAMS ((bitset, bitset_bindex));
void (*reset) PARAMS ((bitset, bitset_bindex));
bool (*toggle) PARAMS ((bitset, bitset_bindex));
bool (*test) PARAMS ((bitset, bitset_bindex));
bitset_bindex (*resize) PARAMS ((bitset, bitset_bindex));
bitset_bindex (*size) PARAMS ((bitset));
bitset_bindex (*count) PARAMS ((bitset));
bool (*empty_p) (bitset);
void (*ones) (bitset);
void (*zero) (bitset);
bool (*empty_p) PARAMS ((bitset));
void (*ones) PARAMS ((bitset));
void (*zero) PARAMS ((bitset));
void (*copy) (bitset, bitset);
bool (*disjoint_p) (bitset, bitset);
bool (*equal_p) (bitset, bitset);
void (*not_) (bitset, bitset);
bool (*subset_p) (bitset, bitset);
void (*copy) PARAMS ((bitset, bitset));
bool (*disjoint_p) PARAMS ((bitset, bitset));
bool (*equal_p) PARAMS ((bitset, bitset));
void (*not) PARAMS ((bitset, bitset));
bool (*subset_p) PARAMS ((bitset, bitset));
void (*and_) (bitset, bitset, bitset);
bool (*and_cmp) (bitset, bitset, bitset);
void (*andn) (bitset, bitset, bitset);
bool (*andn_cmp) (bitset, bitset, bitset);
void (*or_) (bitset, bitset, bitset);
bool (*or_cmp) (bitset, bitset, bitset);
void (*xor_) (bitset, bitset, bitset);
bool (*xor_cmp) (bitset, bitset, bitset);
void (*and) PARAMS ((bitset, bitset, bitset));
bool (*and_cmp) PARAMS ((bitset, bitset, bitset));
void (*andn) PARAMS ((bitset, bitset, bitset));
bool (*andn_cmp) PARAMS ((bitset, bitset, bitset));
void (*or) PARAMS ((bitset, bitset, bitset));
bool (*or_cmp) PARAMS ((bitset, bitset, bitset));
void (*xor) PARAMS ((bitset, bitset, bitset));
bool (*xor_cmp) PARAMS ((bitset, bitset, bitset));
void (*and_or) (bitset, bitset, bitset, bitset);
bool (*and_or_cmp) (bitset, bitset, bitset, bitset);
void (*andn_or) (bitset, bitset, bitset, bitset);
bool (*andn_or_cmp) (bitset, bitset, bitset, bitset);
void (*or_and) (bitset, bitset, bitset, bitset);
bool (*or_and_cmp) (bitset, bitset, bitset, bitset);
void (*and_or) PARAMS ((bitset, bitset, bitset, bitset));
bool (*and_or_cmp) PARAMS ((bitset, bitset, bitset, bitset));
void (*andn_or) PARAMS ((bitset, bitset, bitset, bitset));
bool (*andn_or_cmp) PARAMS ((bitset, bitset, bitset, bitset));
void (*or_and) PARAMS ((bitset, bitset, bitset, bitset));
bool (*or_and_cmp) PARAMS ((bitset, bitset, bitset, bitset));
bitset_bindex (*list) (bitset, bitset_bindex *, bitset_bindex,
bitset_bindex *);
bitset_bindex (*list_reverse) (bitset, bitset_bindex *, bitset_bindex,
bitset_bindex *);
void (*free) (bitset);
bitset_bindex (*list) PARAMS ((bitset, bitset_bindex *,
bitset_bindex, bitset_bindex *));
bitset_bindex (*list_reverse) PARAMS ((bitset,
bitset_bindex *, bitset_bindex,
bitset_bindex *));
void (*free) PARAMS ((bitset));
enum bitset_type type;
};
@@ -217,14 +220,14 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
#define BITSET_EQUAL_P_(DST, SRC) (SRC)->b.vtable->equal_p (DST, SRC)
/* DST = ~SRC. */
#define BITSET_NOT_(DST, SRC) (SRC)->b.vtable->not_ (DST, SRC)
#define BITSET_NOT_(DST, SRC) (SRC)->b.vtable->not (DST, SRC)
/* Return DST == DST | SRC. */
#define BITSET_SUBSET_P_(DST, SRC) (SRC)->b.vtable->subset_p (DST, SRC)
/* DST = SRC1 & SRC2. */
#define BITSET_AND_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_ (DST, SRC1, SRC2)
#define BITSET_AND_(DST, SRC1, SRC2) (SRC1)->b.vtable->and (DST, SRC1, SRC2)
#define BITSET_AND_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_cmp (DST, SRC1, SRC2)
/* DST = SRC1 & ~SRC2. */
@@ -232,11 +235,11 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
#define BITSET_ANDN_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->andn_cmp (DST, SRC1, SRC2)
/* DST = SRC1 | SRC2. */
#define BITSET_OR_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_ (DST, SRC1, SRC2)
#define BITSET_OR_(DST, SRC1, SRC2) (SRC1)->b.vtable->or (DST, SRC1, SRC2)
#define BITSET_OR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_cmp (DST, SRC1, SRC2)
/* DST = SRC1 ^ SRC2. */
#define BITSET_XOR_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_ (DST, SRC1, SRC2)
#define BITSET_XOR_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor (DST, SRC1, SRC2)
#define BITSET_XOR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_cmp (DST, SRC1, SRC2)
@@ -278,24 +281,24 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
/* Private functions for bitset implementations. */
extern bool bitset_toggle_ (bitset, bitset_bindex);
extern bool bitset_toggle_ PARAMS ((bitset, bitset_bindex));
extern bitset_bindex bitset_count_ (bitset);
extern bitset_bindex bitset_count_ PARAMS ((bitset));
extern bitset_bindex bitset_size_ (bitset);
extern bitset_bindex bitset_size_ PARAMS ((bitset));
extern bool bitset_copy_ (bitset, bitset);
extern bool bitset_copy_ PARAMS ((bitset, bitset));
extern void bitset_and_or_ (bitset, bitset, bitset, bitset);
extern void bitset_and_or_ PARAMS ((bitset, bitset, bitset, bitset));
extern bool bitset_and_or_cmp_ (bitset, bitset, bitset, bitset);
extern bool bitset_and_or_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
extern void bitset_andn_or_ (bitset, bitset, bitset, bitset);
extern void bitset_andn_or_ PARAMS ((bitset, bitset, bitset, bitset));
extern bool bitset_andn_or_cmp_ (bitset, bitset, bitset, bitset);
extern bool bitset_andn_or_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
extern void bitset_or_and_ (bitset, bitset, bitset, bitset);
extern void bitset_or_and_ PARAMS ((bitset, bitset, bitset, bitset));
extern bool bitset_or_and_cmp_ (bitset, bitset, bitset, bitset);
extern bool bitset_or_and_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
#endif /* _BBITSET_H */
+22 -20
View File
@@ -1,10 +1,10 @@
/* General bitsets.
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software: you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -13,14 +13,16 @@
GNU General Public License for more details.
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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <config.h>
#include "bitset.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include "bitset.h"
#include "abitset.h"
#include "lbitset.h"
#include "ebitset.h"
@@ -43,9 +45,6 @@ bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
switch (type)
{
default:
abort ();
case BITSET_ARRAY:
bytes = abitset_bytes (n_bits);
break;
@@ -61,6 +60,9 @@ bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
case BITSET_VARRAY:
bytes = vbitset_bytes (n_bits);
break;
default:
abort ();
}
return bytes;
@@ -76,9 +78,6 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
switch (type)
{
default:
abort ();
case BITSET_ARRAY:
return abitset_init (bset, n_bits);
@@ -90,6 +89,9 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
case BITSET_VARRAY:
return vbitset_init (bset, n_bits);
default:
abort ();
}
}
@@ -109,7 +111,7 @@ bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned int attr)
/* Choose the type of bitset. Note that sometimes we will be asked
for a zero length fixed size bitset. */
/* If no attributes selected, choose a good compromise. */
if (!attr)
return BITSET_VARRAY;
@@ -136,7 +138,7 @@ bitset_alloc (bitset_bindex n_bits, enum bitset_type type)
bytes = bitset_bytes (type, n_bits);
bset = xcalloc (1, bytes);
bset = (bitset) xcalloc (1, bytes);
/* The cache is disabled until some elements are allocated. If we
have variable length arrays, then we may need to allocate a dummy
@@ -294,7 +296,7 @@ bitset_print (FILE *file, bitset bset, bool verbose)
if (verbose)
fprintf (file, "n_bits = %lu, set = {",
(unsigned long int) bitset_size (bset));
(unsigned long) bitset_size (bset));
pos = 30;
BITSET_FOR_EACH (iter, bset, i, 0)
@@ -305,7 +307,7 @@ bitset_print (FILE *file, bitset bset, bool verbose)
pos = 0;
}
fprintf (file, "%lu ", (unsigned long int) i);
fprintf (file, "%d ", i);
pos += 1 + (i >= 10) + (i >= 100);
};
@@ -419,9 +421,6 @@ bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
switch (op)
{
default:
abort ();
case BITSET_OP_OR_AND:
bitset_or (tmp, src1, src2);
changed = bitset_and_cmp (dst, src3, tmp);
@@ -436,6 +435,9 @@ bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
bitset_andn (tmp, src1, src2);
changed = bitset_or_cmp (dst, src3, tmp);
break;
default:
abort ();
}
bitset_free (tmp);
+62 -52
View File
@@ -1,19 +1,20 @@
/* Generic bitsets.
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _BITSET_H
#define _BITSET_H
@@ -22,12 +23,18 @@
Only use the functions and macros defined in this file. */
#include "bbitset.h"
#include "obstack.h"
#include <stdio.h>
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
/* obstack.h tries to be portable to K&R compilers, but its
__INT_TO_PTR macro generates diagnostics on compilers like Tru64 cc
that define __STDC__ to 0 when not in strict ANSI mode. The bitset
code assumes C89 or later, so it can avoid these glitches by
defining __INT_TO_PTR appropriately for C89 or later. */
#ifndef __INT_TO_PTR
# define __INT_TO_PTR(P) ((void *) ((P) + (char *) 0))
#endif
#include "obstack.h"
#include <stdio.h>
/* Attributes used to select a bitset implementation. */
enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */
@@ -96,37 +103,38 @@ typedef struct
/* Return bytes required for bitset of desired type and size. */
extern size_t bitset_bytes (enum bitset_type, bitset_bindex);
extern size_t bitset_bytes PARAMS ((enum bitset_type, bitset_bindex));
/* Initialise a bitset with desired type and size. */
extern bitset bitset_init (bitset, bitset_bindex, enum bitset_type);
extern bitset bitset_init PARAMS ((bitset, bitset_bindex, enum bitset_type));
/* Select an implementation type based on the desired bitset size
and attributes. */
extern enum bitset_type bitset_type_choose (bitset_bindex, bitset_attrs);
extern enum bitset_type bitset_type_choose PARAMS ((bitset_bindex,
bitset_attrs));
/* Create a bitset of desired type and size. The bitset is zeroed. */
extern bitset bitset_alloc (bitset_bindex, enum bitset_type);
extern bitset bitset_alloc PARAMS ((bitset_bindex, enum bitset_type));
/* Free bitset. */
extern void bitset_free (bitset);
extern void bitset_free PARAMS ((bitset));
/* Create a bitset of desired type and size using an obstack. The
bitset is zeroed. */
extern bitset bitset_obstack_alloc (struct obstack *bobstack,
bitset_bindex, enum bitset_type);
extern bitset bitset_obstack_alloc PARAMS ((struct obstack *bobstack,
bitset_bindex, enum bitset_type));
/* Free bitset allocated on obstack. */
extern void bitset_obstack_free (bitset);
extern void bitset_obstack_free PARAMS ((bitset));
/* Create a bitset of desired size and attributes. The bitset is zeroed. */
extern bitset bitset_create (bitset_bindex, bitset_attrs);
extern bitset bitset_create PARAMS ((bitset_bindex, bitset_attrs));
/* Return bitset type. */
extern enum bitset_type bitset_type_get (bitset);
extern enum bitset_type bitset_type_get PARAMS ((bitset));
/* Return bitset type name. */
extern const char *bitset_type_name_get (bitset);
extern const char *bitset_type_name_get PARAMS ((bitset));
/* Set bit BITNO in bitset BSET. */
@@ -178,7 +186,7 @@ bitset_test (bitset bset, bitset_bindex bitno)
#define bitset_size(SRC) BITSET_SIZE_ (SRC)
/* Change size of bitset. */
extern void bitset_resize (bitset, bitset_bindex);
extern void bitset_resize PARAMS ((bitset, bitset_bindex));
/* Return number of bits set in bitset SRC. */
#define bitset_count(SRC) BITSET_COUNT_ (SRC)
@@ -278,42 +286,43 @@ extern void bitset_resize (bitset, bitset_bindex);
BITSET_LIST_REVERSE_ (BSET, LIST, NUM, NEXT)
/* Return true if both bitsets are of the same type and size. */
extern bool bitset_compatible_p (bitset bset1, bitset bset2);
extern bool
bitset_compatible_p (bitset bset1, bitset bset2);
/* Find next set bit from the given bit index. */
extern bitset_bindex bitset_next (bitset, bitset_bindex);
extern bitset_bindex bitset_next PARAMS ((bitset, bitset_bindex));
/* Find previous set bit from the given bit index. */
extern bitset_bindex bitset_prev (bitset, bitset_bindex);
extern bitset_bindex bitset_prev PARAMS ((bitset, bitset_bindex));
/* Find first set bit. */
extern bitset_bindex bitset_first (bitset);
extern bitset_bindex bitset_first PARAMS ((bitset));
/* Find last set bit. */
extern bitset_bindex bitset_last (bitset);
extern bitset_bindex bitset_last PARAMS ((bitset));
/* Return nonzero if this is the only set bit. */
extern bool bitset_only_set_p (bitset, bitset_bindex);
extern bool bitset_only_set_p PARAMS ((bitset, bitset_bindex));
/* Dump bitset. */
extern void bitset_dump (FILE *, bitset);
extern void bitset_dump PARAMS ((FILE *, bitset));
/* Loop over all elements of BSET, starting with MIN, setting INDEX
to the index of each set bit. For example, the following will print
the bits set in a bitset:
bitset_bindex i;
bitset_bindex index;
bitset_iterator iter;
BITSET_FOR_EACH (iter, src, i, 0)
BITSET_FOR_EACH (iter, src, index, 0)
{
printf ("%lu ", (unsigned long int) i);
printf ("%ld ", index);
};
*/
#define BITSET_FOR_EACH(ITER, BSET, INDEX, MIN) \
for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \
(ITER.num == BITSET_LIST_SIZE) \
&& (ITER.num = bitset_list (BSET, ITER.list, \
(ITER.num == BITSET_LIST_SIZE) \
&& (ITER.num = bitset_list (BSET, ITER.list, \
BITSET_LIST_SIZE, &ITER.next));) \
for (ITER.i = 0; \
ITER.i < ITER.num && ((INDEX) = ITER.list[ITER.i], 1); \
@@ -321,20 +330,20 @@ extern void bitset_dump (FILE *, bitset);
/* Loop over all elements of BSET, in reverse order starting with
MIN, setting INDEX to the index of each set bit. For example, the
MIN, setting INDEX to the index of each set bit. For example, the
following will print the bits set in a bitset in reverse order:
bitset_bindex i;
bitset_bindex index;
bitset_iterator iter;
BITSET_FOR_EACH_REVERSE (iter, src, i, 0)
BITSET_FOR_EACH_REVERSE (iter, src, index, 0)
{
printf ("%lu ", (unsigned long int) i);
printf ("%ld ", index);
};
*/
#define BITSET_FOR_EACH_REVERSE(ITER, BSET, INDEX, MIN) \
for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \
(ITER.num == BITSET_LIST_SIZE) \
(ITER.num == BITSET_LIST_SIZE) \
&& (ITER.num = bitset_list_reverse (BSET, ITER.list, \
BITSET_LIST_SIZE, &ITER.next));) \
for (ITER.i = 0; \
@@ -365,27 +374,28 @@ extern void bitset_dump (FILE *, bitset);
/* Release any memory tied up with bitsets. */
extern void bitset_release_memory (void);
extern void bitset_release_memory PARAMS ((void));
/* Enable bitset stats gathering. */
extern void bitset_stats_enable (void);
extern void bitset_stats_enable PARAMS ((void));
/* Disable bitset stats gathering. */
extern void bitset_stats_disable (void);
extern void bitset_stats_disable PARAMS ((void));
/* Read bitset stats file of accummulated stats. */
void bitset_stats_read (const char *file_name);
void bitset_stats_read PARAMS ((const char *filename));
/* Write bitset stats file of accummulated stats. */
void bitset_stats_write (const char *file_name);
void bitset_stats_write PARAMS ((const char *filename));
/* Dump bitset stats. */
extern void bitset_stats_dump (FILE *);
extern void bitset_stats_dump PARAMS ((FILE *));
/* Function to debug bitset from debugger. */
extern void debug_bitset (bitset);
extern void debug_bitset PARAMS ((bitset));
/* Function to debug bitset stats from debugger. */
extern void debug_bitset_stats (void);
extern void debug_bitset_stats PARAMS ((void));
#endif /* _BITSET_H */
+45 -37
View File
@@ -1,10 +1,10 @@
/* Bitset statistics.
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software: you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -13,30 +13,38 @@
GNU General Public License for more details.
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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* This file is a wrapper bitset implementation for the other bitset
implementations. It provides bitset compatibility checking and
statistics gathering without having to instrument the bitset
implementations. When statistics gathering is enabled, the bitset
operations get vectored through here and we then call the appropriate
routines. */
routines.
*/
#include <config.h>
#include "bitset_stats.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "bbitset.h"
#include "abitset.h"
#include "ebitset.h"
#include "lbitset.h"
#include "vbitset.h"
#include "bitset_stats.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#ifdef HAVE_GETTEXT_H
#include "gettext.h"
#define _(Msgid) gettext (Msgid)
#else
#define _(Msgid) Msgid
#endif
/* Configuration macros. */
#define BITSET_STATS_FILE "bitset.dat"
@@ -46,29 +54,29 @@
/* Accessor macros. */
#define BITSET_STATS_ALLOCS_INC(TYPE) \
#define BITSET_STATS_ALLOCS_INC(TYPE) \
bitset_stats_info->types[(TYPE)].allocs++
#define BITSET_STATS_FREES_INC(BSET) \
#define BITSET_STATS_FREES_INC(BSET) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].frees++
#define BITSET_STATS_SETS_INC(BSET) \
#define BITSET_STATS_SETS_INC(BSET) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].sets++
#define BITSET_STATS_CACHE_SETS_INC(BSET) \
#define BITSET_STATS_CACHE_SETS_INC(BSET) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_sets++
#define BITSET_STATS_RESETS_INC(BSET) \
#define BITSET_STATS_RESETS_INC(BSET) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].resets++
#define BITSET_STATS_CACHE_RESETS_INC(BSET) \
#define BITSET_STATS_CACHE_RESETS_INC(BSET) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_resets++
#define BITSET_STATS_TESTS_INC(BSET) \
#define BITSET_STATS_TESTS_INC(BSET) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].tests++
#define BITSET_STATS_CACHE_TESTS_INC(BSET) \
#define BITSET_STATS_CACHE_TESTS_INC(BSET) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_tests++
#define BITSET_STATS_LISTS_INC(BSET) \
#define BITSET_STATS_LISTS_INC(BSET) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].lists++
#define BITSET_STATS_LIST_COUNTS_INC(BSET, I) \
#define BITSET_STATS_LIST_COUNTS_INC(BSET, I) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_counts[(I)]++
#define BITSET_STATS_LIST_SIZES_INC(BSET, I) \
#define BITSET_STATS_LIST_SIZES_INC(BSET, I) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_sizes[(I)]++
#define BITSET_STATS_LIST_DENSITY_INC(BSET, I) \
#define BITSET_STATS_LIST_DENSITY_INC(BSET, I) \
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_density[(I)]++
@@ -156,8 +164,8 @@ bitset_log_histogram_print (FILE *file, const char *name, const char *msg,
for (; i < n_bins; i++)
fprintf (file, "%*lu-%lu\t%8u (%5.1f%%)\n",
max_width - ((unsigned int) (0.30103 * (i) + 0.9999) + 1),
1UL << (i - 1),
(1UL << i) - 1,
(unsigned long) 1 << (i - 1),
((unsigned long) 1 << i) - 1,
bins[i],
(100.0 * bins[i]) / total);
}
@@ -237,17 +245,17 @@ bitset_stats_disable (void)
/* Read bitset statistics file. */
void
bitset_stats_read (const char *file_name)
bitset_stats_read (const char *filename)
{
FILE *file;
if (!bitset_stats_info)
return;
if (!file_name)
file_name = BITSET_STATS_FILE;
if (!filename)
filename = BITSET_STATS_FILE;
file = fopen (file_name, "r");
file = fopen (filename, "r");
if (file)
{
if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
@@ -267,17 +275,17 @@ bitset_stats_read (const char *file_name)
/* Write bitset statistics file. */
void
bitset_stats_write (const char *file_name)
bitset_stats_write (const char *filename)
{
FILE *file;
if (!bitset_stats_info)
return;
if (!file_name)
file_name = BITSET_STATS_FILE;
if (!filename)
filename = BITSET_STATS_FILE;
file = fopen (file_name, "w");
file = fopen (filename, "w");
if (file)
{
if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
@@ -692,32 +700,32 @@ bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
we are a wrapper over. */
switch (type)
{
default:
abort ();
case BITSET_ARRAY:
bytes = abitset_bytes (n_bits);
sbset = xcalloc (1, bytes);
sbset = (bitset) xcalloc (1, bytes);
abitset_init (sbset, n_bits);
break;
case BITSET_LIST:
bytes = lbitset_bytes (n_bits);
sbset = xcalloc (1, bytes);
sbset = (bitset) xcalloc (1, bytes);
lbitset_init (sbset, n_bits);
break;
case BITSET_TABLE:
bytes = ebitset_bytes (n_bits);
sbset = xcalloc (1, bytes);
sbset = (bitset) xcalloc (1, bytes);
ebitset_init (sbset, n_bits);
break;
case BITSET_VARRAY:
bytes = vbitset_bytes (n_bits);
sbset = xcalloc (1, bytes);
sbset = (bitset) xcalloc (1, bytes);
vbitset_init (sbset, n_bits);
break;
default:
abort ();
}
bset->s.bset = sbset;
+16 -14
View File
@@ -1,19 +1,20 @@
/* Functions to support bitset statistics.
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _BITSET_STATS_H
#define _BITSET_STATS_H
@@ -22,10 +23,11 @@
extern bool bitset_stats_enabled;
extern enum bitset_type bitset_stats_type_get (bitset);
extern enum bitset_type bitset_stats_type_get PARAMS ((bitset));
extern size_t bitset_stats_bytes (void);
extern size_t bitset_stats_bytes PARAMS ((void));
extern bitset bitset_stats_init (bitset, bitset_bindex, enum bitset_type);
extern bitset bitset_stats_init PARAMS ((bitset, bitset_bindex,
enum bitset_type));
#endif
+21 -16
View File
@@ -1,24 +1,29 @@
/* Bitset vectors.
Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This file is part of GCC.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
#include <config.h>
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#include "bitsetv.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include "bitsetv.h"
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
@@ -42,7 +47,7 @@ bitsetv_alloc (bitset_bindex n_vecs, bitset_bindex n_bits,
/* Allocate vector table at head of bitset array. */
vector_bytes = (n_vecs + 1) * sizeof (bitset) + bytes - 1;
vector_bytes -= vector_bytes % bytes;
bsetv = xcalloc (1, vector_bytes + bytes * n_vecs);
bsetv = (bitset *) xcalloc (1, vector_bytes + bytes * n_vecs);
for (i = 0; i < n_vecs; i++)
{
@@ -144,7 +149,7 @@ bitsetv_dump (FILE *file, char const *title, char const *subtitle,
fprintf (file, "%s\n", title);
for (i = 0; bsetv[i]; i++)
{
fprintf (file, "%s %lu\n", subtitle, (unsigned long int) i);
fprintf (file, "%s %lu\n", subtitle, (unsigned long) i);
bitset_dump (file, bsetv[i]);
}
@@ -159,7 +164,7 @@ debug_bitsetv (bitsetv bsetv)
for (i = 0; bsetv[i]; i++)
{
fprintf (stderr, "%lu: ", (unsigned long int) i);
fprintf (stderr, "%lu: ", (unsigned long) i);
debug_bitset (bsetv[i]);
}
+24 -20
View File
@@ -1,19 +1,20 @@
/* Bitset vectors.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _BITSETV_H
#define _BITSETV_H
@@ -24,35 +25,38 @@ typedef bitset * bitsetv;
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
type TYPE. */
extern bitsetv bitsetv_alloc (bitset_bindex, bitset_bindex, enum bitset_type);
extern bitsetv bitsetv_alloc PARAMS ((bitset_bindex, bitset_bindex,
enum bitset_type));
/* Create a vector of N_VECS bitsets, each of N_BITS, and with
attribute hints specified by ATTR. */
extern bitsetv bitsetv_create (bitset_bindex, bitset_bindex, unsigned int);
extern bitsetv bitsetv_create PARAMS ((bitset_bindex, bitset_bindex,
unsigned int));
/* Free vector of bitsets. */
extern void bitsetv_free (bitsetv);
extern void bitsetv_free PARAMS ((bitsetv));
/* Zero vector of bitsets. */
extern void bitsetv_zero (bitsetv);
extern void bitsetv_zero PARAMS ((bitsetv));
/* Set vector of bitsets. */
extern void bitsetv_ones (bitsetv);
extern void bitsetv_ones PARAMS ((bitsetv));
/* Given a vector BSETV of N bitsets of size N, modify its contents to
be the transitive closure of what was given. */
extern void bitsetv_transitive_closure (bitsetv);
extern void bitsetv_transitive_closure PARAMS ((bitsetv));
/* Given a vector BSETV of N bitsets of size N, modify its contents to
be the reflexive transitive closure of what was given. This is
the same as transitive closure but with all bits on the diagonal
of the bit matrix set. */
extern void bitsetv_reflexive_transitive_closure (bitsetv);
extern void bitsetv_reflexive_transitive_closure PARAMS ((bitsetv));
/* Dump vector of bitsets. */
extern void bitsetv_dump (FILE *, const char *, const char *, bitsetv);
extern void bitsetv_dump PARAMS ((FILE *, const char *,
const char *, bitsetv));
/* Function to debug vector of bitsets from debugger. */
extern void debug_bitsetv (bitsetv);
extern void debug_bitsetv PARAMS ((bitsetv));
#endif /* _BITSETV_H */
+36 -28
View File
@@ -1,10 +1,10 @@
/* Functions to support expandable bitsets.
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software: you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -13,12 +13,15 @@
GNU General Public License for more details.
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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "ebitset.h"
#include "obstack.h"
#include <stdlib.h>
#include <string.h>
@@ -49,7 +52,7 @@
/* Number of bits stored in each element. */
#define EBITSET_ELT_BITS \
((unsigned int) (EBITSET_ELT_WORDS * BITSET_WORD_BITS))
((unsigned) (EBITSET_ELT_WORDS * BITSET_WORD_BITS))
/* Ebitset element. We use an array of bits. */
typedef struct ebitset_elt_struct
@@ -112,13 +115,15 @@ static ebitset_elt *ebitset_free_list; /* Free list of bitset elements. */
((BSET)->b.cindex = (EINDEX) * EBITSET_ELT_WORDS, \
(BSET)->b.cdata = EBITSET_WORDS (EBITSET_ELTS (BSET) [EINDEX]))
#undef min
#undef max
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
static bitset_bindex
ebitset_resize (bitset src, bitset_bindex n_bits)
ebitset_resize (src, n_bits)
bitset src;
bitset_bindex n_bits;
{
bitset_windex oldsize;
bitset_windex newsize;
@@ -133,7 +138,7 @@ ebitset_resize (bitset src, bitset_bindex n_bits)
{
bitset_windex size;
/* The bitset needs to grow. If we already have enough memory
/* The bitset needs to grow. If we already have enough memory
allocated, then just zero what we need. */
if (newsize > EBITSET_ASIZE (src))
{
@@ -146,13 +151,13 @@ ebitset_resize (bitset src, bitset_bindex n_bits)
size = newsize;
else
size = newsize + newsize / 4;
EBITSET_ELTS (src)
= realloc (EBITSET_ELTS (src), size * sizeof (ebitset_elt *));
EBITSET_ASIZE (src) = size;
}
memset (EBITSET_ELTS (src) + oldsize, 0,
memset (EBITSET_ELTS (src) + oldsize, 0,
(newsize - oldsize) * sizeof (ebitset_elt *));
}
else
@@ -207,13 +212,15 @@ ebitset_elt_alloc (void)
#define OBSTACK_CHUNK_FREE free
#endif
#if ! defined __GNUC__ || __GNUC__ < 2
#if !defined(__GNUC__) || (__GNUC__ < 2)
#define __alignof__(type) 0
#endif
obstack_specify_allocation (&ebitset_obstack, OBSTACK_CHUNK_SIZE,
__alignof__ (ebitset_elt),
(void *(*)PARAMS ((long)))
OBSTACK_CHUNK_ALLOC,
(void (*)PARAMS ((void *)))
OBSTACK_CHUNK_FREE);
}
@@ -319,9 +326,6 @@ ebitset_elt_find (bitset bset, bitset_bindex bindex,
switch (mode)
{
default:
abort ();
case EBITSET_FIND:
return 0;
@@ -337,6 +341,9 @@ ebitset_elt_find (bitset bset, bitset_bindex bindex,
case EBITSET_SUBST:
return &ebitset_zero_elts[0];
default:
abort ();
}
}
@@ -831,14 +838,15 @@ ebitset_list (bitset bset, bitset_bindex *list,
/* Ensure that any unused bits within the last element are clear. */
static inline void
ebitset_unused_clear (bitset dst)
ebitset_unused_clear (dst)
bitset dst;
{
unsigned int last_bit;
bitset_bindex n_bits;
n_bits = BITSET_NBITS_ (dst);
last_bit = n_bits % EBITSET_ELT_BITS;
if (last_bit)
{
bitset_windex eindex;
@@ -846,20 +854,20 @@ ebitset_unused_clear (bitset dst)
ebitset_elt *elt;
elts = EBITSET_ELTS (dst);
eindex = n_bits / EBITSET_ELT_BITS;
elt = elts[eindex];
if (elt)
{
bitset_windex windex;
bitset_windex woffset;
bitset_word *srcp = EBITSET_WORDS (elt);
windex = n_bits / BITSET_WORD_BITS;
woffset = eindex * EBITSET_ELT_WORDS;
srcp[windex - woffset] &= ((bitset_word) 1 << last_bit) - 1;
srcp[windex - woffset] &= ((bitset_word) 1 << last_bit) - 1;
windex++;
for (; (windex - woffset) < EBITSET_ELT_WORDS; windex++)
srcp[windex - woffset] = 0;
@@ -1087,9 +1095,6 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
dstp = EBITSET_WORDS (delt);
switch (op)
{
default:
abort ();
case BITSET_OP_OR:
for (i = 0; i < EBITSET_ELT_WORDS; i++, dstp++)
{
@@ -1141,6 +1146,9 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
}
}
break;
default:
abort ();
}
if (!ebitset_elt_zero_p (delt))
+16 -15
View File
@@ -1,29 +1,30 @@
/* Functions to support ebitsets.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _EBITSET_H
#define _EBITSET_H
#define _EBITSET_H
#include "bitset.h"
extern size_t ebitset_bytes (bitset_bindex);
extern size_t ebitset_bytes PARAMS ((bitset_bindex));
extern bitset ebitset_init (bitset, bitset_bindex);
extern bitset ebitset_init PARAMS ((bitset, bitset_bindex));
extern void ebitset_release_memory (void);
extern void ebitset_release_memory PARAMS ((void));
#endif
+28 -22
View File
@@ -1,10 +1,10 @@
/* Functions to support link list bitsets.
Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Contributed by Michael Hayes ([email protected]).
This program is free software: you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -13,12 +13,15 @@
GNU General Public License for more details.
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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "lbitset.h"
#include "obstack.h"
#include <stddef.h>
#include <stdlib.h>
@@ -38,7 +41,7 @@
/* Number of words to use for each element. The larger the value the
greater the size of the cache and the shorter the time to find a given bit
but the more memory wasted for sparse bitsets and the longer the time
to search for set bits.
to search for set bits.
The routines that dominate timing profiles are lbitset_elt_find
and lbitset_elt_link, especially when accessing the bits randomly. */
@@ -51,7 +54,7 @@ typedef bitset_word lbitset_word;
/* Number of bits stored in each element. */
#define LBITSET_ELT_BITS \
((unsigned int) (LBITSET_ELT_WORDS * LBITSET_WORD_BITS))
((unsigned) (LBITSET_ELT_WORDS * LBITSET_WORD_BITS))
/* Lbitset element. We use an array of bits for each element.
These are linked together in a doubly-linked list. */
@@ -75,7 +78,7 @@ static struct obstack lbitset_obstack;
static bool lbitset_obstack_init = false;
static lbitset_elt *lbitset_free_list; /* Free list of bitset elements. */
extern void debug_lbitset (bitset);
extern void debug_lbitset PARAMS ((bitset));
#define LBITSET_CURRENT1(X) \
((lbitset_elt *) (void *) ((char *) (X) - offsetof (lbitset_elt, words)))
@@ -118,13 +121,15 @@ lbitset_elt_alloc (void)
#define OBSTACK_CHUNK_FREE free
#endif
#if ! defined __GNUC__ || __GNUC__ < 2
#if !defined(__GNUC__) || (__GNUC__ < 2)
#define __alignof__(type) 0
#endif
obstack_specify_allocation (&lbitset_obstack, OBSTACK_CHUNK_SIZE,
__alignof__ (lbitset_elt),
(void *(*)PARAMS ((long)))
OBSTACK_CHUNK_ALLOC,
(void (*)PARAMS ((void *)))
OBSTACK_CHUNK_FREE);
}
@@ -360,9 +365,6 @@ lbitset_elt_find (bitset bset, bitset_windex windex,
switch (mode)
{
default:
abort ();
case LBITSET_FIND:
return 0;
@@ -376,6 +378,9 @@ lbitset_elt_find (bitset bset, bitset_windex windex,
case LBITSET_SUBST:
return &lbitset_zero_elts[0];
default:
abort ();
}
}
@@ -878,25 +883,26 @@ lbitset_empty_p (bitset dst)
/* Ensure that any unused bits within the last element are clear. */
static inline void
lbitset_unused_clear (bitset dst)
lbitset_unused_clear (dst)
bitset dst;
{
unsigned int last_bit;
bitset_bindex n_bits;
n_bits = BITSET_SIZE_ (dst);
last_bit = n_bits % LBITSET_ELT_BITS;
if (last_bit)
{
lbitset_elt *elt;
bitset_windex windex;
bitset_word *srcp;
elt = LBITSET_TAIL (dst);
srcp = elt->words;
windex = n_bits / BITSET_WORD_BITS;
srcp[windex - elt->index] &= ((bitset_word) 1 << last_bit) - 1;
srcp[windex - elt->index] &= ((bitset_word) 1 << last_bit) - 1;
windex++;
for (; (windex - elt->index) < LBITSET_ELT_WORDS; windex++)
@@ -1114,9 +1120,6 @@ lbitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
dstp = dtmp->words;
switch (op)
{
default:
abort ();
case BITSET_OP_OR:
for (i = 0; i < LBITSET_ELT_WORDS; i++, dstp++)
{
@@ -1168,6 +1171,9 @@ lbitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
}
}
break;
default:
abort ();
}
if (!lbitset_elt_zero_p (dtmp))
@@ -1385,7 +1391,7 @@ debug_lbitset (bitset bset)
for (elt = LBITSET_HEAD (bset); elt; elt = elt->next)
{
fprintf (stderr, "Elt %lu\n", (unsigned long int) elt->index);
fprintf (stderr, "Elt %lu\n", (unsigned long) elt->index);
for (i = 0; i < LBITSET_ELT_WORDS; i++)
{
unsigned int j;
+16 -15
View File
@@ -1,29 +1,30 @@
/* Functions to support lbitsets.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _LBITSET_H
#define _LBITSET_H
#define _LBITSET_H
#include "bitset.h"
extern size_t lbitset_bytes (bitset_bindex);
extern size_t lbitset_bytes PARAMS ((bitset_bindex));
extern bitset lbitset_init (bitset, bitset_bindex);
extern bitset lbitset_init PARAMS ((bitset, bitset_bindex));
extern void lbitset_release_memory (void);
extern void lbitset_release_memory PARAMS ((void));
#endif
+7 -30
View File
@@ -1,35 +1,12 @@
/* Fake libiberty.h for Bison.
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
/* Dummy libiberty header file. */
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
#define PARAMS(X) X
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define xmalloc malloc
#define xcalloc calloc
#define xrealloc realloc
#define xalloc_die()
/* Bison depends on libiberty's implementation of bitsets, which
requires a `libiberty.h' file. This file provides the minimum
services. */
#ifndef BISON_LIBIBERTY_H_
# define BISON_LIBIBERTY_H_ 1
# ifndef __attribute__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
# define __attribute__(x)
# endif
# endif
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
# include "xalloc.h"
#endif /* ! BISON_LIBIBERTY_H_ */
+144 -75
View File
@@ -1,10 +1,10 @@
/* Variable array bitsets.
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software: you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -13,45 +13,51 @@
GNU General Public License for more details.
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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "vbitset.h"
#include <stdlib.h>
#include <string.h>
/* This file implements variable size bitsets stored as a variable
length array of words. Any unused bits in the last word must be
zero.
zero.
Note that binary or ternary operations assume that each bitset operand
has the same size.
*/
static void vbitset_unused_clear (bitset);
static void vbitset_unused_clear PARAMS ((bitset));
static void vbitset_set (bitset, bitset_bindex);
static void vbitset_reset (bitset, bitset_bindex);
static bool vbitset_test (bitset, bitset_bindex);
static bitset_bindex vbitset_list (bitset, bitset_bindex *,
bitset_bindex, bitset_bindex *);
static bitset_bindex vbitset_list_reverse (bitset, bitset_bindex *,
bitset_bindex, bitset_bindex *);
static void vbitset_set PARAMS ((bitset, bitset_bindex));
static void vbitset_reset PARAMS ((bitset, bitset_bindex));
static bool vbitset_test PARAMS ((bitset, bitset_bindex));
static bitset_bindex vbitset_list PARAMS ((bitset, bitset_bindex *,
bitset_bindex,
bitset_bindex *));
static bitset_bindex vbitset_list_reverse PARAMS ((bitset, bitset_bindex *,
bitset_bindex,
bitset_bindex *));
#define VBITSET_N_WORDS(N) (((N) + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS)
#define VBITSET_WORDS(X) ((X)->b.cdata)
#define VBITSET_SIZE(X) ((X)->b.csize)
#define VBITSET_ASIZE(X) ((X)->v.size)
#undef min
#undef max
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
static bitset_bindex
vbitset_resize (bitset src, bitset_bindex n_bits)
vbitset_resize (src, n_bits)
bitset src;
bitset_bindex n_bits;
{
bitset_windex oldsize;
bitset_windex newsize;
@@ -66,7 +72,7 @@ vbitset_resize (bitset src, bitset_bindex n_bits)
{
bitset_windex size;
/* The bitset needs to grow. If we already have enough memory
/* The bitset needs to grow. If we already have enough memory
allocated, then just zero what we need. */
if (newsize > VBITSET_ASIZE (src))
{
@@ -79,13 +85,13 @@ vbitset_resize (bitset src, bitset_bindex n_bits)
size = newsize;
else
size = newsize + newsize / 4;
VBITSET_WORDS (src)
= realloc (VBITSET_WORDS (src), size * sizeof (bitset_word));
VBITSET_ASIZE (src) = size;
}
memset (VBITSET_WORDS (src) + oldsize, 0,
memset (VBITSET_WORDS (src) + oldsize, 0,
(newsize - oldsize) * sizeof (bitset_word));
VBITSET_SIZE (src) = newsize;
}
@@ -337,7 +343,8 @@ vbitset_unused_clear (dst)
static void
vbitset_ones (bitset dst)
vbitset_ones (dst)
bitset dst;
{
bitset_word *dstp = VBITSET_WORDS (dst);
unsigned int bytes;
@@ -350,7 +357,8 @@ vbitset_ones (bitset dst)
static void
vbitset_zero (bitset dst)
vbitset_zero (dst)
bitset dst;
{
bitset_word *dstp = VBITSET_WORDS (dst);
unsigned int bytes;
@@ -362,7 +370,8 @@ vbitset_zero (bitset dst)
static bool
vbitset_empty_p (bitset dst)
vbitset_empty_p (dst)
bitset dst;
{
unsigned int i;
bitset_word *dstp = VBITSET_WORDS (dst);
@@ -376,7 +385,9 @@ vbitset_empty_p (bitset dst)
static void
vbitset_copy1 (bitset dst, bitset src)
vbitset_copy1 (dst, src)
bitset dst;
bitset src;
{
bitset_word *srcp;
bitset_word *dstp;
@@ -401,7 +412,9 @@ vbitset_copy1 (bitset dst, bitset src)
static void
vbitset_not (bitset dst, bitset src)
vbitset_not (dst, src)
bitset dst;
bitset src;
{
unsigned int i;
bitset_word *srcp;
@@ -424,9 +437,11 @@ vbitset_not (bitset dst, bitset src)
sizeof (bitset_word) * (dsize - ssize));
}
static bool
vbitset_equal_p (bitset dst, bitset src)
vbitset_equal_p (dst, src)
bitset dst;
bitset src;
{
unsigned int i;
bitset_word *srcp = VBITSET_WORDS (src);
@@ -456,14 +471,16 @@ vbitset_equal_p (bitset dst, bitset src)
static bool
vbitset_subset_p (bitset dst, bitset src)
vbitset_subset_p (dst, src)
bitset dst;
bitset src;
{
unsigned int i;
bitset_word *srcp = VBITSET_WORDS (src);
bitset_word *dstp = VBITSET_WORDS (dst);
bitset_windex ssize = VBITSET_SIZE (src);
bitset_windex dsize = VBITSET_SIZE (dst);
for (i = 0; i < min (ssize, dsize); i++, dstp++, srcp++)
if (*dstp != (*srcp | *dstp))
return 0;
@@ -480,7 +497,9 @@ vbitset_subset_p (bitset dst, bitset src)
static bool
vbitset_disjoint_p (bitset dst, bitset src)
vbitset_disjoint_p (dst, src)
bitset dst;
bitset src;
{
unsigned int i;
bitset_word *srcp = VBITSET_WORDS (src);
@@ -497,7 +516,10 @@ vbitset_disjoint_p (bitset dst, bitset src)
static void
vbitset_and (bitset dst, bitset src1, bitset src2)
vbitset_and (dst, src1, src2)
bitset dst;
bitset src1;
bitset src2;
{
unsigned int i;
bitset_word *src1p;
@@ -518,13 +540,16 @@ vbitset_and (bitset dst, bitset src1, bitset src2)
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ & *src2p++;
memset (dstp, 0, sizeof (bitset_word) * (dsize - min (ssize1, ssize2)));
}
static bool
vbitset_and_cmp (bitset dst, bitset src1, bitset src2)
vbitset_and_cmp (dst, src1, src2)
bitset dst;
bitset src1;
bitset src2;
{
unsigned int i;
int changed = 0;
@@ -547,14 +572,14 @@ vbitset_and_cmp (bitset dst, bitset src1, bitset src2)
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ & *src2p++;
if (*dstp != tmp)
{
changed = 1;
*dstp = tmp;
}
}
if (ssize2 > ssize1)
{
src1p = src2p;
@@ -577,7 +602,10 @@ vbitset_and_cmp (bitset dst, bitset src1, bitset src2)
static void
vbitset_andn (bitset dst, bitset src1, bitset src2)
vbitset_andn (dst, src1, src2)
bitset dst;
bitset src1;
bitset src2;
{
unsigned int i;
bitset_word *src1p;
@@ -598,7 +626,7 @@ vbitset_andn (bitset dst, bitset src1, bitset src2)
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ & ~(*src2p++);
if (ssize2 > ssize1)
{
for (; i < ssize2; i++)
@@ -617,7 +645,10 @@ vbitset_andn (bitset dst, bitset src1, bitset src2)
static bool
vbitset_andn_cmp (bitset dst, bitset src1, bitset src2)
vbitset_andn_cmp (dst, src1, src2)
bitset dst;
bitset src1;
bitset src2;
{
unsigned int i;
int changed = 0;
@@ -640,14 +671,14 @@ vbitset_andn_cmp (bitset dst, bitset src1, bitset src2)
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ & ~(*src2p++);
if (*dstp != tmp)
{
changed = 1;
*dstp = tmp;
}
}
if (ssize2 > ssize1)
{
for (; i < ssize2; i++, dstp++)
@@ -666,7 +697,7 @@ vbitset_andn_cmp (bitset dst, bitset src1, bitset src2)
for (; i < ssize1; i++, dstp++)
{
bitset_word tmp = *src1p++;
if (*dstp != tmp)
{
changed = 1;
@@ -682,7 +713,10 @@ vbitset_andn_cmp (bitset dst, bitset src1, bitset src2)
static void
vbitset_or (bitset dst, bitset src1, bitset src2)
vbitset_or (dst, src1, src2)
bitset dst;
bitset src1;
bitset src2;
{
unsigned int i;
bitset_word *src1p;
@@ -703,7 +737,7 @@ vbitset_or (bitset dst, bitset src1, bitset src2)
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ | *src2p++;
if (ssize2 > ssize1)
{
src1p = src2p;
@@ -718,7 +752,10 @@ vbitset_or (bitset dst, bitset src1, bitset src2)
static bool
vbitset_or_cmp (bitset dst, bitset src1, bitset src2)
vbitset_or_cmp (dst, src1, src2)
bitset dst;
bitset src1;
bitset src2;
{
unsigned int i;
int changed = 0;
@@ -741,14 +778,14 @@ vbitset_or_cmp (bitset dst, bitset src1, bitset src2)
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ | *src2p++;
if (*dstp != tmp)
{
changed = 1;
*dstp = tmp;
}
}
if (ssize2 > ssize1)
{
src1p = src2p;
@@ -758,7 +795,7 @@ vbitset_or_cmp (bitset dst, bitset src1, bitset src2)
for (; i < ssize1; i++, dstp++)
{
bitset_word tmp = *src1p++;
if (*dstp != tmp)
{
changed = 1;
@@ -773,7 +810,10 @@ vbitset_or_cmp (bitset dst, bitset src1, bitset src2)
static void
vbitset_xor (bitset dst, bitset src1, bitset src2)
vbitset_xor (dst, src1, src2)
bitset dst;
bitset src1;
bitset src2;
{
unsigned int i;
bitset_word *src1p;
@@ -794,7 +834,7 @@ vbitset_xor (bitset dst, bitset src1, bitset src2)
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ ^ *src2p++;
if (ssize2 > ssize1)
{
src1p = src2p;
@@ -809,7 +849,10 @@ vbitset_xor (bitset dst, bitset src1, bitset src2)
static bool
vbitset_xor_cmp (bitset dst, bitset src1, bitset src2)
vbitset_xor_cmp (dst, src1, src2)
bitset dst;
bitset src1;
bitset src2;
{
unsigned int i;
int changed = 0;
@@ -832,14 +875,14 @@ vbitset_xor_cmp (bitset dst, bitset src1, bitset src2)
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ ^ *src2p++;
if (*dstp != tmp)
{
changed = 1;
*dstp = tmp;
}
}
if (ssize2 > ssize1)
{
src1p = src2p;
@@ -849,7 +892,7 @@ vbitset_xor_cmp (bitset dst, bitset src1, bitset src2)
for (; i < ssize1; i++, dstp++)
{
bitset_word tmp = *src1p++;
if (*dstp != tmp)
{
changed = 1;
@@ -867,7 +910,11 @@ vbitset_xor_cmp (bitset dst, bitset src1, bitset src2)
bitsets. */
static void
vbitset_and_or (bitset dst, bitset src1, bitset src2, bitset src3)
vbitset_and_or (dst, src1, src2, src3)
bitset dst;
bitset src1;
bitset src2;
bitset src3;
{
unsigned int i;
bitset_word *src1p;
@@ -875,7 +922,7 @@ vbitset_and_or (bitset dst, bitset src1, bitset src2, bitset src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
{
@@ -897,7 +944,11 @@ vbitset_and_or (bitset dst, bitset src1, bitset src2, bitset src3)
static bool
vbitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
vbitset_and_or_cmp (dst, src1, src2, src3)
bitset dst;
bitset src1;
bitset src2;
bitset src3;
{
unsigned int i;
int changed = 0;
@@ -906,7 +957,7 @@ vbitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
return bitset_and_or_cmp_ (dst, src1, src2, src3);
@@ -918,11 +969,11 @@ vbitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
for (i = 0; i < size; i++, dstp++)
{
bitset_word tmp = (*src1p++ & *src2p++) | *src3p++;
if (*dstp != tmp)
{
changed = 1;
@@ -934,7 +985,11 @@ vbitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
static void
vbitset_andn_or (bitset dst, bitset src1, bitset src2, bitset src3)
vbitset_andn_or (dst, src1, src2, src3)
bitset dst;
bitset src1;
bitset src2;
bitset src3;
{
unsigned int i;
bitset_word *src1p;
@@ -942,7 +997,7 @@ vbitset_andn_or (bitset dst, bitset src1, bitset src2, bitset src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
{
@@ -964,7 +1019,11 @@ vbitset_andn_or (bitset dst, bitset src1, bitset src2, bitset src3)
static bool
vbitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
vbitset_andn_or_cmp (dst, src1, src2, src3)
bitset dst;
bitset src1;
bitset src2;
bitset src3;
{
unsigned int i;
int changed = 0;
@@ -973,7 +1032,7 @@ vbitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
return bitset_andn_or_cmp_ (dst, src1, src2, src3);
@@ -985,11 +1044,11 @@ vbitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
for (i = 0; i < size; i++, dstp++)
{
bitset_word tmp = (*src1p++ & ~(*src2p++)) | *src3p++;
if (*dstp != tmp)
{
changed = 1;
@@ -1001,7 +1060,11 @@ vbitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
static void
vbitset_or_and (bitset dst, bitset src1, bitset src2, bitset src3)
vbitset_or_and (dst, src1, src2, src3)
bitset dst;
bitset src1;
bitset src2;
bitset src3;
{
unsigned int i;
bitset_word *src1p;
@@ -1009,7 +1072,7 @@ vbitset_or_and (bitset dst, bitset src1, bitset src2, bitset src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
{
@@ -1024,14 +1087,18 @@ vbitset_or_and (bitset dst, bitset src1, bitset src2, bitset src3)
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
for (i = 0; i < size; i++)
*dstp++ = (*src1p++ | *src2p++) & *src3p++;
}
static bool
vbitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
vbitset_or_and_cmp (dst, src1, src2, src3)
bitset dst;
bitset src1;
bitset src2;
bitset src3;
{
unsigned int i;
int changed = 0;
@@ -1040,7 +1107,7 @@ vbitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
return bitset_or_and_cmp_ (dst, src1, src2, src3);
@@ -1052,11 +1119,11 @@ vbitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
for (i = 0; i < size; i++, dstp++)
{
bitset_word tmp = (*src1p++ | *src2p++) & *src3p++;
if (*dstp != tmp)
{
changed = 1;
@@ -1067,8 +1134,10 @@ vbitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
}
static void
vbitset_copy (bitset dst, bitset src)
void
vbitset_copy (dst, src)
bitset dst;
bitset src;
{
if (BITSET_COMPATIBLE_ (dst, src))
vbitset_copy1 (dst, src);
+15 -14
View File
@@ -1,27 +1,28 @@
/* Functions to support vbitsets.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _VBITSET_H
#define _VBITSET_H
#define _VBITSET_H
#include "bitset.h"
extern size_t vbitset_bytes (bitset_bindex);
extern size_t vbitset_bytes PARAMS ((bitset_bindex));
extern bitset vbitset_init (bitset, bitset_bindex);
extern bitset vbitset_init PARAMS ((bitset, bitset_bindex));
#endif
-5
View File
@@ -4,8 +4,6 @@ config-h.m4
dirname.m4
dos.m4
double-slash-root.m4
environ.m4
errno_h.m4
error.m4
exitfail.m4
extensions.m4
@@ -39,7 +37,6 @@ po.m4
progtest.m4
quote.m4
quotearg.m4
setenv.m4
stdbool.m4
stdint.m4
stdint_h.m4
@@ -53,12 +50,10 @@ strnlen.m4
strtol.m4
strtoul.m4
strverscmp.m4
threadlib.m4
unistd-safer.m4
unistd_h.m4
unlocked-io.m4
warning.m4
warnings.m4
wchar.m4
wchar_t.m4
wctype.m4
-68
View File
@@ -1,68 +0,0 @@
/absolute-header.m4
/argmatch.m4
/config-h.m4
/dirname.m4
/dos.m4
/double-slash-root.m4
/environ.m4
/errno_h.m4
/error.m4
/exitfail.m4
/extensions.m4
/getopt.m4
/gettext.m4
/gnulib-cache.m4
/gnulib-common.m4
/gnulib-comp.m4
/gnulib-tool.m4
/hash.m4
/iconv.m4
/include_next.m4
/inline.m4
/intlmacosx.m4
/inttypes-h.m4
/inttypes-pri.m4
/inttypes.m4
/javacomp.m4
/javaexec.m4
/lib-ld.m4
/lib-link.m4
/lib-prefix.m4
/localcharset.m4
/longlong.m4
/malloc.m4
/mbrtowc.m4
/mbstate_t.m4
/mbswidth.m4
/nls.m4
/po.m4
/progtest.m4
/quote.m4
/quotearg.m4
/setenv.m4
/stdbool.m4
/stdint.m4
/stdint_h.m4
/stdio-safer.m4
/stdlib_h.m4
/stpcpy.m4
/strerror.m4
/string_h.m4
/strndup.m4
/strnlen.m4
/strtol.m4
/strtoul.m4
/strverscmp.m4
/threadlib.m4
/unistd-safer.m4
/unistd_h.m4
/unlocked-io.m4
/warning.m4
/warnings.m4
/wchar.m4
/wchar_t.m4
/wctype.m4
/wcwidth.m4
/wint_t.m4
/xalloc.m4
/xstrndup.m4
-858
View File
@@ -1,858 +0,0 @@
# -*-Makefile-*-
# This Makefile fragment tries to be general-purpose enough to be
# used by at least coreutils, idutils, CPPI, Bison, and Autoconf.
## Copyright (C) 2001-2008 Free Software Foundation, Inc.
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
# This is reported not to work with make-3.79.1
# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
ME := maint.mk
# Do not save the original name or timestamp in the .tar.gz file.
# Use --rsyncable if available.
gzip_rsyncable := \
$(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null && echo --rsyncable)
GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
GIT = git
VC = $(GIT)
VC-tag = git tag -s -m '$(VERSION)'
VC_LIST = build-aux/vc-list-files
VC_LIST_EXCEPT = \
$(VC_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi
ifeq ($(origin prev_version_file), undefined)
prev_version_file = $(srcdir)/.prev-version
endif
PREV_VERSION := $(shell cat $(prev_version_file))
VERSION_REGEXP = $(subst .,\.,$(VERSION))
PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION))
ifeq ($(VC),$(GIT))
this-vc-tag = v$(VERSION)
this-vc-tag-regexp = v$(VERSION_REGEXP)
else
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
tag-this-version = $(subst .,_,$(VERSION))
this-vc-tag = $(tag-package)-$(tag-this-version)
this-vc-tag-regexp = $(this-vc-tag)
endif
my_distdir = $(PACKAGE)-$(VERSION)
# Old releases are stored here.
release_archive_dir ?= ../release
# Prevent programs like 'sort' from considering distinct strings to be equal.
# Doing it here saves us from having to set LC_ALL elsewhere in this file.
export LC_ALL = C
## --------------- ##
## Sanity checks. ##
## --------------- ##
# Collect the names of rules starting with `sc_'.
syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \
$(srcdir)/$(ME))
.PHONY: $(syntax-check-rules)
local-checks-available = \
po-check copyright-check m4-check author_mark_check \
patch-check strftime-check $(syntax-check-rules) \
makefile_path_separator_check \
makefile-check check-AUTHORS
.PHONY: $(local-checks-available)
local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available))
syntax-check: $(local-check)
# @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \
# $$(find -type f -name '*.[chly]') && \
# { echo '$(ME): found conditional include' 1>&2; \
# exit 1; } || :
# grep -nE '^# *include <(string|stdlib)\.h>' \
# $(srcdir)/{lib,src}/*.[chy] && \
# { echo '$(ME): FIXME' 1>&2; \
# exit 1; } || :
# FIXME: don't allow `#include .strings\.h' anywhere
sc_avoid_if_before_free:
@$(srcdir)/build-aux/useless-if-before-free \
$(useless_free_options) \
$$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found useless "if" before "free" above' 1>&2; \
exit 1; } || :
sc_cast_of_argument_to_free:
@grep -nE '\<free *\( *\(' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): don'\''t cast free argument' 1>&2; \
exit 1; } || :
sc_cast_of_x_alloc_return_value:
@grep -nE '\*\) *x(m|c|re)alloc\>' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \
exit 1; } || :
sc_cast_of_alloca_return_value:
@grep -nE '\*\) *alloca\>' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): don'\''t cast alloca return value' 1>&2; \
exit 1; } || :
sc_space_tab:
@grep -n '[ ] ' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
1>&2; exit 1; } || :
# Don't use *scanf or the old ato* functions in `real' code.
# They provide no error checking mechanism.
# Instead, use strto* functions.
sc_prohibit_atoi_atof:
@grep -nE '\<([fs]?scanf|ato([filq]|ll))\>' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): do not use *scan''f, ato''f, ato''i, ato''l, ato''ll, ato''q, or ss''canf' \
1>&2; exit 1; } || :
# Use STREQ rather than comparing strcmp == 0, or != 0.
sc_prohibit_strcmp:
@grep -nE '! *str''cmp *\(|\<str''cmp *\([^)]+\) *==' \
$$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): use STREQ in place of the above uses of str''cmp' \
1>&2; exit 1; } || :
# Using EXIT_SUCCESS as the first argument to error is misleading,
# since when that parameter is 0, error does not exit. Use `0' instead.
sc_error_exit_success:
@grep -nF 'error (EXIT_SUCCESS,' \
$$(find -type f -name '*.[chly]') && \
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \
exit 1; } || :
# `FATAL:' should be fully upper-cased in error messages
# `WARNING:' should be fully upper-cased, or fully lower-cased
sc_error_message_warn_fatal:
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
| grep -E '"Warning|"Fatal|"fatal' && \
{ echo '$(ME): use FATAL, WARNING or warning' 1>&2; \
exit 1; } || :
# Error messages should not start with a capital letter
sc_error_message_uppercase:
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
| grep -E '"[A-Z]' \
| grep -vE '"FATAL|"WARNING|"Java|"C#|PRIuMAX' && \
{ echo '$(ME): found capitalized error message' 1>&2; \
exit 1; } || :
# Error messages should not end with a period
sc_error_message_period:
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
| grep -E '[^."]\."' && \
{ echo '$(ME): found error message ending in period' 1>&2; \
exit 1; } || :
sc_file_system:
@grep -ni 'file''system' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found use of "file''system";' \
'rewrite to use "file system"' 1>&2; \
exit 1; } || :
# Don't use cpp tests of this symbol. All code assumes config.h is included.
sc_no_have_config_h:
@grep -n '^# *if.*HAVE''_CONFIG_H' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found use of HAVE''_CONFIG_H; remove' \
1>&2; exit 1; } || :
# Nearly all .c files must include <config.h>.
sc_require_config_h:
@if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
grep -L '^# *include <config\.h>' \
$$($(VC_LIST_EXCEPT) | grep '\.c$$') \
| grep . && \
{ echo '$(ME): the above files do not include <config.h>' \
1>&2; exit 1; } || :; \
else :; \
fi
# To use this "command" macro, you must first define two shell variables:
# h: the header, enclosed in <> or ""
# re: a regular expression that matches IFF something provided by $h is used.
define _header_without_use
h_esc=`echo "$$h"|sed 's/\./\\./'`; \
if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
files=$$(grep -l '^# *include '"$$h_esc" \
$$($(VC_LIST_EXCEPT) | grep '\.c$$')) && \
grep -LE "$$re" $$files | grep . && \
{ echo "$(ME): the above files include $$h but don't use it" \
1>&2; exit 1; } || :; \
else :; \
fi
endef
# Prohibit the inclusion of assert.h without an actual use of assert.
sc_prohibit_assert_without_use:
@h='<assert.h>' re='\<assert *\(' $(_header_without_use)
# Prohibit the inclusion of getopt.h without an actual use.
sc_prohibit_getopt_without_use:
@h='<getopt.h>' re='\<getopt(_long)? *\(' $(_header_without_use)
# Don't include quotearg.h unless you use one of its functions.
sc_prohibit_quotearg_without_use:
@h='"quotearg.h"' re='\<quotearg(_[^ ]+)? *\(' $(_header_without_use)
# Don't include quote.h unless you use one of its functions.
sc_prohibit_quote_without_use:
@h='"quote.h"' re='\<quote(_n)? *\(' $(_header_without_use)
# Don't include this header unless you use one of its functions.
sc_prohibit_long_options_without_use:
@h='"long-options.h"' re='\<parse_long_options *\(' \
$(_header_without_use)
# Don't include this header unless you use one of its functions.
sc_prohibit_inttostr_without_use:
@h='"inttostr.h"' re='\<(off|[iu]max|uint)tostr *\(' \
$(_header_without_use)
# Don't include this header unless you use one of its functions.
sc_prohibit_error_without_use:
@h='"error.h"' \
re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? *\('\
$(_header_without_use)
sc_prohibit_safe_read_without_use:
@h='"safe-read.h"' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \
$(_header_without_use)
sc_prohibit_argmatch_without_use:
@h='"argmatch.h"' \
re='(\<(ARRAY_CARDINALITY|X?ARGMATCH(|_TO_ARGUMENT|_VERIFY))\>|\<argmatch(_exit_fn|_(in)?valid) *\()' \
$(_header_without_use)
sc_prohibit_root_dev_ino_without_use:
@h='"root-dev-ino.h"' \
re='(\<ROOT_DEV_INO_(CHECK|WARN)\>|\<get_root_dev_ino *\()' \
$(_header_without_use)
sc_obsolete_symbols:
@grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
$$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
1>&2; exit 1; } || :
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
# Each nonempty line must start with a year number, or a TAB.
sc_changelog:
@grep -n '^[^12 ]' $$(find . -maxdepth 2 -name ChangeLog) && \
{ echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
exit 1; } || :
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
# with the strings from the two affected variables.
dd_c = $(srcdir)/src/dd.c
sc_dd_max_sym_length:
ifneq ($(wildcard $(dd_c)),)
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
|sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
| wc --max-line-length); \
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|tr -d '"' | wc --max-line-length); \
if test "$$len" = "$$max"; then :; else \
echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
exit 1; \
fi
endif
# Many m4 macros names once began with `jm_'.
# On 2004-04-13, they were all changed to start with gl_ instead.
# Make sure that none are inadvertently reintroduced.
sc_prohibit_jm_in_m4:
@grep -nE 'jm_[A-Z]' \
$$($(VC_LIST) m4 |grep '\.m4$$'; echo /dev/null) && \
{ echo '$(ME): do not use jm_ in m4 macro names' \
1>&2; exit 1; } || :
# Ensure that each root-requiring test is run via the "check-root" rule.
sc_root_tests:
@if test -d tests \
&& grep check-root tests/Makefile.am>/dev/null 2>&1; then \
t1=sc-root.expected; t2=sc-root.actual; \
grep -nl '^require_root_$$' \
$$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1; \
sed -n '/^root_tests =[ ]*\\$$/,/[^\]$$/p' \
$(srcdir)/tests/Makefile.am \
| sed 's/^ *//;/^root_tests =/d' \
| tr -s '\012\\' ' ' | fmt -1 | sort > $$t2; \
diff -u $$t1 $$t2 || diff=1; \
rm -f $$t1 $$t2; \
test "$$diff" \
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
exit 1; } || :; \
fi
headers_with_interesting_macro_defs = \
exit.h \
fcntl_.h \
fnmatch_.h \
intprops.h \
inttypes_.h \
lchown.h \
openat.h \
stat-macros.h \
stdint_.h
# Create a list of regular expressions matching the names
# of macros that are guaranteed by parts of gnulib to be defined.
.re-defmac:
@(cd $(srcdir)/lib; \
for f in $(headers_with_interesting_macro_defs); do \
test -f $$f && \
sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \
done; \
) | sort -u \
| grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \
| sed 's/^/^# *define /' \
> $@-t
@mv $@-t $@
# Don't define macros that we already get from gnulib header files.
sc_always_defined_macros: .re-defmac
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \
grep -f .re-defmac $$($(VC_LIST)) \
&& { echo '$(ME): define the above via some gnulib .h file' \
1>&2; exit 1; } || :; \
fi
# Create a list of regular expressions matching the names
# of files included from system.h. Exclude a couple.
.re-list:
@sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
| grep -Ev 'sys/(param|file)\.h' \
| sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
> $@-t
@mv $@-t $@
# Files in src/ should not include directly any of
# the headers already included via system.h.
sc_system_h_headers: .re-list
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
grep -nE -f .re-list \
$$($(VC_LIST) src | \
grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
&& { echo '$(ME): the above are already included via system.h'\
1>&2; exit 1; } || :; \
fi
# Ensure that each .c file containing a "main" function also
# calls set_program_name.
sc_program_name:
@if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
files=$$(grep -l '^main *(' $$($(VC_LIST_EXCEPT) | grep '\.c$$')); \
grep -LE 'set_program_name *\(m?argv\[0\]\);' $$files \
| grep . && \
{ echo '$(ME): the above files do not call set_program_name' \
1>&2; exit 1; } || :; \
else :; \
fi
# Require that the final line of each test-lib.sh-using test be this one:
# (exit $fail); exit $fail
# Note: this test requires GNU grep's --label= option.
sc_require_test_exit_idiom:
@if test -f $(srcdir)/tests/test-lib.sh; then \
die=0; \
for i in $$(grep -l -F /../test-lib.sh $$($(VC_LIST) tests)); do \
tail -n1 $$i | grep '^(exit \$$fail); exit \$$fail$$' > /dev/null \
&& : || { die=1; echo $$i; } \
done; \
test $$die = 1 && \
{ echo 1>&2 '$(ME): the final line in each of the above is not:'; \
echo 1>&2 '(exit $$fail); exit $$fail'; \
exit 1; } || :; \
fi
sc_sun_os_names:
@grep -nEi \
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
$$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
exit 1; } || :
sc_the_the:
@grep -ni '\<the ''the\>' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found use of "the ''the";' 1>&2; \
exit 1; } || :
sc_tight_scope:
$(MAKE) -C src $@
sc_trailing_blank:
@grep -n '[ ]$$' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found trailing blank(s)' \
1>&2; exit 1; } || :
# Match lines like the following, but where there is only one space
# between the options and the description:
# -D, --all-repeated[=delimit-method] print all duplicate lines\n
longopt_re = --[a-z][0-9A-Za-z-]*(\[?=[0-9A-Za-z-]*\]?)?
sc_two_space_separator_in_usage:
@grep -nE '^ *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$' \
$$($(VC_LIST_EXCEPT)) && \
{ echo "$(ME): help2man requires at least two spaces between"; \
echo "$(ME): an option and its description"; \
1>&2; exit 1; } || :
# Look for diagnostics that aren't marked for translation.
# This won't find any for which error's format string is on a separate line.
sc_unmarked_diagnostics:
@grep -nE \
'\<error \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
| grep -v '_''(' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
exit 1; } || :
# Avoid useless parentheses like those in this example:
# #if defined (SYMBOL) || defined (SYM2)
sc_useless_cpp_parens:
@grep -n '^# *if .*defined *(' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found useless parentheses in cpp directive' \
1>&2; exit 1; } || :
# Require the latest GPL.
sc_GPL_version:
@grep -n 'either ''version [^3]' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): GPL vN, N!=3' 1>&2; exit 1; } || :
# Perl-based tests used to exec perl from a #!/bin/sh script.
# Now they all start with #!/usr/bin/perl and the portability
# infrastructure is in tests/Makefile.am. Make sure no old-style
# script sneaks back in.
sc_no_exec_perl_coreutils:
@if test -f $(srcdir)/tests/Coreutils.pm; then \
grep '^exec *\$$PERL.*MCoreutils' $$($(VC_LIST) tests) && \
{ echo 1>&2 '$(ME): found anachronistic Perl-based tests'; \
exit 1; } || :; \
fi
NEWS_hash = \
$$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \
$(srcdir)/NEWS | md5sum -)
# Ensure that we don't accidentally insert an entry into an old NEWS block.
sc_immutable_NEWS:
@if test -f $(srcdir)/NEWS; then \
test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : || \
{ echo '$(ME): you have modified old NEWS' 1>&2; exit 1; }; \
fi
# Each program that uses proper_name_utf8 must link with
# one of the ICONV libraries.
sc_proper_name_utf8_requires_ICONV:
@progs=$$(grep -l 'proper_name_utf8 ''("' $$($(VC_LIST_EXCEPT)));\
if test "x$$progs" != x; then \
fail=0; \
for p in $$progs; do \
dir=$$(dirname "$$p"); \
base=$$(basename "$$p" .c); \
grep "$${base}_LDADD.*ICONV)" $$dir/Makefile.am > /dev/null \
|| { fail=1; echo 1>&2 "$(ME): $$p uses proper_name_utf8"; }; \
done; \
test $$fail = 1 && \
{ echo 1>&2 '$(ME): the above do not link with any ICONV library'; \
exit 1; } || :; \
fi
# Warn about "c0nst struct Foo const foo[]",
# but not about "char const *const foo" or "#define const const".
sc_redundant_const:
@grep -E '\bconst\b[[:space:][:alnum:]]{2,}\bconst\b' \
$$($(VC_LIST_EXCEPT)) && \
{ echo 1>&2 '$(ME): redundant "const" in declarations'; \
exit 1; } || :
sc_const_long_option:
@grep '^ *static.*struct option ' $$($(VC_LIST_EXCEPT)) \
| grep -Ev 'const struct option|struct option const' && { \
echo 1>&2 '$(ME): add "const" to the above declarations'; \
exit 1; } || :
# Update the hash stored above. Do this after each release and
# for any corrections to old entries.
update-NEWS-hash: NEWS
perl -pi -e 's/^(old_NEWS_hash = ).*/$${1}'"$(NEWS_hash)/" \
$(srcdir)/cfg.mk
epoch_date = 1970-01-01 00:00:00.000000000 +0000
# Ensure that the c99-to-c89 patch applies cleanly.
patch-check:
rm -rf src-c89 $@.1 $@.2
cp -a src src-c89
(cd src-c89; patch -p1 -V never --fuzz=0) < src/c99-to-c89.diff \
> $@.1 2>&1
if test "$(REGEN_PATCH)" = yes; then \
diff -upr src src-c89 | sed 's,src-c89/,src/,' \
| grep -vE '^(Only in|File )' \
| perl -pe 's/^((?:\+\+\+|---) \S+\t).*/$${1}$(epoch_date)/;' \
-e 's/^ $$//' \
> new-diff || : ; fi
grep -v '^patching file ' $@.1 > $@.2 || :
msg=ok; test -s $@.2 && msg='fuzzy patch' || : ; \
rm -f src-c89/*.o || msg='rm failed'; \
$(MAKE) -C src-c89 CFLAGS='-Wdeclaration-after-statement -Werror' \
|| msg='compile failure with extra options'; \
test "$$msg" = ok && rm -rf src-c89 $@.1 $@.2 || echo "$$msg" 1>&2; \
test "$$msg" = ok
# Ensure that date's --help output stays in sync with the info
# documentation for GNU strftime. The only exception is %N,
# which date accepts but GNU strftime does not.
extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
strftime-check:
if test -f $(srcdir)/src/date.c; then \
grep '^ %. ' $(srcdir)/src/date.c | sort \
| $(extract_char) > $@-src; \
{ echo N; \
info libc date calendar format | grep '^ `%.'\' \
| $(extract_char); } | sort > $@-info; \
diff -u $@-src $@-info || exit 1; \
rm -f $@-src $@-info; \
fi
check-AUTHORS:
$(MAKE) -C src $@
# Ensure that we use only the standard $(VAR) notation,
# not @...@ in Makefile.am, now that we can rely on automake
# to emit a definition for each substituted variable.
makefile-check:
@grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \
&& { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
news-date-check: NEWS
today=`date +%Y-%m-%d`; \
if head NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
>/dev/null; then \
:; \
else \
echo "version or today's date is not in NEWS" 1>&2; \
exit 1; \
fi
changelog-check:
if head ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \
>/dev/null; then \
:; \
else \
echo "$(VERSION) not in ChangeLog" 1>&2; \
exit 1; \
fi
m4-check:
@grep -n 'AC_DEFUN([^[]' m4/*.m4 \
&& { echo '$(ME): quote the first arg to AC_DEFUN' 1>&2; \
exit 1; } || :
# Verify that all source files using _() are listed in po/POTFILES.in.
po-check:
@if test -f po/POTFILES.in; then \
grep -E -v '^(#|$$)' po/POTFILES.in \
| grep -v '^src/false\.c$$' | sort > $@-1; \
files=; \
for file in $$($(VC_LIST_EXCEPT)) lib/*.[ch]; do \
case $$file in \
*.?|*.??) ;; \
*) continue;; \
esac; \
case $$file in \
*.[ch]) \
base=`expr " $$file" : ' \(.*\)\..'`; \
{ test -f $$base.l || test -f $$base.y; } && continue;; \
esac; \
files="$$files $$file"; \
done; \
grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files \
| sort -u > $@-2; \
diff -u $@-1 $@-2 || exit 1; \
rm -f $@-1 $@-2; \
fi
# In a definition of #define AUTHORS "... and ..." where the RHS contains
# the English word `and', the string must be marked with `N_ (...)' so that
# gettext recognizes it as a string requiring translation.
author_mark_check:
@grep -n '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \
{ echo '$(ME): enclose the above strings in N_ (...)' 1>&2; \
exit 1; } || :
# Sometimes it is useful to change the PATH environment variable
# in Makefiles. When doing so, it's better not to use the Unix-centric
# path separator of `:', but rather the automake-provided `@PATH_SEPARATOR@'.
# It'd be better to use `find -print0 ...|xargs -0 ...', but less portable,
# and there probably aren't many projects with so many Makefile.am files
# that we'd have to worry about limits on command line length.
msg = '$(ME): Do not use `:'\'' above; use @PATH_SEPARATOR@ instead'
makefile_path_separator_check:
@grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \
&& { echo $(msg) 1>&2; exit 1; } || :
# Check that `make alpha' will not fail at the end of the process.
writable-files:
if test -d $(release_archive_dir); then :; else \
for file in $(distdir).tar.gz \
$(release_archive_dir)/$(distdir).tar.gz; do \
test -e $$file || continue; \
test -w $$file \
|| { echo ERROR: $$file is not writable; fail=1; }; \
done; \
test "$$fail" && exit 1 || : ; \
fi
v_etc_file = lib/version-etc.c
sample-test = tests/sample-test
texi = doc/$(PACKAGE).texi
# Make sure that the copyright date in $(v_etc_file) is up to date.
# Do the same for the $(sample-test) and the main doc/.texi file.
copyright-check:
@if test -f $(v_etc_file); then \
grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
>/dev/null \
|| { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
exit 1; }; \
fi
@if test -f $(sample-test); then \
grep '# Copyright (C) '$$(date +%Y)' Free' $(sample-test) \
>/dev/null \
|| { echo 'out of date copyright in $(sample-test); update it' 1>&2; \
exit 1; }; \
fi
@if test -f $(texi); then \
grep 'Copyright @copyright{} .*'$$(date +%Y)' Free' $(texi) \
>/dev/null \
|| { echo 'out of date copyright in $(texi); update it' 1>&2; \
exit 1; }; \
fi
vc-diff-check:
$(VC) diff > vc-diffs || :
if test -s vc-diffs; then \
cat vc-diffs; \
echo "Some files are locally modified:" 1>&2; \
exit 1; \
else \
rm vc-diffs; \
fi
cvs-check: vc-diff-check
maintainer-distcheck:
$(MAKE) distcheck
$(MAKE) my-distcheck
# Don't make a distribution if checks fail.
# Also, make sure the NEWS file is up-to-date.
vc-dist: $(local-check) cvs-check maintainer-distcheck
$(MAKE) dist
# Use this to make sure we don't run these programs when building
# from a virgin tgz file, below.
null_AM_MAKEFLAGS = \
ACLOCAL=false \
AUTOCONF=false \
AUTOMAKE=false \
AUTOHEADER=false \
MAKEINFO=false
built_programs = $$(cd src && MAKEFLAGS= $(MAKE) -s built_programs.list)
warn_cflags = -Dlint -O -Werror -Wall -Wformat -Wshadow -Wpointer-arith
bin=bin-$$$$
write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
TMPDIR ?= /tmp
t=$(TMPDIR)/$(PACKAGE)/test
pfx=$(t)/i
# Verify that a twisted use of --program-transform-name=PROGRAM works.
define install-transform-check
rm -rf $(pfx); \
$(MAKE) program_transform_name='s/.*/zyx/' \
prefix=$(pfx) install \
&& test "$$(echo $(pfx)/bin/*)" = "$(pfx)/bin/zyx" \
&& test "$$(echo $(pfx)/share/man/man1/*)" = \
"$(pfx)/share/man/man1/zyx.1"
endef
# Install, then verify that all binaries and man pages are in place.
# Note that neither the binary, ginstall, nor the ].1 man page is installed.
define my-instcheck
$(MAKE) prefix=$(pfx) install \
&& test ! -f $(pfx)/bin/ginstall \
&& { fail=0; \
for i in $(built_programs); do \
test "$$i" = ginstall && i=install; \
for j in "$(pfx)/bin/$$i" \
"$(pfx)/share/man/man1/$$i.1"; do \
case $$j in *'[.1') continue;; esac; \
test -f "$$j" && : \
|| { echo "$$j not installed"; fail=1; }; \
done; \
done; \
test $$fail = 1 && exit 1 || :; \
}
endef
# Use -Wformat -Werror to detect format-string/arg-list mismatches.
# Also, check for shadowing problems with -Wshadow, and for pointer
# arithmetic problems with -Wpointer-arith.
# These CFLAGS are pretty strict. If you build this target, you probably
# have to have a recent version of gcc and glibc headers.
# The hard-linking for-loop below ensures that there is a bin/ directory
# full of all of the programs under test (except the ones that are required
# for basic Makefile rules), all symlinked to the just-built "false" program.
# This is to ensure that if ever a test neglects to make PATH include
# the build srcdir, these always-failing programs will run.
# Otherwise, it is too easy to test the wrong programs.
# Note that "false" itself is a symlink to true, so it too will malfunction.
my-distcheck: $(DIST_ARCHIVES) $(local-check)
$(MAKE) syntax-check
$(MAKE) check
-rm -rf $(t)
mkdir -p $(t)
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
cd $(t)/$(distdir) \
&& ./configure --disable-nls \
&& $(MAKE) CFLAGS='$(warn_cflags)' \
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
&& $(MAKE) dvi \
&& $(install-transform-check) \
&& $(my-instcheck) \
&& mkdir $(bin) \
&& ($(write_loser)) > $(bin)/loser \
&& chmod a+x $(bin)/loser \
&& for i in $(built_programs); do \
case $$i in \
rm|expr|basename|echo|sort|ls|tr);; \
cat|dirname|mv|wc);; \
*) ln $(bin)/loser $(bin)/$$i;; \
esac; \
done \
&& ln -sf ../src/true $(bin)/false \
&& PATH=`pwd`/$(bin):$$PATH $(MAKE) -C tests check \
&& { test -d gnulib-tests \
&& $(MAKE) -C gnulib-tests check \
|| :; } \
&& rm -rf $(bin) \
&& $(MAKE) distclean
(cd $(t) && mv $(distdir) $(distdir).old \
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
if test -f $(srcdir)/src/c99-to-c89.diff; then \
cd $(t)/$(distdir) \
&& (cd src && patch -V never --fuzz=0 <c99-to-c89.diff) \
&& ./configure --disable-largefile \
CFLAGS='-Werror -ansi -Wno-long-long' \
&& $(MAKE); \
fi
-rm -rf $(t)
@echo "========================"; \
echo "$(distdir).tar.gz is ready for distribution"; \
echo "========================"
WGET = wget
WGETFLAGS = -C off
rel-check:
tarz=/tmp/rel-check-tarz-$$$$; \
md5_tmp=/tmp/rel-check-md5-$$$$; \
set -e; \
trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
$(WGET) $(WGETFLAGS) -q --output-document=$$tarz $(url); \
echo "$(md5) -" > $$md5_tmp; \
md5sum -c $$md5_tmp < $$tarz
rel-files = $(DIST_ARCHIVES)
gnulib-version = $$(cd $(gnulib_dir) && git describe)
announcement: NEWS ChangeLog $(rel-files)
@./build-aux/announce-gen \
--release-type=$(RELEASE_TYPE) \
--package=$(PACKAGE) \
--prev=$(PREV_VERSION) \
--curr=$(VERSION) \
--gpg-key-id=$(gpg_key_ID) \
--news=NEWS \
--bootstrap-tools=autoconf,automake,flex,gnulib \
--gnulib-version=$(gnulib-version) \
$(addprefix --url-dir=, $(url_dir_list))
## ---------------- ##
## Updating files. ##
## ---------------- ##
ftp-gnu = ftp://ftp.gnu.org/gnu
www-gnu = http://www.gnu.org
# Use mv, if you don't have/want move-if-change.
move_if_change ?= move-if-change
emit_upload_commands:
@echo =====================================
@echo =====================================
@echo "$(srcdir)/build-aux/gnupload $(GNUPLOADFLAGS) \\"
@echo " --to $(gnu_rel_host):$(PACKAGE) \\"
@echo " $(rel-files)"
@echo '# send the /tmp/announcement e-mail'
@echo =====================================
@echo =====================================
noteworthy = * Noteworthy changes in release ?.? (????-??-??) [?]
define emit-commit-log
printf '%s\n' 'post-release administrivia' '' \
'* NEWS: Add header line for next release.' \
'* .prev-version: Record previous version.' \
'* cfg.mk (old_NEWS_hash): Auto-update.'
endef
.PHONY: alpha beta major
alpha beta major: $(local-check) writable-files
test $@ = major \
&& { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$' \
|| { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\
|| :
$(MAKE) vc-dist
$(MAKE) news-date-check
$(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir)
if test -d $(release_archive_dir); then \
ln $(rel-files) $(release_archive_dir); \
chmod a-w $(rel-files); \
fi
$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
echo $(VERSION) > $(prev_version_file)
$(MAKE) update-NEWS-hash
perl -pi -e '$$. == 3 and print "$(noteworthy)\n\n\n"' NEWS
$(emit-commit-log) > .ci-msg
$(VC) commit -F .ci-msg
-2
View File
@@ -1,7 +1,5 @@
*.gmo
*.po
*.po~
.reference
LINGUAS
Makefile
Makefile.in
-22
View File
@@ -1,22 +0,0 @@
/*.gmo
/*.po
/*.po~
/.reference
/LINGUAS
/Makefile
/Makefile.in
/Makefile.in.in
/Makevars
/Makevars.template
/POTFILES
/Rules-quot
/bison.pot
/boldquot.sed
/[email protected]
/[email protected]
/insert-header.sed
/insert-header.sin
/quot.sed
/remove-potcdate.sed
/remove-potcdate.sin
/stamp-po
-2
View File
@@ -1,7 +1,5 @@
*.gmo
*.po
*.po~
.reference
LINGUAS
Makefile
Makefile.in
-20
View File
@@ -1,20 +0,0 @@
/*.gmo
/*.po
/*.po~
/.reference
/LINGUAS
/Makefile
/Makefile.in
/Makefile.in.in
/Makevars
/POTFILES
/Rules-quot
/bison-runtime.pot
/boldquot.sed
/[email protected]
/[email protected]
/insert-header.sin
/quot.sed
/remove-potcdate.sed
/remove-potcdate.sin
/stamp-po
+1
View File
@@ -5,6 +5,7 @@
Makefile
Makefile.in
bison
revision.c
scan-code.c
scan-gram.c
scan-skel.c
-13
View File
@@ -1,13 +0,0 @@
/*.flc
/*.log
/*.o
/*.output
/.deps
/Makefile
/Makefile.in
/bison
/bison.exe
/scan-code.c
/scan-gram.c
/scan-skel.c
/yacc
+14 -2
View File
@@ -1,6 +1,6 @@
# Make bison/src.
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir)/lib
AM_YFLAGS = "-dv"
@@ -53,6 +53,7 @@ bison_SOURCES = \
print-xml.c print-xml.h \
reader.c reader.h \
reduce.c reduce.h \
revision.c revision.h \
relation.c relation.h \
scan-code.h scan-code-c.c \
scan-gram.h scan-gram-c.c \
@@ -69,6 +70,7 @@ EXTRA_bison_SOURCES = scan-code.l scan-skel.l scan-gram.l
BUILT_SOURCES = \
parse-gram.c parse-gram.h \
revision.c \
scan-code.c \
scan-skel.c \
scan-gram.c
@@ -83,6 +85,16 @@ yacc:
echo:
echo $(bison_SOURCES) $(noinst_HEADERS)
revision.c: $(top_srcdir)/configure $(top_srcdir)/ChangeLog
case "$(VERSION)" in \
*+*) sed -n \
's/^\$$\(Id.*\)\$$$$/const char *revision = "\1\\n";/p' \
$(top_srcdir)/ChangeLog \
;; \
*) echo 'const char *revision = "";' \
;; \
esac >$@
# The following rule is not designed to be portable,
# and relies on tools that not everyone has.
+2 -6
View File
@@ -1,7 +1,7 @@
/* Open and close files for Bison.
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008 Free Software Foundation, Inc.
2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -267,9 +267,7 @@ compute_file_name_parts (void)
if (spec_file_prefix)
{
/* If --file-prefix=foo was specified, ALL_BUT_TAB_EXT = `foo'. */
dir_prefix =
xstrndup (spec_file_prefix,
last_component (spec_file_prefix) - spec_file_prefix);
dir_prefix = xstrndup (grammar_file, base - grammar_file);
all_but_tab_ext = xstrdup (spec_file_prefix);
}
else if (yacc_flag)
@@ -353,8 +351,6 @@ compute_output_file_names (void)
void
output_file_name_check (char const *file_name)
{
if (0 == strcmp (file_name, grammar_file))
fatal (_("refusing to overwrite the input file %s"), quote (file_name));
{
int i;
for (i = 0; i < file_names_count; i++)
+6 -5
View File
@@ -20,6 +20,7 @@
#include <config.h>
#include "system.h"
#include "revision.h"
#include "output.h"
#include <argmatch.h>
@@ -70,9 +71,9 @@ static struct bison_language const valid_languages[] = {
{ "", "", "", "", false }
};
int skeleton_prio = default_prio;
static int skeleton_prio = 2;
const char *skeleton = NULL;
int language_prio = default_prio;
static int language_prio = 2;
struct bison_language const *language = &valid_languages[0];
const char *include = NULL;
@@ -272,7 +273,6 @@ Operation modes:\n\
fputs (_("\
Parser:\n\
-L, --language=LANGUAGE specify the output programming language\n\
(this is an experimental feature)\n\
-S, --skeleton=FILE specify the skeleton to use\n\
-t, --debug instrument the parser for debugging\n\
--locations enable locations computation\n\
@@ -338,6 +338,7 @@ version (void)
continue. */
printf (_("bison (GNU Bison) %s"), VERSION);
putc ('\n', stdout);
printf ("%s", revision);
fputs (_("Written by Robert Corbett and Richard Stallman.\n"), stdout);
putc ('\n', stdout);
@@ -520,11 +521,11 @@ getargs (int argc, char *argv[])
break;
case 'L':
language_argmatch (optarg, command_line_prio, NULL);
language_argmatch (optarg, 0, NULL);
break;
case 'S':
skeleton_arg (AS_FILE_NAME (optarg), command_line_prio, NULL);
skeleton_arg (AS_FILE_NAME (optarg), 0, NULL);
break;
case 'T':
+1 -4
View File
@@ -1,7 +1,7 @@
/* Parse command line arguments for bison.
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008 Free Software Foundation, Inc.
2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -24,13 +24,11 @@
#include "location.h"
extern char *program_name;
enum { command_line_prio, grammar_prio, default_prio };
/* flags set by % directives */
/* for -S */
extern char const *skeleton;
extern int skeleton_prio;
/* for -I */
extern char const *include;
@@ -70,7 +68,6 @@ struct bison_language
bool add_tab;
};
extern int language_prio;
extern struct bison_language const *language;
/*-----------.
+14 -46
View File
@@ -473,10 +473,13 @@ output_skeleton (void)
FILE *in;
FILE *out;
int filter_fd[2];
char const *argv[9];
char const *argv[7];
pid_t pid;
/* Compute the names of the package data dir and skeleton files. */
/* Compute the names of the package data dir and skeleton file.
Test whether m4sugar.m4 is readable, to check for proper
installation. A faulty installation can cause deadlock, so a
cheap sanity check is worthwhile. */
char const m4sugar[] = "m4sugar/m4sugar.m4";
char const m4bison[] = "bison.m4";
char *full_m4sugar;
@@ -502,61 +505,26 @@ output_skeleton (void)
strcpy (full_skeleton, skeleton);
else
strcpy (full_skeleton + pkgdatadirlen + 1, skeleton);
/* Test whether m4sugar.m4 is readable, to check for proper
installation. A faulty installation can cause deadlock, so a
cheap sanity check is worthwhile. */
xfclose (xfopen (full_m4sugar, "r"));
/* Create an m4 subprocess connected to us via two pipes. */
if (trace_flag & trace_tools)
fprintf (stderr, "running: %s %s - %s %s\n",
m4, full_m4sugar, full_m4bison, full_skeleton);
m4, full_m4sugar, full_m4bison, full_skeleton);
/* Some future version of GNU M4 (most likely 1.6) may treat the -dV in a
position-dependent manner. Keep it as the first argument so that all
files are traced.
argv[0] = m4;
argv[1] = full_m4sugar;
argv[2] = "-";
argv[3] = full_m4bison;
argv[4] = full_skeleton;
argv[5] = trace_flag & trace_m4 ? "-dV" : NULL;
argv[6] = NULL;
See the thread starting at
<http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>
for details. */
{
int i = 0;
argv[i++] = m4;
argv[i++] = "-I";
argv[i++] = pkgdatadir;
if (trace_flag & trace_m4)
argv[i++] = "-dV";
argv[i++] = full_m4sugar;
argv[i++] = "-";
argv[i++] = full_m4bison;
argv[i++] = full_skeleton;
argv[i++] = NULL;
}
/* When POSIXLY_CORRECT is set, some future versions of GNU M4 (most likely
2.0) may drop some of the GNU extensions that Bison's skeletons depend
upon. So that the next release of Bison is forward compatible with those
future versions of GNU M4, we unset POSIXLY_CORRECT here.
FIXME: A user might set POSIXLY_CORRECT to affect processes run from
macros like m4_syscmd in a custom skeleton. For now, Bison makes no
promises about the behavior of custom skeletons, so this scenario is not a
concern. However, we eventually want to eliminate this shortcoming. The
next release of GNU M4 (1.4.12 or 1.6) will accept the -g command-line
option as a no-op, and later releases will accept it to indicate that
POSIXLY_CORRECT should be ignored. Once the GNU M4 versions that accept
-g are pervasive, Bison should use -g instead of unsetting
POSIXLY_CORRECT.
See the thread starting at
<http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>
for details. */
unsetenv ("POSIXLY_CORRECT");
init_subpipe ();
pid = create_subpipe (argv, filter_fd);
free (full_m4sugar);
free (full_m4bison);
free (full_m4sugar);
free (full_skeleton);
out = fdopen (filter_fd[0], "w");
+145 -143
View File
@@ -1,5 +1,5 @@
/* A Bison parser, made by GNU Bison 2.4.4-738cd. */
/* A Bison parser, made by GNU Bison 2.3a+. */
/* Skeleton implementation for Bison's Yacc-like parsers in C
@@ -46,7 +46,7 @@
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "2.4.4-738cd"
#define YYBISON_VERSION "2.3a+"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -100,6 +100,8 @@
#include <config.h>
#include "system.h"
#include <strverscmp.h>
#include "complain.h"
#include "conflicts.h"
#include "files.h"
@@ -151,7 +153,7 @@ static int current_prec = 0;
/* Line 189 of yacc.c */
#line 155 "parse-gram.c"
#line 157 "parse-gram.c"
/* Enabling traces. */
#ifndef YYDEBUG
@@ -299,8 +301,8 @@ static int current_prec = 0;
typedef union YYSTYPE
{
/* Line 222 of yacc.c */
#line 92 "parse-gram.y"
/* Line 214 of yacc.c */
#line 94 "parse-gram.y"
symbol *symbol;
symbol_list *list;
@@ -313,8 +315,8 @@ typedef union YYSTYPE
/* Line 222 of yacc.c */
#line 318 "parse-gram.c"
/* Line 214 of yacc.c */
#line 320 "parse-gram.c"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -339,7 +341,7 @@ typedef struct YYLTYPE
/* Line 264 of yacc.c */
#line 343 "parse-gram.c"
#line 345 "parse-gram.c"
#ifdef short
# undef short
@@ -664,17 +666,17 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 202, 202, 210, 212, 216, 217, 227, 228, 232,
233, 238, 239, 240, 241, 242, 243, 248, 257, 258,
259, 260, 261, 262, 263, 264, 265, 266, 267, 280,
281, 305, 306, 307, 308, 312, 313, 314, 318, 325,
332, 336, 340, 347, 362, 363, 367, 379, 379, 384,
384, 389, 400, 415, 416, 417, 421, 422, 427, 429,
434, 435, 440, 442, 447, 448, 452, 453, 454, 455,
460, 465, 470, 476, 482, 493, 494, 503, 504, 510,
511, 512, 519, 519, 523, 524, 525, 530, 531, 533,
535, 537, 539, 549, 550, 556, 559, 568, 588, 590,
599, 604, 605, 610, 617, 619
0, 204, 204, 212, 214, 218, 219, 229, 230, 234,
235, 240, 241, 242, 243, 244, 245, 250, 259, 260,
261, 262, 263, 264, 265, 266, 267, 268, 269, 282,
283, 307, 308, 309, 310, 314, 315, 316, 320, 327,
334, 338, 342, 349, 364, 365, 369, 381, 381, 386,
386, 391, 402, 417, 418, 419, 423, 424, 429, 431,
436, 437, 442, 444, 449, 450, 454, 455, 456, 457,
462, 467, 472, 478, 484, 495, 496, 505, 506, 512,
513, 514, 521, 521, 525, 526, 527, 532, 533, 535,
537, 539, 541, 551, 552, 558, 561, 570, 590, 592,
601, 606, 607, 612, 619, 621
};
#endif
@@ -1030,146 +1032,146 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
case 3: /* "\"string\"" */
/* Line 715 of yacc.c */
#line 180 "parse-gram.y"
#line 182 "parse-gram.y"
{ fputs (quotearg_style (c_quoting_style, (yyvaluep->chars)), stderr); };
/* Line 715 of yacc.c */
#line 1038 "parse-gram.c"
#line 1040 "parse-gram.c"
break;
case 4: /* "\"integer\"" */
/* Line 715 of yacc.c */
#line 191 "parse-gram.y"
#line 193 "parse-gram.y"
{ fprintf (stderr, "%d", (yyvaluep->integer)); };
/* Line 715 of yacc.c */
#line 1047 "parse-gram.c"
#line 1049 "parse-gram.c"
break;
case 43: /* "\"{...}\"" */
/* Line 715 of yacc.c */
#line 182 "parse-gram.y"
#line 184 "parse-gram.y"
{ fprintf (stderr, "{\n%s\n}", (yyvaluep->code)); };
/* Line 715 of yacc.c */
#line 1056 "parse-gram.c"
#line 1058 "parse-gram.c"
break;
case 44: /* "\"char\"" */
/* Line 715 of yacc.c */
#line 174 "parse-gram.y"
#line 176 "parse-gram.y"
{ fputs (char_name ((yyvaluep->character)), stderr); };
/* Line 715 of yacc.c */
#line 1065 "parse-gram.c"
#line 1067 "parse-gram.c"
break;
case 45: /* "\"epilogue\"" */
/* Line 715 of yacc.c */
#line 182 "parse-gram.y"
#line 184 "parse-gram.y"
{ fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
/* Line 715 of yacc.c */
#line 1074 "parse-gram.c"
#line 1076 "parse-gram.c"
break;
case 47: /* "\"identifier\"" */
/* Line 715 of yacc.c */
#line 187 "parse-gram.y"
#line 189 "parse-gram.y"
{ fputs ((yyvaluep->uniqstr), stderr); };
/* Line 715 of yacc.c */
#line 1083 "parse-gram.c"
#line 1085 "parse-gram.c"
break;
case 48: /* "\"identifier:\"" */
/* Line 715 of yacc.c */
#line 188 "parse-gram.y"
#line 190 "parse-gram.y"
{ fprintf (stderr, "%s:", (yyvaluep->uniqstr)); };
/* Line 715 of yacc.c */
#line 1092 "parse-gram.c"
#line 1094 "parse-gram.c"
break;
case 51: /* "\"%{...%}\"" */
/* Line 715 of yacc.c */
#line 182 "parse-gram.y"
#line 184 "parse-gram.y"
{ fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
/* Line 715 of yacc.c */
#line 1101 "parse-gram.c"
#line 1103 "parse-gram.c"
break;
case 53: /* "\"type\"" */
/* Line 715 of yacc.c */
#line 186 "parse-gram.y"
#line 188 "parse-gram.y"
{ fprintf (stderr, "<%s>", (yyvaluep->uniqstr)); };
/* Line 715 of yacc.c */
#line 1110 "parse-gram.c"
#line 1112 "parse-gram.c"
break;
case 82: /* "variable" */
/* Line 715 of yacc.c */
#line 187 "parse-gram.y"
#line 189 "parse-gram.y"
{ fputs ((yyvaluep->uniqstr), stderr); };
/* Line 715 of yacc.c */
#line 1119 "parse-gram.c"
#line 1121 "parse-gram.c"
break;
case 83: /* "content.opt" */
/* Line 715 of yacc.c */
#line 182 "parse-gram.y"
#line 184 "parse-gram.y"
{ fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
/* Line 715 of yacc.c */
#line 1128 "parse-gram.c"
#line 1130 "parse-gram.c"
break;
case 84: /* "braceless" */
/* Line 715 of yacc.c */
#line 182 "parse-gram.y"
#line 184 "parse-gram.y"
{ fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
/* Line 715 of yacc.c */
#line 1137 "parse-gram.c"
#line 1139 "parse-gram.c"
break;
case 85: /* "id" */
/* Line 715 of yacc.c */
#line 194 "parse-gram.y"
#line 196 "parse-gram.y"
{ fprintf (stderr, "%s", (yyvaluep->symbol)->tag); };
/* Line 715 of yacc.c */
#line 1146 "parse-gram.c"
#line 1148 "parse-gram.c"
break;
case 86: /* "id_colon" */
/* Line 715 of yacc.c */
#line 195 "parse-gram.y"
#line 197 "parse-gram.y"
{ fprintf (stderr, "%s:", (yyvaluep->symbol)->tag); };
/* Line 715 of yacc.c */
#line 1155 "parse-gram.c"
#line 1157 "parse-gram.c"
break;
case 87: /* "symbol" */
/* Line 715 of yacc.c */
#line 194 "parse-gram.y"
#line 196 "parse-gram.y"
{ fprintf (stderr, "%s", (yyvaluep->symbol)->tag); };
/* Line 715 of yacc.c */
#line 1164 "parse-gram.c"
#line 1166 "parse-gram.c"
break;
case 88: /* "string_as_id" */
/* Line 715 of yacc.c */
#line 194 "parse-gram.y"
#line 196 "parse-gram.y"
{ fprintf (stderr, "%s", (yyvaluep->symbol)->tag); };
/* Line 715 of yacc.c */
#line 1173 "parse-gram.c"
#line 1175 "parse-gram.c"
break;
default:
break;
@@ -1688,8 +1690,8 @@ YYLTYPE yylloc;
/* User initialization code. */
/* Line 1248 of yacc.c */
#line 84 "parse-gram.y"
/* Line 1242 of yacc.c */
#line 86 "parse-gram.y"
{
/* Bison's grammar can initial empty locations, hence a default
location is needed. */
@@ -1697,8 +1699,8 @@ YYLTYPE yylloc;
boundary_set (&yylloc.end, current_file, 1, 1);
}
/* Line 1248 of yacc.c */
#line 1702 "parse-gram.c"
/* Line 1242 of yacc.c */
#line 1704 "parse-gram.c"
yylsp[0] = yylloc;
goto yysetstate;
@@ -1886,7 +1888,7 @@ yyreduce:
case 6:
/* Line 1455 of yacc.c */
#line 218 "parse-gram.y"
#line 220 "parse-gram.y"
{
code_props plain_code;
code_props_plain_init (&plain_code, (yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)]));
@@ -1901,14 +1903,14 @@ yyreduce:
case 7:
/* Line 1455 of yacc.c */
#line 227 "parse-gram.y"
#line 229 "parse-gram.y"
{ debug_flag = true; }
break;
case 8:
/* Line 1455 of yacc.c */
#line 229 "parse-gram.y"
#line 231 "parse-gram.y"
{
muscle_percent_define_insert ((yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].chars));
}
@@ -1917,14 +1919,14 @@ yyreduce:
case 9:
/* Line 1455 of yacc.c */
#line 232 "parse-gram.y"
#line 234 "parse-gram.y"
{ defines_flag = true; }
break;
case 10:
/* Line 1455 of yacc.c */
#line 234 "parse-gram.y"
#line 236 "parse-gram.y"
{
defines_flag = true;
spec_defines_file = xstrdup ((yyvsp[(2) - (2)].chars));
@@ -1934,42 +1936,42 @@ yyreduce:
case 11:
/* Line 1455 of yacc.c */
#line 238 "parse-gram.y"
#line 240 "parse-gram.y"
{ error_verbose = true; }
break;
case 12:
/* Line 1455 of yacc.c */
#line 239 "parse-gram.y"
#line 241 "parse-gram.y"
{ expected_sr_conflicts = (yyvsp[(2) - (2)].integer); }
break;
case 13:
/* Line 1455 of yacc.c */
#line 240 "parse-gram.y"
#line 242 "parse-gram.y"
{ expected_rr_conflicts = (yyvsp[(2) - (2)].integer); }
break;
case 14:
/* Line 1455 of yacc.c */
#line 241 "parse-gram.y"
#line 243 "parse-gram.y"
{ spec_file_prefix = (yyvsp[(2) - (2)].chars); }
break;
case 15:
/* Line 1455 of yacc.c */
#line 242 "parse-gram.y"
#line 244 "parse-gram.y"
{ spec_file_prefix = (yyvsp[(3) - (3)].chars); }
break;
case 16:
/* Line 1455 of yacc.c */
#line 244 "parse-gram.y"
#line 246 "parse-gram.y"
{
nondeterministic_parser = true;
glr_parser = true;
@@ -1979,7 +1981,7 @@ yyreduce:
case 17:
/* Line 1455 of yacc.c */
#line 249 "parse-gram.y"
#line 251 "parse-gram.y"
{
code_props action;
code_props_symbol_action_init (&action, (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)]));
@@ -1993,77 +1995,77 @@ yyreduce:
case 18:
/* Line 1455 of yacc.c */
#line 257 "parse-gram.y"
{ language_argmatch ((yyvsp[(2) - (2)].chars), grammar_prio, &(yylsp[(1) - (2)])); }
#line 259 "parse-gram.y"
{ language_argmatch ((yyvsp[(2) - (2)].chars), 1, &(yylsp[(1) - (2)])); }
break;
case 19:
/* Line 1455 of yacc.c */
#line 258 "parse-gram.y"
#line 260 "parse-gram.y"
{ add_param ("lex_param", (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); }
break;
case 20:
/* Line 1455 of yacc.c */
#line 259 "parse-gram.y"
#line 261 "parse-gram.y"
{ locations_flag = true; }
break;
case 21:
/* Line 1455 of yacc.c */
#line 260 "parse-gram.y"
#line 262 "parse-gram.y"
{ spec_name_prefix = (yyvsp[(2) - (2)].chars); }
break;
case 22:
/* Line 1455 of yacc.c */
#line 261 "parse-gram.y"
#line 263 "parse-gram.y"
{ spec_name_prefix = (yyvsp[(3) - (3)].chars); }
break;
case 23:
/* Line 1455 of yacc.c */
#line 262 "parse-gram.y"
#line 264 "parse-gram.y"
{ no_lines_flag = true; }
break;
case 24:
/* Line 1455 of yacc.c */
#line 263 "parse-gram.y"
#line 265 "parse-gram.y"
{ nondeterministic_parser = true; }
break;
case 25:
/* Line 1455 of yacc.c */
#line 264 "parse-gram.y"
#line 266 "parse-gram.y"
{ spec_outfile = (yyvsp[(2) - (2)].chars); }
break;
case 26:
/* Line 1455 of yacc.c */
#line 265 "parse-gram.y"
#line 267 "parse-gram.y"
{ spec_outfile = (yyvsp[(3) - (3)].chars); }
break;
case 27:
/* Line 1455 of yacc.c */
#line 266 "parse-gram.y"
#line 268 "parse-gram.y"
{ add_param ("parse_param", (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); }
break;
case 28:
/* Line 1455 of yacc.c */
#line 268 "parse-gram.y"
#line 270 "parse-gram.y"
{
/* %pure-parser is deprecated in favor of `%define api.pure', so use
`%define api.pure' in a backward-compatible manner here. First, don't
@@ -2081,14 +2083,14 @@ yyreduce:
case 29:
/* Line 1455 of yacc.c */
#line 280 "parse-gram.y"
#line 282 "parse-gram.y"
{ version_check (&(yylsp[(2) - (2)]), (yyvsp[(2) - (2)].chars)); }
break;
case 30:
/* Line 1455 of yacc.c */
#line 282 "parse-gram.y"
#line 284 "parse-gram.y"
{
char const *skeleton_user = (yyvsp[(2) - (2)].chars);
if (strchr (skeleton_user, '/'))
@@ -2110,35 +2112,35 @@ yyreduce:
skeleton_user = uniqstr_new (skeleton_build);
free (skeleton_build);
}
skeleton_arg (skeleton_user, grammar_prio, &(yylsp[(1) - (2)]));
skeleton_arg (skeleton_user, 1, &(yylsp[(1) - (2)]));
}
break;
case 31:
/* Line 1455 of yacc.c */
#line 305 "parse-gram.y"
#line 307 "parse-gram.y"
{ token_table_flag = true; }
break;
case 32:
/* Line 1455 of yacc.c */
#line 306 "parse-gram.y"
#line 308 "parse-gram.y"
{ report_flag |= report_states; }
break;
case 33:
/* Line 1455 of yacc.c */
#line 307 "parse-gram.y"
#line 309 "parse-gram.y"
{ yacc_flag = true; }
break;
case 37:
/* Line 1455 of yacc.c */
#line 315 "parse-gram.y"
#line 317 "parse-gram.y"
{
grammar_start_symbol_set ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]));
}
@@ -2147,7 +2149,7 @@ yyreduce:
case 38:
/* Line 1455 of yacc.c */
#line 319 "parse-gram.y"
#line 321 "parse-gram.y"
{
symbol_list *list;
for (list = (yyvsp[(3) - (3)].list); list; list = list->next)
@@ -2159,7 +2161,7 @@ yyreduce:
case 39:
/* Line 1455 of yacc.c */
#line 326 "parse-gram.y"
#line 328 "parse-gram.y"
{
symbol_list *list;
for (list = (yyvsp[(3) - (3)].list); list; list = list->next)
@@ -2171,7 +2173,7 @@ yyreduce:
case 40:
/* Line 1455 of yacc.c */
#line 333 "parse-gram.y"
#line 335 "parse-gram.y"
{
default_prec = true;
}
@@ -2180,7 +2182,7 @@ yyreduce:
case 41:
/* Line 1455 of yacc.c */
#line 337 "parse-gram.y"
#line 339 "parse-gram.y"
{
default_prec = false;
}
@@ -2189,7 +2191,7 @@ yyreduce:
case 42:
/* Line 1455 of yacc.c */
#line 341 "parse-gram.y"
#line 343 "parse-gram.y"
{
/* Do not invoke muscle_percent_code_grow here since it invokes
muscle_user_name_list_grow. */
@@ -2201,7 +2203,7 @@ yyreduce:
case 43:
/* Line 1455 of yacc.c */
#line 348 "parse-gram.y"
#line 350 "parse-gram.y"
{
muscle_percent_code_grow ((yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].chars), (yylsp[(3) - (3)]));
code_scanner_last_string_free ();
@@ -2211,21 +2213,21 @@ yyreduce:
case 44:
/* Line 1455 of yacc.c */
#line 362 "parse-gram.y"
#line 364 "parse-gram.y"
{}
break;
case 45:
/* Line 1455 of yacc.c */
#line 363 "parse-gram.y"
#line 365 "parse-gram.y"
{ muscle_code_grow ("union_name", (yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
break;
case 46:
/* Line 1455 of yacc.c */
#line 368 "parse-gram.y"
#line 370 "parse-gram.y"
{
union_seen = true;
muscle_code_grow ("stype", (yyvsp[(3) - (3)].chars), (yylsp[(3) - (3)]));
@@ -2236,14 +2238,14 @@ yyreduce:
case 47:
/* Line 1455 of yacc.c */
#line 379 "parse-gram.y"
#line 381 "parse-gram.y"
{ current_class = nterm_sym; }
break;
case 48:
/* Line 1455 of yacc.c */
#line 380 "parse-gram.y"
#line 382 "parse-gram.y"
{
current_class = unknown_sym;
current_type = NULL;
@@ -2253,14 +2255,14 @@ yyreduce:
case 49:
/* Line 1455 of yacc.c */
#line 384 "parse-gram.y"
#line 386 "parse-gram.y"
{ current_class = token_sym; }
break;
case 50:
/* Line 1455 of yacc.c */
#line 385 "parse-gram.y"
#line 387 "parse-gram.y"
{
current_class = unknown_sym;
current_type = NULL;
@@ -2270,7 +2272,7 @@ yyreduce:
case 51:
/* Line 1455 of yacc.c */
#line 390 "parse-gram.y"
#line 392 "parse-gram.y"
{
symbol_list *list;
tag_seen = true;
@@ -2283,7 +2285,7 @@ yyreduce:
case 52:
/* Line 1455 of yacc.c */
#line 401 "parse-gram.y"
#line 403 "parse-gram.y"
{
symbol_list *list;
++current_prec;
@@ -2300,126 +2302,126 @@ yyreduce:
case 53:
/* Line 1455 of yacc.c */
#line 415 "parse-gram.y"
#line 417 "parse-gram.y"
{ (yyval.assoc) = left_assoc; }
break;
case 54:
/* Line 1455 of yacc.c */
#line 416 "parse-gram.y"
#line 418 "parse-gram.y"
{ (yyval.assoc) = right_assoc; }
break;
case 55:
/* Line 1455 of yacc.c */
#line 417 "parse-gram.y"
#line 419 "parse-gram.y"
{ (yyval.assoc) = non_assoc; }
break;
case 56:
/* Line 1455 of yacc.c */
#line 421 "parse-gram.y"
#line 423 "parse-gram.y"
{ current_type = NULL; }
break;
case 57:
/* Line 1455 of yacc.c */
#line 422 "parse-gram.y"
#line 424 "parse-gram.y"
{ current_type = (yyvsp[(1) - (1)].uniqstr); tag_seen = true; }
break;
case 58:
/* Line 1455 of yacc.c */
#line 428 "parse-gram.y"
#line 430 "parse-gram.y"
{ (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); }
break;
case 59:
/* Line 1455 of yacc.c */
#line 430 "parse-gram.y"
#line 432 "parse-gram.y"
{ (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), symbol_list_sym_new ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]))); }
break;
case 60:
/* Line 1455 of yacc.c */
#line 434 "parse-gram.y"
#line 436 "parse-gram.y"
{ (yyval.symbol) = (yyvsp[(1) - (1)].symbol); }
break;
case 61:
/* Line 1455 of yacc.c */
#line 435 "parse-gram.y"
#line 437 "parse-gram.y"
{ (yyval.symbol) = (yyvsp[(1) - (2)].symbol); symbol_user_token_number_set ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].integer), (yylsp[(2) - (2)])); }
break;
case 62:
/* Line 1455 of yacc.c */
#line 441 "parse-gram.y"
#line 443 "parse-gram.y"
{ (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); }
break;
case 63:
/* Line 1455 of yacc.c */
#line 443 "parse-gram.y"
#line 445 "parse-gram.y"
{ (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), symbol_list_sym_new ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]))); }
break;
case 64:
/* Line 1455 of yacc.c */
#line 447 "parse-gram.y"
#line 449 "parse-gram.y"
{ (yyval.list) = (yyvsp[(1) - (1)].list); }
break;
case 65:
/* Line 1455 of yacc.c */
#line 448 "parse-gram.y"
#line 450 "parse-gram.y"
{ (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].list)); }
break;
case 66:
/* Line 1455 of yacc.c */
#line 452 "parse-gram.y"
#line 454 "parse-gram.y"
{ (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); }
break;
case 67:
/* Line 1455 of yacc.c */
#line 453 "parse-gram.y"
#line 455 "parse-gram.y"
{ (yyval.list) = symbol_list_type_new ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
break;
case 68:
/* Line 1455 of yacc.c */
#line 454 "parse-gram.y"
#line 456 "parse-gram.y"
{ (yyval.list) = symbol_list_default_tagged_new ((yylsp[(1) - (1)])); }
break;
case 69:
/* Line 1455 of yacc.c */
#line 455 "parse-gram.y"
#line 457 "parse-gram.y"
{ (yyval.list) = symbol_list_default_tagless_new ((yylsp[(1) - (1)])); }
break;
case 70:
/* Line 1455 of yacc.c */
#line 461 "parse-gram.y"
#line 463 "parse-gram.y"
{
current_type = (yyvsp[(1) - (1)].uniqstr);
tag_seen = true;
@@ -2429,7 +2431,7 @@ yyreduce:
case 71:
/* Line 1455 of yacc.c */
#line 466 "parse-gram.y"
#line 468 "parse-gram.y"
{
symbol_class_set ((yyvsp[(1) - (1)].symbol), current_class, (yylsp[(1) - (1)]), true);
symbol_type_set ((yyvsp[(1) - (1)].symbol), current_type, (yylsp[(1) - (1)]));
@@ -2439,7 +2441,7 @@ yyreduce:
case 72:
/* Line 1455 of yacc.c */
#line 471 "parse-gram.y"
#line 473 "parse-gram.y"
{
symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true);
symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)]));
@@ -2450,7 +2452,7 @@ yyreduce:
case 73:
/* Line 1455 of yacc.c */
#line 477 "parse-gram.y"
#line 479 "parse-gram.y"
{
symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true);
symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)]));
@@ -2461,7 +2463,7 @@ yyreduce:
case 74:
/* Line 1455 of yacc.c */
#line 483 "parse-gram.y"
#line 485 "parse-gram.y"
{
symbol_class_set ((yyvsp[(1) - (3)].symbol), current_class, (yylsp[(1) - (3)]), true);
symbol_type_set ((yyvsp[(1) - (3)].symbol), current_type, (yylsp[(1) - (3)]));
@@ -2473,7 +2475,7 @@ yyreduce:
case 81:
/* Line 1455 of yacc.c */
#line 513 "parse-gram.y"
#line 515 "parse-gram.y"
{
yyerrok;
}
@@ -2482,77 +2484,77 @@ yyreduce:
case 82:
/* Line 1455 of yacc.c */
#line 519 "parse-gram.y"
#line 521 "parse-gram.y"
{ current_lhs = (yyvsp[(1) - (1)].symbol); current_lhs_location = (yylsp[(1) - (1)]); }
break;
case 84:
/* Line 1455 of yacc.c */
#line 523 "parse-gram.y"
#line 525 "parse-gram.y"
{ grammar_current_rule_end ((yylsp[(1) - (1)])); }
break;
case 85:
/* Line 1455 of yacc.c */
#line 524 "parse-gram.y"
#line 526 "parse-gram.y"
{ grammar_current_rule_end ((yylsp[(3) - (3)])); }
break;
case 87:
/* Line 1455 of yacc.c */
#line 530 "parse-gram.y"
#line 532 "parse-gram.y"
{ grammar_current_rule_begin (current_lhs, current_lhs_location); }
break;
case 88:
/* Line 1455 of yacc.c */
#line 532 "parse-gram.y"
#line 534 "parse-gram.y"
{ grammar_current_rule_symbol_append ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); }
break;
case 89:
/* Line 1455 of yacc.c */
#line 534 "parse-gram.y"
#line 536 "parse-gram.y"
{ grammar_current_rule_action_append ((yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); }
break;
case 90:
/* Line 1455 of yacc.c */
#line 536 "parse-gram.y"
#line 538 "parse-gram.y"
{ grammar_current_rule_prec_set ((yyvsp[(3) - (3)].symbol), (yylsp[(3) - (3)])); }
break;
case 91:
/* Line 1455 of yacc.c */
#line 538 "parse-gram.y"
#line 540 "parse-gram.y"
{ grammar_current_rule_dprec_set ((yyvsp[(3) - (3)].integer), (yylsp[(3) - (3)])); }
break;
case 92:
/* Line 1455 of yacc.c */
#line 540 "parse-gram.y"
#line 542 "parse-gram.y"
{ grammar_current_rule_merge_set ((yyvsp[(3) - (3)].uniqstr), (yylsp[(3) - (3)])); }
break;
case 94:
/* Line 1455 of yacc.c */
#line 550 "parse-gram.y"
#line 552 "parse-gram.y"
{ (yyval.uniqstr) = uniqstr_new ((yyvsp[(1) - (1)].chars)); }
break;
case 95:
/* Line 1455 of yacc.c */
#line 556 "parse-gram.y"
#line 558 "parse-gram.y"
{
(yyval.chars) = "";
}
@@ -2561,7 +2563,7 @@ yyreduce:
case 97:
/* Line 1455 of yacc.c */
#line 569 "parse-gram.y"
#line 571 "parse-gram.y"
{
code_props plain_code;
(yyvsp[(1) - (1)].code)[strlen ((yyvsp[(1) - (1)].code)) - 1] = '\n';
@@ -2575,14 +2577,14 @@ yyreduce:
case 98:
/* Line 1455 of yacc.c */
#line 589 "parse-gram.y"
#line 591 "parse-gram.y"
{ (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
break;
case 99:
/* Line 1455 of yacc.c */
#line 591 "parse-gram.y"
#line 593 "parse-gram.y"
{
(yyval.symbol) = symbol_get (char_name ((yyvsp[(1) - (1)].character)), (yylsp[(1) - (1)]));
symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false);
@@ -2593,14 +2595,14 @@ yyreduce:
case 100:
/* Line 1455 of yacc.c */
#line 599 "parse-gram.y"
#line 601 "parse-gram.y"
{ (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
break;
case 103:
/* Line 1455 of yacc.c */
#line 611 "parse-gram.y"
#line 613 "parse-gram.y"
{
(yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[(1) - (1)].chars)), (yylsp[(1) - (1)]));
symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false);
@@ -2610,7 +2612,7 @@ yyreduce:
case 105:
/* Line 1455 of yacc.c */
#line 620 "parse-gram.y"
#line 622 "parse-gram.y"
{
code_props plain_code;
code_props_plain_init (&plain_code, (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)]));
@@ -2624,7 +2626,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 2628 "parse-gram.c"
#line 2630 "parse-gram.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2843,7 +2845,7 @@ yyreturn:
/* Line 1675 of yacc.c */
#line 630 "parse-gram.y"
#line 632 "parse-gram.y"
+4 -4
View File
@@ -1,5 +1,5 @@
/* A Bison parser, made by GNU Bison 2.4.4-738cd. */
/* A Bison parser, made by GNU Bison 2.3a+. */
/* Skeleton interface for Bison's Yacc-like parsers in C
@@ -160,8 +160,8 @@
typedef union YYSTYPE
{
/* Line 1740 of yacc.c */
#line 92 "parse-gram.y"
/* Line 1676 of yacc.c */
#line 94 "parse-gram.y"
symbol *symbol;
symbol_list *list;
@@ -174,7 +174,7 @@ typedef union YYSTYPE
/* Line 1740 of yacc.c */
/* Line 1676 of yacc.c */
#line 179 "parse-gram.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
+4 -2
View File
@@ -21,6 +21,8 @@
#include <config.h>
#include "system.h"
#include <strverscmp.h>
#include "complain.h"
#include "conflicts.h"
#include "files.h"
@@ -254,7 +256,7 @@ prologue_declaration:
muscle_code_grow ("initial_action", action.code, @2);
code_scanner_last_string_free ();
}
| "%language" STRING { language_argmatch ($2, grammar_prio, &@1); }
| "%language" STRING { language_argmatch ($2, 1, &@1); }
| "%lex-param" "{...}" { add_param ("lex_param", $2, @2); }
| "%locations" { locations_flag = true; }
| "%name-prefix" STRING { spec_name_prefix = $2; }
@@ -300,7 +302,7 @@ prologue_declaration:
skeleton_user = uniqstr_new (skeleton_build);
free (skeleton_build);
}
skeleton_arg (skeleton_user, grammar_prio, &@1);
skeleton_arg (skeleton_user, 1, &@1);
}
| "%token-table" { token_table_flag = true; }
| "%verbose" { report_flag |= report_states; }
+19 -17
View File
@@ -1,7 +1,7 @@
/* Grammar reduction for Bison.
Copyright (C) 1988, 1989, 2000, 2001, 2002, 2003, 2005, 2006,
2007, 2008 Free Software Foundation, Inc.
2007 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -382,24 +382,26 @@ reduce_output (FILE *out)
static void
reduce_print (void)
{
fprintf (stderr, "%s: %s: ", grammar_file, _("warning"));
if (nuseless_nonterminals > 0)
{
fprintf (stderr, "%s: %s: ", grammar_file, _("warning"));
fprintf (stderr, ngettext ("%d nonterminal useless in grammar",
"%d nonterminals useless in grammar",
nuseless_nonterminals),
nuseless_nonterminals);
fprintf (stderr, "\n");
}
fprintf (stderr, ngettext ("%d nonterminal",
"%d nonterminals",
nuseless_nonterminals),
nuseless_nonterminals);
if (nuseless_nonterminals > 0 && nuseless_productions > 0)
fprintf (stderr, _(" and "));
if (nuseless_productions > 0)
{
fprintf (stderr, "%s: %s: ", grammar_file, _("warning"));
fprintf (stderr, ngettext ("%d rule useless in grammar",
"%d rules useless in grammar",
nuseless_productions),
nuseless_productions);
fprintf (stderr, "\n");
}
fprintf (stderr, ngettext ("%d rule",
"%d rules",
nuseless_productions),
nuseless_productions);
if (nuseless_nonterminals > 0 || nuseless_productions > 0)
fprintf (stderr, _(" useless in grammar"));
fprintf (stderr, "\n");
}
void
+25
View File
@@ -0,0 +1,25 @@
/* Between Bison releases, define a precise revision string.
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef REVISION_H_
# define REVISION_H_
extern const char *revision;
#endif /* !REVISION_H_ */
+4 -7
View File
@@ -1,6 +1,6 @@
/* Bison Action Scanner -*- C -*-
Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -170,14 +170,12 @@ splice (\\[ \f\t\v]*\n)*
"{" STRING_GROW; ++braces_level;
"}" {
bool outer_brace = --braces_level == 0;
bool outer_brace = --braces_level < 0;
/* As an undocumented Bison extension, append `;' before the last
brace in braced code, so that the user code can omit trailing
`;'. But do not append `;' if emulating Yacc, since Yacc does
not append one. Also, some output languages (like Java) do not
accept an extra semicolon, so don't append if the user specified
a skeleton or language.
not append one.
FIXME: Bison should warn if a semicolon seems to be necessary
here, and should omit the semicolon if it seems unnecessary
@@ -188,8 +186,7 @@ splice (\\[ \f\t\v]*\n)*
should also diagnose other Bison extensions like %yacc.
Perhaps there should also be a GCC-style --pedantic-errors
option, so that such warnings are diagnosed as errors. */
if (outer_brace && !yacc_flag && language_prio == default_prio
&& skeleton_prio == default_prio)
if (outer_brace && ! yacc_flag)
obstack_1grow (&obstack_for_string, ';');
STRING_GROW;
-16
View File
@@ -1,16 +0,0 @@
/*.dot
/*.output
/atconfig
/atlocal
/autom4te.cache
/bison
/calc
/calc.[chy]
/calc.tab.*
/Makefile
/Makefile.in
/Makefile.in
/package.m4
/testsuite
/testsuite.dir
/testsuite.log
+3 -3
View File
@@ -2,8 +2,8 @@
## Makefile for Bison testsuite.
## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free
## Software Foundation, Inc.
## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
## Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
## package.m4. ##
## ------------ ##
$(srcdir)/package.m4: $(top_srcdir)/configure
$(srcdir)/package.m4: $(top_srcdir)/configure.ac
{ \
echo '# Signature of the current package.'; \
echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])'; \
+4 -4
View File
@@ -1,14 +1,14 @@
# @configure_input@ -*- shell-script -*-
# Configurable variable values for Bison test suite.
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free
# Software Foundation, Inc.
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
# Foundation, Inc.
# We need a C compiler.
CC='@CC@'
# We want no optimization.
CFLAGS='@O0CFLAGS@ @WARN_CFLAGS@ @WERROR_CFLAGS@'
CFLAGS='@O0CFLAGS@ @WARNING_CFLAGS@ @WERROR_CFLAGS@'
# We need `config.h'.
CPPFLAGS="-I$abs_top_builddir/lib @CPPFLAGS@"
@@ -23,7 +23,7 @@ CXX='@CXX@'
BISON_CXX_WORKS='@BISON_CXX_WORKS@'
# We want no optimization with C++, too.
CXXFLAGS='@O0CXXFLAGS@ @WARN_CXXFLAGS@ @WERROR_CFLAGS@'
CXXFLAGS='@O0CXXFLAGS@ @WARNING_CXXFLAGS@ @WERROR_CFLAGS@'
# Are special link options needed?
LDFLAGS='@LDFLAGS@'
+154 -170
View File
@@ -1,7 +1,7 @@
# Simple calculator. -*- Autotest -*-
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free
# Software Foundation, Inc.
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,162 +28,21 @@
# _AT_DATA_CALC_Y($1, $2, $3, [BISON-DIRECTIVES])
# -----------------------------------------------
# Produce `calc.y' and, if %defines was specified, `calc-lex.c' or
# `calc-lex.cc'.
#
# Don't call this macro directly, because it contains some occurrences
# of `$1' etc. which will be interpreted by m4. So you should call it
# with $1, $2, and $3 as arguments, which is what AT_DATA_CALC_Y does.
# Produce `calc.y'. Don't call this macro directly, because it contains
# some occurrences of `$1' etc. which will be interpreted by m4. So
# you should call it with $1, $2, and $3 as arguments, which is what
# AT_DATA_CALC_Y does.
m4_define([_AT_DATA_CALC_Y],
[m4_if([$1$2$3], $[1]$[2]$[3], [],
[m4_fatal([$0: Invalid arguments: $@])])dnl
m4_pushdef([AT_CALC_LEX],
[[#include <ctype.h>
int ]AT_NAME_PREFIX[lex (]AT_LEX_FORMALS[);
static int get_char (]AT_LEX_FORMALS[);
static void unget_char (]AT_LEX_PRE_FORMALS[ int c);
]AT_LOCATION_IF([
static YYLTYPE last_yylloc;
])[
static int
get_char (]AT_LEX_FORMALS[)
{
int res = getc (input);
]AT_USE_LEX_ARGS[;
]AT_LOCATION_IF([
last_yylloc = AT_LOC;
if (res == '\n')
{
AT_LOC.last_line++;
AT_LOC.last_column = 1;
}
else
AT_LOC.last_column++;
])[
return res;
}
static void
unget_char (]AT_LEX_PRE_FORMALS[ int c)
{
]AT_USE_LEX_ARGS[;
]AT_LOCATION_IF([
/* Wrong when C == `\n'. */
AT_LOC = last_yylloc;
])[
ungetc (c, input);
}
static int
read_signed_integer (]AT_LEX_FORMALS[)
{
int c = get_char (]AT_LEX_ARGS[);
int sign = 1;
int n = 0;
]AT_USE_LEX_ARGS[;
if (c == '-')
{
c = get_char (]AT_LEX_ARGS[);
sign = -1;
}
while (isdigit (c))
{
n = 10 * n + (c - '0');
c = get_char (]AT_LEX_ARGS[);
}
unget_char (]AT_LEX_PRE_ARGS[ c);
return sign * n;
}
/*---------------------------------------------------------------.
| Lexical analyzer returns an integer on the stack and the token |
| NUM, or the ASCII character read if not a number. Skips all |
| blanks and tabs, returns 0 for EOF. |
`---------------------------------------------------------------*/
int
]AT_NAME_PREFIX[lex (]AT_LEX_FORMALS[)
{
static int init = 1;
int c;
if (init)
{
init = 0;
]AT_LOCATION_IF([
AT_LOC.last_column = 1;
AT_LOC.last_line = 1;
])[
}
]AT_LOCATION_IF([
AT_LOC.first_column = AT_LOC.last_column;
AT_LOC.first_line = AT_LOC.last_line;
])[
/* Skip white space. */
while ((c = get_char (]AT_LEX_ARGS[)) == ' ' || c == '\t')
{
]AT_LOCATION_IF(
[ AT_LOC.first_column = AT_LOC.last_column;
AT_LOC.first_line = AT_LOC.last_line;
])[
}
/* process numbers */
if (c == '.' || isdigit (c))
{
unget_char (]AT_LEX_PRE_ARGS[ c);
]AT_VAL[.ival = read_signed_integer (]AT_LEX_ARGS[);
return NUM;
}
/* Return end-of-file. */
if (c == EOF)
return CALC_EOF;
/* Return single chars. */
return c;
}
]])
AT_DATA_GRAMMAR([calc.y],
[[/* Infix notation calculator--calc */
]$4
AT_SKEL_CC_IF(
[%define global_tokens_and_yystype])[
%code requires {
/* Exercise pre-prologue dependency to %union. */
typedef int semantic_value;
}
/* Exercise %union. */
%union
{
semantic_value ival;
};
%code provides {
%{
#include <stdio.h>
/* The input. */
extern FILE *input;]AT_SKEL_CC_IF([[
#ifndef YYLTYPE
# define YYLTYPE ]AT_NAME_PREFIX[::location
#endif
#define first_line begin.line
#define first_column begin.column
#define last_line end.line
#define last_column end.column]])[
}
%code {
#include <stdlib.h>
#include <string.h>
#if HAVE_UNISTD_H
@@ -192,13 +51,33 @@ extern FILE *input;]AT_SKEL_CC_IF([[
# undef alarm
# define alarm(seconds) /* empty */
#endif
#include <ctype.h>
#define USE(Var)
FILE *input;
/* Exercise pre-prologue dependency to %union. */
typedef int semantic_value;
static semantic_value global_result = 0;
static int global_count = 0;
%}
/* Exercise %union. */
%union
{
semantic_value ival;
};
%{
static int power (int base, int exponent);
]AT_SKEL_CC_IF(,
]AT_SKEL_CC_IF(
[#ifndef YYLTYPE
[#] define YYLTYPE AT_NAME_PREFIX::location
#endif
#define first_line begin.line
#define first_column begin.column
#define last_line end.line
#define last_column end.column
],
[/* yyerror receives the location if:
- %location & %pure & %glr
- %location & %pure & %yacc & %parse-param. */
@@ -206,8 +85,10 @@ static void yyerror (AT_YYERROR_ARG_LOC_IF([YYLTYPE *llocp, ])
AT_PARAM_IF([semantic_value *result, int *count, ])
const char *s
);])[
int yylex (]AT_LEX_FORMALS[);
}
static int yylex (]AT_LEX_FORMALS[);
static int get_char (]AT_LEX_FORMALS[);
static void unget_char (]AT_LEX_PRE_FORMALS[ int c);
%}
]AT_SKEL_CC_IF(
[/* The lalr1.cc skeleton, for backward compatibility, defines
@@ -258,11 +139,13 @@ exp:
| '-' exp %prec NEG { $$ = -$2; }
| exp '^' exp { $$ = power ($1, $3); }
| '(' exp ')' { $$ = $2; }
| '(' error ')' { $$ = 1111; yyerrok; }
| '(' error ')' { $$ = 1111; }
| '!' { $$ = 0; YYERROR; }
| '-' error { $$ = 0; YYERROR; }
;
%%
/* The input. */
static FILE *input;
]AT_SKEL_CC_IF(
[/* A C++ error reporting function. */
@@ -302,7 +185,117 @@ AT_YYERROR_SEES_LOC_IF([
fprintf (stderr, "%s\n", s);
}])[
]AT_DEFINES_IF(, [AT_CALC_LEX])[
]AT_LOCATION_IF([
static YYLTYPE last_yylloc;
])[
static int
get_char (]AT_LEX_FORMALS[)
{
int res = getc (input);
]AT_USE_LEX_ARGS[;
]AT_LOCATION_IF([
last_yylloc = AT_LOC;
if (res == '\n')
{
AT_LOC.last_line++;
AT_LOC.last_column = 1;
}
else
AT_LOC.last_column++;
])[
return res;
}
static void
unget_char (]AT_LEX_PRE_FORMALS[ int c)
{
]AT_USE_LEX_ARGS[;
]AT_LOCATION_IF([
/* Wrong when C == `\n'. */
AT_LOC = last_yylloc;
])[
ungetc (c, input);
}
static int
read_signed_integer (]AT_LEX_FORMALS[)
{
int c = get_char (]AT_LEX_ARGS[);
int sign = 1;
int n = 0;
]AT_USE_LEX_ARGS[;
if (c == '-')
{
c = get_char (]AT_LEX_ARGS[);
sign = -1;
}
while (isdigit (c))
{
n = 10 * n + (c - '0');
c = get_char (]AT_LEX_ARGS[);
}
unget_char (]AT_LEX_PRE_ARGS[ c);
return sign * n;
}
/*---------------------------------------------------------------.
| Lexical analyzer returns an integer on the stack and the token |
| NUM, or the ASCII character read if not a number. Skips all |
| blanks and tabs, returns 0 for EOF. |
`---------------------------------------------------------------*/
static int
yylex (]AT_LEX_FORMALS[)
{
static int init = 1;
int c;
if (init)
{
init = 0;
]AT_LOCATION_IF([
AT_LOC.last_column = 1;
AT_LOC.last_line = 1;
])[
}
]AT_LOCATION_IF([
AT_LOC.first_column = AT_LOC.last_column;
AT_LOC.first_line = AT_LOC.last_line;
])[
/* Skip white space. */
while ((c = get_char (]AT_LEX_ARGS[)) == ' ' || c == '\t')
{
]AT_LOCATION_IF(
[ AT_LOC.first_column = AT_LOC.last_column;
AT_LOC.first_line = AT_LOC.last_line;
])[
}
/* process numbers */
if (c == '.' || isdigit (c))
{
unget_char (]AT_LEX_PRE_ARGS[ c);
]AT_VAL[.ival = read_signed_integer (]AT_LEX_ARGS[);
return NUM;
}
/* Return end-of-file. */
if (c == EOF)
return CALC_EOF;
/* Return single chars. */
return c;
}
static int
power (int base, int exponent)
@@ -350,18 +343,12 @@ main (int argc, const char **argv)
return status;
}
]])
AT_DEFINES_IF([AT_DATA_SOURCE([[calc-lex.c]AT_SKEL_CC_IF([[c]])],
[[#include "calc.h]AT_SKEL_CC_IF([[h]])["
]AT_CALC_LEX])])
m4_popdef([AT_CALC_LEX])
])# _AT_DATA_CALC_Y
# AT_DATA_CALC_Y([BISON-OPTIONS])
# -------------------------------
# Produce `calc.y' and, if %defines was specified, `calc-lex.c' or
# `calc-lex.cc'.
# Produce `calc.y'.
m4_define([AT_DATA_CALC_Y],
[_AT_DATA_CALC_Y($[1], $[2], $[3], [$1])
])
@@ -466,7 +453,12 @@ m4_ifval([$2], [AT_CHECK([exit 77])])
AT_BISON_OPTION_PUSHDEFS([$1])
AT_DATA_CALC_Y([$1])
AT_FULL_COMPILE([calc], [AT_DEFINES_IF([[lex]])])
AT_SKEL_CC_IF(
[AT_BISON_CHECK([-o calc.cc calc.y])
AT_COMPILE_CXX([calc])],
[AT_BISON_CHECK([-o calc.c calc.y])
AT_COMPILE([calc])])
# Test the priorities.
_AT_CHECK_CALC([$1],
@@ -537,14 +529,6 @@ _AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (0 0) = 1], [113],
[1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
1.12: syntax error, unexpected number
calc: error: 2222 != 1])
# Check that yyerrok works properly: second error is not reported,
# third and fourth are. Parse status is succesfull.
_AT_CHECK_CALC_ERROR([$1], [0], [(* *) + (*) + (*)], [113],
[1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!'])
AT_BISON_OPTION_POPDEFS
AT_CLEANUP
+14 -14
View File
@@ -1,6 +1,6 @@
# Checking GLR Parsing. -*- Autotest -*-
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
# Foundation, Inc.
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
# Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -351,7 +351,7 @@ AT_BISON_OPTION_POPDEFS
])
m4_define([_AT_RESOLVED_GLR_OUTPUT],
[[[+(z,q)
[[+(z,q)
<declare>(T,x)
<init-declare>(T,x,y)
=(x,y)
@@ -360,10 +360,10 @@ m4_define([_AT_RESOLVED_GLR_OUTPUT],
<init-declare>(T,y,+(z,q))
<error>
+(z,q)
]]])
]])
m4_define([_AT_RESOLVED_GLR_OUTPUT_WITH_LOC],
[[[3.0-3.5: +(z,q)
[[3.0-3.5: +(z,q)
5.0-5.3: <declare>(T,x)
7.0-7.7: <init-declare>(T,x,y)
9.0-9.5: =(x,y)
@@ -372,10 +372,10 @@ m4_define([_AT_RESOLVED_GLR_OUTPUT_WITH_LOC],
15.0-15.13: <init-declare>(T,y,+(z,q))
17.0-17.15: <error>
19.0-19.5: +(z,q)
]]])
]])
m4_define([_AT_AMBIG_GLR_OUTPUT],
[[[+(z,q)
[[+(z,q)
<declare>(T,x)
<init-declare>(T,x,y)
=(x,y)
@@ -384,10 +384,10 @@ m4_define([_AT_AMBIG_GLR_OUTPUT],
<OR>(<init-declare>(T,y,+(z,q)),=(<cast>(y,T),+(z,q)))
<error>
+(z,q)
]]])
]])
m4_define([_AT_AMBIG_GLR_OUTPUT_WITH_LOC],
[[[3.0-3.5: +(z,q)
[[3.0-3.5: +(z,q)
5.0-5.3: <declare>(T,x)
7.0-7.7: <init-declare>(T,x,y)
9.0-9.5: =(x,y)
@@ -396,15 +396,15 @@ m4_define([_AT_AMBIG_GLR_OUTPUT_WITH_LOC],
15.0-15.13: <OR>(<init-declare>(T,y,+(z,q)),=(<cast>(y,T),+(z,q)))
17.0-17.15: <error>
19.0-19.5: +(z,q)
]]])
]])
m4_define([_AT_GLR_STDERR],
[[[syntax error
]]])
[[syntax error
]])
m4_define([_AT_VERBOSE_GLR_STDERR],
[[[syntax error, unexpected ID, expecting '=' or '+' or ')'
]]])
[[syntax error, unexpected ID, expecting '=' or '+' or ')'
]])
## ---------------------------------------------------- ##
## Compile the grammar described in the documentation. ##
+1 -368
View File
@@ -1,6 +1,6 @@
# Java tests for simple calculator. -*- Autotest -*-
# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
# Copyright (C) 2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -397,370 +397,3 @@ AT_CHECK_JAVA_CALC([%lex-param { InputStream is } ], [[
new Calc (System.in).parse ();
}
]])
# -----------------#
# Java Directives. #
# -----------------#
AT_BANNER([Java Parameters.])
# AT_CHECK_JAVA_MINIMAL([DIRECTIVES], [PARSER_ACTION], [POSITION_CLASS])
# ----------------------------------------------------------------------
# Check that a mininal parser with DIRECTIVES compiles in Java.
# Put the Java code in YYParser.java.
m4_define([AT_CHECK_JAVA_MINIMAL],
[
AT_DATA([[YYParser.y]], [
%language "Java"
%locations
%debug
%error-verbose
%token-table
$1
%%
start: "end" {$2};
%%
class m4_default([$3], [Position]) {}
])
AT_BISON_CHECK([[YYParser.y]])
AT_CHECK([[grep -q '[mb]4_' YYParser.y]], [1])
AT_JAVA_COMPILE([[YYParser.java]])
])
# AT_CHECK_JAVA_MINIMAL_W_LEXER([1:DIRECTIVES], [2:LEX_THROWS],
# [3:YYLEX_ACTION], [4:LEXER_BODY], [5:PARSER_ACTION], [6:STYPE],
# [7:POSITION_TYPE], [8:LOCATION_TYPE])
# ---------------------------------------------------------------------
# Check that a mininal parser with DIRECTIVES and a "%code lexer".
# YYLEX is the body of yylex () which throws LEX_THROW.
# compiles in Java.
m4_define([AT_CHECK_JAVA_MINIMAL_W_LEXER],
[AT_CHECK_JAVA_MINIMAL([$1
%code lexer
{
m4_default([$6], [Object]) yylval;
public m4_default([$6], [Object]) getLVal() { return yylval; }
public m4_default([$7], [Position]) getStartPos() { return null; }
public m4_default([$7], [Position]) getEndPos() { return null; }
public void yyerror (m4_default([$8], [Location]) loc, String s)
{
System.err.println (loc + ": " + s);
}
public int yylex ()$2
{
$3
}
$4
}], [$5], [$7])])
# AT_CHECK_JAVA_GREP([LINE], [COUNT=1])
# -------------------------------------
# Check that YYParser.java contains exactly COUNT lines matching ^LINE$
# with grep.
m4_define([AT_CHECK_JAVA_GREP],
[AT_CHECK([grep -c '^$1$' YYParser.java], [], [m4_default([$2], [1])
])
])
# ----------------------------------- #
# Java parser class and package names #
# ----------------------------------- #
AT_SETUP([Java parser class and package names])
AT_CHECK_JAVA_MINIMAL([])
AT_CHECK_JAVA_GREP([[class YYParser]])
AT_CHECK_JAVA_MINIMAL([[%name-prefix "Prefix"]])
AT_CHECK_JAVA_GREP([[class PrefixParser]])
AT_CHECK_JAVA_MINIMAL([[%define parser_class_name "ParserClassName"]])
AT_CHECK_JAVA_GREP([[class ParserClassName]])
AT_CHECK_JAVA_MINIMAL([[%define package "user_java_package"]])
AT_CHECK_JAVA_GREP([[package user_java_package;]])
AT_CLEANUP
# --------------------------- #
# Java parser class modifiers #
# --------------------------- #
AT_SETUP([Java parser class modifiers])
AT_CHECK_JAVA_MINIMAL([[%define abstract]])
AT_CHECK_JAVA_GREP([[abstract class YYParser]])
AT_CHECK_JAVA_MINIMAL([[%define final]])
AT_CHECK_JAVA_GREP([[final class YYParser]])
AT_CHECK_JAVA_MINIMAL([[%define strictfp]])
AT_CHECK_JAVA_GREP([[strictfp class YYParser]])
AT_CHECK_JAVA_MINIMAL([[
%define abstract
%define strictfp]])
AT_CHECK_JAVA_GREP([[abstract strictfp class YYParser]])
AT_CHECK_JAVA_MINIMAL([[
%define final
%define strictfp]])
AT_CHECK_JAVA_GREP([[final strictfp class YYParser]])
AT_CHECK_JAVA_MINIMAL([[%define public]])
AT_CHECK_JAVA_GREP([[public class YYParser]])
AT_CHECK_JAVA_MINIMAL([[
%define public
%define abstract]])
AT_CHECK_JAVA_GREP([[public abstract class YYParser]])
AT_CHECK_JAVA_MINIMAL([[
%define public
%define final]])
AT_CHECK_JAVA_GREP([[public final class YYParser]])
AT_CHECK_JAVA_MINIMAL([[
%define public
%define strictfp]])
AT_CHECK_JAVA_GREP([[public strictfp class YYParser]])
AT_CHECK_JAVA_MINIMAL([[
%define public
%define abstract
%define strictfp]])
AT_CHECK_JAVA_GREP([[public abstract strictfp class YYParser]])
AT_CHECK_JAVA_MINIMAL([[
%define public
%define final
%define strictfp]])
AT_CHECK_JAVA_GREP([[public final strictfp class YYParser]])
AT_CLEANUP
# ---------------------------------------- #
# Java parser class extends and implements #
# ---------------------------------------- #
AT_SETUP([Java parser class extends and implements])
AT_CHECK_JAVA_MINIMAL([[%define extends "Thread"]])
AT_CHECK_JAVA_GREP([[class YYParser extends Thread]])
AT_CHECK_JAVA_MINIMAL([[%define implements "Cloneable"]])
AT_CHECK_JAVA_GREP([[class YYParser implements Cloneable]])
AT_CHECK_JAVA_MINIMAL([[
%define extends "Thread"
%define implements "Cloneable"]])
AT_CHECK_JAVA_GREP([[class YYParser extends Thread implements Cloneable]])
AT_CLEANUP
# -------------------------------- #
# Java %parse-param and %lex-param #
# -------------------------------- #
AT_SETUP([Java %parse-param and %lex-param])
AT_CHECK_JAVA_MINIMAL([])
AT_CHECK_JAVA_GREP([[ *public YYParser (Lexer yylexer) {]])
AT_CHECK_JAVA_MINIMAL([[%parse-param {int parse_param1}]])
AT_CHECK_JAVA_GREP([[ *protected final int parse_param1;]])
AT_CHECK_JAVA_GREP([[ *public YYParser (Lexer yylexer, *int parse_param1) {]])
AT_CHECK_JAVA_GREP([[[ ]*this.parse_param1 = parse_param1;]])
AT_CHECK_JAVA_MINIMAL([[
%parse-param {int parse_param1}
%parse-param {long parse_param2}]])
AT_CHECK_JAVA_GREP([[ *protected final int parse_param1;]])
AT_CHECK_JAVA_GREP([[ *protected final long parse_param2;]])
AT_CHECK_JAVA_GREP([[ *public YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {]])
AT_CHECK_JAVA_GREP([[[ ]*this.parse_param1 = parse_param1;]])
AT_CHECK_JAVA_GREP([[[ ]*this.parse_param2 = parse_param2;]])
AT_CHECK_JAVA_MINIMAL_W_LEXER([], [], [[return EOF;]])
AT_CHECK_JAVA_GREP([[ *public YYParser () {]])
AT_CHECK_JAVA_GREP([[ *protected YYParser (Lexer yylexer) {]])
AT_CHECK_JAVA_MINIMAL_W_LEXER([[%parse-param {int parse_param1}]],
[], [[return EOF;]])
AT_CHECK_JAVA_GREP([[ *protected final int parse_param1;]])
AT_CHECK_JAVA_GREP([[ *public YYParser (int parse_param1) {]])
AT_CHECK_JAVA_GREP([[ *protected YYParser (Lexer yylexer, *int parse_param1) {]])
AT_CHECK_JAVA_GREP([[[ ]*this.parse_param1 = parse_param1;]], [2])
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
%parse-param {int parse_param1}
%parse-param {long parse_param2}]],
[], [[return EOF;]])
AT_CHECK_JAVA_GREP([[ *protected final int parse_param1;]])
AT_CHECK_JAVA_GREP([[ *protected final long parse_param2;]])
AT_CHECK_JAVA_GREP([[ *public YYParser (int parse_param1, *long parse_param2) {]])
AT_CHECK_JAVA_GREP([[ *protected YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {]])
AT_CHECK_JAVA_GREP([[[ ]*this.parse_param1 = parse_param1;]], [2])
AT_CHECK_JAVA_GREP([[[ ]*this.parse_param2 = parse_param2;]], [2])
AT_CHECK_JAVA_MINIMAL_W_LEXER([[%lex-param {char lex_param1}]],
[], [[return EOF;]], [[YYLexer (char lex_param1) {}]])
AT_CHECK_JAVA_GREP([[ *public YYParser (char lex_param1) {]])
AT_CHECK_JAVA_GREP([[.* = new YYLexer *(lex_param1);]])
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
%lex-param {char lex_param1}
%lex-param {short lex_param2}]],
[], [[return EOF;]], [[YYLexer (char lex_param1, short lex_param2) {}]])
AT_CHECK_JAVA_GREP([[ *public YYParser (char lex_param1, *short lex_param2) {]])
AT_CHECK_JAVA_GREP([[.* = new YYLexer *(lex_param1, *lex_param2);]])
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
%parse-param {int parse_param1}
%parse-param {long parse_param2}
%lex-param {char lex_param1}
%lex-param {short lex_param2}]],
[], [[return EOF;]], [[YYLexer (char lex_param1, short lex_param2) {}]])
AT_CHECK_JAVA_GREP([[ *protected final int parse_param1;]])
AT_CHECK_JAVA_GREP([[ *protected final long parse_param2;]])
AT_CHECK_JAVA_GREP([[ *public YYParser (char lex_param1, *short lex_param2, *int parse_param1, *long parse_param2) {]])
AT_CHECK_JAVA_GREP([[.* = new YYLexer *(lex_param1, *lex_param2);]])
AT_CHECK_JAVA_GREP([[ *protected YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {]])
AT_CHECK_JAVA_GREP([[[ ]*this.parse_param1 = parse_param1;]], [2])
AT_CHECK_JAVA_GREP([[[ ]*this.parse_param2 = parse_param2;]], [2])
AT_CLEANUP
# ------------------------- #
# Java throw specifications #
# ------------------------- #
AT_SETUP([Java throws specifications])
# %define throws - 0 1 2
# %define lex-throws - 0 1 2
# %code lexer 0 1
m4_define([AT_JT_lex_throws_define], [m4_case(AT_JT_lex_throws,
-1, [],
0, [[%define lex_throws ""]],
1, [[%define lex_throws "InterruptedException"]],
2, [[%define lex_throws "InterruptedException, IllegalAccessException"]])])
m4_define([AT_JT_yylex_throws], [m4_case(AT_JT_lex_throws,
-1, [[ throws java.io.IOException]],
0, [],
1, [[ throws InterruptedException]],
2, [[ throws InterruptedException, IllegalAccessException]])])
m4_define([AT_JT_yylex_action], [m4_case(AT_JT_lex_throws,
-1, [[throw new java.io.IOException();]],
0, [[return EOF;]],
1, [[throw new InterruptedException();]],
2, [[throw new IllegalAccessException();]])])
m4_define([AT_JT_throws_define], [m4_case(AT_JT_throws,
-1, [],
0, [[%define throws ""]],
1, [[%define throws "ClassNotFoundException"]],
2, [[%define throws "ClassNotFoundException, InstantiationException"]])])
m4_define([AT_JT_yyaction_throws], [m4_case(AT_JT_throws,
-1, [],
0, [],
1, [[ throws ClassNotFoundException]],
2, [[ throws ClassNotFoundException, InstantiationException]])])
m4_define([AT_JT_parse_throws_2], [m4_case(AT_JT_throws,
-1, [],
0, [],
1, [[, ClassNotFoundException]],
2, [[, ClassNotFoundException, InstantiationException]])])
m4_define([AT_JT_parse_throws],
[m4_if(m4_quote(AT_JT_yylex_throws), [],
[AT_JT_yyaction_throws],
[AT_JT_yylex_throws[]AT_JT_parse_throws_2])])
m4_define([AT_JT_initial_action], [m4_case(AT_JT_throws,
-1, [],
0, [],
1, [[%initial-action {if (true) throw new ClassNotFoundException();}]],
2, [[%initial-action {if (true) throw new InstantiationException();}]])])
m4_define([AT_JT_parse_action], [m4_case(AT_JT_throws,
-1, [],
0, [],
1, [[throw new ClassNotFoundException();]],
2, [[throw new ClassNotFoundException();]])])
m4_for([AT_JT_lexer], 0, 1, 1,
[m4_for([AT_JT_lex_throws], -1, 2, 1,
[m4_for([AT_JT_throws], -1, 2, 1,
[m4_if(AT_JT_lexer, 0,
[AT_CHECK_JAVA_MINIMAL([
AT_JT_throws_define
AT_JT_lex_throws_define
AT_JT_initial_action],
[AT_JT_parse_action])],
[AT_CHECK_JAVA_MINIMAL_W_LEXER([
AT_JT_throws_define
AT_JT_lex_throws_define
AT_JT_initial_action],
[AT_JT_yylex_throws],
[AT_JT_yylex_action],
[],
[AT_JT_parse_action])])
AT_CHECK_JAVA_GREP([[ *int yylex ()]AT_JT_yylex_throws *[;]])
AT_CHECK_JAVA_GREP([[ *private int yyaction ([^)]*)]AT_JT_yyaction_throws[ *]])
AT_CHECK_JAVA_GREP([[ *public boolean parse ()]AT_JT_parse_throws[ *]])
])])])
AT_CLEANUP
# --------------------------------------------- #
# Java stype, position_class and location_class #
# --------------------------------------------- #
AT_SETUP([Java stype, position_class and location_class])
AT_CHECK_JAVA_MINIMAL([[
%define stype "java.awt.Color"
%type<java.awt.Color> start;
%define location_type "MyLoc"
%define position_type "MyPos"
%code { class MyPos {} }]], [[$$ = $<java.awt.Color>1;]], [[MyPos]])
AT_CHECK([[grep -q 'java.awt.Color' YYParser.java]])
AT_CHECK([[egrep -v ' */?\*' YYParser.java | grep -q 'Position']], [1])
AT_CHECK([[egrep -v ' */?\*' YYParser.java | grep -q 'Location']], [1])
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
%define stype "java.awt.Color"
%type<java.awt.Color> start;
%define location_type "MyLoc"
%define position_type "MyPos"
%code { class MyPos {} }]], [], [[return EOF;]], [],
[[$$ = $<java.awt.Color>1;]],
[[java.awt.Color]], [[MyPos]], [[MyLoc]])
AT_CHECK([[grep -q 'java.awt.Color' YYParser.java]])
AT_CHECK([[egrep -v ' */?\*' YYParser.java | grep -q 'Position']], [1])
AT_CHECK([[egrep -v ' */?\*' YYParser.java | grep -q 'Location']], [1])
AT_CLEANUP
+11 -45
View File
@@ -1,8 +1,7 @@
# Process this -*- Autotest -*- file with autom4te.
# Macros for the GNU Bison Test suite.
# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
# Inc.
# Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,8 +39,6 @@ m4_define([AT_BISON_OPTION_PUSHDEFS],
m4_define([_AT_BISON_OPTION_PUSHDEFS],
[m4_if([$1$2], $[1]$[2], [],
[m4_fatal([$0: Invalid arguments: $@])])dnl
m4_pushdef([AT_DEFINES_IF],
[m4_bmatch([$3], [%defines], [$1], [$2])])
m4_pushdef([AT_SKEL_CC_IF],
[m4_bmatch([$3], [%language "[Cc]\+\+"\|%skeleton "[a-z0-9]+\.cc"], [$1], [$2])])
m4_pushdef([AT_GLR_IF],
@@ -103,8 +100,8 @@ AT_PURE_LEX_IF(
m4_pushdef([AT_LEX_PRE_ARGS],
[AT_LEX_ARGS, ])
],
[m4_pushdef([AT_LOC], [[(]AT_NAME_PREFIX[lloc)]])
m4_pushdef([AT_VAL], [[(]AT_NAME_PREFIX[lval)]])
[m4_pushdef([AT_LOC], [(yylloc)])
m4_pushdef([AT_VAL], [(yylval)])
m4_pushdef([AT_LEX_FORMALS], [void])
m4_pushdef([AT_LEX_ARGS], [])
m4_pushdef([AT_USE_LEX_ARGS], [])
@@ -138,7 +135,6 @@ m4_popdef([AT_GLR_IF])
m4_popdef([AT_SKEL_CC_IF])
m4_popdef([AT_GLR_CC_IF])
m4_popdef([AT_LALR1_CC_IF])
m4_popdef([AT_DEFINES_IF])
])# AT_BISON_OPTION_POPDEFS
@@ -147,38 +143,22 @@ m4_popdef([AT_DEFINES_IF])
## Generating Grammar Files. ##
## -------------------------- ##
# AT_DATA_SOURCE_PROLOGUE
# ------------------------
# The prologue that should be included in any source code that is
# meant to be compiled.
m4_define([AT_DATA_SOURCE_PROLOGUE],
[[#include <config.h>
/* We don't need perfect functions for these tests. */
#undef malloc
#undef memcmp
#undef realloc
]])
# AT_DATA_GRAMMAR_PROLOGUE
# ------------------------
# The prologue that should be included in any grammar which parser is
# meant to be compiled.
m4_define([AT_DATA_GRAMMAR_PROLOGUE],
[[%code top {
]AT_DATA_SOURCE_PROLOGUE[]dnl
[}
]])
# AT_DATA_SOURCE(NAME, CONTENT)
# -----------------------------
# Generate the file NAME, which CONTENT is preceded by
# AT_DATA_SOURCE_PROLOGUE.
m4_define([AT_DATA_SOURCE],
[AT_DATA([$1],
[AT_DATA_SOURCE_PROLOGUE
$2])
[[%{
#include <config.h>
/* We don't need perfect functions for these tests. */
#undef malloc
#undef memcmp
#undef realloc
%}]
])
# AT_DATA_GRAMMAR(NAME, CONTENT)
# ------------------------------
# Generate the file NAME, which CONTENT is preceded by
@@ -288,20 +268,6 @@ AT_CHECK([$CXX $CXXFLAGS $CPPFLAGS m4_bmatch([$1], [[.]], [], [$LDFLAGS ])-o $1
0, [ignore], [ignore])])
# AT_FULL_COMPILE(OUTPUT, [OTHER])
# --------------------------------
# Compile OUTPUT.y to OUTPUT.c or OUTPUT.cc, and compile it to OUTPUT.
# If OTHER is specified, compile OUTPUT-OTHER.c or OUTPUT-OTHER.cc to OUTPUT
# along with it.
# Relies on AT_SKEL_CC_IF.
m4_define([AT_FULL_COMPILE],
[AT_SKEL_CC_IF(
[AT_BISON_CHECK([-o $1.cc $1.y])
AT_COMPILE_CXX([$1]m4_ifval($2, [, [$1.cc $1-$2.cc]]))],
[AT_BISON_CHECK([-o $1.c $1.y])
AT_COMPILE([$1]m4_ifval($2, [, [$1.c $1-$2.c]]))])
])
## ---------------------------- ##
## Running a generated parser. ##
+8 -21
View File
@@ -23,11 +23,9 @@ AT_BANNER([[Output file names.]])
# -----------------------------------------------------------------------------
m4_define([AT_CHECK_OUTPUT],
[AT_SETUP([[Output files: $2 $3 $5]])
for file in $1 $4; do
case "$file" in
*/*) mkdir -p `echo "$file" | sed 's,/.*,,'`;;
esac
done
case "$1" in
*/*) mkdir `echo "$1" | sed 's,/.*,,'`;;
esac
AT_DATA([$1],
[[$2
%%
@@ -118,15 +116,9 @@ AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %defines %verbose],
[subdir/foo.cc subdir/foo.hh subdir/foo.output subdir/location.hh subdir/stack.hh subdir/position.hh],
[], [AT_CHECK_NO_SUBDIR_PART([subdir/foo])])
AT_CHECK_OUTPUT([gram_dir/foo.yy],
[%skeleton "lalr1.cc" %defines %verbose %file-prefix "output_dir/foo"],
[],
[output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/foo.output output_dir/location.hh output_dir/stack.hh output_dir/position.hh])
# AT_CHECK_CONFLICTING_OUTPUT(INPUT-FILE, DIRECTIVES, FLAGS, STDERR,
# [EXIT-STATUS])
# ------------------------------------------------------------------
# AT_CHECK_CONFLICTING_OUTPUT(INPUT-FILE, DIRECTIVES, FLAGS, STDERR)
# -----------------------------------------------------------------------------
m4_define([AT_CHECK_CONFLICTING_OUTPUT],
[AT_SETUP([Conflicting output files: $2 $3])
case "$1" in
@@ -138,7 +130,7 @@ AT_DATA([$1],
foo: {};
]])
AT_BISON_CHECK([$3 $1], $5, [], [$4])
AT_BISON_CHECK([$3 $1], 0, [], [$4])
AT_CLEANUP
])
@@ -157,10 +149,6 @@ AT_CHECK_CONFLICTING_OUTPUT([foo.y],
[foo.y: warning: conflicting outputs to file `location.hh'
])
AT_CHECK_CONFLICTING_OUTPUT([foo.y], [], [-o foo.y],
[foo.y: fatal error: refusing to overwrite the input file `foo.y'
], 1)
# AT_CHECK_OUTPUT_FILE_NAME(FILE-NAME-PREFIX, [ADDITIONAL-TESTS])
# -----------------------------------------------------------------------------
@@ -200,10 +188,9 @@ AT_CLEANUP
AT_CHECK_OUTPUT_FILE_NAME([[`~!@#$%^&*()-=_+{}[]|\:;<>, .']])
dnl Work around a bug in m4_expand that broke AT_SETUP in autoconf 2.62,
dnl by using the definition from 2.63.
m4_version_prereq([2.63], [],
[m4_define([m4_expand], [_$0(-=<{($1)}>=-)])
m4_define([m4_expand], [_$0(-=<{($1)}>=-)])
m4_define([_m4_expand],
[m4_changequote([-=<{(], [)}>=-])$1m4_changequote([, ])])])
[m4_changequote([-=<{(], [)}>=-])$1m4_changequote([, ])])
AT_CHECK_OUTPUT_FILE_NAME([[(]])
AT_CHECK_OUTPUT_FILE_NAME([[)]])
AT_CHECK_OUTPUT_FILE_NAME([[#]])
+5 -9
View File
@@ -1,5 +1,5 @@
# Exercising Bison Grammar Reduction. -*- Autotest -*-
# Copyright (C) 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
# Copyright (C) 2001, 2002, 2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -142,8 +142,7 @@ useless9: '9';
]])
AT_BISON_CHECK([[input.y]], 0, [],
[[input.y: warning: 9 nonterminals useless in grammar
input.y: warning: 9 rules useless in grammar
[[input.y: warning: 9 nonterminals and 9 rules useless in grammar
input.y:6.1-8: warning: nonterminal useless in grammar: useless1
input.y:7.1-8: warning: nonterminal useless in grammar: useless2
input.y:8.1-8: warning: nonterminal useless in grammar: useless3
@@ -238,8 +237,7 @@ non_productive: non_productive useless_token
]])
AT_BISON_CHECK([[not-reduced.y]], 0, [],
[[not-reduced.y: warning: 2 nonterminals useless in grammar
not-reduced.y: warning: 3 rules useless in grammar
[[not-reduced.y: warning: 2 nonterminals and 3 rules useless in grammar
not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable
not-reduced.y:11.6-19: warning: nonterminal useless in grammar: non_productive
not-reduced.y:11.6-57: warning: rule useless in grammar: exp: non_productive
@@ -313,8 +311,7 @@ indirection: underivable;
]])
AT_BISON_CHECK([[input.y]], 0, [],
[[input.y: warning: 2 nonterminals useless in grammar
input.y: warning: 3 rules useless in grammar
[[input.y: warning: 2 nonterminals and 3 rules useless in grammar
input.y:5.15-25: warning: nonterminal useless in grammar: underivable
input.y:6.14-24: warning: nonterminal useless in grammar: indirection
input.y:5.15-25: warning: rule useless in grammar: exp: underivable
@@ -349,8 +346,7 @@ exp: exp;
]])
AT_BISON_CHECK([[input.y]], 1, [],
[[input.y: warning: 2 nonterminals useless in grammar
input.y: warning: 2 rules useless in grammar
[[input.y: warning: 2 nonterminals and 2 rules useless in grammar
input.y:3.1-3: fatal error: start symbol exp does not derive any sentence
]])
+1 -25
View File
@@ -1201,7 +1201,7 @@ AT_CLEANUP
## Token number in precedence declaration. ##
## ---------------------------------------- ##
AT_SETUP([[Token number in precedence declaration]])
AT_SETUP([[Token number in precedence declaration.]])
# POSIX says token numbers can be declared in %left, %right, and %nonassoc, but
# we lost this in Bison 1.50.
@@ -1255,27 +1255,3 @@ AT_COMPILE([[input]])
AT_PARSER_CHECK([[./input]])
AT_CLEANUP
## ----------------------------------------------- ##
## Fix user actions without a trailing semicolon. ##
## ----------------------------------------------- ##
AT_SETUP([[Fix user actions without a trailing semicolon]])
# This feature is undocumented, but we accidentally broke it in 2.3a, and there
# was a complaint at:
# <http://lists.gnu.org/archive/html/bug-bison/2008-11/msg00001.html>.
AT_DATA([input.y],
[[%%
start: {asdffdsa} ;
]])
AT_BISON_CHECK([[-o input.c input.y]])
AT_CHECK([[sed -n '/asdffdsa/s/^ *//p' input.c]], [[0]],
[[{asdffdsa;}
]])
AT_CLEANUP