* 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.
This commit is contained in:
Paul Eggert
2005-07-24 07:24:22 +00:00
parent 135bc829bd
commit 040984073a
46 changed files with 1008 additions and 1026 deletions

161
ChangeLog
View File

@@ -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> 2005-07-21 Paul Eggert <eggert@cs.ucla.edu>
* data/glr.c (yyinitGLRStack, yyreturn): Don't call malloc * data/glr.c (yyinitGLRStack, yyreturn): Don't call malloc
@@ -13886,24 +14022,13 @@
* REFERENCES: entered into RCS * REFERENCES: entered into RCS
----- -----
Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996,
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice and this
Bison is free software; you can redistribute it and/or modify notice are preserved.
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.

View File

@@ -2,7 +2,7 @@
# This Makefile fragment is shared between the coreutils, # This Makefile fragment is shared between the coreutils,
# CPPI, Bison, and Autoconf. # 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 ## 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 ## it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
ME := Makefile.maint ME := Makefile.maint
# Do not save the original name or timestamp in the .tar.gz file. # Do not save the original name or timestamp in the .tar.gz file.
# Use --rsyncable if available.
GZIP_ENV = \ GZIP_ENV = \
"--no-name --best$$( \ "--no-name --best$$( \
case $$(gzip --help) in \ case $$(gzip --help) in \
@@ -33,6 +34,20 @@ GZIP_ENV = \
CVS = cvs 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) ifeq ($(origin prev_version_file), undefined)
prev_version_file = .prev-version prev_version_file = .prev-version
endif endif
@@ -69,126 +84,184 @@ local-checks-available = \
local-check = $(filter-out $(local-checks-to-skip), $(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) .PHONY: $(syntax-check-rules)
syntax-check-rules = \ syntax-check-rules = \
sc_cast_of_argument_to_free \ sc_cast_of_argument_to_free \
sc_cast_of_x_alloc_return_value \ sc_cast_of_x_alloc_return_value \
sc_cast_of_alloca_return_value \
sc_changelog \ sc_changelog \
sc_dd_max_sym_length \
sc_error_exit_success \ 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_space_tab \
sc_sun_os_names \ sc_sun_os_names \
sc_system_h_headers \ sc_system_h_headers \
sc_unmarked_diagnostics \ sc_tight_scope \
sc_xalloc_h_in_src sc_trailing_space \
sc_unmarked_diagnostics
syntax-check: $(syntax-check-rules) 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]') && \ # $$(find -type f -name '*.[chly]') && \
# { echo '$(ME): found conditional include' 1>&2; \ # { echo '$(ME): found conditional include' 1>&2; \
# exit 1; } || : # exit 1; } || :
# grep -E '^# *include <(string|stdlib)\.h>' \ # grep -nE '^# *include <(string|stdlib)\.h>' \
# $(srcdir)/{lib,src}/*.[chy] && \ # $(srcdir)/{lib,src}/*.[chy] && \
# { echo '$(ME): FIXME' 1>&2; \ # { echo '$(ME): FIXME' 1>&2; \
# exit 1; } || : # exit 1; } || :
# FIXME: don't allow `#include .strings\.h' anywhere # 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: 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; \ { echo '$(ME): don'\''t cast free argument' 1>&2; \
exit 1; } || : exit 1; } || :
sc_cast_of_x_alloc_return_value: sc_cast_of_x_alloc_return_value:
@grep -E --exclude=$(srcdir)/lib/regex.c \ @grep -nE --exclude=$(srcdir)/lib/regex.c \
'\*\) *x(m|c|re)alloc\>' $(srcdir)/{lib,src}/*.[chy] && \ '\*\) *x(m|c|re)alloc\>' \
$(srcdir)/{lib,src}/*.[chy] && \
{ echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \ { echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \
exit 1; } || : 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: sc_space_tab:
@( cvsu --list ) > /dev/null 2>&1 || : && \ @grep -n '[ ] ' \
grep '[ ] ' \ $$($(CVS_LIST_EXCEPT)) && \
$$(cvsu --list | grep -vEf .x-$@ ) && \
{ echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \ { echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
1>&2; exit 1; } || : 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, # Using EXIT_SUCCESS as the first argument to error is misleading,
# since when that parameter is 0, error does not exit. Use `0' instead. # since when that parameter is 0, error does not exit. Use `0' instead.
sc_error_exit_success: sc_error_exit_success:
@grep -F 'error (EXIT_SUCCESS,' \ @grep -nF 'error (EXIT_SUCCESS,' \
$$(find -type f -name '*.[chly]') && \ $$(find -type f -name '*.[chly]') && \
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \ { echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \
exit 1; } || : exit 1; } || :
# FIXME: merge this with sc_system_h_headers below. sc_file_system:
# xalloc.h is included via system.h, so should not be included @grep -ni 'file''system' \
# directly by any file in src/. $$($(CVS_LIST_EXCEPT)) && \
sc_xalloc_h_in_src: { echo '$(ME): found use of "file''system";' \
@if test -f $(srcdir)/src/sys2.h; then \ 'rewrite to use "file system"' 1>&2; \
if grep 'xalloc\.h' $(srcdir)/src/*.c; then \ exit 1; } || :
exit 1; \
fi; \ sc_obsolete_symbols:
fi @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 # FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
# Each nonempty line must start with a year number, or a TAB. # Each nonempty line must start with a year number, or a TAB.
sc_changelog: 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; \ { echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
exit 1; } || : exit 1; } || :
header_regexp = \ # Ensure that dd's definition of LONGEST_SYMBOL stays in sync
alloca\ # with the strings from the two affected variables.
|closeout\ dd_c = $(srcdir)/src/dd.c
|ctype\ sc_dd_max_sym_length:
|dirent\ ifneq ($(wildcard $(dd_c)),)
|errno\ @len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
|fcntl\ sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
|inttypes\ |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
|limits\ | wc --max-line-length); \
|locale\ max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|pathmax\ |tr -d '"' | wc --max-line-length); \
|std(lib|bool)\ if test "$$len" = "$$max"; then :; else \
|string\ echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
|sys/(stat|dir|time)\ exit 1; \
|time\ fi
|unistd\ endif
|utime\
|version-etc\ # Many m4 macros names once began with `jm_'.
|xalloc # On 2004-04-13, they were all changed to start with gl_ instead.
h_re := $(shell echo '$(header_regexp)'|tr -d ' ') # 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 # Files in src/ should not include directly any of
# the headers already included via system.h. # the headers already included via system.h.
# Get list of candidates with this: sc_system_h_headers: .re-list
# grep -h include src/sys*.h|sed 's/.*include //'|sort - if test -f $(srcdir)/src/system.h; then \
sc_system_h_headers: trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
@( cvsu --list ) > /dev/null 2>&1 || : && \ grep -nE -f .re-list \
grep -E '^# *include ["<]($(h_re))\.h[">]' \ $$($(CVS_LIST) src | \
$$(cvsu --list src | grep -Ev 'sys(2|tem)\.h$$') \ grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
&& { echo '$(ME): the above are already included via system.h'\ && { echo '$(ME): the above are already included via system.h'\
1>&2; exit 1; } || : 1>&2; exit 1; } || :; \
fi
sc_sun_os_names: sc_sun_os_names:
@( cvsu --list ) > /dev/null 2>&1 || : && \ @grep -nEi \
grep -Ei \
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \ '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; \ { echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
exit 1; } || : 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 # Ensure that date's --help output stays in sync with the info
# documentation for GNU strftime. The only exception is %N, # documentation for GNU strftime. The only exception is %N,
# which date accepts but GNU strftime does not. # 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 # not @...@ in Makefile.am, now that we can rely on automake
# to emit a definition for each substituted variable. # to emit a definition for each substituted variable.
makefile-check: makefile-check:
grep -E '@[A-Z_0-9]+@' `find . -name Makefile.am` \ grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \
&& { echo 'Makefile.maint: use $(...), not @...@' 1>&2; exit 1; } || : && { 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: changelog-check:
if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \ if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
@@ -225,9 +307,11 @@ m4-check:
exit 1; } || : exit 1; } || :
# Verify that all source files using _() are listed in po/POTFILES.in. # 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: po-check:
if test -f po/POTFILES.in; then \ if test -f po/POTFILES.in; then \
grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \ grep -E -v '^(#|$$)' po/POTFILES.in \
| grep -v '^src/false\.c$$' | sort > $@-1; \
files=; \ files=; \
for file in lib/*.[chly] src/*.[chly]; do \ for file in lib/*.[chly] src/*.[chly]; do \
case $$file in \ case $$file in \
@@ -246,7 +330,7 @@ po-check:
# the English word `and', the string must be marked with `N_ (...)' so that # the English word `and', the string must be marked with `N_ (...)' so that
# gettext recognizes it as a string requiring translation. # gettext recognizes it as a string requiring translation.
author_mark_check: 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; \ { echo 'Makefile.maint: enclose the above strings in N_ (...)' 1>&2; \
exit 1; } || : exit 1; } || :
@@ -258,7 +342,7 @@ author_mark_check:
# that we'd have to worry about limits on command line length. # that we'd have to worry about limits on command line length.
msg = 'Makefile.maint: Do not use `:'\'' above; use @PATH_SEPARATOR@ instead' msg = 'Makefile.maint: Do not use `:'\'' above; use @PATH_SEPARATOR@ instead'
makefile_path_separator_check: 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; } || : && { echo $(msg) 1>&2; exit 1; } || :
# Check that `make alpha' will not fail at the end of the process. # 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. # Make sure that the copyright date in $(v_etc_file) is up to date.
copyright-check: copyright-check:
@if test -f $(v_etc_file); then \ @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 \ >/dev/null \
|| { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \ || { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
exit 1; }; \ exit 1; }; \
@@ -330,7 +414,9 @@ null_AM_MAKEFLAGS = \
# Detect format-string/arg-list mismatches that would normally be obscured # Detect format-string/arg-list mismatches that would normally be obscured
# by the use of _(). The --disable-nls effectively defines away that macro, # by the use of _(). The --disable-nls effectively defines away that macro,
# and building with CFLAGS='-Wformat -Werror' causes any format warning to be # 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 TMPDIR ?= /tmp
t=$(TMPDIR)/$(PACKAGE)/test t=$(TMPDIR)/$(PACKAGE)/test
my-distcheck: $(local-check) my-distcheck: $(local-check)
@@ -339,7 +425,7 @@ my-distcheck: $(local-check)
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
cd $(t)/$(distdir) \ cd $(t)/$(distdir) \
&& ./configure --disable-nls \ && ./configure --disable-nls \
&& $(MAKE) CFLAGS='-Wformat -Werror' \ && $(MAKE) CFLAGS='-Werror -Wall -Wformat -Wshadow' \
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \ AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
&& $(MAKE) dvi \ && $(MAKE) dvi \
&& $(MAKE) check \ && $(MAKE) check \
@@ -377,15 +463,9 @@ rel-check:
prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
signatures ?= $(distdir).tar.bz2.asc $(distdir).tar.gz.asc rel-files = $(xd-delta) $(DIST_ARCHIVES)
%.asc: % announcement: NEWS ChangeLog $(rel-files)
rm -f $@ @./announce-gen \
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) \
--release-type=$(RELEASE_TYPE) \ --release-type=$(RELEASE_TYPE) \
--package=$(PACKAGE) \ --package=$(PACKAGE) \
--prev=$(PREV_VERSION) \ --prev=$(PREV_VERSION) \
@@ -395,25 +475,125 @@ announcement: NEWS ChangeLog $(rel-files) $(signatures)
$(addprefix --url-dir=, $(url_dir_list)) \ $(addprefix --url-dir=, $(url_dir_list)) \
define emit-upload-commands ## ---------------- ##
echo ===================================== ## Updating files. ##
echo ===================================== ## ---------------- ##
echo upload $(PACKAGE) $(PREV_VERSION) $(VERSION)
echo '# send the /tmp/announcement e-mail' ftp-gnu = ftp://ftp.gnu.org/gnu
echo ===================================== www-gnu = http://www.gnu.org
echo =====================================
endef # 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 $(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
xdelta delta -9 $^ $@ || : xdelta delta -9 $^ $@ || :
.PHONY: alpha beta major .PHONY: alpha beta major
alpha beta major: $(local-check) alpha beta major: news-date-check $(local-check)
$(MAKE) cvs-dist $(MAKE) cvs-dist
$(MAKE) $(xd-delta) $(MAKE) $(xd-delta)
$(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir) $(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir)
ln $(rel-files) $(release_archive_dir) ln $(rel-files) $(release_archive_dir)
chmod a-w $(rel-files) chmod a-w $(rel-files)
$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
echo $(VERSION) > $(prev_version_file) echo $(VERSION) > $(prev_version_file)
$(CVS) ci -m. $(prev_version_file) $(CVS) ci -m. $(prev_version_file)
@$(emit-upload-commands)

7
NEWS
View File

@@ -1,7 +1,7 @@
Bison News 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 * Bison-generated parsers now support the translation of diagnostics like
"syntax error" into languages other than English. The default "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 behind on the stack. Also, the start symbol is now destroyed after a
successful parse. In both cases, the behavior was formerly inconsistent. 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 * When generating verbose diagnostics, Bison-generated parsers no longer
quote the literal strings associated with tokens. For example, for quote the literal strings associated with tokens. For example, for

View File

@@ -2,7 +2,9 @@ divert(-1)# -*- Autoconf -*-
# This file is part of Autoconf. # This file is part of Autoconf.
# Base M4 layer. # Base M4 layer.
# Requires GNU M4. # 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 # 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 # it under the terms of the GNU General Public License as published by
@@ -58,7 +60,7 @@ changequote([, ])
# long macros we define. # long macros we define.
ifdef([__gnu__], , ifdef([__gnu__], ,
[errprint(M4sugar requires GNU M4. Install it before installing M4sugar or [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)]) m4exit(2)])
@@ -83,12 +85,12 @@ m4_undefine([undefine])
# Define DST as the definition of SRC. # Define DST as the definition of SRC.
# What's the difference between: # What's the difference between:
# 1. m4_copy([from], [to]) # 1. m4_copy([from], [to])
# 2. m4_define([from], [to($@)]) # 2. m4_define([to], [from($@)])
# Well, obviously 1 is more expansive in space. Maybe 2 is more expansive # 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. # 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' # 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. # 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([m4_copy],
[m4_define([$2], m4_defn([$1]))]) [m4_define([$2], m4_defn([$1]))])
@@ -131,7 +133,7 @@ m4_rename_m4([eval])
m4_rename_m4([format]) m4_rename_m4([format])
m4_rename_m4([ifdef]) m4_rename_m4([ifdef])
m4_rename([ifelse], [m4_if]) m4_rename([ifelse], [m4_if])
m4_rename_m4([include]) m4_undefine([include])
m4_rename_m4([incr]) m4_rename_m4([incr])
m4_rename_m4([index]) m4_rename_m4([index])
m4_rename_m4([indir]) m4_rename_m4([indir])
@@ -144,7 +146,7 @@ m4_undefine([popdef])
m4_rename_m4([pushdef]) m4_rename_m4([pushdef])
m4_rename([regexp], [m4_bregexp]) m4_rename([regexp], [m4_bregexp])
m4_rename_m4([shift]) m4_rename_m4([shift])
m4_rename_m4([sinclude]) m4_undefine([sinclude])
m4_rename_m4([substr]) m4_rename_m4([substr])
m4_rename_m4([symbols]) m4_rename_m4([symbols])
m4_rename_m4([syscmd]) m4_rename_m4([syscmd])
@@ -199,76 +201,29 @@ m4_define([m4_assert],
[m4_fatal([assert failed: $1], [$2])])]) [m4_fatal([assert failed: $1], [$2])])])
## ------------- ## ## ------------- ##
## 3. Warnings. ## ## 3. Warnings. ##
## ------------- ## ## ------------- ##
# m4_warning_ifelse(CATEGORY, IF-TRUE, IF-FALSE) # _m4_warn(CATEGORY, MESSAGE, STACK-TRACE)
# ---------------------------------------------- # ----------------------------------------
# If the CATEGORY of warnings is enabled, expand IF_TRUE otherwise # Report a MESSAGE to the user if the CATEGORY of warnings is enabled.
# IF-FALSE. # This is for traces only.
# # The STACK-TRACE is a \n-separated list of "LOCATION: MESSAGE".
# The variable `m4_warnings' contains a comma separated list of m4_define([_m4_warn], [])
# 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) # m4_warn(CATEGORY, MESSAGE)
# -------------------------- # --------------------------
# Report a MESSAGE to the autoconf user if the CATEGORY of warnings # Report a MESSAGE to the user if the CATEGORY of warnings is enabled.
# is requested (in fact, not disabled).
m4_define([m4_warn], 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
])
@@ -367,7 +322,7 @@ m4_define([m4_ifvaln],
# expand IF-FALSE, otherwise IF-TRUE. # expand IF-FALSE, otherwise IF-TRUE.
m4_define([m4_ifset], m4_define([m4_ifset],
[m4_ifdef([$1], [m4_ifdef([$1],
[m4_if(m4_defn([$1]), [], [$3], [$2])], [m4_ifval(m4_defn([$1]), [$2], [$3])],
[$3])]) [$3])])
@@ -419,23 +374,32 @@ m4_define([m4_case],
# All the values are optional, and the macro is robust to active symbols # All the values are optional, and the macro is robust to active symbols
# properly quoted. # properly quoted.
m4_define([m4_bmatch], m4_define([m4_bmatch],
[m4_if([$#], 0, [], [m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
[$#], 1, [], [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])],
[$#], 2, [$2], [$#], 2, [$2],
[m4_if(m4_bregexp([$1], [$2]), -1, [$0([$1], m4_shiftn(3, $@))], [m4_if(m4_bregexp([$1], [$2]), -1, [$0([$1], m4_shiftn(3, $@))],
[$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) # m4_map(MACRO, LIST)
# ------------------- # -------------------
# Invoke MACRO($1), MACRO($2) etc. where $1, $2... are the elements # Invoke MACRO($1), MACRO($2) etc. where $1, $2... are the elements
# of LIST (which can be lists themselves, for multiple arguments MACROs). # of LIST (which can be lists themselves, for multiple arguments MACROs).
m4_define([m4_fst], [$1]) m4_define([m4_fst], [$1])
m4_define([m4_map], m4_define([m4_map],
[m4_if([$2], [], [], [m4_ifval([$2],
[$2], [[]], [], [$1(m4_fst($2))[]m4_map([$1], m4_cdr($2))])])
[$1(m4_fst($2))[]dnl
m4_map([$1], m4_cdr($2))])])
# m4_map_sep(MACRO, SEPARATOR, LIST) # 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 # are the elements of LIST (which can be lists themselves, for multiple
# arguments MACROs). # arguments MACROs).
m4_define([m4_map_sep], m4_define([m4_map_sep],
[m4_if([$3], [[]], [], [m4_ifval([$3],
[$1(m4_fst($3))[]dnl [$1(m4_fst($3))[]m4_map([$2[]$1], m4_cdr($3))])])
m4_if(m4_cdr($3),
[[]], [],
[$2])[]dnl
m4_map_sep([$1], [$2], m4_cdr($3))])])
## ---------------------------------------- ## ## ---------------------------------------- ##
## 6. Enhanced version of some primitives. ## ## 6. Enhanced version of some primitives. ##
## ---------------------------------------- ## ## ---------------------------------------- ##
# m4_patsubsts(STRING, RE1, SUBST1, RE2, SUBST2, ...) # m4_bpatsubsts(STRING, RE1, SUBST1, RE2, SUBST2, ...)
# --------------------------------------------------- # ----------------------------------------------------
# m4 equivalent of # m4 equivalent of
# #
# $_ = STRING; # $_ = 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 # All the values are optional, and the macro is robust to active symbols
# properly quoted. # 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 # 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. # the anchors are broken :( I can't let users be trapped by that.
m4_define([m4_bpatsubsts], m4_define([m4_bpatsubsts],
@@ -726,14 +686,25 @@ m4_if($1, [$2], [],
m4_define([m4_foreach], m4_define([m4_foreach],
[m4_pushdef([$1])_m4_foreach($@)m4_popdef([$1])]) [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_define([_m4_foreach],
[m4_if([$2], [[]], [], [m4_ifval([$2],
[m4_define([$1], m4_car($2))$3[]_m4_foreach([$1], [m4_define([$1], m4_car($2))$3[]dnl
m4_cdr($2), _m4_foreach([$1], m4_cdr($2), [$3])])])
[$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,7 +716,7 @@ m4_define([_m4_foreach],
# _m4_divert(DIVERSION-NAME or NUMBER) # _m4_divert(DIVERSION-NAME or NUMBER)
# ------------------------------------ # ------------------------------------
# If DIVERSION-NAME is the name of a diversion, return its 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_define([_m4_divert],
[m4_ifdef([_m4_divert($1)], [m4_ifdef([_m4_divert($1)],
[m4_indir([_m4_divert($1)])], [m4_indir([_m4_divert($1)])],
@@ -755,13 +726,19 @@ m4_define([_m4_divert],
m4_define([_m4_divert(KILL)], -1) 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) # m4_divert(DIVERSION-NAME)
# ------------------------- # -------------------------
# Change the diversion stream to DIVERSION-NAME. # Change the diversion stream to DIVERSION-NAME.
m4_define([m4_divert], m4_define([m4_divert],
[m4_define([m4_divert_stack], [m4_define([m4_divert_stack], m4_location[: $0: $1]_m4_divert_n_stack)dnl
m4_location[: $0: $1]m4_ifdef([m4_divert_stack], [
m4_defn([m4_divert_stack])]))dnl
m4_builtin([divert], _m4_divert([$1]))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. # Change the diversion stream to DIVERSION-NAME, while stacking old values.
m4_define([m4_divert_push], m4_define([m4_divert_push],
[m4_pushdef([m4_divert_stack], [m4_pushdef([m4_divert_stack], m4_location[: $0: $1]_m4_divert_n_stack)dnl
m4_location[: $0: $1]m4_ifdef([m4_divert_stack], [
m4_defn([m4_divert_stack])]))dnl
m4_pushdef([_m4_divert_diversion], [$1])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. # Change the diversion stream to its previous value, unstacking it.
# If specified, verify we left DIVERSION-NAME. # 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_define([m4_divert_pop],
[m4_ifval([$1], [m4_ifndef([_m4_divert_diversion],
[m4_if(_m4_divert([$1]), m4_divnum, [], [m4_fatal([too many m4_divert_pop])])dnl
[m4_fatal([$0($1): diversion mismatch: ] m4_if([$1], [], [],
m4_defn([m4_divert_stack]))])])dnl [$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 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_builtin([divert],
m4_ifdef([_m4_divert_diversion], m4_ifdef([_m4_divert_diversion],
[_m4_divert(_m4_divert_diversion)], -1))dnl [_m4_divert(m4_defn([_m4_divert_diversion]))],
m4_popdef([m4_divert_stack])dnl -1))dnl
]) ])
@@ -980,7 +956,7 @@ m4_define([m4_undivert],
# GROW: # GROW:
# BODY: TEST2a; TEST3; TEST2b: TEST1 # 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 # are like me, you will want to see the actual functioning of this
# implementation to be convinced. The next section gives the full # implementation to be convinced. The next section gives the full
# details. # details.
@@ -997,12 +973,12 @@ m4_define([m4_undivert],
# You should keep the definitions of _m4_defun_pro, _m4_defun_epi, and # You should keep the definitions of _m4_defun_pro, _m4_defun_epi, and
# m4_require at hand to follow the steps. # 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 # 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 # record the current diversion under the name _m4_divert_dump (denoted
# DUMP below for short). This introduces an important difference with # DUMP below for short). This introduces an important difference with
# the previous versions of Autoconf: you cannot use m4_require if you # 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. # m4_require directly from the top level.
# #
# We have not tried to simulate the old behavior (better yet, we # We have not tried to simulate the old behavior (better yet, we
@@ -1017,7 +993,7 @@ m4_define([m4_undivert],
# diversion stack: BODY |- # diversion stack: BODY |-
# #
# * TEST1 is expanded # * 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 # where the current elaboration will be dumped, to the current
# diversion. It also m4_divert_push to GROW, where the full # diversion. It also m4_divert_push to GROW, where the full
# expansion of TEST1 and its dependencies will be elaborated. # expansion of TEST1 and its dependencies will be elaborated.
@@ -1025,96 +1001,56 @@ m4_define([m4_undivert],
# BODY: empty # BODY: empty
# diversions: GROW, BODY |- # diversions: GROW, BODY |-
# #
# * TEST1 requires TEST2a: prologue # * TEST1 requires TEST2a
# m4_require m4_divert_pushes another temporary diversion GROW - 1 (in # _m4_require_call m4_divert_pushes another temporary diversion,
# fact, the diversion whose number is one less than the current # GROW - 1, and expands TEST2a in there.
# diversion), and expands TEST2a in there.
# DUMP: BODY # DUMP: BODY
# BODY: empty # 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
# GROW - 1: TEST2a # GROW - 1: TEST2a
# diversions: GROW - 1, GROW, BODY |- # diversions: GROW - 1, GROW, BODY |-
# # Than the content of the temporary diversion is moved to DUMP and the
# * TEST1 requires TEST2a: epilogue # temporary diversion is popped.
# The content of the current diversion is appended to DUMP (and removed
# from the current diversion). A diversion is popped.
# DUMP: BODY # DUMP: BODY
# BODY: TEST2a # BODY: TEST2a
# diversions: GROW, BODY |- # diversions: GROW, BODY |-
# #
# * TEST1 requires TEST2b: prologue # * TEST1 requires TEST2b
# m4_require pushes GROW - 1 and expands TEST2b. # Again, _m4_require_call pushes GROW - 1 and heads to expand TEST2b.
# DUMP: BODY # DUMP: BODY
# BODY: TEST2a # BODY: TEST2a
# diversions: GROW - 1, GROW, BODY |- # diversions: GROW - 1, GROW, BODY |-
# #
# * TEST2b is expanded. # * TEST2b requires TEST3
# Its prologue pushes the current diversion again. # _m4_require_call pushes GROW - 2 and expands TEST3 here.
# DUMP: BODY # (TEST3 requires TEST2a, but TEST2a has already been m4_provide'd, so
# BODY: TEST2a # nothing happens.)
# 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 # DUMP: BODY
# BODY: TEST2a # BODY: TEST2a
# GROW - 2: TEST3 # GROW - 2: TEST3
# diversions: GROW - 2, GROW - 1, GROW - 1, GROW, BODY |- # 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 |-
# #
# * TEST2b requires TEST3: epilogue # * TEST1 requires TEST2b (contd.)
# The current diversion is appended to DUMP, and a diversion is popped. # The content of TEST2b is expanded...
# 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 # DUMP: BODY
# BODY: TEST2a; TEST3 # BODY: TEST2a; TEST3
# GROW - 1: TEST2b, # GROW - 1: TEST2b,
# diversions: GROW - 1, GROW, BODY |- # diversions: GROW - 1, GROW, BODY |-
# # ... and moved to DUMP.
# * TEST1 requires TEST2b: epilogue
# The current diversion is appended to DUMP, and a diversion is popped.
# DUMP: BODY # DUMP: BODY
# BODY: TEST2a; TEST3; TEST2b # BODY: TEST2a; TEST3; TEST2b
# diversions: GROW, BODY |- # diversions: GROW, BODY |-
# #
# * TEST1 is expanded: epilogue # * TEST1 is expanded: epilogue
# TEST1's own content is in GROW, and it's epilogue pops a diversion. # TEST1's own content is in GROW...
# DUMP: BODY # DUMP: BODY
# BODY: TEST2a; TEST3; TEST2b # BODY: TEST2a; TEST3; TEST2b
# GROW: TEST1 # GROW: TEST1
# diversions: BODY |- # diversions: BODY |-
# Here, the epilogue of TEST1 notices the elaboration is done because # ... and it's epilogue moves it to DUMP and then undefines DUMP.
# DUMP and the current diversion are the same, it then undiverts
# GROW by hand, and undefines DUMP.
# DUMP: undefined # DUMP: undefined
# BODY: TEST2a; TEST3; TEST2b; TEST1 # BODY: TEST2a; TEST3; TEST2b; TEST1
# diversions: BODY |- # diversions: BODY |-
@@ -1136,24 +1072,9 @@ m4_define([m4_undivert],
# we prepend its name in m4_expansion_stack, and when we exit the # we prepend its name in m4_expansion_stack, and when we exit the
# macro, we remove it (thanks to pushdef/popdef). # macro, we remove it (thanks to pushdef/popdef).
# #
# In addition, we want to use the expansion stack to detect circular # In addition, we want to detect circular m4_require dependencies.
# m4_require dependencies. This means we need to browse the stack to # Each time we expand a macro FOO we define _m4_expanding(FOO); and
# check whether a macro being expanded is m4_require'd. For ease of # m4_require(BAR) simply checks whether _m4_expanding(BAR) is defined.
# 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.
# m4_expansion_stack_push(TEXT) # m4_expansion_stack_push(TEXT)
@@ -1166,7 +1087,6 @@ m4_defn([m4_expansion_stack])]))])
# m4_expansion_stack_pop # m4_expansion_stack_pop
# ---------------------- # ----------------------
# Dump the expansion stack.
m4_define([m4_expansion_stack_pop], m4_define([m4_expansion_stack_pop],
[m4_popdef([m4_expansion_stack])]) [m4_popdef([m4_expansion_stack])])
@@ -1203,29 +1123,33 @@ m4_define([_m4_divert(GROW)], 10000)
# ------------------------- # -------------------------
# The prologue for Autoconf macros. # The prologue for Autoconf macros.
m4_define([_m4_defun_pro], 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_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) # _m4_defun_epi(MACRO-NAME)
# ------------------------- # -------------------------
# The Epilogue for Autoconf macros. MACRO-NAME only helps tracing # The Epilogue for Autoconf macros. MACRO-NAME only helps tracing
# the PRO/EPI pairs. # the PRO/EPI pairs.
m4_define([_m4_defun_epi], m4_define([_m4_defun_epi],
[m4_divert_pop()dnl [m4_popdef([_m4_expanding($1)])dnl
m4_if(_m4_divert_dump, _m4_divert_diversion,
[m4_undivert([GROW])dnl
m4_undefine([_m4_divert_dump])])dnl
m4_expansion_stack_pop()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_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) # m4_defun(NAME, EXPANSION)
# ------------------------- # -------------------------
@@ -1314,26 +1238,40 @@ m4_define([m4_before],
# `extension' prevents `AC_LANG_COMPILER' from having actual arguments that # `extension' prevents `AC_LANG_COMPILER' from having actual arguments that
# it passes to `AC_LANG_COMPILER(C)'. # it passes to `AC_LANG_COMPILER(C)'.
m4_define([m4_require], m4_define([m4_require],
[m4_expansion_stack_push(m4_location[: $1 is required by...])dnl [m4_ifdef([_m4_expanding($1)],
m4_ifdef([_m4_expanding($1)],
[m4_fatal([$0: circular dependency of $1])])dnl [m4_fatal([$0: circular dependency of $1])])dnl
m4_ifndef([_m4_divert_dump], 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_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_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_provide_if([$1],
[], [],
[m4_warn([syntax], [m4_warn([syntax],
[$1 is m4_require'd but is not m4_defun'd])])dnl [$1 is m4_require'd but not m4_defun'd])])dnl
m4_expansion_stack_pop()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]) # m4_expand_once(TEXT, [WITNESS = TEXT])
# -------------------------------------- # --------------------------------------
# If TEXT has never been expanded, expand it *here*. Use WITNESS as # If TEXT has never been expanded, expand it *here*. Use WITNESS as
@@ -1397,17 +1335,18 @@ m4_defn([m4_cr_digits])dnl
# m4_re_escape(STRING) # m4_re_escape(STRING)
# -------------------- # --------------------
# Escape BRE active characters in STRING. # Escape RE active characters in STRING.
m4_define([m4_re_escape], m4_define([m4_re_escape],
[m4_bpatsubst([$1], [m4_bpatsubst([$1],
[[][+*.]], [\\\&])]) [[][*+.?\^$]], [\\\&])])
# m4_re_string # m4_re_string
# ------------ # ------------
# Regexp for `[a-zA-Z_0-9]*' # Regexp for `[a-zA-Z_0-9]*'
# m4_dquote provides literal [] for the character class.
m4_define([m4_re_string], m4_define([m4_re_string],
m4_defn([m4_cr_symbols2])dnl m4_dquote(m4_defn([m4_cr_symbols2]))dnl
[*]dnl [*]dnl
) )
@@ -1416,7 +1355,7 @@ m4_defn([m4_cr_symbols2])dnl
# ---------- # ----------
# Regexp for `[a-zA-Z_][a-zA-Z_0-9]*' # Regexp for `[a-zA-Z_][a-zA-Z_0-9]*'
m4_define([m4_re_word], 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 m4_defn([m4_re_string])dnl
) )
@@ -1440,11 +1379,11 @@ m4_define([m4_toupper],
# #
# REGEXP specifies where to split. Default is [\t ]+. # REGEXP specifies where to split. Default is [\t ]+.
# #
# Pay attention to the m4_changequotes. Inner m4_changequotes exist for # If STRING is empty, the result is an empty list.
# obvious reasons (we want to insert square brackets). Outer #
# m4_changequotes are needed because otherwise the m4 parser, when it # Pay attention to the m4_changequotes. When m4 reads the definition of
# sees the closing bracket we add to the result, believes it is the # m4_split, it still has quotes set to [ and ]. Luckily, these are matched
# end of the body of the macro we define. # in the macro body, so the definition is stored correctly.
# #
# Also, notice that $1 is quoted twice, since we want the result to # Also, notice that $1 is quoted twice, since we want the result to
# be quoted. Then you should understand that the argument of # be quoted. Then you should understand that the argument of
@@ -1455,16 +1394,17 @@ m4_define([m4_toupper],
# m4_split([active active ])end # m4_split([active active ])end
# => [active], [active], []end # => [active], [active], []end
m4_changequote(<<, >>) m4_define([m4_split],
m4_define(<<m4_split>>, [m4_ifval([$1], [_m4_split($@)])])
<<m4_changequote(``, '')dnl
m4_define([_m4_split],
[m4_changequote(``, '')dnl
[dnl Can't use m4_default here instead of m4_if, because m4_default uses [dnl Can't use m4_default here instead of m4_if, because m4_default uses
dnl [ and ] as quotes. dnl [ and ] as quotes.
m4_bpatsubst(````$1'''', m4_bpatsubst(````$1'''',
m4_if(``$2'',, ``[ ]+'', ``$2''), m4_if(``$2'',, ``[ ]+'', ``$2''),
``], ['')]dnl ``], ['')]dnl
m4_changequote([, ])>>) m4_changequote([, ])])
m4_changequote([, ])
@@ -1491,13 +1431,10 @@ m4_define([m4_flatten],
# #
# This macro is robust to active symbols. # This macro is robust to active symbols.
# m4_define(active, ACTIVE) # m4_define(active, ACTIVE)
# m4_strip([ active active ])end # m4_strip([ active <tab> <tab>active ])end
# => active activeend # => active activeend
# #
# This macro is fun! Because we want to preserve active symbols, STRING # Because we want to preserve active symbols, STRING must be double-quoted.
# 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).
# #
# Then notice the 2 last patterns: they are in charge of removing the # Then notice the 2 last patterns: they are in charge of removing the
# leading/trailing spaces. Why not just `[^ ]'? Because they are # leading/trailing spaces. Why not just `[^ ]'? Because they are
@@ -1589,10 +1526,10 @@ m4_define([m4_append_uniq],
# m4_text_wrap(STRING, [PREFIX], [FIRST-PREFIX], [WIDTH]) # m4_text_wrap(STRING, [PREFIX], [FIRST-PREFIX], [WIDTH])
# ------------------------------------------------------- # -------------------------------------------------------
# Expands into STRING wrapped to hold in WIDTH columns (default = 79). # 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 # 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 # specified, then the first line is prefixed with it. As a special case,
# case, if the length of the first prefix is greater than that of # if the length of FIRST-PREFIX is greater than that of PREFIX, then
# PREFIX, then FIRST-PREFIX will be left alone on the first line. # FIRST-PREFIX will be left alone on the first line.
# #
# Typical outputs are: # Typical outputs are:
# #
@@ -1619,12 +1556,15 @@ m4_define([m4_append_uniq],
# we really want to bother with people trying each single corner # we really want to bother with people trying each single corner
# of a software? # 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, # This macro does not leave a trailing space behind the last word,
# what complicates it a bit. The algorithm is stupid simple: all the # 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 # words are preceded by m4_Separator which is defined to empty for the
# first word, and then ` ' (single space) for all the others. # first word, and then ` ' (single space) for all the others.
m4_define([m4_text_wrap], 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_Prefix1], m4_default([$3], [m4_Prefix]))dnl
m4_pushdef([m4_Width], m4_default([$4], 79))dnl m4_pushdef([m4_Width], m4_default([$4], 79))dnl
m4_pushdef([m4_Cursor], m4_len(m4_Prefix1))dnl m4_pushdef([m4_Cursor], m4_len(m4_Prefix1))dnl
@@ -1633,7 +1573,7 @@ m4_Prefix1[]dnl
m4_if(m4_eval(m4_Cursor > m4_len(m4_Prefix)), m4_if(m4_eval(m4_Cursor > m4_len(m4_Prefix)),
1, [m4_define([m4_Cursor], m4_len(m4_Prefix)) 1, [m4_define([m4_Cursor], m4_len(m4_Prefix))
m4_Prefix])[]dnl 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 [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 New line if too long, else insert a space unless it is the first
dnl of the words. dnl of the words.
@@ -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. ## ## 10. Number processing. ##
@@ -1746,13 +1701,23 @@ m4_define([m4_version_compare],
(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]) # m4_version_prereq(VERSION, [IF-OK], [IF-NOT = FAIL])
# ---------------------------------------------------- # ----------------------------------------------------
# Check this Autoconf version against VERSION. # Check this Autoconf version against VERSION.
m4_define([m4_version_prereq], m4_define([m4_version_prereq],
[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [$1]), -1, [m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [$1]), -1,
[m4_default([$3], [m4_default([$3],
[m4_fatal([Autoconf version $1 or higher is required])])], [m4_fatal([Autoconf version $1 or higher is required],
63)])],
[$2])[]dnl [$2])[]dnl
]) ])
@@ -1795,8 +1760,7 @@ m4_pattern_forbid([^dnl$])
# Check the divert push/pop perfect balance. # Check the divert push/pop perfect balance.
m4_wrap([m4_ifdef([_m4_divert_diversion], m4_wrap([m4_ifdef([_m4_divert_diversion],
[m4_fatal([$0: unbalanced m4_divert_push:] [m4_fatal([$0: unbalanced m4_divert_push:]_m4_divert_n_stack)])[]])
m4_defn([m4_divert_stack]))])[]])
m4_divert_push([KILL]) m4_divert_push([KILL])
m4_wrap([m4_divert_pop([KILL])[]]) m4_wrap([m4_divert_pop([KILL])[]])

View File

@@ -7425,6 +7425,9 @@ parser's to get the set of defined tokens.
@comment file: calc++-scanner.ll @comment file: calc++-scanner.ll
@example @example
%@{ /* -*- C++ -*- */ %@{ /* -*- C++ -*- */
# include <cstdlib>
# include <errno.h>
# include <limits.h>
# include <string> # include <string>
# include "calc++-driver.hh" # include "calc++-driver.hh"
# include "calc++-parser.hh" # include "calc++-parser.hh"
@@ -7482,7 +7485,14 @@ errors.
@example @example
[-+*/] return yytext[0]; [-+*/] return yytext[0];
":=" return TOKEN_ASSIGN; ":=" 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; @{id@} yylval->sval = new std::string (yytext); return TOKEN_IDENTIFIER;
. driver.error (*yylloc, "invalid character"); . driver.error (*yylloc, "invalid character");
%% %%

View File

@@ -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

View File

@@ -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);
}

View File

@@ -386,4 +386,3 @@ extern void debug_bitset (bitset);
extern void debug_bitset_stats (void); extern void debug_bitset_stats (void);
#endif /* _BITSET_H */ #endif /* _BITSET_H */

View File

@@ -44,9 +44,7 @@
# define STDOUT_FILENO 1 # define STDOUT_FILENO 1
#endif #endif
#if ! HAVE_DUP2 && ! defined dup2 #if ! HAVE_DUP2 && ! defined dup2
# if HAVE_FCNTL_H
# include <fcntl.h> # include <fcntl.h>
# endif
# define dup2(f, t) (close (t), fcntl (f, F_DUPFD, t)) # define dup2(f, t) (close (t), fcntl (f, F_DUPFD, t))
#endif #endif
@@ -109,11 +107,13 @@ create_subpipe (char const * const *argv, int fd[2])
|| pipe (pipe_fd) != 0 || pipe (pipe_fd) != 0
|| (fd[1] = fd_safer (pipe_fd[0])) < 0 || (fd[1] = fd_safer (pipe_fd[0])) < 0
|| (child_fd[1] = fd_safer (pipe_fd[1])) < 0) || (child_fd[1] = fd_safer (pipe_fd[1])) < 0)
error (EXIT_FAILURE, errno, "pipe"); error (EXIT_FAILURE, errno,
"pipe");
pid = vfork (); pid = vfork ();
if (pid < 0) if (pid < 0)
error (EXIT_FAILURE, errno, "fork"); error (EXIT_FAILURE, errno,
"fork");
if (! pid) if (! pid)
{ {
@@ -148,7 +148,8 @@ reap_subpipe (pid_t pid, char const *program)
#if HAVE_WAITPID || defined waitpid #if HAVE_WAITPID || defined waitpid
int wstatus; int wstatus;
if (waitpid (pid, &wstatus, 0) < 0) if (waitpid (pid, &wstatus, 0) < 0)
error (EXIT_FAILURE, errno, "waitpid"); error (EXIT_FAILURE, errno,
"waitpid");
else else
{ {
int status = WIFEXITED (wstatus) ? WEXITSTATUS (wstatus) : -1; int status = WIFEXITED (wstatus) ? WEXITSTATUS (wstatus) : -1;

View File

@@ -1,7 +1,7 @@
# -*- Autoconf -*- # -*- Autoconf -*-
# Checks required to run `subpipe'. # 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 # 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 # it under the terms of the GNU General Public License as published by
@@ -23,7 +23,6 @@
AC_DEFUN([BISON_PREREQ_SUBPIPE], AC_DEFUN([BISON_PREREQ_SUBPIPE],
[ [
AC_TYPE_PID_T AC_TYPE_PID_T
AC_CHECK_HEADERS([fcntl.h])
AC_HEADER_SYS_WAIT AC_HEADER_SYS_WAIT
AC_CHECK_FUNCS(dup2 waitpid) AC_CHECK_FUNCS(dup2 waitpid)
AC_FUNC_FORK AC_FUNC_FORK

View File

@@ -15,9 +15,7 @@
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301 USA ## 02110-1301 USA
DEFS = @DEFS@ \ DEFS += -DPKGDATADIR=\"$(pkgdatadir)\" -DLOCALEDIR=\"$(datadir)/locale\"
-DPKGDATADIR=\"$(pkgdatadir)\" \
-DLOCALEDIR=\"$(datadir)/locale\"
AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS) AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib
@@ -56,7 +54,7 @@ bison_SOURCES = \
reduce.c reduce.h \ reduce.c reduce.h \
relation.c relation.h \ relation.c relation.h \
scan-gram.l \ scan-gram.l \
scan-skel.l \ scan-skel.h scan-skel.l \
state.c state.h \ state.c state.h \
symlist.c symlist.h \ symlist.c symlist.h \
symtab.c symtab.h \ symtab.c symtab.h \
@@ -77,3 +75,34 @@ yacc:
echo: echo:
echo $(bison_SOURCES) $(noinst_HEADERS) 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

View File

@@ -66,9 +66,9 @@ static char *full_base_name = NULL;
char *short_base_name = NULL; char *short_base_name = NULL;
/* C source file extension (the parser source). */ /* 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). */ /* 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 | | Return a newly allocated string composed of the concatenation of |

View File

@@ -285,7 +285,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
`----------------------*/ `----------------------*/
/* Shorts options. */ /* 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. */ /* Values for long options that do not have single-letter equivalents. */
enum enum

View File

@@ -1,5 +1,5 @@
/* Parse command line arguments for bison. /* 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. Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
@@ -23,8 +23,12 @@
# define GETARGS_H_ # define GETARGS_H_
/* flags set by % directives */ /* 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 debug_flag; /* for -t */
extern bool defines_flag; /* for -d */ extern bool defines_flag; /* for -d */

View File

@@ -56,9 +56,9 @@ main (int argc, char *argv[])
{ {
program_name = argv[0]; program_name = argv[0];
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR); (void) bindtextdomain (PACKAGE, LOCALEDIR);
bindtextdomain ("bison-runtime", LOCALEDIR); (void) bindtextdomain ("bison-runtime", LOCALEDIR);
textdomain (PACKAGE); (void) textdomain (PACKAGE);
uniqstrs_new (); uniqstrs_new ();

View File

@@ -41,7 +41,7 @@ struct obstack muscle_obstack;
/* Initial capacity of muscles hash table. */ /* Initial capacity of muscles hash table. */
#define HT_INITIAL_CAPACITY 257 #define HT_INITIAL_CAPACITY 257
struct hash_table *muscle_table = NULL; static struct hash_table *muscle_table = NULL;
static bool static bool
hash_compare_muscles (void const *x, void const *y) hash_compare_muscles (void const *x, void const *y)

View File

@@ -36,12 +36,10 @@
#include "muscle_tab.h" #include "muscle_tab.h"
#include "output.h" #include "output.h"
#include "reader.h" #include "reader.h"
#include "scan-skel.h"
#include "symtab.h" #include "symtab.h"
#include "tables.h" #include "tables.h"
/* From src/scan-skel.l. */
void scan_skel (FILE *);
static struct obstack format_obstack; static struct obstack format_obstack;
@@ -559,7 +557,8 @@ output_skeleton (void)
out = fdopen (filter_fd[0], "w"); out = fdopen (filter_fd[0], "w");
if (! out) if (! out)
error (EXIT_FAILURE, get_errno (), "fdopen"); error (EXIT_FAILURE, get_errno (),
"fdopen");
/* Output the definitions of all the muscles. */ /* Output the definitions of all the muscles. */
fputs ("m4_init()\n", out); fputs ("m4_init()\n", out);
@@ -580,7 +579,8 @@ output_skeleton (void)
timevar_push (TV_M4); timevar_push (TV_M4);
in = fdopen (filter_fd[1], "r"); in = fdopen (filter_fd[1], "r");
if (! in) if (! in)
error (EXIT_FAILURE, get_errno (), "fdopen"); error (EXIT_FAILURE, get_errno (),
"fdopen");
scan_skel (in); scan_skel (in);
xfclose (in); xfclose (in);
reap_subpipe (pid, m4); reap_subpipe (pid, m4);

View File

@@ -48,12 +48,12 @@ static void gram_error (location const *, char const *);
static void add_param (char const *, char *, location); static void add_param (char const *, char *, location);
symbol_class current_class = unknown_sym; static symbol_class current_class = unknown_sym;
uniqstr current_type = 0; static uniqstr current_type = 0;
symbol *current_lhs; symbol *current_lhs;
location current_lhs_location; location current_lhs_location;
assoc current_assoc; assoc current_assoc;
int current_prec = 0; static int current_prec = 0;
%} %}
%debug %debug

View File

@@ -1,6 +1,6 @@
/* Output a VCG description on generated parser, for Bison, /* 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. This file is part of Bison, the GNU Compiler Compiler.
@@ -21,7 +21,6 @@
#include "system.h" #include "system.h"
#include <obstack.h>
#include <quotearg.h> #include <quotearg.h>
#include "LR0.h" #include "LR0.h"

View File

@@ -159,7 +159,7 @@ free_merger_functions (void)
`-------------------------------------------------------------------*/ `-------------------------------------------------------------------*/
/* The (currently) last symbol of GRAMMAR. */ /* The (currently) last symbol of GRAMMAR. */
symbol_list *grammar_end = NULL; static symbol_list *grammar_end = NULL;
/* Append SYM to the grammar. */ /* Append SYM to the grammar. */
void void
@@ -179,7 +179,7 @@ grammar_symbol_append (symbol *sym, location loc)
CURRENT_RULE points to the first LHS of the current rule, while CURRENT_RULE points to the first LHS of the current rule, while
PREVIOUS_RULE_END points to the *end* of the previous rule (NULL). */ PREVIOUS_RULE_END points to the *end* of the previous rule (NULL). */
symbol_list *current_rule = NULL; symbol_list *current_rule = NULL;
symbol_list *previous_rule_end = NULL; static symbol_list *previous_rule_end = NULL;
/*----------------------------------------------. /*----------------------------------------------.

View File

@@ -43,6 +43,11 @@ void scanner_initialize (void);
void scanner_free (void); void scanner_free (void);
void scanner_last_string_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) # define YY_DECL int gram_lex (YYSTYPE *val, location *loc)
YY_DECL; YY_DECL;

41
src/scan-skel.h Normal file
View File

@@ -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);

View File

@@ -31,21 +31,7 @@
#include "complain.h" #include "complain.h"
#include "getargs.h" #include "getargs.h"
#include "files.h" #include "files.h"
#include "scan-skel.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);
#define QPUTS(String) \ #define QPUTS(String) \
fputs (quotearg_style (c_quoting_style, (String)), yyout) fputs (quotearg_style (c_quoting_style, (String)), yyout)
@@ -110,8 +96,6 @@ int skel_lex_destroy (void);
| Scan a Bison skeleton. | | Scan a Bison skeleton. |
`------------------------*/ `------------------------*/
void scan_skel (FILE *);
void void
scan_skel (FILE *in) scan_skel (FILE *in)
{ {

View File

@@ -1,6 +1,6 @@
/* Keep a unique copy of strings. /* 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. 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)) 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 (); abort ();
} }
} }

View File

@@ -51,8 +51,8 @@
# define G_VERTICAL_ORDER 0 /* Unspecified for subgraphs. */ # define G_VERTICAL_ORDER 0 /* Unspecified for subgraphs. */
# define G_HORIZONTAL_ORDER 0 /* Unspecified for subgraphs. */ # define G_HORIZONTAL_ORDER 0 /* Unspecified for subgraphs. */
# define G_XMAX 90 /* Not output */ # define G_XMAX 90 /* Not output. */
# define G_YMAX 90 /* Not output */ # define G_YMAX 90 /* Not output. */
# define G_XBASE 5 # define G_XBASE 5
# define G_YBASE 5 # define G_YBASE 5
@@ -67,7 +67,7 @@
# 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_INFONAME NULL
# define G_COLORENTRY NULL # define G_COLORENTRY NULL

View File

@@ -32,11 +32,11 @@ MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
$(srcdir)/package.m4: $(top_srcdir)/configure.ac $(srcdir)/package.m4: $(top_srcdir)/configure.ac
{ \ { \
echo '# Signature of the current package.'; \ echo '# Signature of the current package.'; \
echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])'; \
echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \ echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])'; \
echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])'; \
echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])'; \
echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
} >$(srcdir)/package.m4 } >$(srcdir)/package.m4
## ------------ ## ## ------------ ##

View File

@@ -1,5 +1,5 @@
# Exercising Bison Grammar Sets. -*- Autotest -*- # 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 # 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 # it under the terms of the GNU General Public License as published by

View File

@@ -388,6 +388,8 @@ m4_define([AT_DATA_STACK_TORTURE],
# exp: # exp:
AT_DATA([input.y], AT_DATA([input.y],
[[%{ [[%{
#include <errno.h>
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
]$1[ ]$1[
@@ -406,9 +408,6 @@ yyerror (const char *msg)
fprintf (stderr, "%s\n", msg); fprintf (stderr, "%s\n", msg);
} }
/* There are YYLVAL_MAX of WAIT_FOR_EOFs. */
unsigned int yylval_max;
static int static int
yylex (void) yylex (void)
{ {
@@ -421,9 +420,14 @@ yylex (void)
int int
main (int argc, const char **argv) main (int argc, const char **argv)
{ {
char *endp;
if (argc != 2) if (argc != 2)
abort (); 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; yydebug = 1;
return yyparse (); return yyparse ();
} }