summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-07-24 07:24:22 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-07-24 07:24:22 +0000
commit040984073a54b4c603172be3c3f44b908ea5deb9 (patch)
tree20613968ae52fbb193b35616a4284cc67ad88166
parent135bc829bd90e60e58ae16bc442647043a2d9362 (diff)
downloadbison-040984073a54b4c603172be3c3f44b908ea5deb9.tar.gz
* NEWS: Version 2.0b.
* data/glr.c (ATTRIBUTE_UNUSED): Remove, since it infringes on the user's name space. All uses changed to __attribute__ ((__unused__)). (yyFail, yyMemoryExhausted, yyreportAmbiguity): Add __attribute__ ((__noreturn__)). * etc/clcommit: Remove. We weren't using it, and it failed "make maintainer-distcheck". * Makefile.maint: Merge from coreutils. (CVS_LIST, CVS_LIST_EXCEPT): New macros. (syntax-check-rules): Change list of rules as described below. (sc_cast_of_alloca_return_value, sc_dd_max_sym_length): (sc_file_system, sc_obsolete_symbols, sc_prohibit_atoi_atof): (sc_prohibit_jm_in_m4, sc_root_tests, sc_tight_scope): (sc_trailing_space): New rules. (sc_xalloc_h_in_src): Remove. (sc_cast_of_argument_to_free, sc_cast_of_x_alloc_return_value): (sc_space_tab, sc_error_exit_success, sc_changelog): (sc_system_h_headers, sc_sun_os_names, sc_unmarked_diagnostics): (makefile-check, po-check, author_mark_check): (makefile_path_separator_check, copyright-check): Use grep -n, to make it easier to find violations. Use CVS_LIST and CVS_LIST_EXCEPT. (header_regexp, h_re): Remove. (dd_c): New macro. (sc_dd_max_sym_length, .re-list, news-date-check): New rules. (my-distcheck): Use more-modern GCC flags. (signatures, %.asc): Remove. (rel-files, announcement): Remove signatures. Restore old updating code, even though we don't use it, so that we're the same as coreutils. (alpha, beta, major): Depend on news-date-check. Make the upload commands. * data/c.m4, data/lalr1.cc, data/yacc.c: Normalize white space. * lib/abitset.h, lib/bbitset.h, lib/bitset.h: Likewise. * lib/bitset_stats.c, lib/ebitset.h, lib/lbitset.c: Likewise. * lib/libitset.h, lib/timevar.c, lib/vbitset.h: Likewise. * src/Makefile.am, src/gram.c, src/muscle_tab.h: Likewise. * src/parse-gram.y, src/system.h, src/tables.c, src/vcg.c: Likewise. * src/vcg_defaults.h, tests/cxx-type.at, tests/existing.at: Likewise. * tests/sets.at: Likewise. * data/m4sugar/m4sugar.m4: Sync from Autoconf, except that we comment out the Autoconf version number. * doc/bison.texinfo (Calc++ Scanner): Don't use atoi, as it's error-prone and "make maintainer-distcheck" rejects it. * lib/subpipe.c: Include <fcntl.h> without checking for HAVE_FCNTL_H. Indent calls to "error" to pacify "make maintainer-distcheck", when the calls are not intended to be translated. * m4/subpipe.m4 (BISON_PREREQ_SUBPIPE): Don't check for fcntl.h. * src/Makefile.am (DEFS): Use +=, to pacify "make maintainer-distcheck". (bison_SOURCES): Add scan-skel.h. (sc_tight_scope): New rule, from coreutils. * src/files.c (src_extension, header_extension): Now static, not extern. * src/getargs.c (short_options): Likewise. * src/muscle_tab.c (muscle_table): Likewise. * src/parse-gram.y (current_class, current_type, current_prec): Likewise. * src/reader.c (grammar_end, previous_rule_end): Likewise. * src/getargs.h: Redo comments to pacify "make maintainer-distcheck". * src/main.c (main): Cast bindtextdomain and textdomain calls to void, to avoid warning when NLS is disabled. * src/output.c: Include scan-skel.h. (scan_skel): Remove decl, since scan-skel.h does this. (output_skeleton): Indent calls to "error" to pacify "make maintainer-distcheck". * src/print_graph.c: Don't include <obstack.h>, as system.h does this. * src/reader.h (gram_end, gram_lineno): New decls to pacify "make maintainer-distcheck". * src/scan-skel.l (skel_lex, skel_get_lineno, skel_get_in): (skel_get_out, skel_get_leng, skel_get_text, skel_set_lineno): (skel_set_in, skel_set_out, skel_get_debug, skel_set_debug): (skel_lex_destroy, scan_skel): Move these decls to... * src/scan-skel.h: New file. * src/uniqstr.c (uniqstr_assert): Indent calls to "error" to pacify "make maintainer-distcheck". * tests/Makefile.am ($(srcdir)/package.m4): Use $(VAR), not @VAR@. * tests/torture.at: Revamp to avoid misuse of atoi that "make maintainer-distcheck" complained about.
-rw-r--r--ChangeLog165
-rw-r--r--Makefile.maint400
-rw-r--r--NEWS7
-rw-r--r--data/c.m42
-rw-r--r--data/lalr1.cc2
-rw-r--r--data/m4sugar/m4sugar.m4708
-rw-r--r--data/yacc.c8
-rw-r--r--doc/bison.texinfo12
-rwxr-xr-xetc/clcommit300
-rw-r--r--examples/calc++/calc++-parser.yy66
-rw-r--r--lib/abitset.h2
-rw-r--r--lib/bbitset.h2
-rw-r--r--lib/bitset.h7
-rw-r--r--lib/bitset_stats.c24
-rw-r--r--lib/ebitset.h2
-rw-r--r--lib/lbitset.c10
-rw-r--r--lib/lbitset.h2
-rw-r--r--lib/subpipe.c13
-rw-r--r--lib/timevar.c2
-rw-r--r--lib/vbitset.h2
-rw-r--r--m4/subpipe.m43
-rw-r--r--src/Makefile.am39
-rw-r--r--src/files.c4
-rw-r--r--src/getargs.c2
-rw-r--r--src/getargs.h10
-rw-r--r--src/gram.c2
-rw-r--r--src/main.c6
-rw-r--r--src/muscle_tab.c2
-rw-r--r--src/muscle_tab.h4
-rw-r--r--src/output.c10
-rw-r--r--src/parse-gram.y10
-rw-r--r--src/print_graph.c3
-rw-r--r--src/reader.c4
-rw-r--r--src/reader.h5
-rw-r--r--src/scan-skel.h41
-rw-r--r--src/scan-skel.l18
-rw-r--r--src/system.h6
-rw-r--r--src/tables.c2
-rw-r--r--src/uniqstr.c5
-rw-r--r--src/vcg.c4
-rw-r--r--src/vcg_defaults.h12
-rw-r--r--tests/Makefile.am10
-rw-r--r--tests/cxx-type.at4
-rw-r--r--tests/existing.at68
-rw-r--r--tests/sets.at10
-rw-r--r--tests/torture.at12
46 files changed, 1007 insertions, 1025 deletions
diff --git a/ChangeLog b/ChangeLog
index a3deacb9..6b30ded8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,139 @@
+2005-07-24 Paul Eggert <eggert@cs.ucla.edu>
+
+ * NEWS: Version 2.0b.
+
+ * data/glr.c (ATTRIBUTE_UNUSED): Remove, since it infringes on
+ the user's name space. All uses changed to __attribute__
+ ((__unused__)).
+ (yyFail, yyMemoryExhausted, yyreportAmbiguity):
+ Add __attribute__ ((__noreturn__)).
+
+ * etc/clcommit: Remove. We weren't using it, and it failed
+ "make maintainer-distcheck".
+ * Makefile.maint: Merge from coreutils.
+ (CVS_LIST, CVS_LIST_EXCEPT): New macros.
+ (syntax-check-rules): Change list of rules as described below.
+ (sc_cast_of_alloca_return_value, sc_dd_max_sym_length):
+ (sc_file_system, sc_obsolete_symbols, sc_prohibit_atoi_atof):
+ (sc_prohibit_jm_in_m4, sc_root_tests, sc_tight_scope):
+ (sc_trailing_space): New rules.
+ (sc_xalloc_h_in_src): Remove.
+ (sc_cast_of_argument_to_free, sc_cast_of_x_alloc_return_value):
+ (sc_space_tab, sc_error_exit_success, sc_changelog):
+ (sc_system_h_headers, sc_sun_os_names, sc_unmarked_diagnostics):
+ (makefile-check, po-check, author_mark_check):
+ (makefile_path_separator_check, copyright-check):
+ Use grep -n, to make it easier to find violations.
+ Use CVS_LIST and CVS_LIST_EXCEPT.
+ (header_regexp, h_re): Remove.
+ (dd_c): New macro.
+ (sc_dd_max_sym_length, .re-list, news-date-check): New rules.
+ (my-distcheck): Use more-modern GCC flags.
+ (signatures, %.asc): Remove.
+ (rel-files, announcement): Remove signatures.
+ Restore old updating code, even though we don't use it, so
+ that we're the same as coreutils.
+ (alpha, beta, major): Depend on news-date-check.
+ Make the upload commands.
+
+ * data/c.m4, data/lalr1.cc, data/yacc.c: Normalize white space.
+ * lib/abitset.h, lib/bbitset.h, lib/bitset.h: Likewise.
+ * lib/bitset_stats.c, lib/ebitset.h, lib/lbitset.c: Likewise.
+ * lib/libitset.h, lib/timevar.c, lib/vbitset.h: Likewise.
+ * src/Makefile.am, src/gram.c, src/muscle_tab.h: Likewise.
+ * src/parse-gram.y, src/system.h, src/tables.c, src/vcg.c: Likewise.
+ * src/vcg_defaults.h, tests/cxx-type.at, tests/existing.at: Likewise.
+ * tests/sets.at: Likewise.
+
+ * data/m4sugar/m4sugar.m4: Sync from Autoconf, except that
+ we comment out the Autoconf version number.
+ * doc/bison.texinfo (Calc++ Scanner): Don't use atoi, as
+ it's error-prone and "make maintainer-distcheck" rejects it.
+
+ * lib/subpipe.c: Include <fcntl.h> without checking for HAVE_FCNTL_H.
+ Indent calls to "error" to pacify "make maintainer-distcheck",
+ when the calls are not intended to be translated.
+ * m4/subpipe.m4 (BISON_PREREQ_SUBPIPE): Don't check for fcntl.h.
+
+ * src/Makefile.am (DEFS): Use +=, to pacify
+ "make maintainer-distcheck".
+ (bison_SOURCES): Add scan-skel.h.
+ (sc_tight_scope): New rule, from coreutils.
+
+ * src/files.c (src_extension, header_extension):
+ Now static, not extern.
+ * src/getargs.c (short_options): Likewise.
+ * src/muscle_tab.c (muscle_table): Likewise.
+ * src/parse-gram.y (current_class, current_type, current_prec):
+ Likewise.
+ * src/reader.c (grammar_end, previous_rule_end): Likewise.
+ * src/getargs.h: Redo comments to pacify "make maintainer-distcheck".
+ * src/main.c (main): Cast bindtextdomain and textdomain calls to
+ void, to avoid warning when NLS is disabled.
+ * src/output.c: Include scan-skel.h.
+ (scan_skel): Remove decl, since scan-skel.h does this.
+ (output_skeleton):
+ Indent calls to "error" to pacify "make maintainer-distcheck".
+ * src/print_graph.c: Don't include <obstack.h>, as system.h does this.
+ * src/reader.h (gram_end, gram_lineno): New decls to pacify
+ "make maintainer-distcheck".
+ * src/scan-skel.l (skel_lex, skel_get_lineno, skel_get_in):
+ (skel_get_out, skel_get_leng, skel_get_text, skel_set_lineno):
+ (skel_set_in, skel_set_out, skel_get_debug, skel_set_debug):
+ (skel_lex_destroy, scan_skel): Move these decls to...
+ * src/scan-skel.h: New file.
+ * src/uniqstr.c (uniqstr_assert):
+ Indent calls to "error" to pacify "make maintainer-distcheck".
+
+ * tests/Makefile.am ($(srcdir)/package.m4): Use $(VAR),
+ not @VAR@.
+
+ * tests/torture.at: Revamp to avoid misuse of atoi that
+ "make maintainer-distcheck" complained about.
+
+ * examples/extexi (message): Don't print a message more than once,
+ and omit line-number decoration that makes Emacs compile think
+ that informative messages are worth worrying about.
+
+2005-07-22 Paul Eggert <eggert@cs.ucla.edu>
+
+ * configure.ac: Update version number.
+
+ * Makefile.am (SUBDIRS): Add examples; somehow this got removed
+ accidentally.
+ * examples/calc++/calc++-parser.yy: Remove from CVS, as it's
+ autogenerated by the maintainer.
+ * examples/calc++/.cvsignore: Add *.yy.
+
+ * lib/bitset.c (bitset_alloc): Don't cast xcalloc result.
+ * lib/bitset_stats.c (bitset_stats_init): Likewise.
+ * lib/bitsetv.c (bitsetv_alloc): Likewise.
+
+ * po/POTFILES.in: Add lib/xalloc-die.c; remove lib/xmalloc.c.
+
+ * src/relation.c (relation_transpose): Rewrite to avoid bogus complaint
+ from maintainer-distcheck about casting the argument of 'free'.
+
+ * NEWS: Mention recent yytname changes.
+ * THANKS: Add Anthony Heading, twlevo@xs4all.nl.
+
+ * bootstrap: For translations that have not yet been upgraded to
+ the new runtime-po domain, prime the pump by extracting the
+ relevant strings from the obsolete translations. This code can be
+ removed once the bison-runtime domain has been translated by each
+ team.
+
+ * src/scan-gram.l (<SC_PRE_CODE>.): Don't double-quote token names,
+ now that token names are already quoted.
+
+ Fix problem reported by Anthony Heading.
+ * data/glr.c (YYTOKEN_TABLE): New macro.
+ (yytname): Define if YYTOKEN_TABLE.
+ * data/yacc.c (YYTOKEN_TABLE, yytname): Likewise.
+ * data/lalr1.cc (YYTOKEN_TABLE, yytname_): Likewise.
+ (YYERROR_VERBOSE): Define the same way the other skeletons do.
+ * src/output.c (prepare_symbols): Output token_table_flag.
+
2005-07-21 Paul Eggert <eggert@cs.ucla.edu>
* data/glr.c (yyinitGLRStack, yyreturn): Don't call malloc
@@ -1283,7 +1419,7 @@
line.
2004-10-22 Akim Demaille <akim@epita.fr>
- and Paul Eggert <eggert@cs.ucla.edu>
+ and Paul Eggert <eggert@cs.ucla.edu>
Remove some arbitrary limits on goto numbers and relations.
* src/lalr.c (goto_map, ngotos, from_state, to_state): Omit
@@ -1513,7 +1649,7 @@
2004-09-06 Akim Demaille <akim@epita.fr>
* data/lalr1.cc: Adjust the indentation of the labels.
- (Parser::pop): New.
+ (Parser::pop): New.
Use it.
2004-09-06 Akim Demaille <akim@epita.fr>
@@ -13886,24 +14022,13 @@
* REFERENCES: entered into RCS
------
-
-Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of Bison, the GNU Compiler Compiler.
-Bison 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.
+ -----
-Bison 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.
+ Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996,
+ 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
+ Foundation, Inc.
-You should have received a copy of the GNU General Public License
-along with Bison; see the file COPYING. If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.
+ Copying and distribution of this file, with or without
+ modification, are permitted provided the copyright notice and this
+ notice are preserved.
diff --git a/Makefile.maint b/Makefile.maint
index e803a810..8656fbba 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -2,7 +2,7 @@
# This Makefile fragment is shared between the coreutils,
# CPPI, Bison, and Autoconf.
-## Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+## Copyright (C) 2001, 2002, 2003, 2004, 2005 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
@@ -24,6 +24,7 @@
ME := Makefile.maint
# Do not save the original name or timestamp in the .tar.gz file.
+# Use --rsyncable if available.
GZIP_ENV = \
"--no-name --best$$( \
case $$(gzip --help) in \
@@ -33,6 +34,20 @@ GZIP_ENV = \
CVS = cvs
+CVS_LIST = sh -c ' \
+ (cvsu --find --types=AFGM $$*) 2>/dev/null || \
+ awk -F/ '\''{ \
+ if (!$$1 && $$3 !~ /^-/) { \
+ f=FILENAME; \
+ sub(/CVS\/Entries/, "", f); \
+ print f $$2; \
+ }}'\'' \
+ $$(find $${*-*} -name Entries -print) /dev/null \
+ ' 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
@@ -69,126 +84,184 @@ local-checks-available = \
local-check = $(filter-out $(local-checks-to-skip), $(local-checks-available))
-# Make sure C source files in src/ don't include xalloc.h directly,
-# since they all already include it via sys2.h.
-# It's not a big deal -- just aesthetics.
.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_obsolete_symbols \
+ sc_prohibit_atoi_atof \
+ sc_prohibit_jm_in_m4 \
+ sc_root_tests \
sc_space_tab \
sc_sun_os_names \
sc_system_h_headers \
- sc_unmarked_diagnostics \
- sc_xalloc_h_in_src
+ sc_tight_scope \
+ sc_trailing_space \
+ sc_unmarked_diagnostics
syntax-check: $(syntax-check-rules)
-# @grep -E '# *include <(limits|std(def|arg|bool))\.h>' \
+# @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \
# $$(find -type f -name '*.[chly]') && \
# { echo '$(ME): found conditional include' 1>&2; \
# exit 1; } || :
-# grep -E '^# *include <(string|stdlib)\.h>' \
+# 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
-# 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 --exclude=$(srcdir)/src/shred.c -E \
- '\<error \([^"]*"[^"]*[a-z]{3}' $(srcdir)/{lib,src}/*.c \
- | grep -v '_(' && \
- { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
- exit 1; } || :
-
sc_cast_of_argument_to_free:
- @grep -E '\<free \(\(' $(srcdir)/{lib,src}/*.[chly] && \
+ @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 -E --exclude=$(srcdir)/lib/regex.c \
- '\*\) *x(m|c|re)alloc\>' $(srcdir)/{lib,src}/*.[chy] && \
+ @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:
- @( cvsu --list ) > /dev/null 2>&1 || : && \
- grep '[ ] ' \
- $$(cvsu --list | grep -vEf .x-$@ ) && \
+ @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]|ato''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 -F 'error (EXIT_SUCCESS,' \
+ @grep -nF 'error (EXIT_SUCCESS,' \
$$(find -type f -name '*.[chly]') && \
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \
exit 1; } || :
-# FIXME: merge this with sc_system_h_headers below.
-# xalloc.h is included via system.h, so should not be included
-# directly by any file in src/.
-sc_xalloc_h_in_src:
- @if test -f $(srcdir)/src/sys2.h; then \
- if grep 'xalloc\.h' $(srcdir)/src/*.c; then \
- exit 1; \
- fi; \
- fi
+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_obsolete_symbols:
+ @grep -nE '\<(HAVE_''FCNTL_H)\>' \
+ $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): do not use HAVE_''FCNTL_H' \
+ 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 '^[^12 ]' $$(find . -name ChangeLog -maxdepth 2) && \
+ @grep -n '^[^12 ]' $$(find . -maxdepth 2 -name ChangeLog) && \
{ echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
exit 1; } || :
-header_regexp = \
- alloca\
- |closeout\
- |ctype\
- |dirent\
- |errno\
- |fcntl\
- |inttypes\
- |limits\
- |locale\
- |pathmax\
- |std(lib|bool)\
- |string\
- |sys/(stat|dir|time)\
- |time\
- |unistd\
- |utime\
- |version-etc\
- |xalloc
-h_re := $(shell echo '$(header_regexp)'|tr -d ' ')
+# 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.
-# Get list of candidates with this:
-# grep -h include src/sys*.h|sed 's/.*include //'|sort -
-sc_system_h_headers:
- @( cvsu --list ) > /dev/null 2>&1 || : && \
- grep -E '^# *include ["<]($(h_re))\.h[">]' \
- $$(cvsu --list src | grep -Ev 'sys(2|tem)\.h$$') \
- && { echo '$(ME): the above are already included via system.h'\
- 1>&2; exit 1; } || :
+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:
- @( cvsu --list ) > /dev/null 2>&1 || : && \
- grep -Ei \
+ @grep -nEi \
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
- $$(cvsu --list | grep -vEf .x-$@ ) && \
+ $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
exit 1; } || :
+sc_tight_scope:
+ $(MAKE) -C src $@
+
+sc_trailing_space:
+ @grep -n '[ ]$$' \
+ $$($(CVS_LIST_EXCEPT)) && \
+ { echo '$(ME): found trailing space(s)' \
+ 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}' $(srcdir)/{lib,src}/*.c \
+ | grep -v '_(' && \
+ { echo '$(ME): found unmarked diagnostic(s)' 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.
@@ -208,8 +281,17 @@ strftime-check:
# not @...@ in Makefile.am, now that we can rely on automake
# to emit a definition for each substituted variable.
makefile-check:
- grep -E '@[A-Z_0-9]+@' `find . -name Makefile.am` \
- && { echo 'Makefile.maint: use $(...), not @...@' 1>&2; exit 1; } || :
+ 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 '^\*.*'$$today >/dev/null; then \
+ :; \
+ else \
+ echo "today's date is not in NEWS" 1>&2; \
+ exit 1; \
+ fi
changelog-check:
if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
@@ -225,28 +307,30 @@ m4-check:
exit 1; } || :
# Verify that all source files using _() are listed in po/POTFILES.in.
+# FIXME: don't hard-code src/false.c below; use a more general mechanism.
po-check:
- if test -f po/POTFILES.in; then \
- grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
- files=; \
+ if test -f po/POTFILES.in; then \
+ grep -E -v '^(#|$$)' po/POTFILES.in \
+ | grep -v '^src/false\.c$$' | sort > $@-1; \
+ files=; \
for file in lib/*.[chly] src/*.[chly]; do \
- 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 > $@-2; \
- diff -u $@-1 $@-2 || exit 1; \
- rm -f $@-1 $@-2; \
+ 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 > $@-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 '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \
+ @grep -n '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \
{ echo 'Makefile.maint: enclose the above strings in N_ (...)' 1>&2; \
exit 1; } || :
@@ -258,7 +342,7 @@ author_mark_check:
# 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 'PATH=.*:' `find $(srcdir) -name Makefile.am` \
+ @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.
@@ -279,7 +363,7 @@ 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 '"Copyright (C) $(shell date +%Y) Free' $(v_etc_file) \
+ grep 'enum { COPYRIGHT_YEAR = 2005 };' $(v_etc_file) \
>/dev/null \
|| { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
exit 1; }; \
@@ -330,21 +414,23 @@ null_AM_MAKEFLAGS = \
# 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.
+# 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)
-rm -rf $(t)
mkdir -p $(t)
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
- cd $(t)/$(distdir) \
- && ./configure --disable-nls \
- && $(MAKE) CFLAGS='-Wformat -Werror' \
- AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
- && $(MAKE) dvi \
- && $(MAKE) check \
+ 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 \
+ (cd $(t) && mv $(distdir) $(distdir).old \
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
-rm -rf $(t)
@@ -377,15 +463,9 @@ rel-check:
prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
-signatures ?= $(distdir).tar.bz2.asc $(distdir).tar.gz.asc
-%.asc: %
- rm -f $@
- gpg --armor --detach-sign -o $@ $<
-
-rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz $(signatures)
-announce_gen ?= ./announce-gen
-announcement: NEWS ChangeLog $(rel-files) $(signatures)
- @$(announce_gen) \
+rel-files = $(xd-delta) $(DIST_ARCHIVES)
+announcement: NEWS ChangeLog $(rel-files)
+ @./announce-gen \
--release-type=$(RELEASE_TYPE) \
--package=$(PACKAGE) \
--prev=$(PREV_VERSION) \
@@ -395,25 +475,125 @@ announcement: NEWS ChangeLog $(rel-files) $(signatures)
$(addprefix --url-dir=, $(url_dir_list)) \
-define emit-upload-commands
- echo =====================================
- echo =====================================
- echo upload $(PACKAGE) $(PREV_VERSION) $(VERSION)
- echo '# send the /tmp/announcement e-mail'
- echo =====================================
- echo =====================================
-endef
+## ---------------- ##
+## 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:anoncvs@sources.redhat.com:/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: $(local-check)
+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)
- @$(emit-upload-commands)
diff --git a/NEWS b/NEWS
index ac3587eb..8593f27f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,7 @@
Bison News
----------
-Changes in the next version (not yet released):
+Changes in version 2.0b, 2005-07-24:
* Bison-generated parsers now support the translation of diagnostics like
"syntax error" into languages other than English. The default
@@ -19,7 +19,10 @@ Changes in the next version (not yet released):
behind on the stack. Also, the start symbol is now destroyed after a
successful parse. In both cases, the behavior was formerly inconsistent.
-The following change was also in version 2.0a, 2005-05-22:
+* The yytname array now contains the same contents that it did in 2.0,
+ undoing an incompatible and undocumented change made in 2.0a.
+
+Changes in version 2.0a, 2005-05-22:
* When generating verbose diagnostics, Bison-generated parsers no longer
quote the literal strings associated with tokens. For example, for
diff --git a/data/c.m4 b/data/c.m4
index 86aca105..e28954be 100644
--- a/data/c.m4
+++ b/data/c.m4
@@ -119,7 +119,7 @@ m4_define([b4_int_type],
m4_eval([0 <= $1]), [1], [unsigned int],
- [int])])
+ [int])])
# b4_int_type_for(NAME)
diff --git a/data/lalr1.cc b/data/lalr1.cc
index e6190c8b..7eddaf90 100644
--- a/data/lalr1.cc
+++ b/data/lalr1.cc
@@ -946,7 +946,7 @@ yy::]b4_parser_class_name[::yyreport_syntax_error_ ()
{
message += (!count++) ? ", expecting " : " or ";
message += yytnamerr_ (yytname_[x]);
- }
+ }
}
}
else
diff --git a/data/m4sugar/m4sugar.m4 b/data/m4sugar/m4sugar.m4
index ea532930..bd6c8d68 100644
--- a/data/m4sugar/m4sugar.m4
+++ b/data/m4sugar/m4sugar.m4
@@ -2,7 +2,9 @@ divert(-1)# -*- Autoconf -*-
# This file is part of Autoconf.
# Base M4 layer.
# Requires GNU M4.
-# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+#
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 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
@@ -58,7 +60,7 @@ changequote([, ])
# long macros we define.
ifdef([__gnu__], ,
[errprint(M4sugar requires GNU M4. Install it before installing M4sugar or
-set the M4 environment variable to its path name.)
+set the M4 environment variable to its absolute file name.)
m4exit(2)])
@@ -83,12 +85,12 @@ m4_undefine([undefine])
# Define DST as the definition of SRC.
# What's the difference between:
# 1. m4_copy([from], [to])
-# 2. m4_define([from], [to($@)])
-# Well, obviously 1 is more expansive in space. Maybe 2 is more expansive
+# 2. m4_define([to], [from($@)])
+# Well, obviously 1 is more expensive in space. Maybe 2 is more expensive
# in time, but because of the space cost of 1, it's not that obvious.
# Nevertheless, one huge difference is the handling of `$0'. If `from'
# uses `$0', then with 1, `to''s `$0' is `to', while it is `from' in 2.
-# The user will certainly prefer see `from'.
+# The user will certainly prefer to see `to'.
m4_define([m4_copy],
[m4_define([$2], m4_defn([$1]))])
@@ -131,7 +133,7 @@ m4_rename_m4([eval])
m4_rename_m4([format])
m4_rename_m4([ifdef])
m4_rename([ifelse], [m4_if])
-m4_rename_m4([include])
+m4_undefine([include])
m4_rename_m4([incr])
m4_rename_m4([index])
m4_rename_m4([indir])
@@ -144,7 +146,7 @@ m4_undefine([popdef])
m4_rename_m4([pushdef])
m4_rename([regexp], [m4_bregexp])
m4_rename_m4([shift])
-m4_rename_m4([sinclude])
+m4_undefine([sinclude])
m4_rename_m4([substr])
m4_rename_m4([symbols])
m4_rename_m4([syscmd])
@@ -199,76 +201,29 @@ m4_define([m4_assert],
[m4_fatal([assert failed: $1], [$2])])])
+
## ------------- ##
## 3. Warnings. ##
## ------------- ##
-# m4_warning_ifelse(CATEGORY, IF-TRUE, IF-FALSE)
-# ----------------------------------------------
-# If the CATEGORY of warnings is enabled, expand IF_TRUE otherwise
-# IF-FALSE.
-#
-# The variable `m4_warnings' contains a comma separated list of
-# warnings which order is the converse from the one specified by
-# the user, i.e., if she specified `-W error,none,obsolete',
-# `m4_warnings' is `obsolete,none,error'. We read it from left to
-# right, and:
-# - if none or noCATEGORY is met, run IF-FALSE
-# - if all or CATEGORY is met, run IF-TRUE
-# - if there is nothing left, run IF-FALSE.
-m4_define([m4_warning_ifelse],
-[_m4_warning_ifelse([$1], [$2], [$3], m4_warnings)])
-
-
-# _m4_warning_ifelse(CATEGORY, IF-TRUE, IF-FALSE, WARNING1, ...)
-# --------------------------------------------------------------
-# Implementation of the loop described above.
-m4_define([_m4_warning_ifelse],
-[m4_case([$4],
- [$1], [$2],
- [all], [$2],
- [], [$3],
- [none], [$3],
- [no-$1], [$3],
- [$0([$1], [$2], [$3], m4_shiftn(4, $@))])])
-
-
-# _m4_warning_error_ifelse(IF-TRUE, IF-FALSE)
-# -------------------------------------------
-# The same as m4_warning_ifelse, but scan for `error' only.
-m4_define([_m4_warning_error_ifelse],
-[__m4_warning_error_ifelse([$1], [$2], m4_warnings)])
-
-
-# __m4_warning_error_ifelse(IF-TRUE, IF-FALSE)
-# --------------------------------------------
-# The same as _m4_warning_ifelse, but scan for `error' only.
-m4_define([__m4_warning_error_ifelse],
-[m4_case([$3],
- [error], [$1],
- [], [$2],
- [no-error], [$2],
- [$0([$1], [$2], m4_shiftn(3, $@))])])
-
-
-
-# _m4_warn(MESSAGE)
-# -----------------
-# Report MESSAGE as a warning, unless the user requested -W error,
-# in which case report a fatal error.
-m4_define([_m4_warn],
-[_m4_warning_error_ifelse([m4_fatal([$1])],
- [m4_warning([$1])])])
+# _m4_warn(CATEGORY, MESSAGE, STACK-TRACE)
+# ----------------------------------------
+# Report a MESSAGE to the user if the CATEGORY of warnings is enabled.
+# This is for traces only.
+# The STACK-TRACE is a \n-separated list of "LOCATION: MESSAGE".
+m4_define([_m4_warn], [])
# m4_warn(CATEGORY, MESSAGE)
# --------------------------
-# Report a MESSAGE to the autoconf user if the CATEGORY of warnings
-# is requested (in fact, not disabled).
+# Report a MESSAGE to the user if the CATEGORY of warnings is enabled.
m4_define([m4_warn],
-[m4_warning_ifelse([$1], [_m4_warn([$2])])])
-
+[_m4_warn([$1], [$2],
+m4_ifdef([m4_expansion_stack],
+ [m4_defn([m4_expansion_stack])
+m4_location[: the top level]]))dnl
+])
@@ -294,7 +249,7 @@ m4_define([m4_warn],
# been included.
m4_define([m4_include_unique],
[m4_ifdef([m4_include($1)],
- [m4_warn([syntax], [file `$1' included several times])])dnl
+ [m4_warn([syntax], [file `$1' included several times])])dnl
m4_define([m4_include($1)])])
@@ -347,7 +302,7 @@ m4_define([m4_ifval],
m4_define([m4_n],
[m4_if([$1],
[], [],
- [$1
+ [$1
])])
@@ -358,7 +313,7 @@ m4_define([m4_n],
m4_define([m4_ifvaln],
[m4_if([$1],
[], [m4_n([$3])],
- [m4_n([$2])])])
+ [m4_n([$2])])])
# m4_ifset(MACRO, [IF-TRUE], [IF-FALSE])
@@ -367,8 +322,8 @@ m4_define([m4_ifvaln],
# expand IF-FALSE, otherwise IF-TRUE.
m4_define([m4_ifset],
[m4_ifdef([$1],
- [m4_if(m4_defn([$1]), [], [$3], [$2])],
- [$3])])
+ [m4_ifval(m4_defn([$1]), [$2], [$3])],
+ [$3])])
# m4_ifndef(NAME, [IF-NOT-DEFINED], [IF-DEFINED])
@@ -419,23 +374,32 @@ m4_define([m4_case],
# All the values are optional, and the macro is robust to active symbols
# properly quoted.
m4_define([m4_bmatch],
-[m4_if([$#], 0, [],
- [$#], 1, [],
+[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
+ [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])],
[$#], 2, [$2],
[m4_if(m4_bregexp([$1], [$2]), -1, [$0([$1], m4_shiftn(3, $@))],
[$3])])])
+# m4_car(LIST)
+# m4_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+m4_define([m4_car], [[$1]])
+m4_define([m4_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+ [$#], 1, [],
+ [m4_dquote(m4_shift($@))])])
+
+
# m4_map(MACRO, LIST)
# -------------------
# Invoke MACRO($1), MACRO($2) etc. where $1, $2... are the elements
# of LIST (which can be lists themselves, for multiple arguments MACROs).
m4_define([m4_fst], [$1])
m4_define([m4_map],
-[m4_if([$2], [], [],
- [$2], [[]], [],
- [$1(m4_fst($2))[]dnl
-m4_map([$1], m4_cdr($2))])])
+[m4_ifval([$2],
+ [$1(m4_fst($2))[]m4_map([$1], m4_cdr($2))])])
# m4_map_sep(MACRO, SEPARATOR, LIST)
@@ -444,20 +408,16 @@ m4_map([$1], m4_cdr($2))])])
# are the elements of LIST (which can be lists themselves, for multiple
# arguments MACROs).
m4_define([m4_map_sep],
-[m4_if([$3], [[]], [],
- [$1(m4_fst($3))[]dnl
-m4_if(m4_cdr($3),
- [[]], [],
- [$2])[]dnl
-m4_map_sep([$1], [$2], m4_cdr($3))])])
+[m4_ifval([$3],
+ [$1(m4_fst($3))[]m4_map([$2[]$1], m4_cdr($3))])])
## ---------------------------------------- ##
## 6. Enhanced version of some primitives. ##
## ---------------------------------------- ##
-# m4_patsubsts(STRING, RE1, SUBST1, RE2, SUBST2, ...)
-# ---------------------------------------------------
+# m4_bpatsubsts(STRING, RE1, SUBST1, RE2, SUBST2, ...)
+# ----------------------------------------------------
# m4 equivalent of
#
# $_ = STRING;
@@ -468,7 +428,7 @@ m4_map_sep([$1], [$2], m4_cdr($3))])])
# All the values are optional, and the macro is robust to active symbols
# properly quoted.
#
-# I would have liked to name this macro `m4_patsubst', unfortunately,
+# I would have liked to name this macro `m4_bpatsubst', unfortunately,
# due to quotation problems, I need to double quote $1 below, therefore
# the anchors are broken :( I can't let users be trapped by that.
m4_define([m4_bpatsubsts],
@@ -476,7 +436,7 @@ m4_define([m4_bpatsubsts],
[$#], 1, [m4_fatal([$0: too few arguments: $#: $1])],
[$#], 2, [m4_builtin([patsubst], $@)],
[$0(m4_builtin([patsubst], [[$1]], [$2], [$3]),
- m4_shiftn(3, $@))])])
+ m4_shiftn(3, $@))])])
@@ -511,7 +471,7 @@ m4_define([m4_default],
# undefined.
m4_define([m4_defn],
[m4_ifndef([$1],
- [m4_fatal([$0: undefined macro: $1])])dnl
+ [m4_fatal([$0: undefined macro: $1])])dnl
m4_builtin([defn], $@)])
@@ -519,7 +479,7 @@ m4_builtin([defn], $@)])
# ---------------------
m4_define([_m4_dumpdefs_up],
[m4_ifdef([$1],
- [m4_pushdef([_m4_dumpdefs], m4_defn([$1]))dnl
+ [m4_pushdef([_m4_dumpdefs], m4_defn([$1]))dnl
m4_dumpdef([$1])dnl
m4_popdef([$1])dnl
_m4_dumpdefs_up([$1])])])
@@ -529,7 +489,7 @@ _m4_dumpdefs_up([$1])])])
# -----------------------
m4_define([_m4_dumpdefs_down],
[m4_ifdef([_m4_dumpdefs],
- [m4_pushdef([$1], m4_defn([_m4_dumpdefs]))dnl
+ [m4_pushdef([$1], m4_defn([_m4_dumpdefs]))dnl
m4_popdef([_m4_dumpdefs])dnl
_m4_dumpdefs_down([$1])])])
@@ -549,7 +509,7 @@ _m4_dumpdefs_down([$1])])
# undefined.
m4_define([m4_popdef],
[m4_ifndef([$1],
- [m4_fatal([$0: undefined macro: $1])])dnl
+ [m4_fatal([$0: undefined macro: $1])])dnl
m4_builtin([popdef], $@)])
@@ -594,7 +554,7 @@ m4_define([_m4_shiftn],
# undefined.
m4_define([m4_undefine],
[m4_ifndef([$1],
- [m4_fatal([$0: undefined macro: $1])])dnl
+ [m4_fatal([$0: undefined macro: $1])])dnl
m4_builtin([undefine], $@)])
@@ -609,8 +569,8 @@ m4_builtin([undefine], $@)])
# Both limits are included, and bounds are checked for consistency.
m4_define([m4_for],
[m4_case(m4_sign(m4_eval($3 - $2)),
- 1, [m4_assert(m4_sign(m4_default($4, 1)) == 1)],
- -1, [m4_assert(m4_sign(m4_default($4, -1)) == -1)])dnl
+ 1, [m4_assert(m4_sign(m4_default($4, 1)) == 1)],
+ -1, [m4_assert(m4_sign(m4_default($4, -1)) == -1)])dnl
m4_pushdef([$1], [$2])dnl
m4_if(m4_eval([$3 > $2]), 1,
[_m4_for([$1], [$3], m4_default([$4], 1), [$5])],
@@ -639,8 +599,8 @@ m4_if($1, [$2], [],
# | [m4_pushdef([$1])_foreach([$1], [$2], [$3])m4_popdef([$1])])
# | m4_define([_arg1], [$1])
# | m4_define([_foreach],
-# | [m4_if([$2], [()], ,
-# | [m4_define([$1], _arg1$2)$3[]_foreach([$1],
+# | [m4_if([$2], [()], ,
+# | [m4_define([$1], _arg1$2)$3[]_foreach([$1],
# | (shift$2),
# | [$3])])])
#
@@ -670,7 +630,7 @@ m4_if($1, [$2], [],
# | m4_define([_arg1], [[$1]])
# | m4_define([_foreach],
# | [m4_if($2, [()], ,
-# | [m4_define([$1], [_arg1$2])$3[]_foreach([$1],
+# | [m4_define([$1], [_arg1$2])$3[]_foreach([$1],
# | [(shift$2)],
# | [$3])])])
#
@@ -695,7 +655,7 @@ m4_if($1, [$2], [],
# | m4_define([_arg1], [$1])
# | m4_define([_foreach],
# | [m4_if($2, [], ,
-# | [m4_define([$1], [_arg1($2)])$3[]_foreach([$1],
+# | [m4_define([$1], [_arg1($2)])$3[]_foreach([$1],
# | [shift($2)],
# | [$3])])])
#
@@ -726,14 +686,25 @@ m4_if($1, [$2], [],
m4_define([m4_foreach],
[m4_pushdef([$1])_m4_foreach($@)m4_popdef([$1])])
-# Low level macros used to define m4_foreach.
-m4_define([m4_car], [[$1]])
-m4_define([m4_cdr], [m4_dquote(m4_shift($@))])
m4_define([_m4_foreach],
-[m4_if([$2], [[]], [],
- [m4_define([$1], m4_car($2))$3[]_m4_foreach([$1],
- m4_cdr($2),
- [$3])])])
+[m4_ifval([$2],
+ [m4_define([$1], m4_car($2))$3[]dnl
+_m4_foreach([$1], m4_cdr($2), [$3])])])
+
+
+# m4_foreach_w(VARIABLE, LIST, EXPRESSION)
+# ----------------------------------------
+#
+# Like m4_foreach, but the list is whitespace separated.
+#
+# This macro is robust to active symbols:
+# m4_foreach_w([Var], [ active
+# b act\
+# ive ], [-Var-])end
+# => -active--b--active-end
+#
+m4_define([m4_foreach_w],
+[m4_foreach([$1], m4_split(m4_normalize([$2])), [$3])])
@@ -745,23 +716,29 @@ m4_define([_m4_foreach],
# _m4_divert(DIVERSION-NAME or NUMBER)
# ------------------------------------
# If DIVERSION-NAME is the name of a diversion, return its number,
-# otherwise if is a NUMBER return it.
+# otherwise if it is a NUMBER return it.
m4_define([_m4_divert],
[m4_ifdef([_m4_divert($1)],
- [m4_indir([_m4_divert($1)])],
- [$1])])
+ [m4_indir([_m4_divert($1)])],
+ [$1])])
# KILL is only used to suppress output.
m4_define([_m4_divert(KILL)], -1)
+# _m4_divert_n_stack
+# ------------------
+# Print m4_divert_stack with newline prepended, if it's nonempty.
+m4_define([_m4_divert_n_stack],
+[m4_ifdef([m4_divert_stack], [
+m4_defn([m4_divert_stack])])])
+
+
# m4_divert(DIVERSION-NAME)
# -------------------------
# Change the diversion stream to DIVERSION-NAME.
m4_define([m4_divert],
-[m4_define([m4_divert_stack],
- m4_location[: $0: $1]m4_ifdef([m4_divert_stack], [
-m4_defn([m4_divert_stack])]))dnl
+[m4_define([m4_divert_stack], m4_location[: $0: $1]_m4_divert_n_stack)dnl
m4_builtin([divert], _m4_divert([$1]))dnl
])
@@ -770,11 +747,9 @@ m4_builtin([divert], _m4_divert([$1]))dnl
# ------------------------------
# Change the diversion stream to DIVERSION-NAME, while stacking old values.
m4_define([m4_divert_push],
-[m4_pushdef([m4_divert_stack],
- m4_location[: $0: $1]m4_ifdef([m4_divert_stack], [
-m4_defn([m4_divert_stack])]))dnl
+[m4_pushdef([m4_divert_stack], m4_location[: $0: $1]_m4_divert_n_stack)dnl
m4_pushdef([_m4_divert_diversion], [$1])dnl
-m4_builtin([divert], _m4_divert(_m4_divert_diversion))dnl
+m4_builtin([divert], _m4_divert([$1]))dnl
])
@@ -782,18 +757,19 @@ m4_builtin([divert], _m4_divert(_m4_divert_diversion))dnl
# -------------------------------
# Change the diversion stream to its previous value, unstacking it.
# If specified, verify we left DIVERSION-NAME.
+# When we pop the last value from the stack, we divert to -1.
m4_define([m4_divert_pop],
-[m4_ifval([$1],
- [m4_if(_m4_divert([$1]), m4_divnum, [],
- [m4_fatal([$0($1): diversion mismatch: ]
-m4_defn([m4_divert_stack]))])])dnl
+[m4_ifndef([_m4_divert_diversion],
+ [m4_fatal([too many m4_divert_pop])])dnl
+m4_if([$1], [], [],
+ [$1], m4_defn([_m4_divert_diversion]), [],
+ [m4_fatal([$0($1): diversion mismatch: ]_m4_divert_n_stack)])dnl
+m4_popdef([m4_divert_stack])dnl
m4_popdef([_m4_divert_diversion])dnl
-dnl m4_ifndef([_m4_divert_diversion],
-dnl [m4_fatal([too many m4_divert_pop])])dnl
m4_builtin([divert],
- m4_ifdef([_m4_divert_diversion],
- [_m4_divert(_m4_divert_diversion)], -1))dnl
-m4_popdef([m4_divert_stack])dnl
+ m4_ifdef([_m4_divert_diversion],
+ [_m4_divert(m4_defn([_m4_divert_diversion]))],
+ -1))dnl
])
@@ -866,18 +842,18 @@ m4_define([m4_undivert],
# must keep the expansions of the various level of m4_require separated.
# Right before executing the epilogue of TEST1, we have:
#
-# GROW - 2: Test...3
-# GROW - 1: Test...2
-# GROW: Test...1
-# BODY:
+# GROW - 2: Test...3
+# GROW - 1: Test...2
+# GROW: Test...1
+# BODY:
#
# Finally the epilogue of TEST1 undiverts GROW - 2, GROW - 1, and
# GROW into the regular flow, BODY.
#
-# GROW - 2:
-# GROW - 1:
-# GROW:
-# BODY: Test...3; Test...2; Test...1
+# GROW - 2:
+# GROW - 1:
+# GROW:
+# BODY: Test...3; Test...2; Test...1
#
# (The semicolons are here for clarification, but of course are not
# emitted.) This is what Autoconf 2.0 (I think) to 2.13 (I'm sure)
@@ -901,27 +877,27 @@ m4_define([m4_undivert],
#
# The dependencies between the macros are:
#
-# 3 --- 2b
-# / \ is m4_require'd by
-# / \ left -------------------- right
-# 2a ------------ 1
+# 3 --- 2b
+# / \ is m4_require'd by
+# / \ left -------------------- right
+# 2a ------------ 1
#
# If you strictly apply the rules given in the previous section you get:
#
-# GROW - 2: TEST3
-# GROW - 1: TEST2a; TEST2b
-# GROW: TEST1
-# BODY:
+# GROW - 2: TEST3
+# GROW - 1: TEST2a; TEST2b
+# GROW: TEST1
+# BODY:
#
# (TEST2a, although required by TEST3 is not expanded in GROW - 3
# because is has already been expanded before in GROW - 1, so it has
# been AC_PROVIDE'd, so it is not expanded again) so when you undivert
# the stack of diversions, you get:
#
-# GROW - 2:
-# GROW - 1:
-# GROW:
-# BODY: TEST3; TEST2a; TEST2b; TEST1
+# GROW - 2:
+# GROW - 1:
+# GROW:
+# BODY: TEST3; TEST2a; TEST2b; TEST1
#
# i.e., TEST2a is expanded after TEST3 although the latter required the
# former.
@@ -939,48 +915,48 @@ m4_define([m4_undivert],
# In the example above, when TEST2a is expanded, but it's epilogue is
# not run yet, you have:
#
-# GROW - 2:
-# GROW - 1: TEST2a
-# GROW: Elaboration of TEST1
-# BODY:
+# GROW - 2:
+# GROW - 1: TEST2a
+# GROW: Elaboration of TEST1
+# BODY:
#
# The epilogue of TEST2a emits it immediately:
#
-# GROW - 2:
-# GROW - 1:
-# GROW: Elaboration of TEST1
-# BODY: TEST2a
+# GROW - 2:
+# GROW - 1:
+# GROW: Elaboration of TEST1
+# BODY: TEST2a
#
# TEST2b then requires TEST3, so right before the epilogue of TEST3, you
# have:
#
-# GROW - 2: TEST3
-# GROW - 1: Elaboration of TEST2b
-# GROW: Elaboration of TEST1
-# BODY: TEST2a
+# GROW - 2: TEST3
+# GROW - 1: Elaboration of TEST2b
+# GROW: Elaboration of TEST1
+# BODY: TEST2a
#
# The epilogue of TEST3 emits it:
#
-# GROW - 2:
-# GROW - 1: Elaboration of TEST2b
-# GROW: Elaboration of TEST1
-# BODY: TEST2a; TEST3
+# GROW - 2:
+# GROW - 1: Elaboration of TEST2b
+# GROW: Elaboration of TEST1
+# BODY: TEST2a; TEST3
#
# TEST2b is now completely expanded, and emitted:
#
-# GROW - 2:
-# GROW - 1:
-# GROW: Elaboration of TEST1
-# BODY: TEST2a; TEST3; TEST2b
+# GROW - 2:
+# GROW - 1:
+# GROW: Elaboration of TEST1
+# BODY: TEST2a; TEST3; TEST2b
#
# and finally, TEST1 is finished and emitted:
#
-# GROW - 2:
-# GROW - 1:
-# GROW:
-# BODY: TEST2a; TEST3; TEST2b: TEST1
+# GROW - 2:
+# GROW - 1:
+# GROW:
+# BODY: TEST2a; TEST3; TEST2b: TEST1
#
-# The idea, is simple, but the implementation is a bit evolved. If you
+# The idea is simple, but the implementation is a bit evolved. If you
# are like me, you will want to see the actual functioning of this
# implementation to be convinced. The next section gives the full
# details.
@@ -991,18 +967,18 @@ m4_define([m4_undivert],
#
# We consider the macros above, and this configure.ac:
#
-# AC_INIT
-# TEST1
+# AC_INIT
+# TEST1
#
# You should keep the definitions of _m4_defun_pro, _m4_defun_epi, and
# m4_require at hand to follow the steps.
#
-# This implements tries not to assume that of the current diversion is
+# This implements tries not to assume that the current diversion is
# BODY, so as soon as a macro (m4_defun'd) is expanded, we first
# record the current diversion under the name _m4_divert_dump (denoted
# DUMP below for short). This introduces an important difference with
# the previous versions of Autoconf: you cannot use m4_require if you
-# were not inside an m4_defun'd macro, and especially, you cannot
+# are not inside an m4_defun'd macro, and especially, you cannot
# m4_require directly from the top level.
#
# We have not tried to simulate the old behavior (better yet, we
@@ -1017,104 +993,64 @@ m4_define([m4_undivert],
# diversion stack: BODY |-
#
# * TEST1 is expanded
-# The prologue of TEST1 sets AC_DIVERSION_DUMP, which is the diversion
+# The prologue of TEST1 sets _m4_divert_dump, which is the diversion
# where the current elaboration will be dumped, to the current
# diversion. It also m4_divert_push to GROW, where the full
# expansion of TEST1 and its dependencies will be elaborated.
-# DUMP: BODY
-# BODY: empty
-# diversions: GROW, BODY |-
-#
-# * TEST1 requires TEST2a: prologue
-# m4_require m4_divert_pushes another temporary diversion GROW - 1 (in
-# fact, the diversion whose number is one less than the current
-# diversion), and expands TEST2a in there.
-# DUMP: BODY
-# BODY: empty
-# diversions: GROW-1, GROW, BODY |-
-#
-# * TEST2a is expanded.
-# Its prologue pushes the current diversion again.
-# DUMP: BODY
-# BODY: empty
-# diversions: GROW - 1, GROW - 1, GROW, BODY |-
-# It is expanded in GROW - 1, and GROW - 1 is popped by the epilogue
-# of TEST2a.
# DUMP: BODY
-# BODY: nothing
+# BODY: empty
+# diversions: GROW, BODY |-
+#
+# * TEST1 requires TEST2a
+# _m4_require_call m4_divert_pushes another temporary diversion,
+# GROW - 1, and expands TEST2a in there.
+# DUMP: BODY
+# BODY: empty
# GROW - 1: TEST2a
# diversions: GROW - 1, GROW, BODY |-
+# Than the content of the temporary diversion is moved to DUMP and the
+# temporary diversion is popped.
+# DUMP: BODY
+# BODY: TEST2a
+# diversions: GROW, BODY |-
#
-# * TEST1 requires TEST2a: epilogue
-# The content of the current diversion is appended to DUMP (and removed
-# from the current diversion). A diversion is popped.
-# DUMP: BODY
-# BODY: TEST2a
-# diversions: GROW, BODY |-
-#
-# * TEST1 requires TEST2b: prologue
-# m4_require pushes GROW - 1 and expands TEST2b.
-# DUMP: BODY
-# BODY: TEST2a
-# diversions: GROW - 1, GROW, BODY |-
-#
-# * TEST2b is expanded.
-# Its prologue pushes the current diversion again.
-# DUMP: BODY
-# BODY: TEST2a
-# diversions: GROW - 1, GROW - 1, GROW, BODY |-
-# The body is expanded here.
-#
-# * TEST2b requires TEST3: prologue
-# m4_require pushes GROW - 2 and expands TEST3.
-# DUMP: BODY
-# BODY: TEST2a
-# diversions: GROW - 2, GROW - 1, GROW - 1, GROW, BODY |-
-#
-# * TEST3 is expanded.
-# Its prologue pushes the current diversion again.
-# DUMP: BODY
-# BODY: TEST2a
-# diversions: GROW-2, GROW-2, GROW-1, GROW-1, GROW, BODY |-
-# TEST3 requires TEST2a, but TEST2a has already been AC_PROVIDE'd, so
-# nothing happens. It's body is expanded here, and its epilogue pops a
-# diversion.
-# DUMP: BODY
-# BODY: TEST2a
-# GROW - 2: TEST3
-# diversions: GROW - 2, GROW - 1, GROW - 1, GROW, BODY |-
-#
-# * TEST2b requires TEST3: epilogue
-# The current diversion is appended to DUMP, and a diversion is popped.
-# DUMP: BODY
-# BODY: TEST2a; TEST3
-# diversions: GROW - 1, GROW - 1, GROW, BODY |-
-# The content of TEST2b is expanded here.
-# DUMP: BODY
-# BODY: TEST2a; TEST3
-# GROW - 1: TEST2b,
-# diversions: GROW - 1, GROW - 1, GROW, BODY |-
-# The epilogue of TEST2b pops a diversion.
-# DUMP: BODY
-# BODY: TEST2a; TEST3
-# GROW - 1: TEST2b,
-# diversions: GROW - 1, GROW, BODY |-
-#
-# * TEST1 requires TEST2b: epilogue
-# The current diversion is appended to DUMP, and a diversion is popped.
-# DUMP: BODY
-# BODY: TEST2a; TEST3; TEST2b
-# diversions: GROW, BODY |-
+# * TEST1 requires TEST2b
+# Again, _m4_require_call pushes GROW - 1 and heads to expand TEST2b.
+# DUMP: BODY
+# BODY: TEST2a
+# diversions: GROW - 1, GROW, BODY |-
+#
+# * TEST2b requires TEST3
+# _m4_require_call pushes GROW - 2 and expands TEST3 here.
+# (TEST3 requires TEST2a, but TEST2a has already been m4_provide'd, so
+# nothing happens.)
+# DUMP: BODY
+# BODY: TEST2a
+# GROW - 2: TEST3
+# diversions: GROW - 2, GROW - 1, GROW, BODY |-
+# Than the diversion is appended to DUMP, and popped.
+# DUMP: BODY
+# BODY: TEST2a; TEST3
+# diversions: GROW - 1, GROW, BODY |-
+#
+# * TEST1 requires TEST2b (contd.)
+# The content of TEST2b is expanded...
+# DUMP: BODY
+# BODY: TEST2a; TEST3
+# GROW - 1: TEST2b,
+# diversions: GROW - 1, GROW, BODY |-
+# ... and moved to DUMP.
+# DUMP: BODY
+# BODY: TEST2a; TEST3; TEST2b
+# diversions: GROW, BODY |-
#
# * TEST1 is expanded: epilogue
-# TEST1's own content is in GROW, and it's epilogue pops a diversion.
-# DUMP: BODY
-# BODY: TEST2a; TEST3; TEST2b
-# GROW: TEST1
-# diversions: BODY |-
-# Here, the epilogue of TEST1 notices the elaboration is done because
-# DUMP and the current diversion are the same, it then undiverts
-# GROW by hand, and undefines DUMP.
+# TEST1's own content is in GROW...
+# DUMP: BODY
+# BODY: TEST2a; TEST3; TEST2b
+# GROW: TEST1
+# diversions: BODY |-
+# ... and it's epilogue moves it to DUMP and then undefines DUMP.
# DUMP: undefined
# BODY: TEST2a; TEST3; TEST2b; TEST1
# diversions: BODY |-
@@ -1136,37 +1072,21 @@ m4_define([m4_undivert],
# we prepend its name in m4_expansion_stack, and when we exit the
# macro, we remove it (thanks to pushdef/popdef).
#
-# In addition, we want to use the expansion stack to detect circular
-# m4_require dependencies. This means we need to browse the stack to
-# check whether a macro being expanded is m4_require'd. For ease of
-# implementation, and certainly for the benefit of performances, we
-# don't browse the m4_expansion_stack, rather each time we expand a
-# macro FOO we define _m4_expanding(FOO). Then m4_require(BAR) simply
-# needs to check whether _m4_expanding(BAR) is defined to diagnose a
-# circular dependency.
-#
-# To improve the diagnostic, in addition to keeping track of the stack
-# of macro calls, m4_expansion_stack also records the m4_require
-# stack. Note that therefore an m4_defun'd macro being required will
-# appear twice in the stack: the first time because it is required,
-# the second because it is expanded. We can avoid this, but it has
-# two small drawbacks: (i) the implementation is slightly more
-# complex, and (ii) it hides the difference between define'd macros
-# (which don't appear in m4_expansion_stack) and m4_defun'd macros
-# (which do). The more debugging information, the better.
+# In addition, we want to detect circular m4_require dependencies.
+# Each time we expand a macro FOO we define _m4_expanding(FOO); and
+# m4_require(BAR) simply checks whether _m4_expanding(BAR) is defined.
# m4_expansion_stack_push(TEXT)
# -----------------------------
m4_define([m4_expansion_stack_push],
[m4_pushdef([m4_expansion_stack],
- [$1]m4_ifdef([m4_expansion_stack], [
+ [$1]m4_ifdef([m4_expansion_stack], [
m4_defn([m4_expansion_stack])]))])
# m4_expansion_stack_pop
# ----------------------
-# Dump the expansion stack.
m4_define([m4_expansion_stack_pop],
[m4_popdef([m4_expansion_stack])])
@@ -1176,7 +1096,7 @@ m4_define([m4_expansion_stack_pop],
# Dump the expansion stack.
m4_define([m4_expansion_stack_dump],
[m4_ifdef([m4_expansion_stack],
- [m4_errprintn(m4_defn([m4_expansion_stack]))])dnl
+ [m4_errprintn(m4_defn([m4_expansion_stack]))])dnl
m4_errprintn(m4_location[: the top level])])
@@ -1203,29 +1123,33 @@ m4_define([_m4_divert(GROW)], 10000)
# -------------------------
# The prologue for Autoconf macros.
m4_define([_m4_defun_pro],
-[m4_expansion_stack_push(m4_defn([m4_location($1)])[: $1 is expanded from...])dnl
+[m4_ifndef([m4_expansion_stack], [_m4_defun_pro_outer[]])dnl
+m4_expansion_stack_push(m4_defn([m4_location($1)])[: $1 is expanded from...])dnl
m4_pushdef([_m4_expanding($1)])dnl
-m4_ifdef([_m4_divert_dump],
- [m4_divert_push(m4_defn([_m4_divert_diversion]))],
- [m4_copy([_m4_divert_diversion], [_m4_divert_dump])dnl
-m4_divert_push([GROW])])dnl
])
+m4_define([_m4_defun_pro_outer],
+[m4_copy([_m4_divert_diversion], [_m4_divert_dump])dnl
+m4_divert_push([GROW])dnl
+])
# _m4_defun_epi(MACRO-NAME)
# -------------------------
# The Epilogue for Autoconf macros. MACRO-NAME only helps tracing
# the PRO/EPI pairs.
m4_define([_m4_defun_epi],
-[m4_divert_pop()dnl
-m4_if(_m4_divert_dump, _m4_divert_diversion,
- [m4_undivert([GROW])dnl
-m4_undefine([_m4_divert_dump])])dnl
+[m4_popdef([_m4_expanding($1)])dnl
m4_expansion_stack_pop()dnl
-m4_popdef([_m4_expanding($1)])dnl
+m4_ifndef([m4_expansion_stack], [_m4_defun_epi_outer[]])dnl
m4_provide([$1])dnl
])
+m4_define([_m4_defun_epi_outer],
+[m4_undefine([_m4_divert_dump])dnl
+m4_divert_pop([GROW])dnl
+m4_undivert([GROW])dnl
+])
+
# m4_defun(NAME, EXPANSION)
# -------------------------
@@ -1240,7 +1164,7 @@ m4_provide([$1])dnl
m4_define([m4_defun],
[m4_define([m4_location($1)], m4_location)dnl
m4_define([$1],
- [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])
+ [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])
# m4_defun_once(NAME, EXPANSION)
@@ -1250,9 +1174,9 @@ m4_define([$1],
m4_define([m4_defun_once],
[m4_define([m4_location($1)], m4_location)dnl
m4_define([$1],
- [m4_provide_if([$1],
- [m4_warn([syntax], [$1 invoked multiple times])],
- [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])])
+ [m4_provide_if([$1],
+ [m4_warn([syntax], [$1 invoked multiple times])],
+ [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])])
# m4_pattern_forbid(ERE, [WHY])
@@ -1278,7 +1202,7 @@ m4_define([m4_pattern_allow], [])
# ---------------------------------------------
m4_define([m4_before],
[m4_provide_if([$2],
- [m4_warn([syntax], [$2 was called before $1])])])
+ [m4_warn([syntax], [$2 was called before $1])])])
# m4_require(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK])
@@ -1314,34 +1238,48 @@ m4_define([m4_before],
# `extension' prevents `AC_LANG_COMPILER' from having actual arguments that
# it passes to `AC_LANG_COMPILER(C)'.
m4_define([m4_require],
-[m4_expansion_stack_push(m4_location[: $1 is required by...])dnl
-m4_ifdef([_m4_expanding($1)],
- [m4_fatal([$0: circular dependency of $1])])dnl
+[m4_ifdef([_m4_expanding($1)],
+ [m4_fatal([$0: circular dependency of $1])])dnl
m4_ifndef([_m4_divert_dump],
- [m4_fatal([$0: cannot be used outside of an m4_defun'd macro])])dnl
+ [m4_fatal([$0($1): cannot be used outside of an m4_defun'd macro])])dnl
m4_provide_if([$1],
- [],
- [m4_divert_push(m4_eval(m4_divnum - 1))dnl
+ [],
+ [_m4_require_call([$1], [$2])])dnl
+])
+
+
+# _m4_require_call(BODY-TO-EXPAND)
+# --------------------------------
+# If m4_require decides to expand the body, it calls this macro.
+m4_define([_m4_require_call],
+[m4_define([_m4_divert_grow], m4_decr(_m4_divert_grow))dnl
+m4_divert_push(_m4_divert_grow)dnl
m4_default([$2], [$1])
-m4_divert(m4_defn([_m4_divert_dump]))dnl
-m4_undivert(m4_defn([_m4_divert_diversion]))dnl
-m4_divert_pop(m4_defn([_m4_divert_dump]))])dnl
m4_provide_if([$1],
- [],
- [m4_warn([syntax],
- [$1 is m4_require'd but is not m4_defun'd])])dnl
-m4_expansion_stack_pop()dnl
+ [],
+ [m4_warn([syntax],
+ [$1 is m4_require'd but not m4_defun'd])])dnl
+m4_divert(m4_defn([_m4_divert_dump]))dnl
+m4_undivert(_m4_divert_grow)dnl
+m4_divert_pop(_m4_divert_grow)dnl
+m4_define([_m4_divert_grow], m4_incr(_m4_divert_grow))dnl
])
+# _m4_divert_grow
+# ---------------
+# The counter for _m4_require_call.
+m4_define([_m4_divert_grow], _m4_divert([GROW]))
+
+
# m4_expand_once(TEXT, [WITNESS = TEXT])
# --------------------------------------
# If TEXT has never been expanded, expand it *here*. Use WITNESS as
# as a memory that TEXT has already been expanded.
m4_define([m4_expand_once],
[m4_provide_if(m4_ifval([$2], [[$2]], [[$1]]),
- [],
- [m4_provide(m4_ifval([$2], [[$2]], [[$1]]))[]$1])])
+ [],
+ [m4_provide(m4_ifval([$2], [[$2]], [[$1]]))[]$1])])
# m4_provide(MACRO-NAME)
@@ -1358,7 +1296,7 @@ m4_define([m4_provide],
# information is coded.
m4_define([m4_provide_if],
[m4_ifdef([m4_provide($1)],
- [$2], [$3])])
+ [$2], [$3])])
## -------------------- ##
@@ -1397,17 +1335,18 @@ m4_defn([m4_cr_digits])dnl
# m4_re_escape(STRING)
# --------------------
-# Escape BRE active characters in STRING.
+# Escape RE active characters in STRING.
m4_define([m4_re_escape],
[m4_bpatsubst([$1],
- [[][+*.]], [\\\&])])
+ [[][*+.?\^$]], [\\\&])])
# m4_re_string
# ------------
# Regexp for `[a-zA-Z_0-9]*'
+# m4_dquote provides literal [] for the character class.
m4_define([m4_re_string],
-m4_defn([m4_cr_symbols2])dnl
+m4_dquote(m4_defn([m4_cr_symbols2]))dnl
[*]dnl
)
@@ -1416,7 +1355,7 @@ m4_defn([m4_cr_symbols2])dnl
# ----------
# Regexp for `[a-zA-Z_][a-zA-Z_0-9]*'
m4_define([m4_re_word],
-m4_defn([m4_cr_symbols1])dnl
+m4_dquote(m4_defn([m4_cr_symbols1]))dnl
m4_defn([m4_re_string])dnl
)
@@ -1440,11 +1379,11 @@ m4_define([m4_toupper],
#
# REGEXP specifies where to split. Default is [\t ]+.
#
-# Pay attention to the m4_changequotes. Inner m4_changequotes exist for
-# obvious reasons (we want to insert square brackets). Outer
-# m4_changequotes are needed because otherwise the m4 parser, when it
-# sees the closing bracket we add to the result, believes it is the
-# end of the body of the macro we define.
+# If STRING is empty, the result is an empty list.
+#
+# Pay attention to the m4_changequotes. When m4 reads the definition of
+# m4_split, it still has quotes set to [ and ]. Luckily, these are matched
+# in the macro body, so the definition is stored correctly.
#
# Also, notice that $1 is quoted twice, since we want the result to
# be quoted. Then you should understand that the argument of
@@ -1455,16 +1394,17 @@ m4_define([m4_toupper],
# m4_split([active active ])end
# => [active], [active], []end
-m4_changequote(<<, >>)
-m4_define(<<m4_split>>,
-<<m4_changequote(``, '')dnl
+m4_define([m4_split],
+[m4_ifval([$1], [_m4_split($@)])])
+
+m4_define([_m4_split],
+[m4_changequote(``, '')dnl
[dnl Can't use m4_default here instead of m4_if, because m4_default uses
dnl [ and ] as quotes.
m4_bpatsubst(````$1'''',
- m4_if(``$2'',, ``[ ]+'', ``$2''),
+ m4_if(``$2'',, ``[ ]+'', ``$2''),
``], ['')]dnl
-m4_changequote([, ])>>)
-m4_changequote([, ])
+m4_changequote([, ])])
@@ -1491,13 +1431,10 @@ m4_define([m4_flatten],
#
# This macro is robust to active symbols.
# m4_define(active, ACTIVE)
-# m4_strip([ active active ])end
+# m4_strip([ active <tab> <tab>active ])end
# => active activeend
#
-# This macro is fun! Because we want to preserve active symbols, STRING
-# must be quoted for each evaluation, which explains there are 4 levels
-# of brackets around $1 (don't forget that the result must be quoted
-# too, hence one more quoting than applications).
+# Because we want to preserve active symbols, STRING must be double-quoted.
#
# Then notice the 2 last patterns: they are in charge of removing the
# leading/trailing spaces. Why not just `[^ ]'? Because they are
@@ -1506,9 +1443,9 @@ m4_define([m4_flatten],
# character, since there are two leading `['; equally for the last pattern.
m4_define([m4_strip],
[m4_bpatsubsts([[$1]],
- [[ ]+], [ ],
- [^\(..\) ], [\1],
- [ \(..\)$], [\1])])
+ [[ ]+], [ ],
+ [^\(..\) ], [\1],
+ [ \(..\)$], [\1])])
# m4_normalize(STRING)
@@ -1533,9 +1470,9 @@ m4_define([m4_normalize],
# Produce ARG1SEPARG2...SEPARGn.
m4_defun([m4_join],
[m4_case([$#],
- [1], [],
- [2], [[$2]],
- [[$2][$1]$0([$1], m4_shiftn(2, $@))])])
+ [1], [],
+ [2], [[$2]],
+ [[$2][$1]$0([$1], m4_shiftn(2, $@))])])
@@ -1573,7 +1510,7 @@ m4_defun([m4_join],
# => active
m4_define([m4_append],
[m4_define([$1],
- m4_ifdef([$1], [m4_defn([$1])$3])[$2])])
+ m4_ifdef([$1], [m4_defn([$1])$3])[$2])])
# m4_append_uniq(MACRO-NAME, STRING, [SEPARATOR])
@@ -1581,18 +1518,18 @@ m4_define([m4_append],
# As `m4_append', but append only if not yet present.
m4_define([m4_append_uniq],
[m4_ifdef([$1],
- [m4_bmatch([$3]m4_defn([$1])[$3], m4_re_escape([$3$2$3]), [],
- [m4_append($@)])],
- [m4_append($@)])])
+ [m4_bmatch([$3]m4_defn([$1])[$3], m4_re_escape([$3$2$3]), [],
+ [m4_append($@)])],
+ [m4_append($@)])])
# m4_text_wrap(STRING, [PREFIX], [FIRST-PREFIX], [WIDTH])
# -------------------------------------------------------
# Expands into STRING wrapped to hold in WIDTH columns (default = 79).
-# If prefix is set, each line is prefixed with it. If FIRST-PREFIX is
-# specified, then the first line is prefixed with it. As a special
-# case, if the length of the first prefix is greater than that of
-# PREFIX, then FIRST-PREFIX will be left alone on the first line.
+# If PREFIX is given, each line is prefixed with it. If FIRST-PREFIX is
+# specified, then the first line is prefixed with it. As a special case,
+# if the length of FIRST-PREFIX is greater than that of PREFIX, then
+# FIRST-PREFIX will be left alone on the first line.
#
# Typical outputs are:
#
@@ -1612,19 +1549,22 @@ m4_define([m4_append_uniq],
#
# m4_text_wrap([Super long documentation.], [ ], [ --too-wide ], 30)
# => --too-wide
-# => Super long
-# => documentation.
+# => Super long
+# => documentation.
#
# FIXME: there is no checking of a longer PREFIX than WIDTH, but do
# we really want to bother with people trying each single corner
# of a software?
#
+# more important:
+# FIXME: handle quadrigraphs correctly, both in TEXT and in FIRST_PREFIX.
+#
# This macro does not leave a trailing space behind the last word,
# what complicates it a bit. The algorithm is stupid simple: all the
# words are preceded by m4_Separator which is defined to empty for the
# first word, and then ` ' (single space) for all the others.
m4_define([m4_text_wrap],
-[m4_pushdef([m4_Prefix], m4_default([$2], []))dnl
+[m4_pushdef([m4_Prefix], [$2])dnl
m4_pushdef([m4_Prefix1], m4_default([$3], [m4_Prefix]))dnl
m4_pushdef([m4_Width], m4_default([$4], 79))dnl
m4_pushdef([m4_Cursor], m4_len(m4_Prefix1))dnl
@@ -1633,13 +1573,13 @@ m4_Prefix1[]dnl
m4_if(m4_eval(m4_Cursor > m4_len(m4_Prefix)),
1, [m4_define([m4_Cursor], m4_len(m4_Prefix))
m4_Prefix])[]dnl
-m4_foreach([m4_Word], m4_quote(m4_split(m4_normalize([$1]))),
+m4_foreach_w([m4_Word], [$1],
[m4_define([m4_Cursor], m4_eval(m4_Cursor + m4_len(m4_defn([m4_Word])) + 1))dnl
dnl New line if too long, else insert a space unless it is the first
dnl of the words.
m4_if(m4_eval(m4_Cursor > m4_Width),
1, [m4_define([m4_Cursor],
- m4_eval(m4_len(m4_Prefix) + m4_len(m4_defn([m4_Word])) + 1))]
+ m4_eval(m4_len(m4_Prefix) + m4_len(m4_defn([m4_Word])) + 1))]
m4_Prefix,
[m4_Separator])[]dnl
m4_defn([m4_Word])[]dnl
@@ -1661,6 +1601,21 @@ m4_define([m4_text_box],
])
+# m4_qlen(STRING)
+# ---------------
+# Expands to the length of STRING after autom4te converts all quadrigraphs.
+m4_define([m4_qlen],
+[m4_len(m4_bpatsubsts([[$1]], [@\(<:\|:>\|S|\|%:\)@], [P], [@&t@]))])
+
+
+# m4_qdelta(STRING)
+# -----------------
+# Expands to the net change in the length of STRING from autom4te converting the
+# quadrigraphs in STRING. This number is always negative or zero.
+m4_define([m4_qdelta],
+[m4_eval(m4_qlen([$1]) - m4_len([$1]))])
+
+
## ----------------------- ##
## 10. Number processing. ##
@@ -1672,9 +1627,9 @@ m4_define([m4_text_box],
# The sign of the integer A.
m4_define([m4_sign],
[m4_bmatch([$1],
- [^-], -1,
- [^0+], 0,
- 1)])
+ [^-], -1,
+ [^0+], 0,
+ 1)])
# m4_cmp(A, B)
# ------------
@@ -1703,9 +1658,9 @@ m4_define([m4_list_cmp],
[$1], [()], [$0((0), [$2])],
[$2], [()], [$0([$1], (0))],
[m4_case(m4_cmp(m4_car$1, m4_car$2),
- -1, -1,
- 1, 1,
- 0, [$0((m4_shift$1), (m4_shift$2))])])])
+ -1, -1,
+ 1, 1,
+ 0, [$0((m4_shift$1), (m4_shift$2))])])])
@@ -1725,14 +1680,14 @@ m4_define([m4_list_cmp],
# reasonable version numbers and is valid up to `z', no double letters.
m4_define([m4_version_unletter],
[m4_translit(m4_bpatsubsts([$1],
- [\([0-9]+\)\([abcdefghi]\)],
- [m4_eval(\1 + 1).-1.\2],
- [\([0-9]+\)\([jklmnopqrs]\)],
- [m4_eval(\1 + 1).-1.1\2],
- [\([0-9]+\)\([tuvwxyz]\)],
- [m4_eval(\1 + 1).-1.2\2]),
- [abcdefghijklmnopqrstuvwxyz],
- [12345678901234567890123456])])
+ [\([0-9]+\)\([abcdefghi]\)],
+ [m4_eval(\1 + 1).-1.\2],
+ [\([0-9]+\)\([jklmnopqrs]\)],
+ [m4_eval(\1 + 1).-1.1\2],
+ [\([0-9]+\)\([tuvwxyz]\)],
+ [m4_eval(\1 + 1).-1.2\2]),
+ [abcdefghijklmnopqrstuvwxyz],
+ [12345678901234567890123456])])
# m4_version_compare(VERSION-1, VERSION-2)
@@ -1743,7 +1698,16 @@ m4_define([m4_version_unletter],
# 1 if >
m4_define([m4_version_compare],
[m4_list_cmp((m4_split(m4_version_unletter([$1]), [\.])),
- (m4_split(m4_version_unletter([$2]), [\.])))])
+ (m4_split(m4_version_unletter([$2]), [\.])))])
+
+
+# m4_PACKAGE_NAME
+# m4_PACKAGE_TARNAME
+# m4_PACKAGE_VERSION
+# m4_PACKAGE_STRING
+# m4_PACKAGE_BUGREPORT
+# --------------------
+#m4_include([m4sugar/version.m4]) # This is needed for Autoconf, but not Bison.
# m4_version_prereq(VERSION, [IF-OK], [IF-NOT = FAIL])
@@ -1752,7 +1716,8 @@ m4_define([m4_version_compare],
m4_define([m4_version_prereq],
[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [$1]), -1,
[m4_default([$3],
- [m4_fatal([Autoconf version $1 or higher is required])])],
+ [m4_fatal([Autoconf version $1 or higher is required],
+ 63)])],
[$2])[]dnl
])
@@ -1795,8 +1760,7 @@ m4_pattern_forbid([^dnl$])
# Check the divert push/pop perfect balance.
m4_wrap([m4_ifdef([_m4_divert_diversion],
- [m4_fatal([$0: unbalanced m4_divert_push:]
-m4_defn([m4_divert_stack]))])[]])
+ [m4_fatal([$0: unbalanced m4_divert_push:]_m4_divert_n_stack)])[]])
m4_divert_push([KILL])
m4_wrap([m4_divert_pop([KILL])[]])
diff --git a/data/yacc.c b/data/yacc.c
index f4b1b1b9..982747d4 100644
--- a/data/yacc.c
+++ b/data/yacc.c
@@ -82,7 +82,7 @@ m4_define([b4_int_type],
m4_eval([0 <= $1]), [1], [unsigned int],
- [int])])
+ [int])])
## ----------------- ##
@@ -390,7 +390,7 @@ union yyalloc
#define YYUNDEFTOK ]b4_undef_token_number[
#define YYMAXUTOK ]b4_user_token_number_max[
-#define YYTRANSLATE(YYX) \
+#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
@@ -529,7 +529,7 @@ do \
goto yybackup; \
} \
else \
- { \
+ { \
yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
YYERROR; \
} \
@@ -609,7 +609,7 @@ do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
- yysymprint (stderr, \
+ yysymprint (stderr, \
Type, Value]b4_location_if([, Location])[); \
YYFPRINTF (stderr, "\n"); \
} \
diff --git a/doc/bison.texinfo b/doc/bison.texinfo
index c25813fb..d2264621 100644
--- a/doc/bison.texinfo
+++ b/doc/bison.texinfo
@@ -7425,6 +7425,9 @@ parser's to get the set of defined tokens.
@comment file: calc++-scanner.ll
@example
%@{ /* -*- C++ -*- */
+# include <cstdlib>
+# include <errno.h>
+# include <limits.h>
# include <string>
# include "calc++-driver.hh"
# include "calc++-parser.hh"
@@ -7482,7 +7485,14 @@ errors.
@example
[-+*/] return yytext[0];
":=" return TOKEN_ASSIGN;
-@{int@} yylval->ival = atoi (yytext); return TOKEN_NUMBER;
+@{int@} @{
+ errno = 0;
+ long n = strtol (yytext, NULL, 10);
+ if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE))
+ driver.error (*yylloc, "integer is out of range");
+ yylval->ival = n;
+ return TOKEN_NUMBER;
+@}
@{id@} yylval->sval = new std::string (yytext); return TOKEN_IDENTIFIER;
. driver.error (*yylloc, "invalid character");
%%
diff --git a/etc/clcommit b/etc/clcommit
deleted file mode 100755
index 77972188..00000000
--- a/etc/clcommit
+++ /dev/null
@@ -1,300 +0,0 @@
-#! /bin/sh
-
-# clcommit version 0.9.5
-
-# Copyright (C) 1999, 2000, Free Software Foundation
-
-# This script is Free Software, and it can be copied, distributed and
-# modified as defined in the GNU General Public License. A copy of
-# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
-
-# Originally by Gary V. Vaughan <gvaughan@oranda.demon.co.uk>
-# Pretty much rewritten by Alexandre Oliva <aoliva@redhat.com>
-
-# This scripts eases checking in changes to CVS-maintained projects
-# with ChangeLog files. It will check that there have been no
-# conflicting commits in the CVS repository and print which files it
-# is going to commit to stderr. A list of files to compare and to
-# check in can be given in the command line. If it is not given, all
-# files in the current directory (and below, unless `-l' is given) are
-# considered for check in.
-
-# The commit message will be extracted from the differences between a
-# file named ChangeLog* in the commit list, or named after -C, and the
-# one in the repository (unless a message was specified with `-m' or
-# `-F'). An empty message is not accepted (but a blank line is). If
-# the message is acceptable, it will be presented for verification
-# (and possible edition) using the $PAGER environment variable (or
-# `more', if it is not set, or `cat', if the `-f' switch is given).
-# If $PAGER exits successfully, the modified files (at that moment)
-# are checked in, unless `-n' was specified, in which case nothing is
-# checked in.
-
-# usage: clcommit [-v] [-h] [-f] [-l] [-n] [-q] [-z N] [-C ChangeLog_file]
-# [-m msg|-F msg_file|-1] [--] [file|dir ...]
-
-# -f --force don't check (unless *followed* by -n), and just
-# display commit message instead of running $PAGER
-# -l --local don't descend into subdirectories
-# -m msg --message=msg set commit message
-# --msg=msg same as -m
-# -F file --file=file read commit message from file
-# -1 --first extract first entry from ChangeLog, no cvs diff
-# -C file --changelog=file extract commit message from specified ChangeLog
-# --fast same as --force --first
-# -n --dry-run don't commit anything
-# -q --quiet run cvs in quiet mode
-# -zN --compress=N set compression level (0-9, 0=none, 9=max)
-# -v --version print version information
-# -h,-? --help print short or long help message
-
-name=clcommit
-: ${CVS=cvs}
-cvsopt=
-updateopt=
-commitopt=
-dry_run=false
-commit=:
-update=:
-log_file="${TMPDIR-/tmp}/commitlog.$$"
-first=false
-
-rm -f "$log_file"
-trap 'rm -f "$log_file"; exit 1' 1 2 15
-
-# this just eases exit handling
-main_repeat=":"
-while $main_repeat; do
-
-repeat="test $# -gt 0"
-while $repeat; do
- case "$1" in
- --fast)
- shift
- set fnord --force --first ${1+"$@"}
- shift
- ;;
- -f|--force)
- update=false
- PAGER=cat
- shift
- ;;
- -l|--local)
- updateopt="$updateopt -l"
- commitopt="$commitopt -l"
- shift
- ;;
- -m|--message|--msg)
- if test $# = 1; then
- echo "$name: missing argument for $1" >&2
- break
- fi
- if $first || test -f "$log_file"; then
- echo "$name: you can have at most one of -m, -F and -1" >&2
- break
- fi
- shift
- echo "$1" > "$log_file"
- shift
- ;;
- -F|--file)
- if $first || test -f "$log_file"; then
- echo "$name: you can have at most one of -m, -F and -1" >&2
- break
- fi
- if test $# = 1; then
- echo "$name: missing argument for $1" >&2
- break
- fi
- shift
- if cat < "$1" > "$log_file"; then :; else
- break
- fi
- shift
- ;;
- -1|--first)
- if test -f "$log_File"; then
- echo "$name: you can have at most one of -m, -F and -1" >&2
- break
- fi
- first=:
- shift
- ;;
- -C|--[cC]hange[lL]og)
- if test $# = 1; then
- echo "$name: missing argument for $1" >&2
- break
- fi
- shift
- if test ! -f "$1"; then
- echo "$name: ChangeLog file \`$1' does not exist" >&2
- break
- fi
- ChangeLog="$1"
- shift
- ;;
- -n|--dry-run)
- commit=false
- update=true
- shift
- ;;
- -q|--quiet)
- cvsopt="$cvsopt -q"
- shift
- ;;
- -v|--verbose)
- cvsopt="$cvsopt -t"
- shift
- ;;
- -z|--compress)
- if test $# = 1; then
- echo "$name: missing argument for $1" >&2
- break
- fi
- case "$2" in
- [0-9]) :;;
- *) echo "$name: invalid argument for $1" >&2
- break
- ;;
- esac
- cvsopt="$cvsopt -z$2"
- shift
- shift
- ;;
-
- -m*|-F*|-C*|-z*)
- opt=`echo "$1" | sed '1s/^\(..\).*$/\1/;q'`
- arg=`echo "$1" | sed '1s/^-[a-zA-Z0-9]//'`
- shift
- set -- "$opt" "$arg" ${1+"$@"}
- ;;
- --message=*|--msg=*|--file=*|--[Cc]hange[Ll]og=*|--compress=*)
- opt=`echo "$1" | sed '1s/^\(--[^=]*\)=.*/\1/;q'`
- arg=`echo "$1" | sed '1s/^--[^=]*=//'`
- shift
- set -- "$opt" "$arg" ${1+"$@"}
- ;;
-
- -v|--version)
- sed '/^# '$name' version /,/^# Heavily modified by/ { s/^# //; p; }; d' < $0
- exit 0
- ;;
- -\?|-h)
- sed '/^# usage:/,/# -h/ { s/^# //; p; }; d' < $0 &&
- echo
- echo "run \`$name --help | more' for full usage"
- exit 0
- ;;
- --help)
- sed '/^# '$name' version /,/^[^#]/ { /^[^#]/ d; s/^# //; p; }; d' < $0
- exit 0
- ;;
- --)
- shift
- repeat=false
- ;;
- -*)
- echo "$name: invalid flag $1" >&2
- break
- ;;
- *)
- repeat=false
- ;;
- esac
-done
-# might have used break 2 within the previous loop, but so what
-$repeat && break
-
-$update && \
-if echo "$name: checking for conflicts..." >&2
- ($CVS $cvsopt -q -n update $updateopt ${1+"$@"} 2>/dev/null \
- | while read line; do
- echo "$line"
- echo "$line" >&3
- done | grep '^C') 3>&1 >/dev/null; then
- echo "$name: some conflicts were found, aborting..." >&2
- break
-fi
-
-if test ! -f "$log_file"; then
- if test -z "$ChangeLog"; then
- for f in ${1+"$@"}; do
- case "$f" in
- ChangeLog* | */ChangeLog*)
- if test -z "$ChangeLog"; then
- ChangeLog="$f"
- else
- echo "$name: multiple ChangeLog files: $ChangeLog and $f" >&2
- break
- fi
- ;;
- esac
- done
- fi
-
- echo "$name: checking commit message..." >&2
- if $first; then
- skipping=:
- sed 's,^,+,' < ${ChangeLog-ChangeLog} |
- while read line; do
- case "$line" in
- "+2"*) if $skipping; then skipping=false; else break; fi;;
- "+ "*)
- echo "$name: *** Warning: lines should start with tabs, not spaces; ignoring line:" >&2
- echo "$line" | sed 's/^.//' >&2;;
- "+ "*)
- $skipping || echo "$line" ;;
- esac
- done |
- sed 's,^\+ ,,' > "$log_file" || break
- else
- $CVS $cvsopt diff -u ${ChangeLog-ChangeLog} |
- while read line; do
- case $line in
- "--- "*) :;;
- "-"*)
- echo "$name: *** Warning: the following line in ChangeLog diff is suspicious:" >&2
- echo "$line" | sed 's/^.//' >&2;;
- "+ "*)
- echo "$name: *** Warning: lines should start with tabs, not spaces; ignoring line:" >&2
- echo "$line" | sed 's/^.//' >&2;;
- "+") echo;;
- "+ "*) echo "$line";;
- esac
- done |
- sed -e 's,\+ ,,' -e '/./p' -e '/./d' -e '1d' -e '$d' > "$log_file" \
- || break
- fi
-# The sed script above removes "+TAB" from the beginning of a line, then
-# deletes the first and/or the last line, when they happen to be empty
-fi
-
-if grep '[^ ]' < "$log_file" > /dev/null; then :; else
- echo "$name: empty commit message, aborting" >&2
- break
-fi
-
-if grep '^$' < "$log_file" > /dev/null; then
- echo "$name: *** Warning: blank lines should not appear within commit messages." >&2
- echo "$name: *** They should be used to separate distinct commits." >&2
-fi
-
-${PAGER-more} "$log_file" || break
-
-sleep 1 # give the user some time for a ^C
-
-# Do not check for empty $log_file again, even though the user might have
-# zeroed it out. If s/he did, it was probably intentional.
-
-if $commit; then
- $CVS $cvsopt commit $commitopt -F $log_file ${1+"$@"} || break
-fi
-
-main_repeat=false
-done
-
-rm -f "$log_file"
-
-# if main_repeat was not set to `false', we failed
-$main_repeat && exit 1
-exit 0
diff --git a/examples/calc++/calc++-parser.yy b/examples/calc++/calc++-parser.yy
deleted file mode 100644
index 141d1da2..00000000
--- a/examples/calc++/calc++-parser.yy
+++ /dev/null
@@ -1,66 +0,0 @@
-#line 7195 "../../doc/bison.texinfo"
-%skeleton "lalr1.cc" /* -*- C++ -*- */
-%define "parser_class_name" "calcxx_parser"
-%defines
-%{
-# include <string>
-# include "calc++-driver.hh"
-%}
-#line 7211 "../../doc/bison.texinfo"
-// The parsing context.
-%parse-param { calcxx_driver& driver }
-%lex-param { calcxx_driver& driver }
-#line 7224 "../../doc/bison.texinfo"
-%locations
-%initial-action
-{
- // Initialize the initial location.
- @$.begin.filename = @$.end.filename = &driver.file;
-};
-#line 7238 "../../doc/bison.texinfo"
-%debug
-%error-verbose
-#line 7248 "../../doc/bison.texinfo"
-// Symbols.
-%union
-{
- int ival;
- std::string *sval;
-};
-#line 7265 "../../doc/bison.texinfo"
-%token YYEOF 0 "end of file"
-%token TOKEN_ASSIGN ":="
-%token <sval> TOKEN_IDENTIFIER "identifier"
-%token <ival> TOKEN_NUMBER "number"
-%type <ival> exp "expression"
-#line 7278 "../../doc/bison.texinfo"
-%printer { debug_stream () << *$$; } "identifier"
-%destructor { delete $$; } "identifier"
-
-%printer { debug_stream () << $$; } "number" "expression"
-#line 7289 "../../doc/bison.texinfo"
-%%
-%start unit;
-unit: assignments exp { driver.result = $2; };
-
-assignments: assignments assignment {}
- | /* Nothing. */ {};
-
-assignment: TOKEN_IDENTIFIER ":=" exp { driver.variables[*$1] = $3; };
-
-%left '+' '-';
-%left '*' '/';
-exp: exp '+' exp { $$ = $1 + $3; }
- | exp '-' exp { $$ = $1 - $3; }
- | exp '*' exp { $$ = $1 * $3; }
- | exp '/' exp { $$ = $1 / $3; }
- | TOKEN_IDENTIFIER { $$ = driver.variables[*$1]; }
- | TOKEN_NUMBER { $$ = $1; };
-%%
-#line 7315 "../../doc/bison.texinfo"
-void
-yy::calcxx_parser::error (const yy::calcxx_parser::location_type& l,
- const std::string& m)
-{
- driver.error (l, m);
-}
diff --git a/lib/abitset.h b/lib/abitset.h
index 2218915a..a22c9191 100644
--- a/lib/abitset.h
+++ b/lib/abitset.h
@@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _ABITSET_H
-#define _ABITSET_H
+#define _ABITSET_H
#include "bitset.h"
diff --git a/lib/bbitset.h b/lib/bbitset.h
index 3bcb92cd..f06a4e27 100644
--- a/lib/bbitset.h
+++ b/lib/bbitset.h
@@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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.
diff --git a/lib/bitset.h b/lib/bitset.h
index 2ffebd50..292f7894 100644
--- a/lib/bitset.h
+++ b/lib/bitset.h
@@ -309,8 +309,8 @@ extern void bitset_dump (FILE *, bitset);
*/
#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); \
@@ -331,7 +331,7 @@ extern void bitset_dump (FILE *, bitset);
*/
#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; \
@@ -386,4 +386,3 @@ extern void debug_bitset (bitset);
extern void debug_bitset_stats (void);
#endif /* _BITSET_H */
-
diff --git a/lib/bitset_stats.c b/lib/bitset_stats.c
index 6cb971a8..bc771584 100644
--- a/lib/bitset_stats.c
+++ b/lib/bitset_stats.c
@@ -50,29 +50,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)]++
diff --git a/lib/ebitset.h b/lib/ebitset.h
index 2d198609..dc602734 100644
--- a/lib/ebitset.h
+++ b/lib/ebitset.h
@@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _EBITSET_H
-#define _EBITSET_H
+#define _EBITSET_H
#include "bitset.h"
diff --git a/lib/lbitset.c b/lib/lbitset.c
index aeaa5b21..9d3d9573 100644
--- a/lib/lbitset.c
+++ b/lib/lbitset.c
@@ -41,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. */
@@ -888,18 +888,18 @@ lbitset_unused_clear (bitset dst)
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++)
diff --git a/lib/lbitset.h b/lib/lbitset.h
index 28dce39b..aaad8345 100644
--- a/lib/lbitset.h
+++ b/lib/lbitset.h
@@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _LBITSET_H
-#define _LBITSET_H
+#define _LBITSET_H
#include "bitset.h"
diff --git a/lib/subpipe.c b/lib/subpipe.c
index 10b62f2c..7f8e44f2 100644
--- a/lib/subpipe.c
+++ b/lib/subpipe.c
@@ -44,9 +44,7 @@
# define STDOUT_FILENO 1
#endif
#if ! HAVE_DUP2 && ! defined dup2
-# if HAVE_FCNTL_H
-# include <fcntl.h>
-# endif
+# include <fcntl.h>
# define dup2(f, t) (close (t), fcntl (f, F_DUPFD, t))
#endif
@@ -109,11 +107,13 @@ create_subpipe (char const * const *argv, int fd[2])
|| pipe (pipe_fd) != 0
|| (fd[1] = fd_safer (pipe_fd[0])) < 0
|| (child_fd[1] = fd_safer (pipe_fd[1])) < 0)
- error (EXIT_FAILURE, errno, "pipe");
+ error (EXIT_FAILURE, errno,
+ "pipe");
pid = vfork ();
if (pid < 0)
- error (EXIT_FAILURE, errno, "fork");
+ error (EXIT_FAILURE, errno,
+ "fork");
if (! pid)
{
@@ -148,7 +148,8 @@ reap_subpipe (pid_t pid, char const *program)
#if HAVE_WAITPID || defined waitpid
int wstatus;
if (waitpid (pid, &wstatus, 0) < 0)
- error (EXIT_FAILURE, errno, "waitpid");
+ error (EXIT_FAILURE, errno,
+ "waitpid");
else
{
int status = WIFEXITED (wstatus) ? WEXITSTATUS (wstatus) : -1;
diff --git a/lib/timevar.c b/lib/timevar.c
index 6de93d50..d647687f 100644
--- a/lib/timevar.c
+++ b/lib/timevar.c
@@ -31,7 +31,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
/* This source file is taken from the GCC source code, with slight
modifications that are under control of the IN_GCC preprocessor
variable. The !IN_GCC part of this file is specific to Bison. */
-
+
# include "../src/system.h"
# if HAVE_SYS_TIME_H
# include <sys/time.h>
diff --git a/lib/vbitset.h b/lib/vbitset.h
index 752086df..bab011c4 100644
--- a/lib/vbitset.h
+++ b/lib/vbitset.h
@@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _VBITSET_H
-#define _VBITSET_H
+#define _VBITSET_H
#include "bitset.h"
diff --git a/m4/subpipe.m4 b/m4/subpipe.m4
index 7cf025b1..dbf909c9 100644
--- a/m4/subpipe.m4
+++ b/m4/subpipe.m4
@@ -1,7 +1,7 @@
# -*- Autoconf -*-
# Checks required to run `subpipe'.
#
-# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005 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
@@ -23,7 +23,6 @@
AC_DEFUN([BISON_PREREQ_SUBPIPE],
[
AC_TYPE_PID_T
- AC_CHECK_HEADERS([fcntl.h])
AC_HEADER_SYS_WAIT
AC_CHECK_FUNCS(dup2 waitpid)
AC_FUNC_FORK
diff --git a/src/Makefile.am b/src/Makefile.am
index 3c9e5695..c4bc05c6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,9 +15,7 @@
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301 USA
-DEFS = @DEFS@ \
- -DPKGDATADIR=\"$(pkgdatadir)\" \
- -DLOCALEDIR=\"$(datadir)/locale\"
+DEFS += -DPKGDATADIR=\"$(pkgdatadir)\" -DLOCALEDIR=\"$(datadir)/locale\"
AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib
@@ -33,7 +31,7 @@ bin_PROGRAMS = bison
bin_SCRIPTS = $(YACC_SCRIPT)
EXTRA_SCRIPTS = yacc
-bison_SOURCES = \
+bison_SOURCES = \
LR0.c LR0.h \
assoc.c assoc.h \
closure.c closure.h \
@@ -56,7 +54,7 @@ bison_SOURCES = \
reduce.c reduce.h \
relation.c relation.h \
scan-gram.l \
- scan-skel.l \
+ scan-skel.h scan-skel.l \
state.c state.h \
symlist.c symlist.h \
symtab.c symtab.h \
@@ -77,3 +75,34 @@ yacc:
echo:
echo $(bison_SOURCES) $(noinst_HEADERS)
+
+# The following rule is not designed to be portable,
+# and relies on tools that not everyone has.
+
+# Most functions in src/*.c should have static scope.
+# Any that don't must be marked with `extern', but `main'
+# and `usage' are exceptions. They're always extern, but
+# don't need to be marked.
+#
+# The second nm|grep checks for file-scope variables with `extern' scope.
+sc_tight_scope: $(all_programs)
+ @t=exceptions-$$$$; \
+ trap 's=$$?; rm -f $$t; exit $$s' 0 1 2 13 15; \
+ ( printf '^main$$\n^usage$$\n'; \
+ grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \
+ | grep -vE '^(extern |--)' |sed 's/^/^/;s/ .*/$$/' ) > $$t; \
+ if nm -e *.$(OBJEXT) \
+ | sed -n 's/.* T //p' \
+ | grep -Ev -f $$t; then \
+ echo 'the above functions should have static scope' 1>&2; \
+ exit 1; \
+ fi; \
+ ( printf '^program_name$$\n'; \
+ sed -n 's/^extern .*[* ]\([a-zA-Z_][a-zA-Z_0-9]*\);$$/^\1$$/p' \
+ $$(ls $(SOURCES) | grep '\.h$$') /dev/null) > $$t; \
+ if nm -e *.$(OBJEXT) \
+ | sed -n 's/.* [BD] //p' \
+ | grep -Ev -f $$t; then \
+ echo 'the above variables should have static scope' 1>&2; \
+ exit 1; \
+ fi
diff --git a/src/files.c b/src/files.c
index 5a0b2ea4..00841dd3 100644
--- a/src/files.c
+++ b/src/files.c
@@ -66,9 +66,9 @@ static char *full_base_name = NULL;
char *short_base_name = NULL;
/* C source file extension (the parser source). */
-const char *src_extension = NULL;
+static char const *src_extension = NULL;
/* Header file extension (if option ``-d'' is specified). */
-const char *header_extension = NULL;
+static char const *header_extension = NULL;
/*-----------------------------------------------------------------.
| Return a newly allocated string composed of the concatenation of |
diff --git a/src/getargs.c b/src/getargs.c
index 1a0432e7..0170f8e3 100644
--- a/src/getargs.c
+++ b/src/getargs.c
@@ -285,7 +285,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
`----------------------*/
/* Shorts options. */
-const char *short_options = "yvegdhr:ltknVo:b:p:S:T::";
+static char const short_options[] = "yvegdhr:ltknVo:b:p:S:T::";
/* Values for long options that do not have single-letter equivalents. */
enum
diff --git a/src/getargs.h b/src/getargs.h
index ec4bf695..2e02a76a 100644
--- a/src/getargs.h
+++ b/src/getargs.h
@@ -1,5 +1,5 @@
/* Parse command line arguments for bison.
- Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004
+ Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -23,8 +23,12 @@
# define GETARGS_H_
/* flags set by % directives */
-extern const char *skeleton; /* for -S */
-extern const char *include; /* for -I */
+
+/* for -S */
+extern char const *skeleton;
+
+/* for -I */
+extern char const *include;
extern bool debug_flag; /* for -t */
extern bool defines_flag; /* for -d */
diff --git a/src/gram.c b/src/gram.c
index e394478d..4636f4e1 100644
--- a/src/gram.c
+++ b/src/gram.c
@@ -269,7 +269,7 @@ grammar_dump (FILE *out, const char *title)
rule *rule_i = &rules[i];
item_number *rp = NULL;
unsigned int rhs_itemno = rule_i->rhs - ritem;
- unsigned int rhs_count = 0;
+ unsigned int rhs_count = 0;
/* Find the last RHS index in ritems. */
for (rp = rule_i->rhs; *rp >= 0; ++rp)
++rhs_count;
diff --git a/src/main.c b/src/main.c
index b2f85599..ba594b47 100644
--- a/src/main.c
+++ b/src/main.c
@@ -56,9 +56,9 @@ main (int argc, char *argv[])
{
program_name = argv[0];
setlocale (LC_ALL, "");
- bindtextdomain (PACKAGE, LOCALEDIR);
- bindtextdomain ("bison-runtime", LOCALEDIR);
- textdomain (PACKAGE);
+ (void) bindtextdomain (PACKAGE, LOCALEDIR);
+ (void) bindtextdomain ("bison-runtime", LOCALEDIR);
+ (void) textdomain (PACKAGE);
uniqstrs_new ();
diff --git a/src/muscle_tab.c b/src/muscle_tab.c
index 876f1c89..6e7bd9bb 100644
--- a/src/muscle_tab.c
+++ b/src/muscle_tab.c
@@ -41,7 +41,7 @@ struct obstack muscle_obstack;
/* Initial capacity of muscles hash table. */
#define HT_INITIAL_CAPACITY 257
-struct hash_table *muscle_table = NULL;
+static struct hash_table *muscle_table = NULL;
static bool
hash_compare_muscles (void const *x, void const *y)
diff --git a/src/muscle_tab.h b/src/muscle_tab.h
index ebd1c3bb..9e8ac24f 100644
--- a/src/muscle_tab.h
+++ b/src/muscle_tab.h
@@ -40,14 +40,14 @@ extern struct obstack muscle_obstack;
#define MUSCLE_INSERT_INT(Key, Value) \
{ \
- obstack_fgrow1 (&muscle_obstack, "%d", Value); \
+ obstack_fgrow1 (&muscle_obstack, "%d", Value); \
obstack_1grow (&muscle_obstack, 0); \
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
}
#define MUSCLE_INSERT_LONG_INT(Key, Value) \
{ \
- obstack_fgrow1 (&muscle_obstack, "%ld", Value); \
+ obstack_fgrow1 (&muscle_obstack, "%ld", Value); \
obstack_1grow (&muscle_obstack, 0); \
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
}
diff --git a/src/output.c b/src/output.c
index cd5846bc..9bc806f1 100644
--- a/src/output.c
+++ b/src/output.c
@@ -36,12 +36,10 @@
#include "muscle_tab.h"
#include "output.h"
#include "reader.h"
+#include "scan-skel.h"
#include "symtab.h"
#include "tables.h"
-/* From src/scan-skel.l. */
-void scan_skel (FILE *);
-
static struct obstack format_obstack;
@@ -559,7 +557,8 @@ output_skeleton (void)
out = fdopen (filter_fd[0], "w");
if (! out)
- error (EXIT_FAILURE, get_errno (), "fdopen");
+ error (EXIT_FAILURE, get_errno (),
+ "fdopen");
/* Output the definitions of all the muscles. */
fputs ("m4_init()\n", out);
@@ -580,7 +579,8 @@ output_skeleton (void)
timevar_push (TV_M4);
in = fdopen (filter_fd[1], "r");
if (! in)
- error (EXIT_FAILURE, get_errno (), "fdopen");
+ error (EXIT_FAILURE, get_errno (),
+ "fdopen");
scan_skel (in);
xfclose (in);
reap_subpipe (pid, m4);
diff --git a/src/parse-gram.y b/src/parse-gram.y
index 735a3fd7..a638cb06 100644
--- a/src/parse-gram.y
+++ b/src/parse-gram.y
@@ -48,12 +48,12 @@ static void gram_error (location const *, char const *);
static void add_param (char const *, char *, location);
-symbol_class current_class = unknown_sym;
-uniqstr current_type = 0;
+static symbol_class current_class = unknown_sym;
+static uniqstr current_type = 0;
symbol *current_lhs;
location current_lhs_location;
assoc current_assoc;
-int current_prec = 0;
+static int current_prec = 0;
%}
%debug
@@ -206,7 +206,7 @@ declaration:
| "%defines" { defines_flag = true; }
| "%error-verbose" { error_verbose = true; }
| "%expect" INT { expected_sr_conflicts = $2; }
-| "%expect-rr" INT { expected_rr_conflicts = $2; }
+| "%expect-rr" INT { expected_rr_conflicts = $2; }
| "%file-prefix" "=" string_content { spec_file_prefix = $3; }
| "%glr-parser"
{
@@ -221,7 +221,7 @@ declaration:
| "%locations" { locations_flag = true; }
| "%name-prefix" "=" string_content { spec_name_prefix = $3; }
| "%no-lines" { no_lines_flag = true; }
-| "%nondeterministic-parser" { nondeterministic_parser = true; }
+| "%nondeterministic-parser" { nondeterministic_parser = true; }
| "%output" "=" string_content { spec_outfile = $3; }
| "%parse-param {...}" { add_param ("parse_param", $1, @1); }
| "%pure-parser" { pure_parser = true; }
diff --git a/src/print_graph.c b/src/print_graph.c
index 187d2eb8..dc0f8306 100644
--- a/src/print_graph.c
+++ b/src/print_graph.c
@@ -1,6 +1,6 @@
/* Output a VCG description on generated parser, for Bison,
- Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -21,7 +21,6 @@
#include "system.h"
-#include <obstack.h>
#include <quotearg.h>
#include "LR0.h"
diff --git a/src/reader.c b/src/reader.c
index 561b7419..6b247b7f 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -159,7 +159,7 @@ free_merger_functions (void)
`-------------------------------------------------------------------*/
/* The (currently) last symbol of GRAMMAR. */
-symbol_list *grammar_end = NULL;
+static symbol_list *grammar_end = NULL;
/* Append SYM to the grammar. */
void
@@ -179,7 +179,7 @@ grammar_symbol_append (symbol *sym, location loc)
CURRENT_RULE points to the first LHS of the current rule, while
PREVIOUS_RULE_END points to the *end* of the previous rule (NULL). */
symbol_list *current_rule = NULL;
-symbol_list *previous_rule_end = NULL;
+static symbol_list *previous_rule_end = NULL;
/*----------------------------------------------.
diff --git a/src/reader.h b/src/reader.h
index d7d53015..3b746e31 100644
--- a/src/reader.h
+++ b/src/reader.h
@@ -43,6 +43,11 @@ void scanner_initialize (void);
void scanner_free (void);
void scanner_last_string_free (void);
+/* These are declared by the scanner, but not used. We put them here
+ to pacify "make syntax-check". */
+extern FILE *gram_out;
+extern int gram_lineno;
+
# define YY_DECL int gram_lex (YYSTYPE *val, location *loc)
YY_DECL;
diff --git a/src/scan-skel.h b/src/scan-skel.h
new file mode 100644
index 00000000..c5b19eac
--- /dev/null
+++ b/src/scan-skel.h
@@ -0,0 +1,41 @@
+/* Scan Bison Skeletons.
+
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of Bison, the GNU Compiler Compiler.
+
+ Bison 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.
+
+ Bison 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 Bison; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+void scan_skel (FILE *);
+
+/* Pacify "make syntax-check". */
+extern FILE *skel_in;
+extern FILE *skel_out;
+extern int skel__flex_debug;
+extern int skel_lineno;
+
+/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */
+int skel_get_lineno (void);
+FILE *skel_get_in (void);
+FILE *skel_get_out (void);
+int skel_get_leng (void);
+char *skel_get_text (void);
+void skel_set_lineno (int);
+void skel_set_in (FILE *);
+void skel_set_out (FILE *);
+int skel_get_debug (void);
+void skel_set_debug (int);
+int skel_lex_destroy (void);
diff --git a/src/scan-skel.l b/src/scan-skel.l
index 951a9fda..c08c330a 100644
--- a/src/scan-skel.l
+++ b/src/scan-skel.l
@@ -31,21 +31,7 @@
#include "complain.h"
#include "getargs.h"
#include "files.h"
-
-int skel_lex (void);
-
-/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */
-int skel_get_lineno (void);
-FILE *skel_get_in (void);
-FILE *skel_get_out (void);
-int skel_get_leng (void);
-char *skel_get_text (void);
-void skel_set_lineno (int);
-void skel_set_in (FILE *);
-void skel_set_out (FILE *);
-int skel_get_debug (void);
-void skel_set_debug (int);
-int skel_lex_destroy (void);
+#include "scan-skel.h"
#define QPUTS(String) \
fputs (quotearg_style (c_quoting_style, (String)), yyout)
@@ -110,8 +96,6 @@ int skel_lex_destroy (void);
| Scan a Bison skeleton. |
`------------------------*/
-void scan_skel (FILE *);
-
void
scan_skel (FILE *in)
{
diff --git a/src/system.h b/src/system.h
index 1cd7deef..755a75cb 100644
--- a/src/system.h
+++ b/src/system.h
@@ -130,9 +130,9 @@ typedef size_t uintptr_t;
| Obstacks. |
`-----------*/
-# define obstack_chunk_alloc xmalloc
-# define obstack_chunk_free free
-# include <obstack.h>
+#define obstack_chunk_alloc xmalloc
+#define obstack_chunk_free free
+#include <obstack.h>
#define obstack_sgrow(Obs, Str) \
obstack_grow (Obs, Str, strlen (Str))
diff --git a/src/tables.c b/src/tables.c
index 3e534bea..4e99f4ad 100644
--- a/src/tables.c
+++ b/src/tables.c
@@ -173,7 +173,7 @@ table_grow (int desired)
/*-------------------------------------------------------------------.
| For GLR parsers, for each conflicted token in S, as indicated |
-| by non-zero entries in CONFLROW, create a list of possible |
+| by non-zero entries in CONFLROW, create a list of possible |
| reductions that are alternatives to the shift or reduction |
| currently recorded for that token in S. Store the alternative |
| reductions followed by a 0 in CONFLICT_LIST, updating |
diff --git a/src/uniqstr.c b/src/uniqstr.c
index 4a345d48..f082f338 100644
--- a/src/uniqstr.c
+++ b/src/uniqstr.c
@@ -1,6 +1,6 @@
/* Keep a unique copy of strings.
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -63,7 +63,8 @@ uniqstr_assert (char const *str)
{
if (!hash_lookup (uniqstrs_table, str))
{
- error (0, 0, "not a uniqstr: %s", quotearg (str));
+ error (0, 0,
+ "not a uniqstr: %s", quotearg (str));
abort ();
}
}
diff --git a/src/vcg.c b/src/vcg.c
index b680b328..fa513388 100644
--- a/src/vcg.c
+++ b/src/vcg.c
@@ -203,7 +203,7 @@ new_edge (edge *e)
}
/*----------------------------------------------.
-| Get functions. |
+| Get functions. |
| Return string corresponding to an enum value. |
`----------------------------------------------*/
@@ -374,7 +374,7 @@ get_arrowstyle_str (enum arrowstyle arrowstyle)
}
/*------------------------------.
-| Add functions. |
+| Add functions. |
| Edge and nodes into a graph. |
`------------------------------*/
diff --git a/src/vcg_defaults.h b/src/vcg_defaults.h
index d20a327d..78e24b5c 100644
--- a/src/vcg_defaults.h
+++ b/src/vcg_defaults.h
@@ -48,11 +48,11 @@
# define G_TEXTMODE centered
# define G_SHAPE box
-# define G_VERTICAL_ORDER 0 /* Unspecified for subgraphs. */
-# define G_HORIZONTAL_ORDER 0 /* Unspecified for subgraphs. */
+# define G_VERTICAL_ORDER 0 /* Unspecified for subgraphs. */
+# define G_HORIZONTAL_ORDER 0 /* Unspecified for subgraphs. */
-# define G_XMAX 90 /* Not output */
-# define G_YMAX 90 /* Not output */
+# define G_XMAX 90 /* Not output. */
+# define G_YMAX 90 /* Not output. */
# define G_XBASE 5
# define G_YBASE 5
@@ -65,9 +65,9 @@
# define G_YRASTER 1
# define G_XLRASTER 1
-# define G_HIDDEN (-1) /* No default value. */
+# define G_HIDDEN (-1) /* No default value. */
-# define G_CLASSNAME NULL /* No class name association */
+# define G_CLASSNAME NULL /* No class name association. */
# define G_INFONAME NULL
# define G_COLORENTRY NULL
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1d9b619e..b26a8653 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -32,11 +32,11 @@ MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
$(srcdir)/package.m4: $(top_srcdir)/configure.ac
{ \
echo '# Signature of the current package.'; \
- echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \
- echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \
- echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \
- echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \
- echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+ echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])'; \
+ echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])'; \
+ echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])'; \
+ echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])'; \
+ echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
} >$(srcdir)/package.m4
## ------------ ##
diff --git a/tests/cxx-type.at b/tests/cxx-type.at
index e551ad01..818c8f82 100644
--- a/tests/cxx-type.at
+++ b/tests/cxx-type.at
@@ -83,7 +83,7 @@ prog :
stmt : expr ';' $2 { $$ = ]$[1; }
| decl $3
| error ';' { static char error_msg[] = "<error>"; $$ = error_msg; }
- | '@' { YYACCEPT; }
+ | '@' { YYACCEPT; }
;
expr : ID
@@ -145,7 +145,7 @@ yylex (LEX_PARAMETERS)
break;
case ' ': case '\f':
colNum += 1;
- break;
+ break;
case '\n':
lineNum += 1;
colNum = 0;
diff --git a/tests/existing.at b/tests/existing.at
index 3568f4dc..27ba3123 100644
--- a/tests/existing.at
+++ b/tests/existing.at
@@ -408,7 +408,7 @@ AT_DATA([[input.y]],
HBEGPAR HENDPAR
HEQR HNER
HADD HSUB HMUL HDIV HINTDIV HEXP
- HDOTDOTDOT
+ HDOTDOTDOT
%token <ident> HIDENTIFIER
%token <ival> HBOOLEANKONST HINTEGERKONST HCHARACTERKONST
@@ -450,7 +450,7 @@ AT_DATA([[input.y]],
MAIN_MODULE : { categ=CLOCAL; mout(MBLOCK);
beginBlock(KBLOKK);separat_comp=FALSE;}
MODULS { endBlock(NULL,CCNO); mout(MENDBLOCK);}
- | error HSTATEMENTSEPARATOR MBEE_DECLSTMS
+ | error HSTATEMENTSEPARATOR MBEE_DECLSTMS
;
EXT_DECLARATION : HEXTERNAL
MBEE_TYPE
@@ -548,7 +548,7 @@ MBEE_ELSE_PART : /*EMPT*/
/* | HELSE
HIF
EXPRESSION
- HTHEN { mout(MELSE);
+ HTHEN { mout(MELSE);
mout(MIF);
OBSBLOCK();}
BLOCK { MBEEENDBLOCK();}
@@ -588,7 +588,7 @@ WHEN_CLAUSE_LIST: HWHEN
HIDENTIFIER
HDO { beginBlock(KCON); mout(MIDENTIFIER);
OBSBLOCK(); moutId($2);
- mout(MWHEN);}
+ mout(MWHEN);}
BLOCK { endBlock(NULL,CCNO);
MBEEENDBLOCK(); mout(MENDWHEN);}
| WHEN_CLAUSE_LIST
@@ -596,7 +596,7 @@ WHEN_CLAUSE_LIST: HWHEN
HIDENTIFIER
HDO { beginBlock(KCON); mout(MIDENTIFIER);
OBSBLOCK(); moutId($3);
- mout(MWHEN);}
+ mout(MWHEN);}
BLOCK { endBlock(NULL,CCNO);
MBEEENDBLOCK(); mout(MENDWHEN);}
;
@@ -645,8 +645,8 @@ MODULSTATEMENT : HWHILE
HDO { STOPOBSBLOCK(); mout(MWHILE);
OBSBLOCK();}
BLOCK { MBEEENDBLOCK(); mout(MENDWHILE);
- $$=STATEMENT;}
- | HIF
+ $$=STATEMENT;}
+ | HIF
EXPRESSION
HTHEN { STOPOBSBLOCK(); mout(MIF);
OBSBLOCK();}
@@ -709,7 +709,7 @@ MODULSTATEMENT : HWHILE
{ STOPOBSBLOCK(); $$=STATEMENT;
mout(MENDASSIGN);}
| ACTIVATOR EXPRESSION SCHEDULE
- { $$=STATEMENT;
+ { $$=STATEMENT;
mout(MENDSEP);
mout(MARGUMENTSEP);
mout(MARGUMENTSEP);
@@ -836,10 +836,10 @@ MBEE_DECLSTMSU : DECLSTATEMENT { $$=$1;}
MODULS : MODULSTATEMENT { if($1==DECLARATION)
{separat_comp=TRUE;gettimestamp();}
$$=$1;}
- | MODULS HSTATEMENTSEPARATOR MODULSTATEMENT
+ | MODULS HSTATEMENTSEPARATOR MODULSTATEMENT
{ if($1>=STATEMENT && $3<=DECLARATION)
yerror (26);else
- if($1>=STATEMENT
+ if($1>=STATEMENT
&& $3!=EMPTYSTATEMENT)yerror (25);
if(separat_comp && $3==STATEMENT)
yerror (25);
@@ -939,7 +939,7 @@ FPP_CATEG : HNAME HLABELSEPARATOR
;
FPP_PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE
HIDENTIFIER
- { $<ival>$=categ;
+ { $<ival>$=categ;
regDecl($3, type, KPROC, categ);
beginBlock(KPROC);}
FPP_HEADING
@@ -1008,7 +1008,7 @@ SPECIFIER : TYPE { kind=KSIMPLE;}
;
PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE
HIDENTIFIER
- { $<ival>$=categ;
+ { $<ival>$=categ;
regDecl($3, type, KPROC, categ);
beginBlock(KPROC);}
HEADING
@@ -1292,7 +1292,7 @@ AT_DATA([[input.y]],
%token AND
%token HERE
%token DOT_N
-%token DOT_E
+%token DOT_E
%token DOT_W
%token DOT_S
%token DOT_NE
@@ -1378,7 +1378,7 @@ parses properly. */
%left CHOP SOLID DASHED DOTTED UP DOWN FILL COLORED OUTLINED
%left LABEL
-%left VARIABLE NUMBER '(' SIN COS ATAN2 LOG EXP SQRT K_MAX K_MIN INT RAND SRAND LAST
+%left VARIABLE NUMBER '(' SIN COS ATAN2 LOG EXP SQRT K_MAX K_MIN INT RAND SRAND LAST
%left ORDINAL HERE '`'
%left BOX CIRCLE ELLIPSE ARC LINE ARROW SPLINE '[' /* ] */
@@ -1518,7 +1518,7 @@ placeless_element:
}
| COPY TEXT THRU
{ delim_flag = 2; }
- DELIMITED
+ DELIMITED
{ delim_flag = 0; }
until
{
@@ -1542,13 +1542,13 @@ placeless_element:
a_delete $6;
}
| FOR VARIABLE '=' expr TO expr optional_by DO
- { delim_flag = 1; }
+ { delim_flag = 1; }
DELIMITED
- {
+ {
delim_flag = 0;
if (yychar < 0)
do_lookahead();
- do_for($2, $4, $6, $7.is_multiplicative, $7.val, $10);
+ do_for($2, $4, $6, $7.is_multiplicative, $7.val, $10);
}
| simple_if
{
@@ -1617,7 +1617,7 @@ print_args:
;
print_arg:
- expr %prec ','
+ expr %prec ','
{
$$.str = new char[GDIGITS + 1];
sprintf($$.str, "%g", $1);
@@ -1652,14 +1652,14 @@ until:
| UNTIL TEXT
{ $$ = $2.str; }
;
-
+
any_expr:
expr
{ $$ = $1; }
| text_expr
{ $$ = $1; }
;
-
+
text_expr:
text EQUALEQUAL text
{
@@ -1831,7 +1831,7 @@ object_spec:
$3.filename, $3.lineno);
a_delete $3.str;
}
- | '['
+ | '['
{
saved_state *p = new saved_state;
$<pstate>$ = p;
@@ -2014,7 +2014,7 @@ object_spec:
$$->segment_pos.y += $3.y;
}
| object_spec THEN
- {
+ {
$$ = $1;
if ($$->flags & HAS_SEGMENT) {
$$->segment_list = new segment($$->segment_pos,
@@ -2088,7 +2088,7 @@ object_spec:
strcpy($$->outlined, $3.str);
}
| object_spec CHOP
- {
+ {
$$ = $1;
// line chop chop means line chop 0 chop 0
if ($$->flags & IS_DEFAULT_CHOPPED) {
@@ -2258,10 +2258,10 @@ sprintf_args:
;
position:
- position_not_place
+ position_not_place
{ $$ = $1; }
| place
- {
+ {
position pos = $1;
$$.x = pos.x;
$$.y = pos.y;
@@ -2377,7 +2377,7 @@ ordinal:
optional_ordinal_last:
LAST
{ $$ = 1; }
- | ordinal LAST
+ | ordinal LAST
{ $$ = $1; }
;
@@ -2416,7 +2416,7 @@ nth_primitive:
object_type:
BOX
- { $$ = BOX_OBJECT; }
+ { $$ = BOX_OBJECT; }
| CIRCLE
{ $$ = CIRCLE_OBJECT; }
| ELLIPSE
@@ -2436,7 +2436,7 @@ object_type:
;
label_path:
- '.' LABEL
+ '.' LABEL
{ $$ = new path($2); }
| label_path '.' LABEL
{
@@ -2450,7 +2450,7 @@ relative_path:
{ $$ = new path($1); }
/* give this a lower precedence than LEFT and RIGHT so that
[A: box] with .A left == [A: box] with (.A left) */
- | label_path %prec TEXT
+ | label_path %prec TEXT
{ $$ = $1; }
| label_path corner
{
@@ -2497,7 +2497,7 @@ path:
corner:
DOT_N
{ $$ = &object::north; }
- | DOT_E
+ | DOT_E
{ $$ = &object::east; }
| DOT_W
{ $$ = &object::west; }
@@ -2517,7 +2517,7 @@ corner:
{ $$ = &object::start; }
| DOT_END
{ $$ = &object::end; }
- | TOP
+ | TOP
{ $$ = &object::north; }
| BOTTOM
{ $$ = &object::south; }
@@ -2573,12 +2573,12 @@ expr:
| NUMBER
{ $$ = $1; }
| place DOT_X
- {
+ {
if ($1.obj != 0)
$$ = $1.obj->origin().x;
else
$$ = $1.x;
- }
+ }
| place DOT_Y
{
if ($1.obj != 0)
diff --git a/tests/sets.at b/tests/sets.at
index 9b83e9c7..c33985da 100644
--- a/tests/sets.at
+++ b/tests/sets.at
@@ -1,5 +1,5 @@
# Exercising Bison Grammar Sets. -*- Autotest -*-
-# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2005 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
@@ -29,25 +29,25 @@ m4_define([AT_EXTRACT_SETS],
:null
p
n
- /^[ ]*$/ !b null
+ /^[ ]*$/ !b null
}
/^FIRSTS$/ {
:firsts
p
n
- /^[ ]*$/ !b firsts
+ /^[ ]*$/ !b firsts
}
/^FDERIVES$/ {
:fderiv
p
n
- /^[ ]*$/ !b fderiv
+ /^[ ]*$/ !b fderiv
}
/^DERIVES$/ {
:deriv
p
n
- /^[ ]*$/ !b deriv
+ /^[ ]*$/ !b deriv
}
]])
AT_CHECK([sed -f extract.sed $1], 0, [stdout])
diff --git a/tests/torture.at b/tests/torture.at
index af5019bc..16425f6a 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -388,6 +388,8 @@ m4_define([AT_DATA_STACK_TORTURE],
# exp:
AT_DATA([input.y],
[[%{
+#include <errno.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
]$1[
@@ -406,9 +408,6 @@ yyerror (const char *msg)
fprintf (stderr, "%s\n", msg);
}
-/* There are YYLVAL_MAX of WAIT_FOR_EOFs. */
-unsigned int yylval_max;
-
static int
yylex (void)
{
@@ -421,9 +420,14 @@ yylex (void)
int
main (int argc, const char **argv)
{
+ char *endp;
if (argc != 2)
abort ();
- yylval = atoi (argv[1]);
+ yylval = strtol (argv[1], &endp, 10);
+ if (! (argv[1] != endp
+ && 0 <= yylval && yylval <= INT_MAX
+ && errno != ERANGE))
+ abort ();
yydebug = 1;
return yyparse ();
}