upgraded to bison 2.3

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19439 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2006-12-06 22:57:59 +00:00
parent a00a227627
commit 19dd8d033e
133 changed files with 12689 additions and 6784 deletions
+1788 -3
View File
File diff suppressed because it is too large Load Diff
+7 -2
View File
@@ -18,14 +18,19 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = config po runtime-po lib data src doc examples tests
SUBDIRS = build-aux po runtime-po lib data src doc examples tests
# Files installed for use by Automake.
aclocaldir = @aclocaldir@
aclocal_DATA = m4/bison-i18n.m4
EXTRA_DIST = GNUmakefile Makefile.cfg Makefile.maint \
OChangeLog PACKAGING
OChangeLog PACKAGING \
djgpp/Makefile.maint djgpp/README.in djgpp/config.bat \
djgpp/config.sed djgpp/config.site djgpp/config_h.sed \
djgpp/subpipe.c djgpp/subpipe.h djgpp/djunpack.bat \
djgpp/fnchange.lst
.PHONY: maintainer-check
maintainer-check:
+13 -14
View File
@@ -1,5 +1,5 @@
# Customize Makefile.maint for Bison. -*- makefile -*-
# Copyright (C) 2003 Free Software Foundation, Inc.
# Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,8 +16,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
prev_version_file = $(srcdir)/config/prev-version.txt
announce_gen = $(srcdir)/config/announce-gen
build_aux_dir = $(srcdir)/build-aux
prev_version_file = $(build_aux_dir)/prev-version.txt
announce_gen = $(build_aux_dir)/announce-gen
release_archive_dir = releases
# Use alpha.gnu.org for alpha and beta releases.
@@ -32,18 +33,16 @@ url_dir_list = \
# Files to update automatically.
wget_files = \
$(srcdir)/config/config.guess \
$(srcdir)/config/config.sub \
$(srcdir)/config/texinfo.tex \
$(build_aux_dir)/config.guess \
$(build_aux_dir)/config.sub \
$(build_aux_dir)/texinfo.tex \
cvs_files = \
$(srcdir)/config/install-sh \
$(srcdir)/config/mdate-sh \
$(srcdir)/config/missing \
$(srcdir)/config/mkinstalldirs
$(build_aux_dir)/install-sh \
$(build_aux_dir)/mdate-sh \
$(build_aux_dir)/missing \
$(build_aux_dir)/mkinstalldirs
# Tests not to run.
# local-checks-to-skip ?= \
# author_mark_check \
# strftime-check syntax-check makefile_path_separator_check \
# makefile-check
local-checks-to-skip = \
changelog-check
+20 -15
View File
@@ -36,17 +36,14 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.hin \
$(top_srcdir)/configure ABOUT-NLS AUTHORS COPYING ChangeLog \
INSTALL NEWS THANKS TODO build-aux/config.guess \
build-aux/config.rpath build-aux/config.sub build-aux/depcomp \
build-aux/install-sh build-aux/mdate-sh build-aux/missing \
build-aux/mkinstalldirs build-aux/texinfo.tex build-aux/ylwrap
subdir = .
INSTALL NEWS THANKS TODO
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \
$(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/cxx.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/bison-i18n.m4 \
$(top_srcdir)/m4/c-working.m4 $(top_srcdir)/m4/cxx.m4 \
$(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \
$(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/error.m4 \
$(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \
@@ -63,11 +60,14 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \
$(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
$(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h_gl.m4 \
$(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \
$(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strndup.m4 \
$(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/subpipe.m4 \
$(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \
$(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \
$(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoul.m4 \
$(top_srcdir)/m4/strverscmp.m4 $(top_srcdir)/m4/subpipe.m4 \
$(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/uintmax_t_gl.m4 \
$(top_srcdir)/m4/ulonglong_gl.m4 \
$(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/warning.m4 \
$(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \
$(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.m4 \
$(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -109,8 +109,6 @@ GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
ALLOCA_H = @ALLOCA_H@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@@ -120,6 +118,8 @@ AUTOM4TE = @AUTOM4TE@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BISON_CXX_WORKS = @BISON_CXX_WORKS@
BISON_CXX_WORKS_FALSE = @BISON_CXX_WORKS_FALSE@
BISON_CXX_WORKS_TRUE = @BISON_CXX_WORKS_TRUE@
BISON_LOCALEDIR = @BISON_LOCALEDIR@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
@@ -179,6 +179,7 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STDBOOL_H = @STDBOOL_H@
STRIP = @STRIP@
UNISTD_H = @UNISTD_H@
USE_NLS = @USE_NLS@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
@@ -234,10 +235,14 @@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = config po runtime-po lib data src doc examples tests
SUBDIRS = build-aux po runtime-po lib data src doc examples tests
aclocal_DATA = m4/bison-i18n.m4
EXTRA_DIST = GNUmakefile Makefile.cfg Makefile.maint \
OChangeLog PACKAGING
OChangeLog PACKAGING \
djgpp/Makefile.maint djgpp/README.in djgpp/config.bat \
djgpp/config.sed djgpp/config.site djgpp/config_h.sed \
djgpp/subpipe.c djgpp/subpipe.h djgpp/djunpack.bat \
djgpp/fnchange.lst
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
@@ -453,7 +458,7 @@ distdir: $(DISTFILES)
esac
$(am__remove_distdir)
mkdir $(distdir)
$(mkdir_p) $(distdir)/build-aux $(distdir)/m4 $(distdir)/po $(distdir)/runtime-po $(distdir)/tests
$(mkdir_p) $(distdir)/djgpp $(distdir)/m4 $(distdir)/po $(distdir)/runtime-po $(distdir)/tests
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
+85 -45
View File
@@ -2,7 +2,7 @@
# This Makefile fragment is shared between the coreutils,
# CPPI, Bison, and Autoconf.
## Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
## Copyright (C) 2001-2006 Free Software Foundation, Inc.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -25,24 +25,25 @@ ME := Makefile.maint
# Do not save the original name or timestamp in the .tar.gz file.
# Use --rsyncable if available.
GZIP_ENV = \
"--no-name --best$$( \
case $$(gzip --help) in \
(*--rsyncable*) echo ' --rsyncable';; \
esac \
)"
gzip_rsyncable = \
(gzip --help|grep rsyncable) >/dev/null 2>&1 && echo --rsyncable
GZIP_ENV = "--no-name --best `$(gzip_rsyncable)`"
CVS = cvs
# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
CVS_LIST = sh -c ' \
(cvsu --find --types=AFGM $$*) 2>/dev/null || \
if test -x $(srcdir)/build-aux/cvsu; then \
$(srcdir)/build-aux/cvsu --find --types=AFGM $$*; \
else \
awk -F/ '\''{ \
if (!$$1 && $$3 !~ /^-/) { \
f=FILENAME; \
sub(/CVS\/Entries/, "", f); \
print f $$2; \
}}'\'' \
$$(find $${*-*} -name Entries -print) /dev/null \
$$(find $${*-*} -name Entries -print) /dev/null; \
fi \
' dummy
CVS_LIST_EXCEPT = \
@@ -53,6 +54,7 @@ ifeq ($(origin prev_version_file), undefined)
endif
PREV_VERSION := $(shell cat $(prev_version_file))
VERSION_REGEXP = $(subst .,\.,$(VERSION))
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
tag-this-version = $(subst .,_,$(VERSION))
@@ -73,12 +75,17 @@ export LC_ALL = C
## Sanity checks. ##
## --------------- ##
# FIXME: add a check to prohibit definition in src/*.c of symbols defined
# in system.h. E.g. today I removed from tail.c a useless definition of
# ENOSYS. It was useless because system.h ensures it's defined.
# Checks that don't require cvs.
# Run `changelog-check' last, as previous test may reveal problems requiring
# new ChangeLog entries.
local-checks-available = \
po-check copyright-check writable-files m4-check author_mark_check \
changelog-check strftime-check syntax-check makefile_path_separator_check \
changelog-check strftime-check $(syntax-check-rules) \
makefile_path_separator_check \
makefile-check
.PHONY: $(local-checks-available)
@@ -93,16 +100,21 @@ syntax-check-rules = \
sc_dd_max_sym_length \
sc_error_exit_success \
sc_file_system \
sc_no_if_have_config_h \
sc_obsolete_symbols \
sc_prohibit_atoi_atof \
sc_prohibit_jm_in_m4 \
sc_prohibit_assert_without_use \
sc_require_config_h \
sc_root_tests \
sc_space_tab \
sc_sun_os_names \
sc_system_h_headers \
sc_tight_scope \
sc_trailing_space \
sc_unmarked_diagnostics
sc_trailing_blank \
sc_two_space_separator_in_usage \
sc_unmarked_diagnostics \
sc_useless_cpp_parens
syntax-check: $(syntax-check-rules)
# @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \
@@ -135,8 +147,7 @@ sc_cast_of_alloca_return_value:
exit 1; } || :
sc_space_tab:
@grep -n '[ ] ' \
$$($(CVS_LIST_EXCEPT)) && \
@grep -n '[ ] ' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
1>&2; exit 1; } || :
@@ -144,8 +155,7 @@ sc_space_tab:
# They provide no error checking mechanism.
# Instead, use strto* functions.
sc_prohibit_atoi_atof:
@grep -nE '\<(ato[filq]|ato''ll)\>' \
$$($(CVS_LIST_EXCEPT)) && \
@grep -nE '\<ato([filq]|ll)\>' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): do not use ato''f, ato''i, ato''l, ato''ll, or ato''q' \
1>&2; exit 1; } || :
@@ -158,16 +168,37 @@ sc_error_exit_success:
exit 1; } || :
sc_file_system:
@grep -ni 'file''system' \
$$($(CVS_LIST_EXCEPT)) && \
@grep -ni 'file''system' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found use of "file''system";' \
'rewrite to use "file system"' 1>&2; \
exit 1; } || :
sc_no_if_have_config_h:
@grep -n '^# *if HAVE_CONFIG_H' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found use of #if HAVE_CONFIG_H; use #ifdef' \
1>&2; exit 1; } || :
# Nearly all .c files must include <config.h>.
sc_require_config_h:
@grep -L '^# *include <config\.h>' \
$$($(CVS_LIST_EXCEPT) | grep '\.c$$') \
| grep . && \
{ echo '$(ME): the above files do not include <config.h>' \
1>&2; exit 1; } || :
# Prohibit the inclusion of assert.h without an actual use of assert.
sc_prohibit_assert_without_use:
@files=$$(grep -l '# *include <assert\.h>' \
$$($(CVS_LIST_EXCEPT) | grep '\.c$$')) && \
grep -L '\<assert (' $$files \
| grep . && \
{ echo "$(ME): the above files include <assert.h> but don't use it" \
1>&2; exit 1; } || :
sc_obsolete_symbols:
@grep -nE '\<(HAVE_''FCNTL_H)\>' \
@grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
$$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): do not use HAVE_''FCNTL_H' \
{ echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
1>&2; exit 1; } || :
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
@@ -228,7 +259,7 @@ sc_root_tests:
# Files in src/ should not include directly any of
# the headers already included via system.h.
sc_system_h_headers: .re-list
if test -f $(srcdir)/src/system.h; then \
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
grep -nE -f .re-list \
$$($(CVS_LIST) src | \
@@ -247,21 +278,34 @@ sc_sun_os_names:
sc_tight_scope:
$(MAKE) -C src $@
sc_trailing_space:
@grep -n '[ ]$$' \
sc_trailing_blank:
@grep -n '[ ]$$' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found trailing blank(s)' \
1>&2; exit 1; } || :
sc_two_space_separator_in_usage:
@grep -n '^ *--[a-z][0-9A-Za-z-]* [^ ].*\\$$' \
$$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found trailing space(s)' \
{ echo "$(ME): help2man requires at least two spaces between"; \
echo "$(ME): an option and its description"; \
1>&2; exit 1; } || :
# Look for diagnostics that aren't marked for translation.
# This won't find any for which error's format string is on a separate line.
sc_unmarked_diagnostics:
@grep -nE \
'\<error \([^"]*"[^"]*[a-z]{3}' $(srcdir)/{lib,src}/*.c \
| grep -v '_(' && \
'\<error \([^"]*"[^"]*[a-z]{3}' $$($(CVS_LIST_EXCEPT)) \
| grep -v '_''(' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
exit 1; } || :
# Avoid useless parentheses like those in this example:
# #if defined (SYMBOL) || defined (SYM2)
sc_useless_cpp_parens:
@grep -n '^# *if .*defined *(' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found useless parentheses in cpp directive' \
1>&2; exit 1; } || :
# Ensure that date's --help output stays in sync with the info
# documentation for GNU strftime. The only exception is %N,
# which date accepts but GNU strftime does not.
@@ -286,15 +330,17 @@ makefile-check:
news-date-check: NEWS
today=`date +%Y-%m-%d`; \
if head NEWS | grep '^\*.*'$$today >/dev/null; then \
if head NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
>/dev/null; then \
:; \
else \
echo "today's date is not in NEWS" 1>&2; \
echo "version or today's date is not in NEWS" 1>&2; \
exit 1; \
fi
changelog-check:
if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
if head ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \
>/dev/null; then \
:; \
else \
echo "$(VERSION) not in ChangeLog" 1>&2; \
@@ -302,18 +348,21 @@ changelog-check:
fi
m4-check:
@grep 'AC_DEFUN([^[]' m4/*.m4 \
@grep -n 'AC_DEFUN([^[]' m4/*.m4 \
&& { echo 'Makefile.maint: quote the first arg to AC_DEFUN' 1>&2; \
exit 1; } || :
# Verify that all source files using _() are listed in po/POTFILES.in.
# FIXME: don't hard-code src/false.c below; use a more general mechanism.
# FIXME: don't hard-code file names below; use a more general mechanism.
po-check:
if test -f po/POTFILES.in; then \
grep -E -v '^(#|$$)' po/POTFILES.in \
| grep -v '^src/false\.c$$' | sort > $@-1; \
files=; \
for file in lib/*.[chly] src/*.[chly]; do \
for file in $$($(CVS_LIST_EXCEPT)) lib/*.[ch]; do \
case $$file in \
djgpp/* | man/*) continue;; \
esac; \
case $$file in \
*.[ch]) \
base=`expr " $$file" : ' \(.*\)\..'`; \
@@ -321,7 +370,7 @@ po-check:
esac; \
files="$$files $$file"; \
done; \
grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort > $@-2; \
grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort -u > $@-2; \
diff -u $@-1 $@-2 || exit 1; \
rm -f $@-1 $@-2; \
fi
@@ -363,7 +412,7 @@ v_etc_file = lib/version-etc.c
# Make sure that the copyright date in $(v_etc_file) is up to date.
copyright-check:
@if test -f $(v_etc_file); then \
grep 'enum { COPYRIGHT_YEAR = 2005 };' $(v_etc_file) \
grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
>/dev/null \
|| { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
exit 1; }; \
@@ -419,7 +468,7 @@ null_AM_MAKEFLAGS = \
# have to have a recent version of gcc and glibc headers.
TMPDIR ?= /tmp
t=$(TMPDIR)/$(PACKAGE)/test
my-distcheck: $(local-check)
my-distcheck: $(local-check) $(release_archive_dir)/$(prev-tgz)
-rm -rf $(t)
mkdir -p $(t)
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
@@ -441,16 +490,6 @@ my-distcheck: $(local-check)
WGET = wget
WGETFLAGS = -C off
tgz-md5 = $(shell md5sum < $(my_distdir).tar.gz|sed 's/ -//')
tgz-sha1 = $(shell sha1sum < $(my_distdir).tar.gz|sed 's/ -//')
bz2-md5 = $(shell md5sum < $(my_distdir).tar.bz2|sed 's/ -//')
bz2-sha1 = $(shell sha1sum < $(my_distdir).tar.bz2|sed 's/ -//')
xdelta-md5 = $(shell md5sum < $(xd-delta)|sed 's/ -//')
xdelta-sha1 = $(shell sha1sum < $(xd-delta)|sed 's/ -//')
tgz-size = $(shell du --human $(my_distdir).tar.gz|sed 's/\([MkK]\).*/ \1B/')
bz2-size = $(shell du --human $(my_distdir).tar.bz2|sed 's/\([MkK]\).*/ \1B/')
xd-size = $(shell du --human $(xd-delta)|sed 's/\([MkK]\).*/ \1B/')
rel-check:
tarz=/tmp/rel-check-tarz-$$$$; \
md5_tmp=/tmp/rel-check-md5-$$$$; \
@@ -471,6 +510,7 @@ announcement: NEWS ChangeLog $(rel-files)
--prev=$(PREV_VERSION) \
--curr=$(VERSION) \
--release-archive-directory=$(release_archive_dir) \
--gpg-key-id=$(gpg_key_ID) \
--news=NEWS \
$(addprefix --url-dir=, $(url_dir_list)) \
+95 -3
View File
@@ -1,8 +1,100 @@
Bison News
----------
Changes in version 2.3, 2006-06-05:
* GLR grammars should now use `YYRECOVERING ()' instead of `YYRECOVERING',
for compatibility with LALR(1) grammars.
* It is now documented that any definition of YYSTYPE or YYLTYPE should
be to a type name that does not contain parentheses or brackets.
Changes in version 2.2, 2006-05-19:
* The distribution terms for all Bison-generated parsers now permit
using the parsers in nonfree programs. Previously, this permission
was granted only for Bison-generated LALR(1) parsers in C.
* %name-prefix changes the namespace name in C++ outputs.
* The C++ parsers export their token_type.
* Bison now allows multiple %union declarations, and concatenates
their contents together.
* New warning: unused values
Right-hand side symbols whose values are not used are reported,
if the symbols have destructors. For instance:
exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
| exp "+" exp
;
will trigger a warning about $$ and $5 in the first rule, and $3 in
the second ($1 is copied to $$ by the default rule). This example
most likely contains three errors, and could be rewritten as:
exp: exp "?" exp ":" exp
{ $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
| exp "+" exp
{ $$ = $1 ? $1 : $3; if ($1) free ($3); }
;
However, if the original actions were really intended, memory leaks
and all, the warnings can be suppressed by letting Bison believe the
values are used, e.g.:
exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
| exp "+" exp { $$ = $1; (void) $3; }
;
If there are mid-rule actions, the warning is issued if no action
uses it. The following triggers no warning: $1 and $3 are used.
exp: exp { push ($1); } '+' exp { push ($3); sum (); };
The warning is intended to help catching lost values and memory leaks.
If a value is ignored, its associated memory typically is not reclaimed.
* %destructor vs. YYABORT, YYACCEPT, and YYERROR.
Destructors are now called when user code invokes YYABORT, YYACCEPT,
and YYERROR, for all objects on the stack, other than objects
corresponding to the right-hand side of the current rule.
* %expect, %expect-rr
Incorrect numbers of expected conflicts are now actual errors,
instead of warnings.
* GLR, YACC parsers.
The %parse-params are available in the destructors (and the
experimental printers) as per the documentation.
* Bison now warns if it finds a stray `$' or `@' in an action.
* %require "VERSION"
This specifies that the grammar file depends on features implemented
in Bison version VERSION or higher.
* lalr1.cc: The token and value types are now class members.
The tokens were defined as free form enums and cpp macros. YYSTYPE
was defined as a free form union. They are now class members:
tokens are enumerations of the `yy::parser::token' struct, and the
semantic values have the `yy::parser::semantic_type' type.
If you do not want or can update to this scheme, the directive
`%define "global_tokens_and_yystype" "1"' triggers the global
definition of tokens and YYSTYPE. This change is suitable both
for previous releases of Bison, and this one.
If you wish to update, then make sure older version of Bison will
fail using `%require "2.2"'.
* DJGPP support added.
Changes in version 2.1, 2005-09-16:
* The C++ lalr1.cc skeleton supports %lex-param.
* Bison-generated parsers now support the translation of diagnostics like
"syntax error" into languages other than English. The default
language is still English. For details, please see the new
@@ -24,7 +116,7 @@ Changes in version 2.1, 2005-09-16:
a syntax error associated with '%token NUM "number"' they might
print 'syntax error, unexpected number' instead of 'syntax error,
unexpected "number"'.
Changes in version 2.0, 2004-12-25:
* Possibly-incompatible changes
@@ -619,8 +711,8 @@ End:
-----
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+56
View File
@@ -0,0 +1,56 @@
Packaging hints for binary package distributors
===============================================
Although the source of the bison package comes as a single package,
in distributions of binary packages the installed files should
be split into two packages:
bison-runtime
Contents: Runtime libraries and programs.
Audience: Anyone who wants to run internationalized programs
that contain Bison-generated parsers.
bison
Contents: Tools and documentation for developers that use Bison.
Audience: Anyone who wants to develop programs that use parsers.
Dependencies: requires bison-runtime.
The 'bison-runtime' binary package is much smaller than the 'bison'
binary package. It should be included in any distribution that
contains localized programs that use the diagnostics contained in
Bison-generated parsers.
If you want to install both packages at the same time, you simply do
at the toplevel directory:
./configure
make
make install
After installation, the file
$prefix/share/locale/*/LC_MESSAGES/bison-runtime.mo
belongs to the bison-runtime package; all other installed files belong
to the bison package.
-----
Copyright (C) 2002, 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 autoconf; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
-38
View File
@@ -1,38 +0,0 @@
-*- text -*-
This is a test release of this package. Using it more or less
implicitly signs you up to help us find whatever problems you report.
The documentation still needs more work. Suggestions welcome.
Patches even more welcome.
Please send comments and problem reports about this test release to
[email protected]. This program will get better only if you report
the problems you encounter.
Please, *do not package this*, *do not distribute it* widely, it is
not ready for full scale use. Because it is not fully functional, if
you distribute this package, we will be buried under bug reports from
panicked users. We don't have time to spend on this, and nor do the
users.
-----
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Bison.
GNU 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.
GNU 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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-30
View File
@@ -1,30 +0,0 @@
From phr Tue Jul 8 10:36:19 1986
Date: Tue, 8 Jul 86 00:52:24 EDT
From: phr (Paul Rubin)
To: riferguson%[email protected], tower
Subject: Re: Bison documentation?
The main difference between Bison and Yacc that I know of is that
Bison supports the @N construction, which gives you access to
the starting and ending line number and character number associated
with any of the symbols in the current rule.
Also, Bison supports the command `%expect N' which says not to mention
the conflicts if there are N shift/reduce conflicts and no reduce/reduce
conflicts.
The differences in the algorithms stem mainly from the horrible
kludges that Johnson had to perpetrate to make Yacc fit in a PDP-11.
Also, Bison uses a faster but less space-efficient encoding for the
parse tables (see Corbett's PhD thesis from Berkeley, "Static
Semantics in Compiler Error Recovery", June 1985, Report No. UCB/CSD
85/251), and more modern technique for generating the lookahead sets.
(See "Efficient Construction of LALR(1) Lookahead Sets" by F. DeRemer
and A. Pennello, in ACM TOPLS Vol 4 No 4, October 1982. Their
technique is the standard one now.)
paul rubin
free software foundation
+7 -1
View File
@@ -21,6 +21,7 @@ Cris Bailiff [email protected]
Cris van Pelt [email protected]
Daniel Hagerty [email protected]
David J. MacKenzie [email protected]
Derek M. Jones [email protected]
Dick Streefland [email protected]
Enrico Scholz [email protected]
Evgeny Stambulchik [email protected]
@@ -34,7 +35,7 @@ Jan Nieuwenhuizen [email protected]
Jesse Thilo [email protected]
Jim Kent [email protected]
Jim Meyering [email protected]
Joel E. Denny jdenny@hubcap.clemson.edu
Joel E. Denny jdenny@ces.clemson.edu
Juan Manuel Guerrero [email protected]
Kees Zeelenberg [email protected]
Keith Browne [email protected]
@@ -42,15 +43,18 @@ Laurent Mascherpa [email protected]
Magnus Fromreide [email protected]
Marc Autret [email protected]
Martin Mokrejs [email protected]
Martin Nylin [email protected]
Matt Kraai [email protected]
Matt Rosing [email protected]
Michael Hayes [email protected]
Mickael Labau [email protected]
Mike Castle [email protected]
Neil Booth [email protected]
Nelson H. F. Beebe [email protected]
Nicolas Burrus [email protected]
Nicolas Tisserand [email protected]
Noah Friedman [email protected]
Oleg Smolsky [email protected]
Pascal Bart [email protected]
Paul Eggert [email protected]
Paul Hilfinger [email protected]
@@ -64,10 +68,12 @@ Raja R Harinath [email protected]
Richard Stallman [email protected]
Robert Anisko [email protected]
Shura [email protected]
Steve Murphy [email protected]
Tim Josling [email protected]
Tim Van Holder [email protected]
Tom Lane [email protected]
Tom Tromey [email protected]
Tommy Nordgren [email protected]
Troy A. Johnson [email protected]
Vin Shelton [email protected]
Wayne Green [email protected]
+11 -48
View File
@@ -87,32 +87,6 @@ we should be able to have:
Or something like this.
** yysymprint interface
It should be improved, in particular when using Bison features such as
locations, and YYPARSE_PARAMS. For the time being, it is almost
recommended to yyprint to steal internal variables...
** Several %unions
I think this is a pleasant (but useless currently) feature, but in the
future, I want a means to %include other bits of grammars, and _then_
it will be important for the various bits to define their needs in
%union.
When implementing multiple-%union support, bare the following in mind:
- when --yacc, this must be flagged as an error. Don't make it fatal
though.
- The #line must now appear *inside* the definition of yystype.
Something like
{
#line 12 "foo.y"
int ival;
#line 23 "foo.y"
char *sval;
}
** %if and the like
It should be possible to have %if/%else/%endif. The implementation is
not clear: should it be lexical or syntactic. Vadim Maslow thinks it
@@ -203,28 +177,16 @@ Paul notes:
the source code. This should get fixed.
* --graph
Show reductions. []
Show reductions.
* Broken options ?
** %no-parser []
** %token-table []
** Skeleton strategy. []
Must we keep %no-parser?
%token-table?
** %no-parser
** %token-table
** Skeleton strategy
Must we keep %no-parser? %token-table?
* src/print_graph.c
Find the best graph parameters. []
* doc/bison.texinfo
** Update
informations about ERROR_VERBOSE. []
** Add explanations about
skeleton muscles. []
%skeleton. []
* testsuite
** tests/pure-parser.at []
New tests.
Find the best graph parameters.
* BTYacc
See if we can integrate backtracking in Bison. Charles-Henri de
@@ -345,16 +307,17 @@ the parser with a means to create the (visual) parse tree.
-----
Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation,
Inc.
This file is part of GNU Bison.
This file is part of Bison, the GNU Compiler Compiler.
GNU Bison is free software; you can redistribute it and/or modify
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.
GNU Bison is distributed in the hope that it will be useful,
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.
+7 -1
View File
@@ -871,8 +871,8 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([m4/alloca.m4])
m4_include([m4/bison-i18n.m4])
m4_include([m4/c-working.m4])
m4_include([m4/cxx.m4])
m4_include([m4/dirname.m4])
m4_include([m4/dmalloc.m4])
@@ -906,13 +906,19 @@ m4_include([m4/stdint_h_gl.m4])
m4_include([m4/stdio-safer.m4])
m4_include([m4/stpcpy.m4])
m4_include([m4/strdup.m4])
m4_include([m4/strerror.m4])
m4_include([m4/strndup.m4])
m4_include([m4/strnlen.m4])
m4_include([m4/strtol.m4])
m4_include([m4/strtoul.m4])
m4_include([m4/strverscmp.m4])
m4_include([m4/subpipe.m4])
m4_include([m4/timevar.m4])
m4_include([m4/uintmax_t_gl.m4])
m4_include([m4/ulonglong_gl.m4])
m4_include([m4/unistd-safer.m4])
m4_include([m4/unistd_h.m4])
m4_include([m4/unlocked-io.m4])
m4_include([m4/warning.m4])
m4_include([m4/xalloc.m4])
m4_include([m4/xstrndup.m4])
+8 -28
View File
@@ -1,14 +1,6 @@
/* config.h. Generated by configure. */
/* config.hin. Generated from configure.ac by autoheader. */
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
/* #undef CRAY_STACKSEG_END */
/* Define to 1 if using `alloca.c'. */
/* #undef C_ALLOCA */
/* Define to 1 if translation of program messages to the user's native
language is requested. */
/* #undef ENABLE_NLS */
@@ -16,27 +8,19 @@
/* Define on systems for which file names may have a so-called `drive letter'
prefix, define this to compute the length of that prefix, including the
colon. */
#define FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX 0
#define FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX 0
/* Define if the backslash character may also serve as a file name component
separator. */
#define FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR 0
#define FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR 0
#if FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
# define FILESYSTEM_PREFIX_LEN(Filename) \
#if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
# define FILE_SYSTEM_PREFIX_LEN(Filename) \
((Filename)[0] && (Filename)[1] == ':' ? 2 : 0)
#else
# define FILESYSTEM_PREFIX_LEN(Filename) 0
# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
#endif
/* Define to 1 if you have `alloca' after including <alloca.h>, a header that
may be supplied by this distribution. */
#define HAVE_ALLOCA 1
/* Define HAVE_ALLOCA_H for backward compatibility with older code that
includes <alloca.h> only if HAVE_ALLOCA_H is defined. */
#define HAVE_ALLOCA_H 1
/* Define to 1 if the system has the type `clock_t'. */
#define HAVE_CLOCK_T 1
@@ -178,10 +162,6 @@
/* Define to 1 if libc includes obstacks. */
#define HAVE_OBSTACK 1
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
and to 0 otherwise. */
#define HAVE_REALLOC 1
/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1
@@ -266,7 +246,7 @@
/* Define to 1 if the system has the type `_Bool'. */
/* #undef HAVE__BOOL */
#if FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
#else
# define ISSLASH(C) ((C) == '/')
@@ -285,13 +265,13 @@
#define PACKAGE_NAME "GNU Bison"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "GNU Bison 1.875d"
#define PACKAGE_STRING "GNU Bison 2.3"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "bison"
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.875d"
#define PACKAGE_VERSION "2.3"
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
+81 -25
View File
@@ -1,13 +1,5 @@
/* config.hin. Generated from configure.ac by autoheader. */
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
#undef CRAY_STACKSEG_END
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
@@ -28,14 +20,6 @@
# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
#endif
/* Define to 1 if you have `alloca' after including <alloca.h>, a header that
may be supplied by this distribution. */
#undef HAVE_ALLOCA
/* Define HAVE_ALLOCA_H for backward compatibility with older code that
includes <alloca.h> only if HAVE_ALLOCA_H is defined. */
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
CoreFoundation framework. */
#undef HAVE_CFLOCALECOPYCURRENT
@@ -51,10 +35,58 @@
*/
#undef HAVE_DCGETTEXT
/* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_CLEARERR_UNLOCKED
/* Define to 1 if you have the declaration of `clock', and to 0 if you don't.
*/
#undef HAVE_DECL_CLOCK
/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you
don't. */
#undef HAVE_DECL_FEOF_UNLOCKED
/* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FERROR_UNLOCKED
/* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FFLUSH_UNLOCKED
/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FGETS_UNLOCKED
/* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FPUTC_UNLOCKED
/* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FPUTS_UNLOCKED
/* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FREAD_UNLOCKED
/* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FWRITE_UNLOCKED
/* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_GETCHAR_UNLOCKED
/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
don't. */
#undef HAVE_DECL_GETC_UNLOCKED
/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
*/
#undef HAVE_DECL_GETENV
/* Define to 1 if you have the declaration of `getrusage', and to 0 if you
don't. */
#undef HAVE_DECL_GETRUSAGE
@@ -63,6 +95,14 @@
otherwise. */
#undef HAVE_DECL_MBSWIDTH_IN_WCHAR_H
/* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_PUTCHAR_UNLOCKED
/* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you
don't. */
#undef HAVE_DECL_PUTC_UNLOCKED
/* Define to 1 if you have the declaration of `strdup', and to 0 if you don't.
*/
#undef HAVE_DECL_STRDUP
@@ -71,6 +111,10 @@
don't. */
#undef HAVE_DECL_STRERROR_R
/* Define to 1 if you have the declaration of `strndup', and to 0 if you
don't. */
#undef HAVE_DECL_STRNDUP
/* Define to 1 if you have the declaration of `strnlen', and to 0 if you
don't. */
#undef HAVE_DECL_STRNLEN
@@ -165,6 +209,9 @@
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the `strerror_r' function. */
#undef HAVE_STRERROR_R
@@ -174,12 +221,21 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strndup' function. */
/* Define if you have the strndup() function and it works. */
#undef HAVE_STRNDUP
/* Define to 1 if you have the `strtol' function. */
#undef HAVE_STRTOL
/* Define to 1 if you have the `strtoul' function. */
#undef HAVE_STRTOUL
/* Define to 1 if the system has the type `struct tms'. */
#undef HAVE_STRUCT_TMS
/* Define to 1 if you have the `strverscmp' function. */
#undef HAVE_STRVERSCMP
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
@@ -267,20 +323,17 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if strerror_r returns char *. */
#undef STRERROR_R_CHAR_P
/* Define to 1 if you want getc etc. to use unlocked I/O if available.
Unlocked I/O can improve performance in unithreaded apps, but it is not
safe for multithreaded apps. */
#undef USE_UNLOCKED_IO
/* Version number of package */
#undef VERSION
@@ -346,6 +399,9 @@
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
/* Define to rpl_strndup if the replacement function should be used, */
#undef strndup
/* Define to rpl_strnlen if the replacement function should be used. */
#undef strnlen
+2093 -512
View File
File diff suppressed because it is too large Load Diff
+6 -4
View File
@@ -1,6 +1,7 @@
# Configure template for GNU Bison. -*-Autoconf-*-
#
# Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software
# Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +24,7 @@
# least Autoconf 2.59.
AC_PREREQ(2.59)
AC_INIT([GNU Bison], [2.1], [[email protected]])
AC_INIT([GNU Bison], [2.3], [[email protected]])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
@@ -58,12 +59,13 @@ if test "${enableval}" = yes; then
BISON_WARNING(-Wbad-function-cast)
BISON_WARNING(-Wmissing-declarations)
BISON_WARNING(-Wmissing-prototypes)
BISON_WARNING(-Wnested-externs)
BISON_WARNING(-Wshadow)
BISON_WARNING(-Wstrict-prototypes)
AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
fi
BISON_TEST_FOR_WORKING_C_COMPILER
AC_ARG_ENABLE([yacc],
[AC_HELP_STRING([--disable-yacc],
[do not build a yacc command or an -ly library])],
@@ -133,7 +135,7 @@ O0CXXFLAGS=`echo $CXXFLAGS | sed 's/-O[[0-9]] *//'`
AC_SUBST([O0CXXFLAGS])
AC_CONFIG_FILES([Makefile
config/Makefile
build-aux/Makefile
po/Makefile.in
data/Makefile
examples/Makefile
+1 -1
View File
@@ -17,7 +17,7 @@
dist_pkgdata_DATA = README \
c.m4 yacc.c glr.c \
c++.m4 lalr1.cc
c++.m4 location.cc lalr1.cc glr.cc
m4sugardir = $(pkgdatadir)/m4sugar
dist_m4sugar_DATA = m4sugar/m4sugar.m4
+12 -8
View File
@@ -40,8 +40,8 @@ subdir = data
DIST_COMMON = README $(dist_m4sugar_DATA) $(dist_pkgdata_DATA) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \
$(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/cxx.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/bison-i18n.m4 \
$(top_srcdir)/m4/c-working.m4 $(top_srcdir)/m4/cxx.m4 \
$(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \
$(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/error.m4 \
$(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \
@@ -58,11 +58,14 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \
$(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
$(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h_gl.m4 \
$(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \
$(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strndup.m4 \
$(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/subpipe.m4 \
$(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \
$(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \
$(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoul.m4 \
$(top_srcdir)/m4/strverscmp.m4 $(top_srcdir)/m4/subpipe.m4 \
$(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/uintmax_t_gl.m4 \
$(top_srcdir)/m4/ulonglong_gl.m4 \
$(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/warning.m4 \
$(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \
$(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.m4 \
$(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -84,8 +87,6 @@ dist_pkgdataDATA_INSTALL = $(INSTALL_DATA)
DATA = $(dist_m4sugar_DATA) $(dist_pkgdata_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
ALLOCA_H = @ALLOCA_H@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@@ -95,6 +96,8 @@ AUTOM4TE = @AUTOM4TE@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BISON_CXX_WORKS = @BISON_CXX_WORKS@
BISON_CXX_WORKS_FALSE = @BISON_CXX_WORKS_FALSE@
BISON_CXX_WORKS_TRUE = @BISON_CXX_WORKS_TRUE@
BISON_LOCALEDIR = @BISON_LOCALEDIR@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
@@ -154,6 +157,7 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STDBOOL_H = @STDBOOL_H@
STRIP = @STRIP@
UNISTD_H = @UNISTD_H@
USE_NLS = @USE_NLS@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
@@ -208,7 +212,7 @@ sysconfdir = @sysconfdir@
target_alias = @target_alias@
dist_pkgdata_DATA = README \
c.m4 yacc.c glr.c \
c++.m4 lalr1.cc
c++.m4 location.cc lalr1.cc glr.cc
m4sugardir = $(pkgdatadir)/m4sugar
dist_m4sugar_DATA = m4sugar/m4sugar.m4
+9 -8
View File
@@ -1,8 +1,8 @@
m4_divert(-1)
m4_divert(-1) -*- Autoconf -*-
# C++ skeleton for Bison
# Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,6 +19,8 @@ m4_divert(-1)
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
m4_include(b4_pkgdatadir/[c.m4])
## ---------------- ##
## Default values. ##
## ---------------- ##
@@ -27,21 +29,20 @@ m4_divert(-1)
m4_define_default([b4_parser_class_name], [parser])
m4_define_default([b4_location_type], [location])
m4_define_default([b4_filename_type], [std::string])
m4_define_default([b4_namespace], m4_defn([b4_prefix]))
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
# -----------------------------------------------------
# Output the definition of the tokens (if there are) as enums.
# Output the definition of the tokens as enums.
m4_define([b4_token_enums],
[m4_if([$@], [[]], [],
[/* Tokens. */
enum yytokentype {
m4_map_sep([ b4_token_enum], [,
],
[$@])
};
])])
])
## ----------------- ##
@@ -61,7 +62,7 @@ m4_define([b4_lhs_value],
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
# symbols on RHS.
m4_define([b4_rhs_value],
[(yysemantic_stack_@{m4_eval([$1 - $2])@}m4_ifval([$3], [.$3]))])
[(yysemantic_stack_@{($1) - ($2)@}m4_ifval([$3], [.$3]))])
# b4_lhs_location()
# -----------------
@@ -75,7 +76,7 @@ m4_define([b4_lhs_location],
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
# on RHS.
m4_define([b4_rhs_location],
[(yylocation_stack_@{m4_eval([$1 - $2])@})])
[(yylocation_stack_@{($1) - ($2)@})])
# b4_parse_param_decl
+148 -54
View File
@@ -1,7 +1,7 @@
m4_divert(-1) -*- Autoconf -*-
# C M4 Macros for Bison.
# Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
# Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,8 +28,9 @@ m4_divert(-1) -*- Autoconf -*-
m4_define([b4_copyright],
[/* A Bison parser, made by GNU Bison b4_version. */
/* $1,
Copyright (C) $2 Free Software Foundation, Inc.
/* $1
m4_text_wrap([Copyright (C) $2 Free Software Foundation, Inc.], [ ])
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -44,7 +45,20 @@ m4_define([b4_copyright],
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */])
Boston, MA 02110-1301, USA. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */])
# b4_identification
@@ -60,7 +74,7 @@ m4_define([b4_identification],
[#]define YYSKELETON_NAME b4_skeleton
/* Pure parsers. */
[#]define YYPURE b4_pure
[#]define YYPURE b4_pure_flag
/* Using locations. */
[#]define YYLSP_NEEDED b4_locations_flag
@@ -96,6 +110,26 @@ m4_define([b4_parse_param],
b4_parse_param))
# b4_parse_param_for(DECL, FORMAL, BODY)
# ---------------------------------------
# Iterate over the user parameters, binding the declaration to DECL,
# the formal name to FORMAL, and evaluating the BODY.
m4_define([b4_parse_param_for],
[m4_foreach([$1_$2], m4_defn([b4_parse_param]),
[m4_pushdef([$1], m4_fst($1_$2))dnl
m4_pushdef([$2], m4_shift($1_$2))dnl
$3[]dnl
m4_popdef([$2])dnl
m4_popdef([$1])dnl
])])
# b4_parse_param_use
# ------------------
# `YYUSE' all the parse-params.
m4_define([b4_parse_param_use],
[b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
])dnl
])
## ------------ ##
## Data Types. ##
@@ -137,23 +171,42 @@ m4_define([b4_int_type_for],
## Decoding options. ##
## ------------------ ##
# b4_location_if(IF-TRUE, IF-FALSE)
# ---------------------------------
# Expand IF-TRUE, if locations are used, IF-FALSE otherwise.
m4_define([b4_location_if],
[m4_if(b4_locations_flag, [1],
[$1],
[$2])])
# b4_flag_if(FLAG, IF-TRUE, IF-FALSE)
# -----------------------------------
# Run IF-TRUE if b4_FLAG_flag is 1, IF-FALSE if FLAG is 0, otherwise fail.
m4_define([b4_flag_if],
[m4_case(b4_$1_flag,
[0], [$3],
[1], [$2],
[m4_fatal([invalid $1 value: ]$1)])])
# b4_pure_if(IF-TRUE, IF-FALSE)
# b4_define_flag_if(FLAG)
# -----------------------
# Define "b4_FLAG_if(IF-TRUE, IF-FALSE)" that depends on the
# value of the Boolean FLAG.
m4_define([b4_define_flag_if],
[_b4_define_flag_if($[1], $[2], [$1])])
# _b4_define_flag_if($1, $2, FLAG)
# --------------------------------
# This macro works around the impossibility to define macros
# inside macros, because issuing `[$1]' is not possible in M4 :(.
# This sucks hard, GNU M4 should really provide M5 like $$1.
m4_define([_b4_define_flag_if],
[m4_if([$1$2], $[1]$[2], [],
[m4_fatal([$0: Invalid arguments: $@])])dnl
m4_define([b4_$3_if],
[b4_flag_if([$3], [$1], [$2])])])
# b4_FLAG_if(IF-TRUE, IF-FALSE)
# -----------------------------
# Expand IF-TRUE, if %pure-parser, IF-FALSE otherwise.
m4_define([b4_pure_if],
[m4_if(b4_pure, [1],
[$1],
[$2])])
# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
b4_define_flag_if([defines]) # Whether headers are requested.
b4_define_flag_if([error_verbose]) # Wheter error are verbose.
b4_define_flag_if([locations]) # Whether locations are tracked.
b4_define_flag_if([pure]) # Whether the interface is pure.
@@ -219,11 +272,25 @@ m4_define([b4_token_enums_defines],
## --------------------------------------------- ##
# b4_modern_c
# -----------
# A predicate useful in #if to determine whether C is ancient or modern.
#
# If __STDC__ is defined, the compiler is modern. IBM xlc 7.0 when run
# as 'cc' doesn't define __STDC__ (or __STDC_VERSION__) for pedantic
# reasons, but it defines __C99__FUNC__ so check that as well.
# Microsoft C normally doesn't define these macros, but it defines _MSC_VER.
# Consider a C++ compiler to be modern if it defines __cplusplus.
#
m4_define([b4_c_modern],
[[(defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)]])
# b4_c_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
# ----------------------------------------------------------
# Declare the function NAME.
m4_define([b4_c_function_def],
[#if defined (__STDC__) || defined (__cplusplus)
[#if b4_c_modern
b4_c_ansi_function_def($@)
#else
$2
@@ -288,7 +355,7 @@ m4_define([b4_c_knr_formal_decl],
# -----------------------------------------------------------
# Declare the function NAME.
m4_define([b4_c_function_decl],
[#if defined (__STDC__) || defined (__cplusplus)
[#if defined __STDC__ || defined __cplusplus
b4_c_ansi_function_decl($@)
#else
$2 $1 ();
@@ -333,14 +400,17 @@ m4_define([b4_c_arg],
## Synclines. ##
## ----------- ##
# b4_syncline(LINE, FILE)
# -----------------------
m4_define([b4_syncline],
[m4_if(b4_synclines_flag, 1,
[[#]line $1 $2])])
[b4_flag_if([synclines], [[#]line $1 $2])])
## -------------- ##
## User actions. ##
## -------------- ##
# b4_symbol_actions(FILENAME, LINENO,
# SYMBOL-TAG, SYMBOL-NUM,
# SYMBOL-ACTION, SYMBOL-TYPENAME)
@@ -369,17 +439,20 @@ m4_define_default([b4_yydestruct_generate],
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
/*ARGSUSED*/
]$1([yydestruct],
[static void],
[[const char *yymsg], [yymsg]],
[[int yytype], [yytype]],
[[YYSTYPE *yyvaluep], [yyvaluep]]b4_location_if([,
[[YYLTYPE *yylocationp], [yylocationp]]]))[
[[YYSTYPE *yyvaluep], [yyvaluep]][]dnl
b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl
m4_ifset([b4_parse_param], [, b4_parse_param]))[
{
/* Pacify ``unused variable'' warnings. */
(void) yyvaluep;
]b4_location_if([ (void) yylocationp;
])[
YYUSE (yyvaluep);
]b4_locations_if([ YYUSE (yylocationp);
])dnl
b4_parse_param_use[]dnl
[
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
@@ -394,40 +467,36 @@ m4_define_default([b4_yydestruct_generate],
])
# b4_yysymprint_generate(FUNCTION-DECLARATOR)
# -------------------------------------------
# Generate the "yysymprint" function, which declaration is issued using
# b4_yy_symbol_print_generate(FUNCTION-DECLARATOR)
# ------------------------------------------------
# Generate the "yy_symbol_print" function, which declaration is issued using
# FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C
# or "b4_c_function_def" for K&R.
m4_define_default([b4_yysymprint_generate],
[[/*--------------------------------.
m4_define_default([b4_yy_symbol_print_generate],
[[
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
]$1([yysymprint],
/*ARGSUSED*/
]$1([yy_symbol_value_print],
[static void],
[[FILE *yyoutput], [yyoutput]],
[[int yytype], [yytype]],
[[YYSTYPE *yyvaluep], [yyvaluep]]b4_location_if([,
[[YYLTYPE *yylocationp], [yylocationp]]]))
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
m4_ifset([b4_parse_param], [, b4_parse_param]))[
{
/* Pacify ``unused variable'' warnings. */
(void) yyvaluep;
b4_location_if([ (void) yylocationp;
if (!yyvaluep)
return;
]b4_locations_if([ YYUSE (yylocationp);
])dnl
[
if (yytype < YYNTOKENS)
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
else
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
]b4_location_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
YYFPRINTF (yyoutput, ": ");
])dnl
[
# ifdef YYPRINT
b4_parse_param_use[]dnl
[# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# else
YYUSE (yyoutput);
# endif
switch (yytype)
{
@@ -435,6 +504,31 @@ b4_location_if([ (void) yylocationp;
[ default:
break;
}
YYFPRINTF (yyoutput, ")");
}
]])
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
]$1([yy_symbol_print],
[static void],
[[FILE *yyoutput], [yyoutput]],
[[int yytype], [yytype]],
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
m4_ifset([b4_parse_param], [, b4_parse_param]))[
{
if (yytype < YYNTOKENS)
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
else
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
YYFPRINTF (yyoutput, ": ");
])dnl
[ yy_symbol_value_print (yyoutput, yytype, yyvaluep]dnl
b4_locations_if([, yylocationp])[]b4_user_args[);
YYFPRINTF (yyoutput, ")");
}]dnl
])
+788 -531
View File
File diff suppressed because it is too large Load Diff
+389
View File
@@ -0,0 +1,389 @@
m4_divert(-1) -*- C -*-
# C++ GLR skeleton for Bison
# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
# This skeleton produces a C++ class that encapsulates a C glr parser.
# This is in order to reduce the maintenance burden. The glr.c
# skeleton is clean and pure enough so that there are no real
# problems. The C++ interface is the same as that of lalr1.cc. In
# fact, glr.c can replace yacc.c without the user noticing any
# difference, and similarly for glr.cc replacing lalr1.cc.
#
# The passing of parse-params
#
# The additional arguments are stored as members of the parser
# object, yyparser. The C routines need to carry yyparser
# throughout the C parser; that easy: just let yyparser become an
# additional parse-param. But because the C++ skeleton needs to
# know the "real" original parse-param, we save them
# (b4_parse_param_orig). Note that b4_parse_param is overquoted
# (and c.m4 strips one level of quotes). This is a PITA, and
# explains why there are so many levels of quotes.
#
# The locations
#
# We use location.cc just like lalr1.cc, but because glr.c stores
# the locations in a (C++) union, the position and location classes
# must not have a constructor. Therefore, contrary to lalr1.cc, we
# must not define "b4_location_constructors". As a consequence the
# user must initialize the first positions (in particular the
# filename member).
# We require a pure interface using locations.
m4_define([b4_locations_flag], [1])
m4_define([b4_pure_flag], [1])
# The header is mandatory.
b4_defines_if([],
[m4_fatal(b4_skeleton[: using %defines is mandatory])])
m4_include(b4_pkgdatadir/[c++.m4])
m4_include(b4_pkgdatadir/[location.cc])
# Save the parse parameters.
m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
# b4_yy_symbol_print_generate
# ---------------------------
# Bypass the default implementation to generate the "yy_symbol_print"
# and "yy_symbol_value_print" functions.
m4_define([b4_yy_symbol_print_generate],
[[
/*--------------------.
| Print this symbol. |
`--------------------*/
]b4_c_ansi_function_def([yy_symbol_print],
[static void],
[[FILE *], []],
[[int yytype], [yytype]],
[[const b4_namespace::b4_parser_class_name::semantic_type *yyvaluep],
[yyvaluep]],
[[const b4_namespace::b4_parser_class_name::location_type *yylocationp],
[yylocationp]],
b4_parse_param)[
{
]b4_parse_param_use[]dnl
[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[);
}
]])
# Declare yyerror.
m4_append([b4_post_prologue],
[/* Line __line__ of glr.cc. */
b4_syncline([@oline@], [@ofile@])
b4_c_ansi_function_decl([yyerror],
[static void],
[[b4_namespace::b4_parser_class_name::location_type *yylocationp], [yylocationp]],
b4_parse_param,
[[const char* msg], [msg]])])
# Define yyerror.
m4_append([b4_epilogue],
[/* Line __line__ of glr.cc. */
b4_syncline([@oline@], [@ofile@])[
/*------------------.
| Report an error. |
`------------------*/
]b4_c_ansi_function_def([yyerror],
[static void],
[[b4_namespace::b4_parser_class_name::location_type *yylocationp], [yylocationp]],
b4_parse_param,
[[const char* msg], [msg]])[
{
]b4_parse_param_use[]dnl
[ yyparser.error (*yylocationp, msg);
}
namespace ]b4_namespace[
{
]dnl In this section, the parse param are the original parse_params.
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
[ /// Build a parser object.
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)
: yycdebug_ (&std::cerr)]b4_parse_param_cons[
{
}
]b4_parser_class_name::~b4_parser_class_name[ ()
{
}
int
]b4_parser_class_name[::parse ()
{
return ::yyparse (*this]b4_user_args[);
}
#if YYDEBUG
/*--------------------.
| Print this symbol. |
`--------------------*/
inline void
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
const semantic_type* yyvaluep, const location_type* yylocationp)
{
/* Pacify ``unused variable'' warnings. */
YYUSE (yyvaluep);
YYUSE (yylocationp);
switch (yytype)
{
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
[ default:
break;
}
}
void
]b4_parser_class_name[::yy_symbol_print_ (int yytype,
const semantic_type* yyvaluep, const location_type* yylocationp)
{
*yycdebug_ << (yytype < YYNTOKENS ? "token" : "nterm")
<< ' ' << yytname[yytype] << " ("
<< *yylocationp << ": ";
yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
*yycdebug_ << ')';
}
std::ostream&
]b4_parser_class_name[::debug_stream () const
{
return *yycdebug_;
}
void
]b4_parser_class_name[::set_debug_stream (std::ostream& o)
{
yycdebug_ = &o;
}
]b4_parser_class_name[::debug_level_type
]b4_parser_class_name[::debug_level () const
{
return ::yydebug;
}
void
]b4_parser_class_name[::set_debug_level (debug_level_type l)
{
::yydebug = l;
}
#endif /* ! YYDEBUG */
]m4_popdef([b4_parse_param])dnl
[} // namespace ]b4_namespace[
]])
# Let glr.c believe that the user arguments include the parser itself.
m4_ifset([b4_parse_param],
[m4_pushdef([b4_parse_param],
m4_dquote([[[b4_namespace::b4_parser_class_name& yyparser], [[yyparser]]],]
m4_defn([b4_parse_param])))],
[m4_pushdef([b4_parse_param],
[[[[b4_namespace::b4_parser_class_name& yyparser], [[yyparser]]]]])
])
m4_include(b4_pkgdatadir/[glr.c])
m4_popdef([b4_parse_param])
@output @output_header_name@
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
[2002, 2003, 2004, 2005, 2006])[
/* C++ GLR parser skeleton written by Akim Demaille. */
#ifndef PARSER_HEADER_H
# define PARSER_HEADER_H
#include <string>
#include <iostream>
/* Using locations. */
#define YYLSP_NEEDED ]b4_locations_flag[
namespace ]b4_namespace[
{
class position;
class location;
}
/* Copy the first part of user declarations. */
]b4_pre_prologue[
]/* Line __line__ of glr.cc. */
b4_syncline([@oline@], [@ofile@])[
#include "location.hh"
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG ]b4_debug_flag[
#endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE ]b4_error_verbose_flag[
#endif
/* Enabling the token table. */
#ifndef YYTOKEN_TABLE
# define YYTOKEN_TABLE ]b4_token_table[
#endif
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
If N is 0, then set CURRENT to the empty location which ends
the previous symbol: RHS[0] (always defined). */
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (N) \
{ \
(Current).begin = YYRHSLOC (Rhs, 1).begin; \
(Current).end = YYRHSLOC (Rhs, N).end; \
} \
else \
{ \
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
} \
while (/*CONSTCOND*/ 0)
#endif
namespace ]b4_namespace[
{
/// A Bison parser.
class ]b4_parser_class_name[
{
public:
/// Symbol semantic values.
#ifndef YYSTYPE
]m4_ifdef([b4_stype],
[ union semantic_type
b4_stype
/* Line __line__ of lalr1.cc. */
b4_syncline([@oline@], [@ofile@])
;],
[ typedef int semantic_type;])[
#else
typedef YYSTYPE semantic_type;
#endif
/// Symbol locations.
typedef ]b4_location_type[ location_type;
/// Tokens.
struct token
{
]b4_token_enums(b4_tokens)[
};
/// Token type.
typedef token::yytokentype token_type;
/// Build a parser object.
]b4_parser_class_name[ (]b4_parse_param_decl[);
virtual ~]b4_parser_class_name[ ();
/// Parse.
/// \returns 0 iff parsing succeeded.
virtual int parse ();
/// The current debugging stream.
std::ostream& debug_stream () const;
/// Set the current debugging stream.
void set_debug_stream (std::ostream &);
/// Type for debugging levels.
typedef int debug_level_type;
/// The current debugging level.
debug_level_type debug_level () const;
/// Set the current debugging level.
void set_debug_level (debug_level_type l);
private:
public:
/// Report a syntax error.
/// \param loc where the syntax error is found.
/// \param msg a description of the syntax error.
virtual void error (const location_type& loc, const std::string& msg);
private:
#if YYDEBUG
public:
/// \brief Report a symbol value on the debug stream.
/// \param yytype The token type.
/// \param yyvaluep Its semantic value.
/// \param yylocationp Its location.
virtual void yy_symbol_value_print_ (int yytype,
const semantic_type* yyvaluep,
const location_type* yylocationp);
/// \brief Report a symbol on the debug stream.
/// \param yytype The token type.
/// \param yyvaluep Its semantic value.
/// \param yylocationp Its location.
virtual void yy_symbol_print_ (int yytype,
const semantic_type* yyvaluep,
const location_type* yylocationp);
private:
#endif /* ! YYDEBUG */
/// \brief Reclaim the memory associated to a symbol.
/// \param yymsg Why this token is reclaimed.
/// \param yytype The symbol type.
/// \param yyvaluep Its semantic value.
/// \param yylocationp Its location.
inline void yydestruct_ (const char* yymsg,
int yytype,
semantic_type* yyvaluep,
location_type* yylocationp);
/* Debugging. */
std::ostream* yycdebug_;
]b4_parse_param_vars[
};
]dnl Redirections for glr.c.
m4_ifset([b4_global_tokens_and_yystype],
[b4_token_defines(b4_tokens)])
[
#ifndef YYSTYPE
# define YYSTYPE ]b4_namespace[::]b4_parser_class_name[::semantic_type
#endif
#ifndef YYLTYPE
# define YYLTYPE ]b4_namespace[::]b4_parser_class_name[::location_type
#endif
}
#endif /* ! defined PARSER_HEADER_H */]
File diff suppressed because it is too large Load Diff
+253
View File
@@ -0,0 +1,253 @@
m4_divert(-1)
# C++ skeleton for Bison
# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
# We do want M4 expansion after # for CPP macros.
m4_changecom()
m4_divert(0)dnl
@output b4_dir_prefix[]position.hh
b4_copyright([Positions for Bison parsers in C++],
[2002, 2003, 2004, 2005, 2006])[
/**
** \file position.hh
** Define the ]b4_namespace[::position class.
*/
#ifndef BISON_POSITION_HH
# define BISON_POSITION_HH
# include <iostream>
# include <string>
namespace ]b4_namespace[
{
/// Abstract a position.
class position
{
public:
]m4_ifdef([b4_location_constructors], [
/// Construct a position.
position ()
: filename (0), line (1), column (0)
{
}
])[
/// Initialization.
inline void initialize (]b4_filename_type[* fn)
{
filename = fn;
line = 1;
column = 0;
}
/** \name Line and Column related manipulators
** \{ */
public:
/// (line related) Advance to the COUNT next lines.
inline void lines (int count = 1)
{
column = 0;
line += count;
}
/// (column related) Advance to the COUNT next columns.
inline void columns (int count = 1)
{
int leftmost = 0;
int current = column;
if (leftmost <= current + count)
column += count;
else
column = 0;
}
/** \} */
public:
/// File name to which this position refers.
]b4_filename_type[* filename;
/// Current line number.
unsigned int line;
/// Current column number.
unsigned int column;
};
/// Add and assign a position.
inline const position&
operator+= (position& res, const int width)
{
res.columns (width);
return res;
}
/// Add two position objects.
inline const position
operator+ (const position& begin, const int width)
{
position res = begin;
return res += width;
}
/// Add and assign a position.
inline const position&
operator-= (position& res, const int width)
{
return res += -width;
}
/// Add two position objects.
inline const position
operator- (const position& begin, const int width)
{
return begin + -width;
}
/** \brief Intercept output stream redirection.
** \param ostr the destination output stream
** \param pos a reference to the position to redirect
*/
inline std::ostream&
operator<< (std::ostream& ostr, const position& pos)
{
if (pos.filename)
ostr << *pos.filename << ':';
return ostr << pos.line << '.' << pos.column;
}
}
#endif // not BISON_POSITION_HH]
@output b4_dir_prefix[]location.hh
b4_copyright([Locations for Bison parsers in C++],
[2002, 2003, 2004, 2005, 2006])[
/**
** \file location.hh
** Define the ]b4_namespace[::location class.
*/
#ifndef BISON_LOCATION_HH
# define BISON_LOCATION_HH
# include <iostream>
# include <string>
# include "position.hh"
namespace ]b4_namespace[
{
/// Abstract a location.
class location
{
public:
]m4_ifdef([b4_location_constructors], [
/// Construct a location.
location ()
: begin (), end ()
{
}
])[
/// Initialization.
inline void initialize (]b4_filename_type[* fn)
{
begin.initialize (fn);
end = begin;
}
/** \name Line and Column related manipulators
** \{ */
public:
/// Reset initial location to final location.
inline void step ()
{
begin = end;
}
/// Extend the current location to the COUNT next columns.
inline void columns (unsigned int count = 1)
{
end += count;
}
/// Extend the current location to the COUNT next lines.
inline void lines (unsigned int count = 1)
{
end.lines (count);
}
/** \} */
public:
/// Beginning of the located region.
position begin;
/// End of the located region.
position end;
};
/// Join two location objects to create a location.
inline const location operator+ (const location& begin, const location& end)
{
location res = begin;
res.end = end.end;
return res;
}
/// Add two location objects.
inline const location operator+ (const location& begin, unsigned int width)
{
location res = begin;
res.columns (width);
return res;
}
/// Add and assign a location.
inline location& operator+= (location& res, unsigned int width)
{
res.columns (width);
return res;
}
/** \brief Intercept output stream redirection.
** \param ostr the destination output stream
** \param loc a reference to the location to redirect
**
** Avoid duplicate information.
*/
inline std::ostream& operator<< (std::ostream& ostr, const location& loc)
{
position last = loc.end - 1;
ostr << loc.begin;
if (last.filename
&& (!loc.begin.filename
|| *loc.begin.filename != *last.filename))
ostr << '-' << last;
else if (loc.begin.line != last.line)
ostr << '-' << last.line << '.' << last.column;
else if (loc.begin.column != last.column)
ostr << '-' << last.column;
return ostr;
}
}
#endif // not BISON_LOCATION_HH]
m4_divert(-1)
m4_changecom([#])
+12 -3
View File
@@ -398,8 +398,11 @@ m4_define([m4_cdr],
# of LIST (which can be lists themselves, for multiple arguments MACROs).
m4_define([m4_fst], [$1])
m4_define([m4_map],
[m4_if([$2], [[]], [],
[_m4_map([$1], [$2])])])
m4_define([_m4_map],
[m4_ifval([$2],
[$1(m4_fst($2))[]m4_map([$1], m4_cdr($2))])])
[$1(m4_fst($2))[]_m4_map([$1], m4_cdr($2))])])
# m4_map_sep(MACRO, SEPARATOR, LIST)
@@ -408,8 +411,8 @@ m4_define([m4_map],
# are the elements of LIST (which can be lists themselves, for multiple
# arguments MACROs).
m4_define([m4_map_sep],
[m4_ifval([$3],
[$1(m4_fst($3))[]m4_map([$2[]$1], m4_cdr($3))])])
[m4_if([$3], [[]], [],
[$1(m4_fst($3))[]_m4_map([$2[]$1], m4_cdr($3))])])
## ---------------------------------------- ##
@@ -1512,6 +1515,12 @@ m4_define([m4_append],
[m4_define([$1],
m4_ifdef([$1], [m4_defn([$1])$3])[$2])])
# m4_prepend(MACRO-NAME, STRING, [SEPARATOR])
# -------------------------------------------
# Same, but prepend.
m4_define([m4_prepend],
[m4_define([$1],
[$2]m4_ifdef([$1], [$3[]m4_defn([$1])]))])
# m4_append_uniq(MACRO-NAME, STRING, [SEPARATOR])
# -----------------------------------------------
+387 -305
View File
File diff suppressed because it is too large Load Diff
-109
View File
@@ -1,109 +0,0 @@
Frequently Asked Questions about Bison:
----------------------------------------------------------------------
Q1. Is Bison Y2K compliant?
A1. If you're looking for a guarantee or certification, I can't
provide it. With a little thought you can answer this one for
yourself, though. (Hint: does a parser generator rely on the
date or time for anything?) If you're still confused, see
http://www.gnu.org/software/year2000.html for more information.
----------------------------------------------------------------------
Q2. I can't build Bison because "make" complains that "msgfmt" is not
found. What should I do?
A2. Like most GNU packages with internationalization support, that
feature is turned on by default. If you have problems building
in the "po" subdirectory, it indicates that your system's
internationalization support is lacking. You can re-configure
Bison with "--disable-nls" to turn off this support, or you can
install GNU gettext from ftp://ftp.gnu.org/gnu/gettext/ and
re-configure Bison. See the file "ABOUT-NLS" for more
information.
----------------------------------------------------------------------
Q3. I'm having trouble using Bison. Where can I find help?
A3. First, read the fine manual which comes with bison. Beyond that,
you can send mail to <[email protected]>. This mailing list is
intended to be populated with people who are willing to answer
questions about using and installing Bison. Please keep in mind
that (most of) the people on the list have aspects of their lives
which are not related to Bison (!), so you may not receive an
answer to your question right away. This can be frustrating, but
please try not to honk them off; remember that any help they
provide is purely voluntary and out of the kindness of their
hearts.
----------------------------------------------------------------------
Q4. I found a bug. What should I include in the bug report?
A4. Before you send a bug report, make sure you are using the latest
version. Check ftp://ftp.gnu.org/pub/gnu/bison/ or one of its
mirrors. Be sure to include the version number in your bug
report. If the bug is present in the latest version but not in a
previous version, try to determine the most recent version which
did not contain the bug.
If the bug is parser-related, you should include the smallest
grammar you can which demonstrates the bug. The grammar file
should also be complete (i.e., I should be able to run it through
Bison without having to edit or add anything). The smaller and
simpler the grammar, the easier it will be to fix the bug.
Include information about your compilation environment, including
your operating system's name and version and your compiler's name
and version. If you have trouble compiling, you should also
include a transcript of the build session, starting with the
invocation of `configure'. Depending on the nature of the bug,
you may be asked to send additional files as well (such as
`config.h' or `config.cache').
Patches are most welcome, but not required. That is, do not
hesitate to send a bug report just because you can not provide a
fix.
Send bug reports to <[email protected]>.
----------------------------------------------------------------------
Q5. Will Bison ever have C++ support?
A5. Yes, it's in the works. Things are very chaotic right now, but
what little information floats around is posted to the bug-bison
mailing list. If you're interested in testing C++ support when
it becomes available, please consider subscribing to the list,
especially if you are willing to beta test other releases as
well.
----------------------------------------------------------------------
Q6. What is involved in being a beta tester?
A6. It's not terribly involved. Basically, you would download a test
release, compile it, and use it to build and run a parser or two.
After that, you would submit either a bug report or a message
saying that everything is okay. It is important to report
successes as well as failures because test releases eventually
become mainstream releases, but only if they are adequately
tested. If no one tests, development is essentially halted.
Beta testers are particularly needed for operating systems to
which I do not have access. I currently have easy access to
Linux (x86 glibc 2.1), Solaris (SPARC) 2.6 and 2.7, and HP-UX
10.20. Reports about other operating systems are especially
welcome.
----------------------------------------------------------------------
Q7. How do I join the help-bison and bug-bison mailing lists?
A7. See http://www.gnu.org/ (the section about "GNU mailing lists")
for more information.
----------------------------------------------------------------------
+2 -2
View File
@@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-
## Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
## Copyright (C) 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ info_TEXINFOS = bison.texinfo
man_MANS = bison.1
bison_TEXINFOS = gpl.texi fdl.texi
EXTRA_DIST = FAQ bison.1 refcard.tex
EXTRA_DIST = bison.1 refcard.tex
CLEANFILES = refcard.dvi refcard.log refcard.ps bison.fns
+12 -8
View File
@@ -40,8 +40,8 @@ DIST_COMMON = $(bison_TEXINFOS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/stamp-vti \
$(srcdir)/version.texi
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \
$(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/cxx.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/bison-i18n.m4 \
$(top_srcdir)/m4/c-working.m4 $(top_srcdir)/m4/cxx.m4 \
$(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \
$(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/error.m4 \
$(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \
@@ -58,11 +58,14 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \
$(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
$(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h_gl.m4 \
$(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \
$(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strndup.m4 \
$(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/subpipe.m4 \
$(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \
$(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \
$(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoul.m4 \
$(top_srcdir)/m4/strverscmp.m4 $(top_srcdir)/m4/subpipe.m4 \
$(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/uintmax_t_gl.m4 \
$(top_srcdir)/m4/ulonglong_gl.m4 \
$(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/warning.m4 \
$(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \
$(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.m4 \
$(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -91,8 +94,6 @@ NROFF = nroff
MANS = $(man_MANS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
ALLOCA_H = @ALLOCA_H@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@@ -102,6 +103,8 @@ AUTOM4TE = @AUTOM4TE@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BISON_CXX_WORKS = @BISON_CXX_WORKS@
BISON_CXX_WORKS_FALSE = @BISON_CXX_WORKS_FALSE@
BISON_CXX_WORKS_TRUE = @BISON_CXX_WORKS_TRUE@
BISON_LOCALEDIR = @BISON_LOCALEDIR@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
@@ -161,6 +164,7 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STDBOOL_H = @STDBOOL_H@
STRIP = @STRIP@
UNISTD_H = @UNISTD_H@
USE_NLS = @USE_NLS@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
@@ -217,7 +221,7 @@ AM_MAKEINFOFLAGS = --no-split
info_TEXINFOS = bison.texinfo
man_MANS = bison.1
bison_TEXINFOS = gpl.texi fdl.texi
EXTRA_DIST = FAQ bison.1 refcard.tex
EXTRA_DIST = bison.1 refcard.tex
CLEANFILES = refcard.dvi refcard.log refcard.ps bison.fns
all: all-am
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -1,4 +1,4 @@
@set UPDATED 16 September 2005
@set UPDATED-MONTH September 2005
@set EDITION 2.1
@set VERSION 2.1
@set UPDATED 30 May 2006
@set UPDATED-MONTH May 2006
@set EDITION 2.3
@set VERSION 2.3
+4 -4
View File
@@ -1,4 +1,4 @@
@set UPDATED 16 September 2005
@set UPDATED-MONTH September 2005
@set EDITION 2.1
@set VERSION 2.1
@set UPDATED 30 May 2006
@set UPDATED-MONTH May 2006
@set EDITION 2.3
@set VERSION 2.3
+1 -2
View File
@@ -32,16 +32,15 @@ StaticLibrary libbison.a :
obstack.c
quote.c
quotearg.c
realloc.c
stpcpy.c
stripslash.c
strndup.c
strnlen.c
strverscmp.c
subpipe.c
timevar.c
vbitset.c
xmalloc.c
xalloc-die.c
xstrdup.c
xstrndup.c
;
+41 -26
View File
@@ -14,8 +14,6 @@
@SET_MAKE@
# This file is generated automatically by "bootstrap".
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
@@ -39,17 +37,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/gnulib.mk alloca.c dirname.c dirname.h dup-safer.c \
error.c error.h exitfail.c exitfail.h fd-safer.c fopen-safer.c \
$(srcdir)/gnulib.mk dirname.c dirname.h dup-safer.c error.c \
error.h exitfail.c exitfail.h fd-safer.c fopen-safer.c \
getopt.c getopt1.c hard-locale.c hard-locale.h hash.c hash.h \
malloc.c obstack.c obstack.h pipe-safer.c quote.c quote.h \
quotearg.c quotearg.h stdio--.h stdio-safer.h stpcpy.c \
strdup.c strdup.h strndup.c strndup.h strnlen.c strnlen.h \
unistd--.h unistd-safer.h xalloc.h xmalloc.c
strdup.c strdup.h strerror.c strndup.c strndup.h strnlen.c \
strnlen.h strtol.c strtoul.c strverscmp.c strverscmp.h \
unistd--.h unistd-safer.h unlocked-io.h xalloc.h xmalloc.c
subdir = lib
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \
$(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/cxx.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/bison-i18n.m4 \
$(top_srcdir)/m4/c-working.m4 $(top_srcdir)/m4/cxx.m4 \
$(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \
$(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/error.m4 \
$(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \
@@ -66,11 +65,14 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \
$(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
$(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h_gl.m4 \
$(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \
$(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strndup.m4 \
$(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/subpipe.m4 \
$(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \
$(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \
$(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoul.m4 \
$(top_srcdir)/m4/strverscmp.m4 $(top_srcdir)/m4/subpipe.m4 \
$(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/uintmax_t_gl.m4 \
$(top_srcdir)/m4/ulonglong_gl.m4 \
$(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/warning.m4 \
$(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \
$(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.m4 \
$(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -91,7 +93,6 @@ AR = ar
ARFLAGS = cru
libbison_a_AR = $(AR) $(ARFLAGS)
am__DEPENDENCIES_1 = @LIBOBJS@
am__DEPENDENCIES_2 = @ALLOCA@
am__objects_1 = abitset.$(OBJEXT) bitset.$(OBJEXT) \
bitset_stats.$(OBJEXT) bitsetv.$(OBJEXT) ebitset.$(OBJEXT) \
lbitset.$(OBJEXT) vbitset.$(OBJEXT)
@@ -120,8 +121,6 @@ ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
ALLOCA_H = @ALLOCA_H@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@@ -131,6 +130,8 @@ AUTOM4TE = @AUTOM4TE@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BISON_CXX_WORKS = @BISON_CXX_WORKS@
BISON_CXX_WORKS_FALSE = @BISON_CXX_WORKS_FALSE@
BISON_CXX_WORKS_TRUE = @BISON_CXX_WORKS_TRUE@
BISON_LOCALEDIR = @BISON_LOCALEDIR@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
@@ -190,6 +191,7 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STDBOOL_H = @STDBOOL_H@
STRIP = @STRIP@
UNISTD_H = @UNISTD_H@
USE_NLS = @USE_NLS@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
@@ -243,20 +245,31 @@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
AM_CFLAGS = $(WARNING_CFLAGS)
BUILT_SOURCES = $(ALLOCA_H) $(GETOPT_H) $(STDBOOL_H)
EXTRA_DIST = alloca_.h getopt_.h getopt_int.h stdbool_.h
MOSTLYCLEANFILES = alloca.h alloca.h-t getopt.h getopt.h-t stdbool.h \
stdbool.h-t
BUILT_SOURCES = $(GETOPT_H) $(STDBOOL_H) $(UNISTD_H)
EXTRA_DIST = getopt_.h getopt_int.h stdbool_.h
MOSTLYCLEANFILES = getopt.h getopt.h-t stdbool.h stdbool.h-t unistd.h
lib_LIBRARIES = $(YACC_LIBRARY)
EXTRA_LIBRARIES = liby.a
noinst_LIBRARIES = libbison.a
liby_a_SOURCES = main.c yyerror.c
libbison_a_SOURCES = $(lib_SOURCES)
# This file is generated automatically by "bootstrap".
# This is for those projects which use "gettextize --intl" to put a source-code
# copy of libintl into their package. In such projects, every Makefile.am needs
# -I$(top_builddir)/intl, so that <libintl.h> can be found in this directory.
# For the Makefile.ams in other directories it is the maintainer's
# responsibility; for the one from gnulib we do it here.
# This option has no effect when the user disables NLS (because then the intl
# directory contains no libintl.h file) or when the project does not use
# "gettextize --intl".
# (commented out by bootstrap) AM_CPPFLAGS += -I$(top_builddir)/intl
lib_SOURCES = get-errno.h get-errno.c subpipe.h subpipe.c \
$(bitsets_sources) $(additional_bitsets_sources) \
$(timevars_sources) argmatch.h argmatch.c basename.c \
stripslash.c exit.h gettext.h mbswidth.h mbswidth.c stpcpy.h \
xalloc-die.c xstrndup.h xstrndup.c
verify.h xalloc-die.c xstrndup.h xstrndup.c
# Implementation of bitsets
bitsets_sources = \
@@ -357,7 +370,6 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/alloca.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/dirname.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/dup-safer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/error.Po@am__quote@
@@ -375,8 +387,12 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/quotearg.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/stpcpy.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strdup.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strerror.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strndup.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strnlen.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strtol.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strtoul.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strverscmp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/xmalloc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abitset.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argmatch.Po@am__quote@
@@ -586,12 +602,6 @@ uninstall-am: uninstall-info-am uninstall-libLIBRARIES
uninstall-libLIBRARIES
# We need the following in order to create <alloca.h> when the system
# doesn't have one that works with the given compiler.
alloca.h: alloca_.h
cp $(srcdir)/alloca_.h $@-t
mv $@-t $@
# We need the following in order to create <getopt.h> when the system
# doesn't have one that works with the given compiler.
getopt.h: getopt_.h
@@ -603,6 +613,11 @@ getopt.h: getopt_.h
stdbool.h: stdbool_.h
sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t
mv $@-t $@
# We need the following in order to create an empty placeholder for
# <unistd.h> when the system doesn't have one.
unistd.h:
echo '/* Empty placeholder for $@. */' >$@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
+8 -10
View File
@@ -1,5 +1,5 @@
/* Array bitsets.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
@@ -13,12 +13,11 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include "config.h"
# include <config.h>
#endif
#include "abitset.h"
@@ -34,14 +33,13 @@
static bitset_bindex
abitset_resize (bitset src ATTRIBUTE_UNUSED,
bitset_bindex size ATTRIBUTE_UNUSED)
abitset_resize (bitset src, bitset_bindex size)
{
if (BITSET_SIZE_ (src) == size)
return size;
/* These bitsets have a fixed size. */
if (BITSET_SIZE_ (src) != size)
abort ();
return size;
}
/* Find list of up to NUM bits set in BSET starting from and including
-491
View File
@@ -1,491 +0,0 @@
/* alloca.c -- allocate automatically reclaimed memory
(Mostly) portable public-domain implementation -- D A Gwyn
This implementation of the PWB library alloca function,
which is used to allocate space off the run-time stack so
that it is automatically reclaimed upon procedure exit,
was inspired by discussions with J. Q. Johnson of Cornell.
J.Otto Tennant <jot@cray.com> contributed the Cray support.
There are some preprocessor constants that can
be defined when compiling for your specific system, for
improved efficiency; however, the defaults should be okay.
The general concept of this implementation is to keep
track of all alloca-allocated blocks, and reclaim any
that are found to be deeper in the stack than the current
invocation. This heuristic does not reclaim storage as
soon as it becomes invalid, but it will do so eventually.
As a special case, alloca(0) reclaims storage without
allocating any. It is a good idea to use alloca(0) in
your main control loop, etc. to force garbage collection. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <alloca.h>
#include <string.h>
#include <stdlib.h>
#ifdef emacs
# include "lisp.h"
# include "blockinput.h"
# ifdef EMACS_FREE
# undef free
# define free EMACS_FREE
# endif
#else
# define memory_full() abort ()
#endif
/* If compiling with GCC 2, this file's not needed. */
#if !defined (__GNUC__) || __GNUC__ < 2
/* If someone has defined alloca as a macro,
there must be some other way alloca is supposed to work. */
# ifndef alloca
# ifdef emacs
# ifdef static
/* actually, only want this if static is defined as ""
-- this is for usg, in which emacs must undefine static
in order to make unexec workable
*/
# ifndef STACK_DIRECTION
you
lose
-- must know STACK_DIRECTION at compile-time
/* Using #error here is not wise since this file should work for
old and obscure compilers. */
# endif /* STACK_DIRECTION undefined */
# endif /* static */
# endif /* emacs */
/* If your stack is a linked list of frames, you have to
provide an "address metric" ADDRESS_FUNCTION macro. */
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
long i00afunc ();
# define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
# else
# define ADDRESS_FUNCTION(arg) &(arg)
# endif
/* Define STACK_DIRECTION if you know the direction of stack
growth for your system; otherwise it will be automatically
deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
# ifndef STACK_DIRECTION
# define STACK_DIRECTION 0 /* Direction unknown. */
# endif
# if STACK_DIRECTION != 0
# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
# else /* STACK_DIRECTION == 0; need run-time code. */
static int stack_dir; /* 1 or -1 once known. */
# define STACK_DIR stack_dir
static void
find_stack_direction (void)
{
static char *addr = NULL; /* Address of first `dummy', once known. */
auto char dummy; /* To get stack address. */
if (addr == NULL)
{ /* Initial entry. */
addr = ADDRESS_FUNCTION (dummy);
find_stack_direction (); /* Recurse once. */
}
else
{
/* Second entry. */
if (ADDRESS_FUNCTION (dummy) > addr)
stack_dir = 1; /* Stack grew upward. */
else
stack_dir = -1; /* Stack grew downward. */
}
}
# endif /* STACK_DIRECTION == 0 */
/* An "alloca header" is used to:
(a) chain together all alloca'ed blocks;
(b) keep track of stack depth.
It is very important that sizeof(header) agree with malloc
alignment chunk size. The following default should work okay. */
# ifndef ALIGN_SIZE
# define ALIGN_SIZE sizeof(double)
# endif
typedef union hdr
{
char align[ALIGN_SIZE]; /* To force sizeof(header). */
struct
{
union hdr *next; /* For chaining headers. */
char *deep; /* For stack depth measure. */
} h;
} header;
static header *last_alloca_header = NULL; /* -> last alloca header. */
/* Return a pointer to at least SIZE bytes of storage,
which will be automatically reclaimed upon exit from
the procedure that called alloca. Originally, this space
was supposed to be taken from the current stack frame of the
caller, but that method cannot be made to work for some
implementations of C, for example under Gould's UTX/32. */
void *
alloca (size_t size)
{
auto char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION (probe);
# if STACK_DIRECTION == 0
if (STACK_DIR == 0) /* Unknown growth direction. */
find_stack_direction ();
# endif
/* Reclaim garbage, defined as all alloca'd storage that
was allocated from deeper in the stack than currently. */
{
register header *hp; /* Traverses linked list. */
# ifdef emacs
BLOCK_INPUT;
# endif
for (hp = last_alloca_header; hp != NULL;)
if ((STACK_DIR > 0 && hp->h.deep > depth)
|| (STACK_DIR < 0 && hp->h.deep < depth))
{
register header *np = hp->h.next;
free (hp); /* Collect garbage. */
hp = np; /* -> next header. */
}
else
break; /* Rest are not deeper. */
last_alloca_header = hp; /* -> last valid storage. */
# ifdef emacs
UNBLOCK_INPUT;
# endif
}
if (size == 0)
return NULL; /* No allocation required. */
/* Allocate combined header + user data storage. */
{
/* Address of header. */
register header *new;
size_t combined_size = sizeof (header) + size;
if (combined_size < sizeof (header))
memory_full ();
new = malloc (combined_size);
if (! new)
memory_full ();
new->h.next = last_alloca_header;
new->h.deep = depth;
last_alloca_header = new;
/* User storage begins just after header. */
return (void *) (new + 1);
}
}
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
# ifdef DEBUG_I00AFUNC
# include <stdio.h>
# endif
# ifndef CRAY_STACK
# define CRAY_STACK
# ifndef CRAY2
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
struct stack_control_header
{
long shgrow:32; /* Number of times stack has grown. */
long shaseg:32; /* Size of increments to stack. */
long shhwm:32; /* High water mark of stack. */
long shsize:32; /* Current size of stack (all segments). */
};
/* The stack segment linkage control information occurs at
the high-address end of a stack segment. (The stack
grows from low addresses to high addresses.) The initial
part of the stack segment linkage control information is
0200 (octal) words. This provides for register storage
for the routine which overflows the stack. */
struct stack_segment_linkage
{
long ss[0200]; /* 0200 overflow words. */
long sssize:32; /* Number of words in this segment. */
long ssbase:32; /* Offset to stack base. */
long:32;
long sspseg:32; /* Offset to linkage control of previous
segment of stack. */
long:32;
long sstcpt:32; /* Pointer to task common address block. */
long sscsnm; /* Private control structure number for
microtasking. */
long ssusr1; /* Reserved for user. */
long ssusr2; /* Reserved for user. */
long sstpid; /* Process ID for pid based multi-tasking. */
long ssgvup; /* Pointer to multitasking thread giveup. */
long sscray[7]; /* Reserved for Cray Research. */
long ssa0;
long ssa1;
long ssa2;
long ssa3;
long ssa4;
long ssa5;
long ssa6;
long ssa7;
long sss0;
long sss1;
long sss2;
long sss3;
long sss4;
long sss5;
long sss6;
long sss7;
};
# else /* CRAY2 */
/* The following structure defines the vector of words
returned by the STKSTAT library routine. */
struct stk_stat
{
long now; /* Current total stack size. */
long maxc; /* Amount of contiguous space which would
be required to satisfy the maximum
stack demand to date. */
long high_water; /* Stack high-water mark. */
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
long hits; /* Number of internal buffer hits. */
long extends; /* Number of block extensions. */
long stko_mallocs; /* Block allocations by $STKOFEN. */
long underflows; /* Number of stack underflow calls ($STKRETN). */
long stko_free; /* Number of deallocations by $STKRETN. */
long stkm_free; /* Number of deallocations by $STKMRET. */
long segments; /* Current number of stack segments. */
long maxs; /* Maximum number of stack segments so far. */
long pad_size; /* Stack pad size. */
long current_address; /* Current stack segment address. */
long current_size; /* Current stack segment size. This
number is actually corrupted by STKSTAT to
include the fifteen word trailer area. */
long initial_address; /* Address of initial segment. */
long initial_size; /* Size of initial segment. */
};
/* The following structure describes the data structure which trails
any stack segment. I think that the description in 'asdef' is
out of date. I only describe the parts that I am sure about. */
struct stk_trailer
{
long this_address; /* Address of this block. */
long this_size; /* Size of this block (does not include
this trailer). */
long unknown2;
long unknown3;
long link; /* Address of trailer block of previous
segment. */
long unknown5;
long unknown6;
long unknown7;
long unknown8;
long unknown9;
long unknown10;
long unknown11;
long unknown12;
long unknown13;
long unknown14;
};
# endif /* CRAY2 */
# endif /* not CRAY_STACK */
# ifdef CRAY2
/* Determine a "stack measure" for an arbitrary ADDRESS.
I doubt that "lint" will like this much. */
static long
i00afunc (long *address)
{
struct stk_stat status;
struct stk_trailer *trailer;
long *block, size;
long result = 0;
/* We want to iterate through all of the segments. The first
step is to get the stack status structure. We could do this
more quickly and more directly, perhaps, by referencing the
$LM00 common block, but I know that this works. */
STKSTAT (&status);
/* Set up the iteration. */
trailer = (struct stk_trailer *) (status.current_address
+ status.current_size
- 15);
/* There must be at least one stack segment. Therefore it is
a fatal error if "trailer" is null. */
if (trailer == 0)
abort ();
/* Discard segments that do not contain our argument address. */
while (trailer != 0)
{
block = (long *) trailer->this_address;
size = trailer->this_size;
if (block == 0 || size == 0)
abort ();
trailer = (struct stk_trailer *) trailer->link;
if ((block <= address) && (address < (block + size)))
break;
}
/* Set the result to the offset in this segment and add the sizes
of all predecessor segments. */
result = address - block;
if (trailer == 0)
{
return result;
}
do
{
if (trailer->this_size <= 0)
abort ();
result += trailer->this_size;
trailer = (struct stk_trailer *) trailer->link;
}
while (trailer != 0);
/* We are done. Note that if you present a bogus address (one
not in any segment), you will get a different number back, formed
from subtracting the address of the first block. This is probably
not what you want. */
return (result);
}
# else /* not CRAY2 */
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
Determine the number of the cell within the stack,
given the address of the cell. The purpose of this
routine is to linearize, in some sense, stack addresses
for alloca. */
static long
i00afunc (long address)
{
long stkl = 0;
long size, pseg, this_segment, stack;
long result = 0;
struct stack_segment_linkage *ssptr;
/* Register B67 contains the address of the end of the
current stack segment. If you (as a subprogram) store
your registers on the stack and find that you are past
the contents of B67, you have overflowed the segment.
B67 also points to the stack segment linkage control
area, which is what we are really interested in. */
stkl = CRAY_STACKSEG_END ();
ssptr = (struct stack_segment_linkage *) stkl;
/* If one subtracts 'size' from the end of the segment,
one has the address of the first word of the segment.
If this is not the first segment, 'pseg' will be
nonzero. */
pseg = ssptr->sspseg;
size = ssptr->sssize;
this_segment = stkl - size;
/* It is possible that calling this routine itself caused
a stack overflow. Discard stack segments which do not
contain the target address. */
while (!(this_segment <= address && address <= stkl))
{
# ifdef DEBUG_I00AFUNC
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
# endif
if (pseg == 0)
break;
stkl = stkl - pseg;
ssptr = (struct stack_segment_linkage *) stkl;
size = ssptr->sssize;
pseg = ssptr->sspseg;
this_segment = stkl - size;
}
result = address - this_segment;
/* If you subtract pseg from the current end of the stack,
you get the address of the previous stack segment's end.
This seems a little convoluted to me, but I'll bet you save
a cycle somewhere. */
while (pseg != 0)
{
# ifdef DEBUG_I00AFUNC
fprintf (stderr, "%011o %011o\n", pseg, size);
# endif
stkl = stkl - pseg;
ssptr = (struct stack_segment_linkage *) stkl;
size = ssptr->sssize;
pseg = ssptr->sspseg;
result += size;
}
return (result);
}
# endif /* not CRAY2 */
# endif /* CRAY */
# endif /* no alloca */
#endif /* not GCC version 2 */
-52
View File
@@ -1,52 +0,0 @@
/* Memory allocation on the stack.
Copyright (C) 1995, 1999, 2001, 2002, 2003, 2004 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA. */
/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
means there is a real alloca function. */
#ifndef _GNULIB_ALLOCA_H
# define _GNULIB_ALLOCA_H
/* alloca (N) returns a pointer to N bytes of memory
allocated on the stack, which will last until the function returns.
Use of alloca should be avoided:
- inside arguments of function calls - undefined behaviour,
- in inline functions - the allocation may actually last until the
calling function returns,
- for huge N (say, N >= 65536) - you never know how large (or small)
the stack is, and when the stack cannot fulfill the memory allocation
request, the program just crashes.
*/
#ifdef __GNUC__
# define alloca __builtin_alloca
#elif defined _AIX
# define alloca __alloca
#elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
#else
# include <stddef.h>
# ifdef __cplusplus
extern "C"
# endif
void *alloca (size_t);
#endif
#endif /* _GNULIB_ALLOCA_H */
+1 -1
View File
@@ -20,7 +20,7 @@
/* Written by David MacKenzie <[email protected]>
Modified by Akim Demaille <demaille@inf.enst.fr> */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+5 -14
View File
@@ -1,6 +1,6 @@
/* argmatch.h -- definitions and prototypes for argmatch.c
Copyright (C) 1990, 1998, 1999, 2001, 2002, 2004 Free Software
Copyright (C) 1990, 1998, 1999, 2001, 2002, 2004, 2005 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -25,24 +25,15 @@
# include <stddef.h>
# include "verify.h"
# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
# define ARGMATCH_CONSTRAINT(Arglist, Vallist) \
(ARRAY_CARDINALITY (Arglist) == ARRAY_CARDINALITY (Vallist) + 1)
/* Assert there are as many real arguments as there are values
(argument list ends with a NULL guard). ARGMATCH_VERIFY is
preferred, since it is guaranteed to be checked at compile-time.
ARGMATCH_ASSERT is for backward compatibility only. */
(argument list ends with a NULL guard). */
# define ARGMATCH_VERIFY(Arglist, Vallist) \
struct argmatch_verify \
{ \
char argmatch_verify[ARGMATCH_CONSTRAINT(Arglist, Vallist) ? 1 : -1]; \
}
# define ARGMATCH_ASSERT(Arglist, Vallist) \
assert (ARGMATCH_CONSTRAINT (Arglist, Vallist))
verify (ARRAY_CARDINALITY (Arglist) == ARRAY_CARDINALITY (Vallist) + 1)
/* Return the index of the element of ARGLIST (NULL terminated) that
matches with ARG. If VALLIST is not NULL, then use it to resolve
+1 -1
View File
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+9 -9
View File
@@ -1,5 +1,5 @@
/* Base bitset stuff.
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
@@ -126,16 +126,16 @@ struct bitset_vtable
void (*copy) (bitset, bitset);
bool (*disjoint_p) (bitset, bitset);
bool (*equal_p) (bitset, bitset);
void (*not) (bitset, bitset);
void (*not_) (bitset, bitset);
bool (*subset_p) (bitset, bitset);
void (*and) (bitset, bitset, bitset);
void (*and_) (bitset, bitset, bitset);
bool (*and_cmp) (bitset, bitset, bitset);
void (*andn) (bitset, bitset, bitset);
bool (*andn_cmp) (bitset, bitset, bitset);
void (*or) (bitset, bitset, bitset);
void (*or_) (bitset, bitset, bitset);
bool (*or_cmp) (bitset, bitset, bitset);
void (*xor) (bitset, bitset, bitset);
void (*xor_) (bitset, bitset, bitset);
bool (*xor_cmp) (bitset, bitset, bitset);
void (*and_or) (bitset, bitset, bitset, bitset);
@@ -218,14 +218,14 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
#define BITSET_EQUAL_P_(DST, SRC) (SRC)->b.vtable->equal_p (DST, SRC)
/* DST = ~SRC. */
#define BITSET_NOT_(DST, SRC) (SRC)->b.vtable->not (DST, SRC)
#define BITSET_NOT_(DST, SRC) (SRC)->b.vtable->not_ (DST, SRC)
/* Return DST == DST | SRC. */
#define BITSET_SUBSET_P_(DST, SRC) (SRC)->b.vtable->subset_p (DST, SRC)
/* DST = SRC1 & SRC2. */
#define BITSET_AND_(DST, SRC1, SRC2) (SRC1)->b.vtable->and (DST, SRC1, SRC2)
#define BITSET_AND_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_ (DST, SRC1, SRC2)
#define BITSET_AND_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_cmp (DST, SRC1, SRC2)
/* DST = SRC1 & ~SRC2. */
@@ -233,11 +233,11 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
#define BITSET_ANDN_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->andn_cmp (DST, SRC1, SRC2)
/* DST = SRC1 | SRC2. */
#define BITSET_OR_(DST, SRC1, SRC2) (SRC1)->b.vtable->or (DST, SRC1, SRC2)
#define BITSET_OR_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_ (DST, SRC1, SRC2)
#define BITSET_OR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_cmp (DST, SRC1, SRC2)
/* DST = SRC1 ^ SRC2. */
#define BITSET_XOR_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor (DST, SRC1, SRC2)
#define BITSET_XOR_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_ (DST, SRC1, SRC2)
#define BITSET_XOR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_cmp (DST, SRC1, SRC2)
+13 -13
View File
@@ -1,5 +1,5 @@
/* General bitsets.
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
@@ -13,11 +13,11 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include "config.h"
# include <config.h>
#endif
#include <stdlib.h>
@@ -45,6 +45,9 @@ bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
switch (type)
{
default:
abort ();
case BITSET_ARRAY:
bytes = abitset_bytes (n_bits);
break;
@@ -60,9 +63,6 @@ bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
case BITSET_VARRAY:
bytes = vbitset_bytes (n_bits);
break;
default:
abort ();
}
return bytes;
@@ -78,6 +78,9 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
switch (type)
{
default:
abort ();
case BITSET_ARRAY:
return abitset_init (bset, n_bits);
@@ -89,9 +92,6 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
case BITSET_VARRAY:
return vbitset_init (bset, n_bits);
default:
abort ();
}
}
@@ -421,6 +421,9 @@ bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
switch (op)
{
default:
abort ();
case BITSET_OP_OR_AND:
bitset_or (tmp, src1, src2);
changed = bitset_and_cmp (dst, src3, tmp);
@@ -435,9 +438,6 @@ bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
bitset_andn (tmp, src1, src2);
changed = bitset_or_cmp (dst, src3, tmp);
break;
default:
abort ();
}
bitset_free (tmp);
+4
View File
@@ -26,6 +26,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "obstack.h"
#include <stdio.h>
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
#endif
/* Attributes used to select a bitset implementation. */
enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */
BITSET_VARIABLE = 2, /* Bitset size variable. */
+8 -10
View File
@@ -1,5 +1,5 @@
/* Bitset statistics.
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
@@ -13,20 +13,18 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* This file is a wrapper bitset implementation for the other bitset
implementations. It provides bitset compatibility checking and
statistics gathering without having to instrument the bitset
implementations. When statistics gathering is enabled, the bitset
operations get vectored through here and we then call the appropriate
routines.
*/
routines. */
#ifdef HAVE_CONFIG_H
#include "config.h"
# include <config.h>
#endif
#include "bbitset.h"
@@ -696,6 +694,9 @@ bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
we are a wrapper over. */
switch (type)
{
default:
abort ();
case BITSET_ARRAY:
bytes = abitset_bytes (n_bits);
sbset = xcalloc (1, bytes);
@@ -719,9 +720,6 @@ bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
sbset = xcalloc (1, bytes);
vbitset_init (sbset, n_bits);
break;
default:
abort ();
}
bset->s.bset = sbset;
+13 -16
View File
@@ -1,25 +1,22 @@
/* Bitset vectors.
Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc.
This file is part of Bison.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include "config.h"
# include <config.h>
#endif
#include <stdlib.h>
+13 -16
View File
@@ -1,25 +1,22 @@
/* Bitset vectors.
Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GCC.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GCC is 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include "config.h"
# include <config.h>
#endif
#include <stdlib.h>
+1 -1
View File
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+1 -1
View File
@@ -17,7 +17,7 @@
/* Written by Paul Eggert. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+11 -12
View File
@@ -1,5 +1,5 @@
/* Functions to support expandable bitsets.
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
@@ -13,12 +13,11 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include "config.h"
# include <config.h>
#endif
#include "ebitset.h"
@@ -210,7 +209,7 @@ ebitset_elt_alloc (void)
#define OBSTACK_CHUNK_FREE free
#endif
#if !defined(__GNUC__) || (__GNUC__ < 2)
#if ! defined __GNUC__ || __GNUC__ < 2
#define __alignof__(type) 0
#endif
@@ -322,6 +321,9 @@ ebitset_elt_find (bitset bset, bitset_bindex bindex,
switch (mode)
{
default:
abort ();
case EBITSET_FIND:
return 0;
@@ -337,9 +339,6 @@ ebitset_elt_find (bitset bset, bitset_bindex bindex,
case EBITSET_SUBST:
return &ebitset_zero_elts[0];
default:
abort ();
}
}
@@ -1090,6 +1089,9 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
dstp = EBITSET_WORDS (delt);
switch (op)
{
default:
abort ();
case BITSET_OP_OR:
for (i = 0; i < EBITSET_ELT_WORDS; i++, dstp++)
{
@@ -1141,9 +1143,6 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
}
}
break;
default:
abort ();
}
if (!ebitset_elt_zero_p (delt))
+1 -1
View File
@@ -17,7 +17,7 @@
If not, write to the Free Software Foundation,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+1 -1
View File
@@ -18,7 +18,7 @@
/* Written by Paul Eggert. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+1 -1
View File
@@ -17,7 +17,7 @@
/* Written by Paul Eggert. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+3 -3
View File
@@ -1,6 +1,6 @@
/* get-errno.h - get and set errno.
/* get-errno.c - get and set errno.
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
/* Written by Paul Eggert. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+16 -66
View File
@@ -2,7 +2,7 @@
NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004
Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -20,28 +20,16 @@
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
Ditto for AIX 3.2 and <stdlib.h>. */
#ifndef _NO_PROTO
# define _NO_PROTO
#endif
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "getopt.h"
#include <stdio.h>
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
# include <stdlib.h>
# include <unistd.h>
#endif /* GNU C library. */
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifdef VMS
# include <unixlib.h>
@@ -76,7 +64,6 @@
GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */
#include "getopt.h"
#include "getopt_int.h"
/* For communication from `getopt' to the caller.
@@ -118,16 +105,9 @@ int optopt = '?';
static struct _getopt_data getopt_data;
#ifndef __GNU_LIBRARY__
/* Avoid depending on library functions or files
whose names are inconsistent. */
#ifndef getenv
#if defined HAVE_DECL_GETENV && !HAVE_DECL_GETENV
extern char *getenv ();
#endif
#endif /* not __GNU_LIBRARY__ */
#ifdef _LIBC
/* Stored original parameters.
@@ -556,10 +536,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
__fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -634,10 +611,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
__fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -674,10 +648,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
__fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -751,10 +722,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
__fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -817,10 +785,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
__fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -868,10 +833,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
__fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -940,10 +902,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
__fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -985,10 +944,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
__fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -1027,10 +983,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
__fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -1101,10 +1054,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
__fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
+1 -3
View File
@@ -1,5 +1,5 @@
/* Declarations for getopt.
Copyright (C) 1989-1994,1996-1999,2001,2003,2004
Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -34,9 +34,7 @@
#if defined __GETOPT_PREFIX && !defined __need_getopt
# include <stdlib.h>
# include <stdio.h>
# if HAVE_UNISTD_H
# include <unistd.h>
# endif
# undef __need_getopt
# undef getopt
# undef getopt_long
+1 -1
View File
@@ -18,7 +18,7 @@
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
# include <config.h>
#endif
#ifdef _LIBC
+24 -11
View File
@@ -1,15 +1,4 @@
# This file is generated automatically by "bootstrap".
BUILT_SOURCES += $(ALLOCA_H)
EXTRA_DIST += alloca_.h
# We need the following in order to create <alloca.h> when the system
# doesn't have one that works with the given compiler.
alloca.h: alloca_.h
cp $(srcdir)/alloca_.h $@-t
mv $@-t $@
MOSTLYCLEANFILES += alloca.h alloca.h-t
lib_SOURCES += argmatch.h argmatch.c
lib_SOURCES += basename.c stripslash.c
@@ -29,6 +18,15 @@ getopt.h: getopt_.h
mv $@-t $@
MOSTLYCLEANFILES += getopt.h getopt.h-t
# This is for those projects which use "gettextize --intl" to put a source-code
# copy of libintl into their package. In such projects, every Makefile.am needs
# -I$(top_builddir)/intl, so that <libintl.h> can be found in this directory.
# For the Makefile.ams in other directories it is the maintainer's
# responsibility; for the one from gnulib we do it here.
# This option has no effect when the user disables NLS (because then the intl
# directory contains no libintl.h file) or when the project does not use
# "gettextize --intl".
# (commented out by bootstrap) AM_CPPFLAGS += -I$(top_builddir)/intl
lib_SOURCES += gettext.h
@@ -59,6 +57,21 @@ lib_SOURCES += stpcpy.h
BUILT_SOURCES += $(UNISTD_H)
# We need the following in order to create an empty placeholder for
# <unistd.h> when the system doesn't have one.
unistd.h:
echo '/* Empty placeholder for $@. */' >$@
MOSTLYCLEANFILES += unistd.h
lib_SOURCES += verify.h
lib_SOURCES += xalloc-die.c
lib_SOURCES += xstrndup.h xstrndup.c
+1 -1
View File
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+1 -1
View File
@@ -24,7 +24,7 @@
/* Define USE_OBSTACK to 1 if you want the allocator to use obstacks instead
of malloc. If you change USE_OBSTACK, you have to recompile! */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+11 -12
View File
@@ -1,5 +1,5 @@
/* Functions to support link list bitsets.
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
@@ -13,12 +13,11 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include "config.h"
# include <config.h>
#endif
#include "lbitset.h"
@@ -121,7 +120,7 @@ lbitset_elt_alloc (void)
#define OBSTACK_CHUNK_FREE free
#endif
#if !defined(__GNUC__) || (__GNUC__ < 2)
#if ! defined __GNUC__ || __GNUC__ < 2
#define __alignof__(type) 0
#endif
@@ -363,6 +362,9 @@ lbitset_elt_find (bitset bset, bitset_windex windex,
switch (mode)
{
default:
abort ();
case LBITSET_FIND:
return 0;
@@ -376,9 +378,6 @@ lbitset_elt_find (bitset bset, bitset_windex windex,
case LBITSET_SUBST:
return &lbitset_zero_elts[0];
default:
abort ();
}
}
@@ -1117,6 +1116,9 @@ lbitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
dstp = dtmp->words;
switch (op)
{
default:
abort ();
case BITSET_OP_OR:
for (i = 0; i < LBITSET_ELT_WORDS; i++, dstp++)
{
@@ -1168,9 +1170,6 @@ lbitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
}
}
break;
default:
abort ();
}
if (!lbitset_elt_zero_p (dtmp))
+1 -1
View File
@@ -17,7 +17,7 @@
/* written by Jim Meyering */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#undef malloc
+4 -9
View File
@@ -51,10 +51,6 @@
# endif
#endif
#if defined _LIBC && defined USE_IN_LIBIO
# include <wchar.h>
#endif
#include <stddef.h>
#ifndef ELIDE_CODE
@@ -433,12 +429,11 @@ print_and_abort (void)
happen because the "memory exhausted" message appears in other places
like this and the translation should be reused instead of creating
a very similar string which requires a separate translation. */
# if defined _LIBC && defined USE_IN_LIBIO
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s\n", _("memory exhausted"));
else
# endif
# ifdef _LIBC
(void) __fxprintf (NULL, "%s\n", _("memory exhausted"));
# else
fprintf (stderr, "%s\n", _("memory exhausted"));
# endif
exit (obstack_exit_failure);
}
+4 -8
View File
@@ -1,11 +1,7 @@
/* obstack.h - object stack macros
Copyright (C) 1988-1994,1996-1999,2003,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org.
Copyright (C) 1988-1994,1996-1999,2003,2004,2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
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
@@ -464,7 +460,7 @@ __extension__ \
(((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr))
# define obstack_int_grow_fast(h,aint) \
(((int *) ((h)->next_free += sizeof (int)))[-1] = (aptr))
(((int *) ((h)->next_free += sizeof (int)))[-1] = (aint))
# define obstack_blank(h,length) \
( (h)->temp.tempint = (length), \
+1 -1
View File
@@ -17,7 +17,7 @@
/* Written by Jim Meyering. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+1 -1
View File
@@ -17,7 +17,7 @@
/* Written by Paul Eggert <[email protected]> */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+15 -4
View File
@@ -1,7 +1,7 @@
/* quotearg.c - quote arguments for output
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free Software
Foundation, Inc.
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006 Free
Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
/* Written by Paul Eggert <[email protected]> */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -307,6 +307,9 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
STORE ('\\');
STORE ('?');
break;
default:
break;
}
break;
@@ -454,6 +457,9 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
case '[': case '\\': case '^':
case '`': case '|':
goto use_shell_always_quoting_style;
default:
break;
}
}
@@ -586,7 +592,12 @@ quotearg_n_options (int n, char const *arg, size_t argsize,
if (nslots <= n0)
{
unsigned int n1 = n0 + 1;
/* FIXME: technically, the type of n1 should be `unsigned int',
but that evokes an unsuppressible warning from gcc-4.0.1 and
older. If gcc ever provides an option to suppress that warning,
revert to the original type, so that the test in xalloc_oversized
is once again performed only at compile time. */
size_t n1 = n0 + 1;
if (xalloc_oversized (n1, sizeof *slotvec))
xalloc_die ();
-39
View File
@@ -1,39 +0,0 @@
/* Work around bug on some systems where realloc (NULL, 0) fails.
Copyright (C) 1997, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* written by Jim Meyering */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#undef realloc
#include <stdlib.h>
/* Change the size of an allocated block of memory P to N bytes,
with error checking. If N is zero, change it to 1. If P is NULL,
use malloc. */
void *
rpl_realloc (void *p, size_t n)
{
if (n == 0)
n = 1;
if (p == 0)
return malloc (n);
return realloc (p, n);
}
+28 -6
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
@@ -70,18 +70,40 @@
(see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
(see ISO C 99 6.3.1.1.(2)). So we add a negative value to the
enum; this ensures that '_Bool' promotes to 'int'. */
#if !(defined __cplusplus || defined __BEOS__)
#if defined __cplusplus || defined __BEOS__
/* A compiler known to have 'bool'. */
/* If the compiler already has both 'bool' and '_Bool', we can assume they
are the same types. */
# if !@HAVE__BOOL@
# if defined __SUNPRO_C && (__SUNPRO_C < 0x550 || __STDC__ == 1)
/* Avoid stupid "warning: _Bool is a keyword in ISO C99". */
typedef bool _Bool;
# endif
#else
# if !defined __GNUC__
/* If @HAVE__BOOL@:
Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
the built-in _Bool type is used. See
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
Similar bugs are likely with other compilers as well; this file
wouldn't be used if <stdbool.h> was working.
So we override the _Bool type.
If !@HAVE__BOOL@:
Need to define _Bool ourselves. As 'signed char' or as an enum type?
Use of a typedef, with SunPRO C, leads to a stupid
"warning: _Bool is a keyword in ISO C99".
Use of an enum type, with IRIX cc, leads to a stupid
"warning(1185): enumerated type mixed with another type".
The only benefit of the enum type, debuggability, is not important
with these compilers. So use 'signed char' and no typedef. */
# define _Bool signed char
enum { false = 0, true = 1 };
# else
/* With this compiler, trust the _Bool type if the compiler has it. */
# if !@HAVE__BOOL@
typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
# endif
# endif
#else
typedef bool _Bool;
#endif
#define bool _Bool
+49
View File
@@ -0,0 +1,49 @@
/* strerror.c --- ANSI C compatible system error routine
Copyright (C) 1986, 1988, 1989, 1991, 2002, 2003 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <limits.h>
/* Don't include <stdio.h>, since it may or may not declare
sys_errlist and its declarations may collide with ours. Just
declare the stuff that we need directly. Standard hosted C89
implementations define strerror and they don't need this strerror
function, so take some liberties with the standard to cater to
ancient or limited freestanding implementations. */
int sprintf (char *, char const *, ...);
extern int sys_nerr;
extern char *sys_errlist[];
char *
strerror (int n)
{
static char const fmt[] = "Unknown error (%d)";
static char mesg[sizeof fmt + sizeof n * CHAR_BIT / 3];
if (n < 0 || n >= sys_nerr)
{
sprintf (mesg, fmt, n);
return mesg;
}
else
return sys_errlist[n];
}
+1 -1
View File
@@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+22 -7
View File
@@ -1,4 +1,5 @@
/* Copyright (C) 1996, 1997, 1998, 2000, 2003, 2005 Free Software Foundation, Inc.
/* Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2005, 2006 Free
Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
@@ -18,26 +19,37 @@
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include "config.h"
# include <config.h>
#endif
#if !_LIBC
# include "strndup.h"
#endif
#include <stdlib.h>
#include <string.h>
/* Get strnlen. */
#include "strnlen.h"
#if !_LIBC
# include "strnlen.h"
# ifndef __strnlen
# define __strnlen strnlen
# endif
#endif
#undef __strndup
#undef strndup
#if _LIBC
# undef strndup
#endif
#ifndef weak_alias
# define __strndup strndup
#endif
char *
__strndup (const char *s, size_t n)
__strndup (s, n)
const char *s;
size_t n;
{
size_t len = strnlen (s, n);
size_t len = __strnlen (s, n);
char *new = malloc (len + 1);
if (new == NULL)
@@ -46,6 +58,9 @@ __strndup (const char *s, size_t n)
new[len] = '\0';
return memcpy (new, s, len);
}
#ifdef libc_hidden_def
libc_hidden_def (__strndup)
#endif
#ifdef weak_alias
weak_alias (__strndup, strndup)
#endif
+7 -22
View File
@@ -1,6 +1,6 @@
/* Find the length of STRING, but scan at most MAXLEN characters.
Copyright (C) 1996, 1997, 1998, 2000-2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
Written by Simon Josefsson.
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
@@ -12,37 +12,22 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#undef strnlen
#include <string.h>
#undef __strnlen
#undef strnlen
#ifndef _LIBC
# define strnlen rpl_strnlen
#endif
#ifndef weak_alias
# define __strnlen strnlen
#endif
#include "strnlen.h"
/* Find the length of STRING, but scan at most MAXLEN characters.
If no '\0' terminator is found in that many characters, return MAXLEN. */
size_t
__strnlen (const char *string, size_t maxlen)
strnlen (const char *string, size_t maxlen)
{
const char *end = memchr (string, '\0', maxlen);
return end ? (size_t) (end - string) : maxlen;
}
#ifdef weak_alias
weak_alias (__strnlen, strnlen)
#endif
+447
View File
@@ -0,0 +1,447 @@
/* Convert string representation of a number into an integer value.
Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005
Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
Library. Bugs can be reported to bug-glibc@gnu.org.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef _LIBC
# define USE_NUMBER_GROUPING
#endif
#include <ctype.h>
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#ifndef __set_errno
# define __set_errno(Val) errno = (Val)
#endif
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#ifdef USE_NUMBER_GROUPING
# include "../locale/localeinfo.h"
#endif
/* Nonzero if we are defining `strtoul' or `strtoull', operating on
unsigned integers. */
#ifndef UNSIGNED
# define UNSIGNED 0
# define INT LONG int
#else
# define INT unsigned LONG int
#endif
/* Determine the name. */
#ifdef USE_IN_EXTENDED_LOCALE_MODEL
# if UNSIGNED
# ifdef USE_WIDE_CHAR
# ifdef QUAD
# define strtol __wcstoull_l
# else
# define strtol __wcstoul_l
# endif
# else
# ifdef QUAD
# define strtol __strtoull_l
# else
# define strtol __strtoul_l
# endif
# endif
# else
# ifdef USE_WIDE_CHAR
# ifdef QUAD
# define strtol __wcstoll_l
# else
# define strtol __wcstol_l
# endif
# else
# ifdef QUAD
# define strtol __strtoll_l
# else
# define strtol __strtol_l
# endif
# endif
# endif
#else
# if UNSIGNED
# ifdef USE_WIDE_CHAR
# ifdef QUAD
# define strtol wcstoull
# else
# define strtol wcstoul
# endif
# else
# ifdef QUAD
# define strtol strtoull
# else
# define strtol strtoul
# endif
# endif
# else
# ifdef USE_WIDE_CHAR
# ifdef QUAD
# define strtol wcstoll
# else
# define strtol wcstol
# endif
# else
# ifdef QUAD
# define strtol strtoll
# endif
# endif
# endif
#endif
/* If QUAD is defined, we are defining `strtoll' or `strtoull',
operating on `long long int's. */
#ifdef QUAD
# define LONG long long
# define STRTOL_LONG_MIN LONG_LONG_MIN
# define STRTOL_LONG_MAX LONG_LONG_MAX
# define STRTOL_ULONG_MAX ULONG_LONG_MAX
/* The extra casts in the following macros work around compiler bugs,
e.g., in Cray C 5.0.3.0. */
/* True if negative values of the signed integer type T use two's
complement, ones' complement, or signed magnitude representation,
respectively. Much GNU code assumes two's complement, but some
people like to be portable to all possible C hosts. */
# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
/* True if the arithmetic type T is signed. */
# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
/* The maximum and minimum values for the integer type T. These
macros have undefined behavior if T is signed and has padding bits.
If this is a problem for you, please let us know how to fix it for
your host. */
# define TYPE_MINIMUM(t) \
((t) (! TYPE_SIGNED (t) \
? (t) 0 \
: TYPE_SIGNED_MAGNITUDE (t) \
? ~ (t) 0 \
: ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
# define TYPE_MAXIMUM(t) \
((t) (! TYPE_SIGNED (t) \
? (t) -1 \
: ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
# ifndef ULONG_LONG_MAX
# define ULONG_LONG_MAX TYPE_MAXIMUM (unsigned long long)
# endif
# ifndef LONG_LONG_MAX
# define LONG_LONG_MAX TYPE_MAXIMUM (long long int)
# endif
# ifndef LONG_LONG_MIN
# define LONG_LONG_MIN TYPE_MINIMUM (long long int)
# endif
# if __GNUC__ == 2 && __GNUC_MINOR__ < 7
/* Work around gcc bug with using this constant. */
static const unsigned long long int maxquad = ULONG_LONG_MAX;
# undef STRTOL_ULONG_MAX
# define STRTOL_ULONG_MAX maxquad
# endif
#else
# define LONG long
# define STRTOL_LONG_MIN LONG_MIN
# define STRTOL_LONG_MAX LONG_MAX
# define STRTOL_ULONG_MAX ULONG_MAX
#endif
/* We use this code also for the extended locale handling where the
function gets as an additional argument the locale which has to be
used. To access the values we have to redefine the _NL_CURRENT
macro. */
#ifdef USE_IN_EXTENDED_LOCALE_MODEL
# undef _NL_CURRENT
# define _NL_CURRENT(category, item) \
(current->values[_NL_ITEM_INDEX (item)].string)
# define LOCALE_PARAM , loc
# define LOCALE_PARAM_PROTO , __locale_t loc
#else
# define LOCALE_PARAM
# define LOCALE_PARAM_PROTO
#endif
#if defined _LIBC || defined HAVE_WCHAR_H
# include <wchar.h>
#endif
#ifdef USE_WIDE_CHAR
# include <wctype.h>
# define L_(Ch) L##Ch
# define UCHAR_TYPE wint_t
# define STRING_TYPE wchar_t
# ifdef USE_IN_EXTENDED_LOCALE_MODEL
# define ISSPACE(Ch) __iswspace_l ((Ch), loc)
# define ISALPHA(Ch) __iswalpha_l ((Ch), loc)
# define TOUPPER(Ch) __towupper_l ((Ch), loc)
# else
# define ISSPACE(Ch) iswspace (Ch)
# define ISALPHA(Ch) iswalpha (Ch)
# define TOUPPER(Ch) towupper (Ch)
# endif
#else
# if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII)
# define IN_CTYPE_DOMAIN(c) 1
# else
# define IN_CTYPE_DOMAIN(c) isascii(c)
# endif
# define L_(Ch) Ch
# define UCHAR_TYPE unsigned char
# define STRING_TYPE char
# ifdef USE_IN_EXTENDED_LOCALE_MODEL
# define ISSPACE(Ch) __isspace_l ((Ch), loc)
# define ISALPHA(Ch) __isalpha_l ((Ch), loc)
# define TOUPPER(Ch) __toupper_l ((Ch), loc)
# else
# define ISSPACE(Ch) (IN_CTYPE_DOMAIN (Ch) && isspace (Ch))
# define ISALPHA(Ch) (IN_CTYPE_DOMAIN (Ch) && isalpha (Ch))
# define TOUPPER(Ch) (IN_CTYPE_DOMAIN (Ch) ? toupper (Ch) : (Ch))
# endif
#endif
#define INTERNAL(X) INTERNAL1(X)
#define INTERNAL1(X) __##X##_internal
#define WEAKNAME(X) WEAKNAME1(X)
#ifdef USE_NUMBER_GROUPING
/* This file defines a function to check for correct grouping. */
# include "grouping.h"
#endif
/* Convert NPTR to an `unsigned long int' or `long int' in base BASE.
If BASE is 0 the base is determined by the presence of a leading
zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
If BASE is < 2 or > 36, it is reset to 10.
If ENDPTR is not NULL, a pointer to the character after the last
one converted is stored in *ENDPTR. */
INT
INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
int base, int group LOCALE_PARAM_PROTO)
{
int negative;
register unsigned LONG int cutoff;
register unsigned int cutlim;
register unsigned LONG int i;
register const STRING_TYPE *s;
register UCHAR_TYPE c;
const STRING_TYPE *save, *end;
int overflow;
#ifdef USE_NUMBER_GROUPING
# ifdef USE_IN_EXTENDED_LOCALE_MODEL
struct locale_data *current = loc->__locales[LC_NUMERIC];
# endif
/* The thousands character of the current locale. */
wchar_t thousands = L'\0';
/* The numeric grouping specification of the current locale,
in the format described in <locale.h>. */
const char *grouping;
if (group)
{
grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
if (*grouping <= 0 || *grouping == CHAR_MAX)
grouping = NULL;
else
{
/* Figure out the thousands separator character. */
# if defined _LIBC || defined _HAVE_BTOWC
thousands = __btowc (*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP));
if (thousands == WEOF)
thousands = L'\0';
# endif
if (thousands == L'\0')
grouping = NULL;
}
}
else
grouping = NULL;
#endif
if (base < 0 || base == 1 || base > 36)
{
__set_errno (EINVAL);
return 0;
}
save = s = nptr;
/* Skip white space. */
while (ISSPACE (*s))
++s;
if (*s == L_('\0'))
goto noconv;
/* Check for a sign. */
if (*s == L_('-'))
{
negative = 1;
++s;
}
else if (*s == L_('+'))
{
negative = 0;
++s;
}
else
negative = 0;
/* Recognize number prefix and if BASE is zero, figure it out ourselves. */
if (*s == L_('0'))
{
if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X'))
{
s += 2;
base = 16;
}
else if (base == 0)
base = 8;
}
else if (base == 0)
base = 10;
/* Save the pointer so we can check later if anything happened. */
save = s;
#ifdef USE_NUMBER_GROUPING
if (group)
{
/* Find the end of the digit string and check its grouping. */
end = s;
for (c = *end; c != L_('\0'); c = *++end)
if ((wchar_t) c != thousands
&& ((wchar_t) c < L_('0') || (wchar_t) c > L_('9'))
&& (!ISALPHA (c) || (int) (TOUPPER (c) - L_('A') + 10) >= base))
break;
if (*s == thousands)
end = s;
else
end = correctly_grouped_prefix (s, end, thousands, grouping);
}
else
#endif
end = NULL;
cutoff = STRTOL_ULONG_MAX / (unsigned LONG int) base;
cutlim = STRTOL_ULONG_MAX % (unsigned LONG int) base;
overflow = 0;
i = 0;
for (c = *s; c != L_('\0'); c = *++s)
{
if (s == end)
break;
if (c >= L_('0') && c <= L_('9'))
c -= L_('0');
else if (ISALPHA (c))
c = TOUPPER (c) - L_('A') + 10;
else
break;
if ((int) c >= base)
break;
/* Check for overflow. */
if (i > cutoff || (i == cutoff && c > cutlim))
overflow = 1;
else
{
i *= (unsigned LONG int) base;
i += c;
}
}
/* Check if anything actually happened. */
if (s == save)
goto noconv;
/* Store in ENDPTR the address of one character
past the last character we converted. */
if (endptr != NULL)
*endptr = (STRING_TYPE *) s;
#if !UNSIGNED
/* Check for a value that is within the range of
`unsigned LONG int', but outside the range of `LONG int'. */
if (overflow == 0
&& i > (negative
? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1
: (unsigned LONG int) STRTOL_LONG_MAX))
overflow = 1;
#endif
if (overflow)
{
__set_errno (ERANGE);
#if UNSIGNED
return STRTOL_ULONG_MAX;
#else
return negative ? STRTOL_LONG_MIN : STRTOL_LONG_MAX;
#endif
}
/* Return the result of the appropriate sign. */
return negative ? -i : i;
noconv:
/* We must handle a special case here: the base is 0 or 16 and the
first two characters are '0' and 'x', but the rest are no
hexadecimal digits. This is no error case. We return 0 and
ENDPTR points to the `x`. */
if (endptr != NULL)
{
if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X')
&& save[-2] == L_('0'))
*endptr = (STRING_TYPE *) &save[-1];
else
/* There was no number to convert. */
*endptr = (STRING_TYPE *) nptr;
}
return 0L;
}
/* External user entry point. */
INT
#ifdef weak_function
weak_function
#endif
strtol (const STRING_TYPE *nptr, STRING_TYPE **endptr,
int base LOCALE_PARAM_PROTO)
{
return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM);
}
+20
View File
@@ -0,0 +1,20 @@
/* Copyright (C) 1991, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define UNSIGNED 1
#include "strtol.c"
+131
View File
@@ -0,0 +1,131 @@
/* Compare strings while treating digits characters numerically.
Copyright (C) 1997, 2000, 2002, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <string.h>
#include <ctype.h>
/* states: S_N: normal, S_I: comparing integral part, S_F: comparing
fractional parts, S_Z: idem but with leading Zeroes only */
#define S_N 0x0
#define S_I 0x4
#define S_F 0x8
#define S_Z 0xC
/* result_type: CMP: return diff; LEN: compare using len_diff/diff */
#define CMP 2
#define LEN 3
/* ISDIGIT differs from isdigit, as follows:
- Its arg may be any int or unsigned int; it need not be an unsigned char.
- It's guaranteed to evaluate its argument exactly once.
- It's typically faster.
POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to
ISDIGIT_LOCALE unless it's important to use the locale's definition
of `digit' even when the host does not conform to POSIX. */
#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
#undef __strverscmp
#undef strverscmp
#ifndef weak_alias
# define __strverscmp strverscmp
#endif
/* Compare S1 and S2 as strings holding indices/version numbers,
returning less than, equal to or greater than zero if S1 is less than,
equal to or greater than S2 (for more info, see the texinfo doc).
*/
int
__strverscmp (const char *s1, const char *s2)
{
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
int state;
int diff;
/* Symbol(s) 0 [1-9] others (padding)
Transition (10) 0 (01) d (00) x (11) - */
static const unsigned int next_state[] =
{
/* state x d 0 - */
/* S_N */ S_N, S_I, S_Z, S_N,
/* S_I */ S_N, S_I, S_I, S_I,
/* S_F */ S_N, S_F, S_F, S_F,
/* S_Z */ S_N, S_F, S_Z, S_Z
};
static const int result_type[] =
{
/* state x/x x/d x/0 x/- d/x d/d d/0 d/-
0/x 0/d 0/0 0/- -/x -/d -/0 -/- */
/* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
/* S_I */ CMP, -1, -1, CMP, 1, LEN, LEN, CMP,
1, LEN, LEN, CMP, CMP, CMP, CMP, CMP,
/* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
/* S_Z */ CMP, 1, 1, CMP, -1, CMP, CMP, CMP,
-1, CMP, CMP, CMP
};
if (p1 == p2)
return 0;
c1 = *p1++;
c2 = *p2++;
/* Hint: '0' is a digit too. */
state = S_N | ((c1 == '0') + (ISDIGIT (c1) != 0));
while ((diff = c1 - c2) == 0 && c1 != '\0')
{
state = next_state[state];
c1 = *p1++;
c2 = *p2++;
state |= (c1 == '0') + (ISDIGIT (c1) != 0);
}
state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT (c2) != 0))];
switch (state)
{
case CMP:
return diff;
case LEN:
while (ISDIGIT (*p1++))
if (!ISDIGIT (*p2++))
return 1;
return ISDIGIT (*p2) ? -1 : diff;
default:
return state;
}
}
#ifdef weak_alias
weak_alias (__strverscmp, strverscmp)
#endif
@@ -1,5 +1,6 @@
/* xstrdup.c -- copy a string with out of memory checking
Copyright (C) 1990, 1996, 1998, 2001, 2003 Free Software Foundation, Inc.
/* Compare strings while treating digits characters numerically.
Copyright (C) 1997, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -13,21 +14,11 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef STRVERSCMP_H_
# define STRVERSCMP_H_
/* Specification. */
#include "xalloc.h"
int strverscmp (const char *, const char *);
#include <string.h>
/* Return a newly allocated copy of STRING. */
char *
xstrdup (const char *string)
{
return xclone (string, strlen (string) + 1);
}
#endif /* not STRVERSCMP_H_ */
+20 -2
View File
@@ -1,6 +1,6 @@
/* Subprocesses with pipes.
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
/* Written by Paul Eggert <[email protected]>
and Florian Krohm <florian@edamail.fishkill.ibm.com>. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -71,6 +71,18 @@
#include "gettext.h"
#define _(Msgid) gettext (Msgid)
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if ! defined __GNUC__ || __GNUC__ < 2 || \
(__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# define __attribute__(Spec) /* empty */
# endif
#endif
#ifndef ATTRIBUTE_UNUSED
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif
/* Initialize this module. */
@@ -166,3 +178,9 @@ reap_subpipe (pid_t pid, char const *program)
}
#endif
}
void
end_of_output_subpipe (pid_t pid ATTRIBUTE_UNUSED,
int fd[2] ATTRIBUTE_UNUSED)
{
}
+12 -14
View File
@@ -1,22 +1,19 @@
/* Subprocesses with pipes.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bison; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Written by Paul Eggert <[email protected]>
and Florian Krohm <florian@edamail.fishkill.ibm.com>. */
@@ -27,4 +24,5 @@
void init_subpipe (void);
pid_t create_subpipe (char const * const *, int[2]);
void end_of_output_subpipe (pid_t, int[2]);
void reap_subpipe (pid_t, char const *);
+16 -16
View File
@@ -1,27 +1,27 @@
/* Timing variables for measuring compiler performance.
Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc.
Copyright (C) 2000, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Alex Samuel <samuel@codesourcery.com>
This file is part of Bison, the GNU Compiler Compiler.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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 this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
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, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#if IN_GCC
#include "config.h"
#include "system.h"
#include "intl.h"
#include "rtl.h"
@@ -447,7 +447,7 @@ timevar_print (fp)
FILE *fp;
{
/* Only print stuff if we have some sort of time information. */
#if defined (HAVE_USER_TIME) || defined (HAVE_SYS_TIME) || defined (HAVE_WALL_TIME)
#if defined HAVE_USER_TIME || defined HAVE_SYS_TIME || defined HAVE_WALL_TIME
unsigned int /* timevar_id_t */ id;
struct timevar_time_def *total = &timevars[TV_TOTAL].elapsed;
struct timevar_time_def now;
+10 -13
View File
@@ -2,22 +2,19 @@
Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc.
Contributed by Alex Samuel <samuel@codesourcery.com>
This file is part of Bison, the GNU Compiler Compiler.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bison; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef GCC_TIMEVAR_H
#define GCC_TIMEVAR_H
+14 -9
View File
@@ -1,6 +1,6 @@
/* Prefer faster, non-thread-safe stdio functions if available.
Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -14,19 +14,13 @@
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Written by Jim Meyering. */
#ifndef UNLOCKED_IO_H
# define UNLOCKED_IO_H 1
# ifndef USE_UNLOCKED_IO
# define USE_UNLOCKED_IO 1
# endif
# if USE_UNLOCKED_IO
/* These are wrappers for functions/macros from the GNU C library, and
from other C libraries supporting POSIX's optional thread-safe functions.
@@ -46,72 +40,84 @@
# else
# define clearerr_unlocked(x) clearerr (x)
# endif
# if HAVE_DECL_FEOF_UNLOCKED
# undef feof
# define feof(x) feof_unlocked (x)
# else
# define feof_unlocked(x) feof (x)
# endif
# if HAVE_DECL_FERROR_UNLOCKED
# undef ferror
# define ferror(x) ferror_unlocked (x)
# else
# define ferror_unlocked(x) ferror (x)
# endif
# if HAVE_DECL_FFLUSH_UNLOCKED
# undef fflush
# define fflush(x) fflush_unlocked (x)
# else
# define fflush_unlocked(x) fflush (x)
# endif
# if HAVE_DECL_FGETS_UNLOCKED
# undef fgets
# define fgets(x,y,z) fgets_unlocked (x,y,z)
# else
# define fgets_unlocked(x,y,z) fgets (x,y,z)
# endif
# if HAVE_DECL_FPUTC_UNLOCKED
# undef fputc
# define fputc(x,y) fputc_unlocked (x,y)
# else
# define fputc_unlocked(x,y) fputc (x,y)
# endif
# if HAVE_DECL_FPUTS_UNLOCKED
# undef fputs
# define fputs(x,y) fputs_unlocked (x,y)
# else
# define fputs_unlocked(x,y) fputs (x,y)
# endif
# if HAVE_DECL_FREAD_UNLOCKED
# undef fread
# define fread(w,x,y,z) fread_unlocked (w,x,y,z)
# else
# define fread_unlocked(w,x,y,z) fread (w,x,y,z)
# endif
# if HAVE_DECL_FWRITE_UNLOCKED
# undef fwrite
# define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z)
# else
# define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
# endif
# if HAVE_DECL_GETC_UNLOCKED
# undef getc
# define getc(x) getc_unlocked (x)
# else
# define getc_unlocked(x) getc (x)
# endif
# if HAVE_DECL_GETCHAR_UNLOCKED
# undef getchar
# define getchar() getchar_unlocked ()
# else
# define getchar_unlocked() getchar ()
# endif
# if HAVE_DECL_PUTC_UNLOCKED
# undef putc
# define putc(x,y) putc_unlocked (x,y)
# else
# define putc_unlocked(x,y) putc (x,y)
# endif
# if HAVE_DECL_PUTCHAR_UNLOCKED
# undef putchar
# define putchar(x) putchar_unlocked (x)
@@ -128,5 +134,4 @@
# undef funlockfile
# define funlockfile(x) ((void) 0)
# endif /* USE_UNLOCKED_IO */
#endif /* UNLOCKED_IO_H */
+4 -5
View File
@@ -1,5 +1,5 @@
/* Variable array bitsets.
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
@@ -13,12 +13,11 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include "config.h"
# include <config.h>
#endif
#include "vbitset.h"
+141
View File
@@ -0,0 +1,141 @@
/* Compile-time assert-like macros.
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */
#ifndef VERIFY_H
# define VERIFY_H 1
/* Each of these macros verifies that its argument R is nonzero. To
be portable, R should be an integer constant expression. Unlike
assert (R), there is no run-time overhead.
There are two macros, since no single macro can be used in all
contexts in C. verify_true (R) is for scalar contexts, including
integer constant expression contexts. verify (R) is for declaration
contexts, e.g., the top level.
Symbols ending in "__" are private to this header.
The code below uses several ideas.
* The first step is ((R) ? 1 : -1). Given an expression R, of
integral or boolean or floating-point type, this yields an
expression of integral type, whose value is later verified to be
constant and nonnegative.
* Next this expression W is wrapped in a type
struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }.
If W is negative, this yields a compile-time error. No compiler can
deal with a bit-field of negative size.
One might think that an array size check would have the same
effect, that is, that the type struct { unsigned int dummy[W]; }
would work as well. However, inside a function, some compilers
(such as C++ compilers and GNU C) allow local parameters and
variables inside array size expressions. With these compilers,
an array size check would not properly diagnose this misuse of
the verify macro:
void function (int n) { verify (n < 0); }
* For the verify macro, the struct verify_type__ will need to
somehow be embedded into a declaration. To be portable, this
declaration must declare an object, a constant, a function, or a
typedef name. If the declared entity uses the type directly,
such as in
struct dummy {...};
typedef struct {...} dummy;
extern struct {...} *dummy;
extern void dummy (struct {...} *);
extern struct {...} *dummy (void);
two uses of the verify macro would yield colliding declarations
if the entity names are not disambiguated. A workaround is to
attach the current line number to the entity name:
#define GL_CONCAT0(x, y) x##y
#define GL_CONCAT(x, y) GL_CONCAT0 (x, y)
extern struct {...} * GL_CONCAT(dummy,__LINE__);
But this has the problem that two invocations of verify from
within the same macro would collide, since the __LINE__ value
would be the same for both invocations.
A solution is to use the sizeof operator. It yields a number,
getting rid of the identity of the type. Declarations like
extern int dummy [sizeof (struct {...})];
extern void dummy (int [sizeof (struct {...})]);
extern int (*dummy (void)) [sizeof (struct {...})];
can be repeated.
* Should the implementation use a named struct or an unnamed struct?
Which of the following alternatives can be used?
extern int dummy [sizeof (struct {...})];
extern int dummy [sizeof (struct verify_type__ {...})];
extern void dummy (int [sizeof (struct {...})]);
extern void dummy (int [sizeof (struct verify_type__ {...})]);
extern int (*dummy (void)) [sizeof (struct {...})];
extern int (*dummy (void)) [sizeof (struct verify_type__ {...})];
In the second and sixth case, the struct type is exported to the
outer scope; two such declarations therefore collide. GCC warns
about the first, third, and fourth cases. So the only remaining
possibility is the fifth case:
extern int (*dummy (void)) [sizeof (struct {...})];
* This implementation exploits the fact that GCC does not warn about
the last declaration mentioned above. If a future version of GCC
introduces a warning for this, the problem could be worked around
by using code specialized to GCC, e.g.,:
#if 4 <= __GNUC__
# define verify(R) \
extern int (* verify_function__ (void)) \
[__builtin_constant_p (R) && (R) ? 1 : -1]
#endif
* In C++, any struct definition inside sizeof is invalid.
Use a template type to work around the problem. */
/* Verify requirement R at compile-time, as an integer constant expression.
Return 1. */
# ifdef __cplusplus
template <int w>
struct verify_type__ { unsigned int verify_error_if_negative_size__: w; };
# define verify_true(R) \
(!!sizeof (verify_type__<(R) ? 1 : -1>))
# else
# define verify_true(R) \
(!!sizeof \
(struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; }))
# endif
/* Verify requirement R at compile-time, as a declaration without a
trailing ';'. */
# define verify(R) extern int (* verify_function__ (void)) [verify_true (R)]
#endif
+2 -3
View File
@@ -1,6 +1,6 @@
/* Report a memory allocation failure and exit.
Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 Free
Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2006 Free
Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -30,7 +30,6 @@
#include "gettext.h"
#define _(msgid) gettext (msgid)
#define N_(msgid) msgid
void
xalloc_die (void)
+1 -1
View File
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+1 -1
View File
@@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+22 -22
View File
@@ -1,6 +1,6 @@
/* Generate the nondeterministic finite state machine for Bison.
Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2004 Free
Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2004, 2005 Free
Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -24,6 +24,7 @@
/* See comments in state.h for the data structures that represent it.
The entry point is generate_states. */
#include <config.h>
#include "system.h"
#include <bitset.h>
@@ -66,11 +67,6 @@ state_list_append (symbol_number sym, size_t core_size, item_number *core)
fprintf (stderr, "state_list_append (state = %d, symbol = %d (%s))\n",
nstates, sym, symbols[sym]->tag);
/* If this is the endtoken, and this is not the initial state, then
this is the final state. */
if (sym == 0 && first_state)
final_state = s;
node->next = NULL;
node->state = s;
@@ -213,20 +209,20 @@ new_itemsets (state *s)
static state *
get_state (symbol_number sym, size_t core_size, item_number *core)
{
state *sp;
state *s;
if (trace_flag & trace_automaton)
fprintf (stderr, "Entering get_state, symbol = %d (%s)\n",
sym, symbols[sym]->tag);
sp = state_hash_lookup (core_size, core);
if (!sp)
sp = state_list_append (sym, core_size, core);
s = state_hash_lookup (core_size, core);
if (!s)
s = state_list_append (sym, core_size, core);
if (trace_flag & trace_automaton)
fprintf (stderr, "Exiting get_state => %d\n", sp->number);
fprintf (stderr, "Exiting get_state => %d\n", s->number);
return sp;
return s;
}
/*---------------------------------------------------------------.
@@ -278,9 +274,18 @@ save_reductions (state *s)
/* Find and count the active items that represent ends of rules. */
for (i = 0; i < nritemset; ++i)
{
int item = ritem[itemset[i]];
if (item < 0)
redset[count++] = &rules[item_number_as_rule_number (item)];
item_number item = ritem[itemset[i]];
if (item_number_is_rule_number (item))
{
rule_number r = item_number_as_rule_number (item);
redset[count++] = &rules[r];
if (r == 0)
{
/* This is "reduce 0", i.e., accept. */
assert (!final_state);
final_state = s;
}
}
}
/* Make a reductions structure and copy the data into it. */
@@ -338,9 +343,8 @@ generate_states (void)
item of this initial rule. */
state_list_append (0, 1, &initial_core);
list = first_state;
while (list)
/* States are queued when they are created; process them all. */
for (list = first_state; list; list = list->next)
{
state *s = list->state;
if (trace_flag & trace_automaton)
@@ -362,10 +366,6 @@ generate_states (void)
/* Create the shifts structures for the shifts to those states,
now that the state numbers transitioning to are known. */
state_transitions_set (s, nshifts, shiftset);
/* states are queued when they are created; process them all.
*/
list = list->next;
}
/* discard various storage */
+4 -2
View File
@@ -53,8 +53,8 @@ bison_SOURCES = \
reader.c reader.h \
reduce.c reduce.h \
relation.c relation.h \
scan-gram.l \
scan-skel.h scan-skel.l \
scan-gram-c.c \
scan-skel-c.c scan-skel.h \
state.c state.h \
symlist.c symlist.h \
symtab.c symtab.h \
@@ -64,6 +64,8 @@ bison_SOURCES = \
vcg.c vcg.h \
vcg_defaults.h
EXTRA_bison_SOURCES = scan-skel.l scan-gram.l
BUILT_SOURCES = scan-skel.c scan-gram.c parse-gram.c parse-gram.h
MOSTLYCLEANFILES = yacc
+19 -12
View File
@@ -42,8 +42,8 @@ subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in parse-gram.c \
scan-gram.c scan-skel.c
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \
$(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/cxx.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/bison-i18n.m4 \
$(top_srcdir)/m4/c-working.m4 $(top_srcdir)/m4/cxx.m4 \
$(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \
$(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/error.m4 \
$(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \
@@ -60,11 +60,14 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \
$(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
$(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h_gl.m4 \
$(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \
$(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strndup.m4 \
$(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/subpipe.m4 \
$(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \
$(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \
$(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoul.m4 \
$(top_srcdir)/m4/strverscmp.m4 $(top_srcdir)/m4/subpipe.m4 \
$(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/uintmax_t_gl.m4 \
$(top_srcdir)/m4/ulonglong_gl.m4 \
$(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/warning.m4 \
$(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \
$(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.m4 \
$(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -82,7 +85,7 @@ am_bison_OBJECTS = LR0.$(OBJEXT) assoc.$(OBJEXT) closure.$(OBJEXT) \
muscle_tab.$(OBJEXT) nullable.$(OBJEXT) output.$(OBJEXT) \
parse-gram.$(OBJEXT) print.$(OBJEXT) print_graph.$(OBJEXT) \
reader.$(OBJEXT) reduce.$(OBJEXT) relation.$(OBJEXT) \
scan-gram.$(OBJEXT) scan-skel.$(OBJEXT) state.$(OBJEXT) \
scan-gram-c.$(OBJEXT) scan-skel-c.$(OBJEXT) state.$(OBJEXT) \
symlist.$(OBJEXT) symtab.$(OBJEXT) tables.$(OBJEXT) \
uniqstr.$(OBJEXT) vcg.$(OBJEXT)
bison_OBJECTS = $(am_bison_OBJECTS)
@@ -101,14 +104,12 @@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
YLWRAP = $(top_srcdir)/build-aux/ylwrap
YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
SOURCES = $(bison_SOURCES)
DIST_SOURCES = $(bison_SOURCES)
SOURCES = $(bison_SOURCES) $(EXTRA_bison_SOURCES)
DIST_SOURCES = $(bison_SOURCES) $(EXTRA_bison_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
ALLOCA_H = @ALLOCA_H@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@@ -118,6 +119,8 @@ AUTOM4TE = @AUTOM4TE@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BISON_CXX_WORKS = @BISON_CXX_WORKS@
BISON_CXX_WORKS_FALSE = @BISON_CXX_WORKS_FALSE@
BISON_CXX_WORKS_TRUE = @BISON_CXX_WORKS_TRUE@
BISON_LOCALEDIR = @BISON_LOCALEDIR@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
@@ -178,6 +181,7 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STDBOOL_H = @STDBOOL_H@
STRIP = @STRIP@
UNISTD_H = @UNISTD_H@
USE_NLS = @USE_NLS@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
@@ -261,8 +265,8 @@ bison_SOURCES = \
reader.c reader.h \
reduce.c reduce.h \
relation.c relation.h \
scan-gram.l \
scan-skel.h scan-skel.l \
scan-gram-c.c \
scan-skel-c.c scan-skel.h \
state.c state.h \
symlist.c symlist.h \
symtab.c symtab.h \
@@ -272,6 +276,7 @@ bison_SOURCES = \
vcg.c vcg.h \
vcg_defaults.h
EXTRA_bison_SOURCES = scan-skel.l scan-gram.l
BUILT_SOURCES = scan-skel.c scan-gram.c parse-gram.c parse-gram.h
MOSTLYCLEANFILES = yacc
all: $(BUILT_SOURCES)
@@ -381,7 +386,9 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reader.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reduce.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/relation.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan-gram-c.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan-gram.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan-skel-c.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan-skel.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/state.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symlist.Po@am__quote@
+5 -2
View File
@@ -1,5 +1,5 @@
/* Associativity information.
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -18,6 +18,7 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include <config.h>
#include "system.h"
#include "assoc.h"
@@ -28,6 +29,9 @@ assoc_to_string (assoc a)
{
switch (a)
{
default:
abort ();
case undef_assoc:
return "undefined associativity";
@@ -40,5 +44,4 @@ assoc_to_string (assoc a)
case non_assoc:
return "%nonassoc";
}
return NULL;
}
+2 -2
View File
@@ -1,5 +1,5 @@
/* Associativity information.
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2006 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -30,6 +30,6 @@ typedef enum
non_assoc
} assoc;
char const *assoc_to_string (assoc);
char const *assoc_to_string (assoc a);
#endif /* !ASSOC_H_ */
+3 -2
View File
@@ -1,7 +1,7 @@
/* Closures for Bison
Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004 Free Software
Foundation, Inc.
Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004, 2005 Free
Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -20,6 +20,7 @@
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#include <config.h>
#include "system.h"
#include <bitset.h>
+3 -1
View File
@@ -1,5 +1,6 @@
/* Declaration for error-reporting function for Bison.
Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
Copyright (C) 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -19,6 +20,7 @@
/* Based on error.c and error.h,
written by David MacKenzie <djm@gnu.ai.mit.edu>. */
#include <config.h>
#include "system.h"
#include <stdarg.h>
+24 -18
View File
@@ -1,6 +1,6 @@
/* Find and resolve or report look-ahead conflicts for bison,
Copyright (C) 1984, 1989, 1992, 2000, 2001, 2002, 2003, 2004
Copyright (C) 1984, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -20,6 +20,7 @@
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#include <config.h>
#include "system.h"
#include <bitset.h>
@@ -39,7 +40,7 @@
int expected_sr_conflicts = -1;
int expected_rr_conflicts = -1;
static char *conflicts;
struct obstack solved_conflicts_obstack;
static struct obstack solved_conflicts_obstack;
static bitset shift_set;
static bitset look_ahead_set;
@@ -215,6 +216,9 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors)
switch (symbols[i]->assoc)
{
default:
abort ();
case right_assoc:
log_resolution (redrule, i, right_resolution);
flush_reduce (look_ahead_tokens, i);
@@ -232,9 +236,6 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors)
/* Record an explicit error for this token. */
errors[nerrs++] = symbols[i];
break;
case undef_assoc:
abort ();
}
}
@@ -464,11 +465,13 @@ conflicts_print (void)
/* Is the number of SR conflicts OK? Either EXPECTED_CONFLICTS is
not set, and then we want 0 SR, or else it is specified, in which
case we want equality. */
bool src_ok = false;
bool rrc_ok = false;
bool src_ok;
bool rrc_ok;
int src_total = 0;
int rrc_total = 0;
int src_expected;
int rrc_expected;
/* Conflicts by state. */
{
@@ -488,33 +491,36 @@ conflicts_print (void)
expected_rr_conflicts = -1;
}
src_ok =
src_total == (expected_sr_conflicts == -1 ? 0 : expected_sr_conflicts);
rrc_ok =
rrc_total == (expected_rr_conflicts == -1 ? 0 : expected_rr_conflicts);
src_expected = expected_sr_conflicts == -1 ? 0 : expected_sr_conflicts;
rrc_expected = expected_rr_conflicts == -1 ? 0 : expected_rr_conflicts;
src_ok = src_total == src_expected;
rrc_ok = rrc_total == rrc_expected;
/* If there are as many RR conflicts and SR conflicts as
expected, then there is nothing to report. */
if (rrc_ok && src_ok)
if (rrc_ok & src_ok)
return;
/* Report the total number of conflicts on STDERR. */
if (src_total | rrc_total)
{
if (! yacc_flag)
fprintf (stderr, "%s: ", current_file);
conflict_report (stderr, src_total, rrc_total);
}
if (expected_sr_conflicts != -1 || expected_rr_conflicts != -1)
{
int sr = expected_sr_conflicts == -1 ? 0 : expected_sr_conflicts;
int rr = expected_rr_conflicts == -1 ? 0 : expected_rr_conflicts;
if (! src_ok)
warn (ngettext ("expected %d shift/reduce conflict",
complain (ngettext ("expected %d shift/reduce conflict",
"expected %d shift/reduce conflicts",
sr), sr);
src_expected),
src_expected);
if (! rrc_ok)
warn (ngettext ("expected %d reduce/reduce conflict",
complain (ngettext ("expected %d reduce/reduce conflict",
"expected %d reduce/reduce conflicts",
rr), rr);
rrc_expected),
rrc_expected);
}
}
+3 -3
View File
@@ -1,7 +1,7 @@
/* Match rules with nonterminals for bison,
Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003 Free Software
Foundation, Inc.
Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003, 2005 Free
Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -20,7 +20,7 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include <config.h>
#include "system.h"
#include "getargs.h"
+55 -52
View File
@@ -20,7 +20,7 @@
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#include <config.h>
#include "system.h"
#include <error.h>
@@ -29,16 +29,12 @@
#include <xstrndup.h>
#include "complain.h"
#include "dirname.h"
#include "files.h"
#include "getargs.h"
#include "gram.h"
#include "stdio-safer.h"
/* From basename.c. Almost a lie, as it returns a char *. */
const char *base_name (char const *name);
FILE *finput = NULL;
struct obstack pre_prologue_obstack;
struct obstack post_prologue_obstack;
@@ -49,21 +45,36 @@ struct obstack post_prologue_obstack;
NULL), then the %directive is ignored. As a result, %name-prefix,
for instance, will not be honored. */
char *spec_outfile = NULL; /* for -o. */
char *spec_file_prefix = NULL; /* for -b. */
const char *spec_name_prefix = NULL; /* for -p. */
char *spec_verbose_file = NULL; /* for --verbose. */
char *spec_graph_file = NULL; /* for -g. */
char *spec_defines_file = NULL; /* for --defines. */
char *parser_file_name = NULL;
char const *spec_outfile = NULL; /* for -o. */
char const *spec_file_prefix = NULL; /* for -b. */
char const *spec_name_prefix = NULL; /* for -p. */
char const *spec_verbose_file = NULL; /* for --verbose. */
char const *spec_graph_file = NULL; /* for -g. */
char const *spec_defines_file = NULL; /* for --defines. */
char const *parser_file_name;
uniqstr grammar_file = NULL;
uniqstr current_file = NULL;
static char *full_base_name = NULL;
/* If --output=dir/foo.c was specified,
DIR_PREFIX is `dir/' and ALL_BUT_EXT and ALL_BUT_TAB_EXT are `dir/foo'.
/* Prefix used to generate output file names. */
char *short_base_name = NULL;
If --output=dir/foo.tab.c was specified, DIR_PREFIX is `dir/',
ALL_BUT_EXT is `dir/foo.tab', and ALL_BUT_TAB_EXT is `dir/foo'.
If --output was not specified but --file-prefix=dir/foo was specified,
ALL_BUT_EXT = `foo.tab' and ALL_BUT_TAB_EXT = `foo'.
If neither --output nor --file was specified but the input grammar
is name dir/foo.y, ALL_BUT_EXT and ALL_BUT_TAB_EXT are `foo'.
If neither --output nor --file was specified, DIR_PREFIX is the
empty string (meaning the current directory); otherwise it is
`dir/'. */
static char const *all_but_ext;
static char const *all_but_tab_ext;
char const *dir_prefix;
/* C source file extension (the parser source). */
static char const *src_extension = NULL;
@@ -121,9 +132,9 @@ xfclose (FILE *ptr)
}
/*---------------------------------------------------------------------.
| Compute FULL_BASE_NAME, SHORT_BASE_NAME and output files extensions. |
`---------------------------------------------------------------------*/
/*------------------------------------------------------------------.
| Compute ALL_BUT_EXT, ALL_BUT_TAB_EXT and output files extensions. |
`------------------------------------------------------------------*/
/* Replace all characters FROM by TO in the string IN.
and returns a new allocated string. */
@@ -218,29 +229,27 @@ file_name_split (const char *file_name,
static void
compute_base_names (void)
compute_file_name_parts (void)
{
const char *base, *tab, *ext;
/* If --output=foo.c was specified (SPEC_OUTFILE == foo.c),
FULL_BASE_NAME and SHORT_BASE_NAME are `foo'.
If --output=foo.tab.c was specified, FULL_BASE_NAME is `foo.tab'
and SHORT_BASE_NAME is `foo'.
/* Compute ALL_BUT_EXT and ALL_BUT_TAB_EXT from SPEC_OUTFILE
or GRAMMAR_FILE.
The precise -o name will be used for FTABLE. For other output
files, remove the ".c" or ".tab.c" suffix. */
if (spec_outfile)
{
file_name_split (spec_outfile, &base, &tab, &ext);
dir_prefix = xstrndup (spec_outfile, base - spec_outfile);
/* The full base name goes up the EXT, excluding it. */
full_base_name =
/* ALL_BUT_EXT goes up the EXT, excluding it. */
all_but_ext =
xstrndup (spec_outfile,
(strlen (spec_outfile) - (ext ? strlen (ext) : 0)));
/* The short base name goes up to TAB, excluding it. */
short_base_name =
/* ALL_BUT_TAB_EXT goes up to TAB, excluding it. */
all_but_tab_ext =
xstrndup (spec_outfile,
(strlen (spec_outfile)
- (tab ? strlen (tab) : (ext ? strlen (ext) : 0))));
@@ -248,40 +257,34 @@ compute_base_names (void)
if (ext)
compute_exts_from_src (ext);
}
/* If --file-prefix=foo was specified, FULL_BASE_NAME = `foo.tab'
and SHORT_BASE_NAME = `foo'.
Construct names from it. */
else
{
file_name_split (grammar_file, &base, &tab, &ext);
if (spec_file_prefix)
{
/* If --file-prefix=foo was specified, SHORT_BASE_NAME =
`foo'. */
short_base_name = xstrdup (spec_file_prefix);
/* If --file-prefix=foo was specified, ALL_BUT_TAB_EXT = `foo'. */
dir_prefix = xstrndup (grammar_file, base - grammar_file);
all_but_tab_ext = xstrdup (spec_file_prefix);
}
else if (yacc_flag)
{
/* If --yacc, then the output is `y.tab.c'. */
short_base_name = xstrdup ("y");
dir_prefix = "";
all_but_tab_ext = "y";
}
else
{
/* Otherwise, the short base name is computed from the input
/* Otherwise, ALL_BUT_TAB_EXT is computed from the input
grammar: `foo/bar.yy' => `bar'. */
file_name_split (grammar_file, &base, &tab, &ext);
short_base_name =
xstrndup (base,
(strlen (base) - (ext ? strlen (ext) : 0)));
dir_prefix = "";
all_but_tab_ext =
xstrndup (base, (strlen (base) - (ext ? strlen (ext) : 0)));
}
full_base_name = xmalloc (strlen (short_base_name)
+ strlen (TAB_EXT) + 1);
stpcpy (stpcpy (full_base_name, short_base_name), TAB_EXT);
all_but_ext = concat2 (all_but_tab_ext, TAB_EXT);
/* Compute the extensions from the grammar file name. */
file_name_split (grammar_file, &base, &tab, &ext);
if (ext && !yacc_flag)
compute_exts_from_gf (ext);
}
@@ -299,7 +302,7 @@ compute_output_file_names (void)
int j;
int names = 0;
compute_base_names ();
compute_file_name_parts ();
/* If not yet done. */
if (!src_extension)
@@ -308,25 +311,25 @@ compute_output_file_names (void)
header_extension = ".h";
name[names++] = parser_file_name =
spec_outfile ? spec_outfile : concat2 (full_base_name, src_extension);
spec_outfile ? spec_outfile : concat2 (all_but_ext, src_extension);
if (defines_flag)
{
if (! spec_defines_file)
spec_defines_file = concat2 (full_base_name, header_extension);
spec_defines_file = concat2 (all_but_ext, header_extension);
name[names++] = spec_defines_file;
}
if (graph_flag)
{
if (! spec_graph_file)
spec_graph_file = concat2 (short_base_name, ".vcg");
spec_graph_file = concat2 (all_but_tab_ext, ".vcg");
name[names++] = spec_graph_file;
}
if (report_flag)
{
spec_verbose_file = concat2 (short_base_name, OUTPUT_EXT);
spec_verbose_file = concat2 (all_but_tab_ext, OUTPUT_EXT);
name[names++] = spec_verbose_file;
}
+8 -11
View File
@@ -24,28 +24,28 @@
# include "uniqstr.h"
/* File name specified with -o for the output file, or 0 if no -o. */
extern char *spec_outfile;
extern char const *spec_outfile;
/* File name for the parser (i.e., the one above, or its default.) */
extern char *parser_file_name;
extern char const *parser_file_name;
/* Symbol prefix specified with -p, or 0 if no -p. */
extern const char *spec_name_prefix;
/* File name prefix specified with -b, or 0 if no -b. */
extern char *spec_file_prefix;
extern char const *spec_file_prefix;
/* --verbose. */
extern char *spec_verbose_file;
extern char const *spec_verbose_file;
/* File name specified for the output VCG graph. */
extern char *spec_graph_file;
extern char const *spec_graph_file;
/* File name specified with --defines. */
extern char *spec_defines_file;
extern char const *spec_defines_file;
/* Read grammar specifications. */
extern FILE *finput;
/* Directory prefix of output file names. */
extern char const *dir_prefix;
/* If semantic parser, output a .h file that defines YYSTYPE... */
@@ -65,7 +65,4 @@ void compute_output_file_names (void);
FILE *xfopen (const char *name, const char *mode);
void xfclose (FILE *ptr);
/* Prefix used to generate output file names. */
extern char *short_base_name;
#endif /* !FILES_H_ */
+15 -9
View File
@@ -1,7 +1,7 @@
/* Parse command line arguments for Bison.
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
2005, 2006 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -20,6 +20,7 @@
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#include <config.h>
#include "system.h"
#include <argmatch.h>
@@ -45,19 +46,22 @@
bool debug_flag;
bool defines_flag;
bool graph_flag;
bool locations_flag;
bool no_lines_flag;
bool no_parser_flag;
int report_flag = report_none;
bool token_table_flag;
bool yacc_flag; /* for -y */
bool graph_flag;
int trace_flag = trace_none;
bool error_verbose = false;
bool nondeterministic_parser = false;
bool glr_parser = false;
bool pure_parser = false;
int report_flag = report_none;
int trace_flag = trace_none;
const char *skeleton = NULL;
const char *include = NULL;
@@ -80,7 +84,8 @@ static const char * const trace_args[] =
"grammar - reading, reducing of the grammar",
"resource - memory consumption (where available)",
"sets - grammar sets: firsts, nullable etc.",
"tools - m4 invocation and preserve the temporary file",
"tools - m4 invocation",
"m4 - m4 traces",
"skeleton - skeleton postprocessing",
"time - time consumption",
"all - all of the above",
@@ -98,16 +103,17 @@ static const int trace_types[] =
trace_resource,
trace_sets,
trace_tools,
trace_m4,
trace_skeleton,
trace_time,
trace_all
};
ARGMATCH_VERIFY (trace_args, trace_types);
static void
trace_argmatch (char *args)
{
verify (trace_constraint, ARGMATCH_CONSTRAINT (trace_args, trace_types));
if (args)
{
args = strtok (args, ",");
@@ -156,11 +162,11 @@ static const int report_types[] =
report_all
};
ARGMATCH_VERIFY (report_args, report_types);
static void
report_argmatch (char *args)
{
verify (report_constraint, ARGMATCH_CONSTRAINT (report_args, report_types));
args = strtok (args, ",");
do
{
@@ -270,7 +276,7 @@ version (void)
putc ('\n', stdout);
fprintf (stdout,
_("Copyright (C) %d Free Software Foundation, Inc.\n"), 2005);
_("Copyright (C) %d Free Software Foundation, Inc.\n"), 2006);
fputs (_("\
This is free software; see the source for copying conditions. There is NO\n\
+6 -2
View File
@@ -1,5 +1,5 @@
/* Parse command line arguments for bison.
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -32,13 +32,16 @@ extern char const *include;
extern bool debug_flag; /* for -t */
extern bool defines_flag; /* for -d */
extern bool graph_flag; /* for -g */
extern bool locations_flag;
extern bool no_lines_flag; /* for -l */
extern bool no_parser_flag; /* for -n */
extern bool token_table_flag; /* for -k */
extern bool graph_flag; /* for -g */
extern bool yacc_flag; /* for -y */
extern bool error_verbose;
/* GLR_PARSER is true if the input file says to use the GLR
(Generalized LR) parser, and to output some additional information
used by the GLR algorithm. */
@@ -70,6 +73,7 @@ enum trace
trace_grammar = 1 << 7,
trace_time = 1 << 8,
trace_skeleton = 1 << 9,
trace_m4 = 1 << 10,
trace_all = ~0
};
extern int trace_flag;

Some files were not shown because too many files have changed in this diff Show More