diff options
Diffstat (limited to 'contrib/libstdc++/src')
45 files changed, 3721 insertions, 646 deletions
diff --git a/contrib/libstdc++/src/Makefile.am b/contrib/libstdc++/src/Makefile.am index ed4c710..47f8cee 100644 --- a/contrib/libstdc++/src/Makefile.am +++ b/contrib/libstdc++/src/Makefile.am @@ -1,6 +1,6 @@ ## Makefile for the src subdirectory of the GNU C++ Standard library. ## -## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 +## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 ## Free Software Foundation, Inc. ## ## This file is part of the libstdc++ version 3 distribution. @@ -19,7 +19,7 @@ ## You should have received a copy of the GNU General Public License along ## with this library; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +## Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ## USA. include $(top_srcdir)/fragment.am @@ -28,17 +28,43 @@ include $(top_srcdir)/fragment.am toolexeclib_LTLIBRARIES = libstdc++.la # Symbol versioning for shared libraries. -if GLIBCXX_BUILD_VERSIONED_SHLIB -version_arg = -Wl,--version-script=libstdc++-symbol.ver -version_dep = libstdc++-symbol.ver -libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP) - cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver +if ENABLE_SYMVERS +libstdc++-symbols.ver: ${glibcxx_srcdir}/$(SYMVER_FILE) \ + $(port_specific_symbol_files) + cp ${glibcxx_srcdir}/$(SYMVER_FILE) ./libstdc++-symbols.ver if test "x$(port_specific_symbol_files)" != x; then \ - sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \ - sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \ - cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \ - rm tmp.top tmp.bottom; \ + if grep '^# Appended to version file.' \ + $(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then \ + cat $(port_specific_symbol_files) >> $@; \ + else \ + sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \ + sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \ + cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \ + rm tmp.top tmp.bottom; \ + fi; \ fi + +if ENABLE_SYMVERS_GNU +version_arg = -Wl,--version-script=libstdc++-symbols.ver +version_dep = libstdc++-symbols.ver +endif +if ENABLE_SYMVERS_GNU_NAMESPACE +version_arg = -Wl,--version-script=libstdc++-symbols.ver +version_dep = libstdc++-symbols.ver +endif +if ENABLE_SYMVERS_DARWIN +version_arg = -Wl,-exported_symbols_list,libstdc++-symbols.explist +version_dep = libstdc++-symbols.explist +libstdc++-symbols.explist : libstdc++-symbols.ver \ + ${glibcxx_srcdir}/scripts/make_exports.pl \ + $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) + perl ${glibcxx_srcdir}/scripts/make_exports.pl \ + libstdc++-symbols.ver \ + $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \ + `echo $(libstdc___la_LIBADD) | \ + sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \ + > $@ || (rm -f $@ ; exit 1) +endif else version_arg = version_dep = @@ -94,16 +120,24 @@ c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC) basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC) $(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true +if GLIBCXX_LDBL_COMPAT +ldbl_compat_sources = compatibility-ldbl.cc +else +ldbl_compat_sources = +endif + # Sources present in the src directory. sources = \ - allocator.cc \ + bitmap_allocator.cc \ + pool_allocator.cc \ + mt_allocator.cc \ codecvt.cc \ + compatibility.cc \ complex_io.cc \ ctype.cc \ debug.cc \ debug_list.cc \ functexcept.cc \ - globals_locale.cc \ globals_io.cc \ ios.cc \ ios_failure.cc \ @@ -122,20 +156,23 @@ sources = \ concept-inst.cc \ fstream-inst.cc \ ext-inst.cc \ - io-inst.cc \ + ios-inst.cc \ + iostream-inst.cc \ istream-inst.cc \ + istream.cc \ locale-inst.cc \ - locale-misc-inst.cc \ misc-inst.cc \ ostream-inst.cc \ sstream-inst.cc \ streambuf-inst.cc \ + streambuf.cc \ string-inst.cc \ valarray-inst.cc \ wlocale-inst.cc \ wstring-inst.cc \ ${host_sources} \ - ${host_sources_extra} + ${host_sources_extra} \ + ${ldbl_compat_sources} VPATH = $(top_srcdir)/src:$(top_srcdir) @@ -150,7 +187,6 @@ libstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD) libstdc___la_LDFLAGS = \ -version-info $(libtool_VERSION) ${version_arg} -lm - # Use special rules for the deprecated source files so that they find # deprecated include files. GLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include @@ -167,6 +203,15 @@ concept-inst.lo: concept-inst.cc concept-inst.o: concept-inst.cc $(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $< +if GLIBCXX_LDBL_COMPAT +# Use special rules for compatibility-ldbl.cc compilation, as we need to +# pass -mlong-double-64. +compatibility-ldbl.lo: compatibility-ldbl.cc + $(LTCXXCOMPILE) -mlong-double-64 -c $< +compatibility-ldbl.o: compatibility-ldbl.cc + $(CXXCOMPILE) -mlong-double-64 -c $< +endif + # AM_CXXFLAGS needs to be in each subdirectory so that it can be # modified in a per-library or per-sub-library way. Need to manually # set this option because CONFIG_CXXFLAGS has to be after @@ -198,7 +243,9 @@ AM_CXXFLAGS = \ # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to # attempt to infer which configuration to use LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) + +LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) # 3) We'd have a problem when building the shared libstdc++ object if # the rules automake generates would be used. We cannot allow g++ to @@ -207,7 +254,7 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \ # directory to configure libstdc++-v3 to use gcc as the C++ # compilation driver. CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ # Added bits to build debug library. diff --git a/contrib/libstdc++/src/Makefile.in b/contrib/libstdc++/src/Makefile.in index 1fae145..6000d21 100644 --- a/contrib/libstdc++/src/Makefile.in +++ b/contrib/libstdc++/src/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.8 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -20,7 +20,6 @@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 @@ -37,8 +36,78 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ - +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/fragment.am +subdir = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ + $(top_srcdir)/../config/lead-dot.m4 \ + $(top_srcdir)/../config/multi.m4 \ + $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/unwind_ipinfo.m4 \ + $(top_srcdir)/../libtool.m4 $(top_srcdir)/crossconfig.m4 \ + $(top_srcdir)/linkage.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/../config/tls.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(toolexeclibdir)" +toolexeclibLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(toolexeclib_LTLIBRARIES) +am__libstdc___la_SOURCES_DIST = bitmap_allocator.cc pool_allocator.cc \ + mt_allocator.cc codecvt.cc compatibility.cc complex_io.cc \ + ctype.cc debug.cc debug_list.cc functexcept.cc globals_io.cc \ + ios.cc ios_failure.cc ios_init.cc ios_locale.cc limits.cc \ + list.cc locale.cc locale_init.cc locale_facets.cc \ + localename.cc stdexcept.cc strstream.cc tree.cc \ + allocator-inst.cc concept-inst.cc fstream-inst.cc ext-inst.cc \ + ios-inst.cc iostream-inst.cc istream-inst.cc istream.cc \ + locale-inst.cc misc-inst.cc ostream-inst.cc sstream-inst.cc \ + streambuf-inst.cc streambuf.cc string-inst.cc valarray-inst.cc \ + wlocale-inst.cc wstring-inst.cc atomicity.cc \ + codecvt_members.cc collate_members.cc ctype_members.cc \ + messages_members.cc monetary_members.cc numeric_members.cc \ + time_members.cc basic_file.cc c++locale.cc \ + compatibility-ldbl.cc +am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \ + ctype_members.lo messages_members.lo monetary_members.lo \ + numeric_members.lo time_members.lo +am__objects_2 = basic_file.lo c++locale.lo +@GLIBCXX_LDBL_COMPAT_TRUE@am__objects_3 = compatibility-ldbl.lo +am__objects_4 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \ + codecvt.lo compatibility.lo complex_io.lo ctype.lo debug.lo \ + debug_list.lo functexcept.lo globals_io.lo ios.lo \ + ios_failure.lo ios_init.lo ios_locale.lo limits.lo list.lo \ + locale.lo locale_init.lo locale_facets.lo localename.lo \ + stdexcept.lo strstream.lo tree.lo allocator-inst.lo \ + concept-inst.lo fstream-inst.lo ext-inst.lo ios-inst.lo \ + iostream-inst.lo istream-inst.lo istream.lo locale-inst.lo \ + misc-inst.lo ostream-inst.lo sstream-inst.lo streambuf-inst.lo \ + streambuf.lo string-inst.lo valarray-inst.lo wlocale-inst.lo \ + wstring-inst.lo $(am__objects_1) $(am__objects_2) \ + $(am__objects_3) +am_libstdc___la_OBJECTS = $(am__objects_4) +libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = +am__depfiles_maybe = +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +SOURCES = $(libstdc___la_SOURCES) +DIST_SOURCES = $(am__libstdc___la_SOURCES_DIST) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) VPATH = $(top_srcdir)/src:$(top_srcdir) +ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@ ACLOCAL = @ACLOCAL@ ALLOCATOR_H = @ALLOCATOR_H@ ALLOCATOR_NAME = @ALLOCATOR_NAME@ @@ -55,7 +124,6 @@ BASIC_FILE_CC = @BASIC_FILE_CC@ BASIC_FILE_H = @BASIC_FILE_H@ CC = @CC@ CCODECVT_CC = @CCODECVT_CC@ -CCODECVT_H = @CCODECVT_H@ CCOLLATE_CC = @CCOLLATE_CC@ CCTYPE_CC = @CCTYPE_CC@ CFLAGS = @CFLAGS@ @@ -68,6 +136,7 @@ CMONEY_CC = @CMONEY_CC@ CNUMERIC_CC = @CNUMERIC_CC@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CPU_DEFINES_SRCDIR = @CPU_DEFINES_SRCDIR@ CSTDIO_H = @CSTDIO_H@ CTIME_CC = @CTIME_CC@ CTIME_H = @CTIME_H@ @@ -82,14 +151,22 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_SYMVERS_DARWIN_FALSE = @ENABLE_SYMVERS_DARWIN_FALSE@ +ENABLE_SYMVERS_DARWIN_TRUE = @ENABLE_SYMVERS_DARWIN_TRUE@ +ENABLE_SYMVERS_FALSE = @ENABLE_SYMVERS_FALSE@ +ENABLE_SYMVERS_GNU_FALSE = @ENABLE_SYMVERS_GNU_FALSE@ +ENABLE_SYMVERS_GNU_NAMESPACE_FALSE = @ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@ +ENABLE_SYMVERS_GNU_NAMESPACE_TRUE = @ENABLE_SYMVERS_GNU_NAMESPACE_TRUE@ +ENABLE_SYMVERS_GNU_TRUE = @ENABLE_SYMVERS_GNU_TRUE@ +ENABLE_SYMVERS_TRUE = @ENABLE_SYMVERS_TRUE@ +ENABLE_VISIBILITY_FALSE = @ENABLE_VISIBILITY_FALSE@ +ENABLE_VISIBILITY_TRUE = @ENABLE_VISIBILITY_TRUE@ EXEEXT = @EXEEXT@ EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@ GLIBCXX_BUILD_DEBUG_FALSE = @GLIBCXX_BUILD_DEBUG_FALSE@ GLIBCXX_BUILD_DEBUG_TRUE = @GLIBCXX_BUILD_DEBUG_TRUE@ GLIBCXX_BUILD_PCH_FALSE = @GLIBCXX_BUILD_PCH_FALSE@ GLIBCXX_BUILD_PCH_TRUE = @GLIBCXX_BUILD_PCH_TRUE@ -GLIBCXX_BUILD_VERSIONED_SHLIB_FALSE = @GLIBCXX_BUILD_VERSIONED_SHLIB_FALSE@ -GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE = @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE = @GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE@ GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE = @GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE@ GLIBCXX_C_HEADERS_C_FALSE = @GLIBCXX_C_HEADERS_C_FALSE@ @@ -99,14 +176,13 @@ GLIBCXX_C_HEADERS_C_TRUE = @GLIBCXX_C_HEADERS_C_TRUE@ GLIBCXX_HOSTED_FALSE = @GLIBCXX_HOSTED_FALSE@ GLIBCXX_HOSTED_TRUE = @GLIBCXX_HOSTED_TRUE@ GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@ -GLIBCXX_TEST_ABI_FALSE = @GLIBCXX_TEST_ABI_FALSE@ -GLIBCXX_TEST_ABI_TRUE = @GLIBCXX_TEST_ABI_TRUE@ -GLIBCXX_TEST_WCHAR_T_FALSE = @GLIBCXX_TEST_WCHAR_T_FALSE@ -GLIBCXX_TEST_WCHAR_T_TRUE = @GLIBCXX_TEST_WCHAR_T_TRUE@ +GLIBCXX_LDBL_COMPAT_FALSE = @GLIBCXX_LDBL_COMPAT_FALSE@ +GLIBCXX_LDBL_COMPAT_TRUE = @GLIBCXX_LDBL_COMPAT_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBICONV = @LIBICONV@ LIBMATHOBJS = @LIBMATHOBJS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ @@ -135,7 +211,7 @@ SECTION_LDFLAGS = @SECTION_LDFLAGS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYMVER_MAP = @SYMVER_MAP@ +SYMVER_FILE = @SYMVER_FILE@ TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ @@ -148,6 +224,8 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ baseline_dir = @baseline_dir@ bindir = @bindir@ build = @build@ @@ -184,6 +262,7 @@ libexecdir = @libexecdir@ libtool_VERSION = @libtool_VERSION@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ multi_basedir = @multi_basedir@ oldincludedir = @oldincludedir@ port_specific_symbol_files = @port_specific_symbol_files@ @@ -199,12 +278,12 @@ target_os = @target_os@ target_vendor = @target_vendor@ toplevel_srcdir = @toplevel_srcdir@ +# May be used by various substitution variables. +gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) MAINT_CHARSET = latin1 - mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs PWD_COMMAND = $${PWDCMD-pwd} STAMP = echo timestamp > - toolexecdir = $(glibcxx_toolexecdir) toolexeclibdir = $(glibcxx_toolexeclibdir) @@ -222,12 +301,14 @@ AM_CPPFLAGS = $(GLIBCXX_INCLUDES) # Cross compiler support. toolexeclib_LTLIBRARIES = libstdc++.la - -# Symbol versioning for shared libraries. -@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@version_arg = -Wl,--version-script=libstdc++-symbol.ver -@GLIBCXX_BUILD_VERSIONED_SHLIB_FALSE@version_arg = -@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@version_dep = libstdc++-symbol.ver -@GLIBCXX_BUILD_VERSIONED_SHLIB_FALSE@version_dep = +@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@version_arg = -Wl,-exported_symbols_list,libstdc++-symbols.explist +@ENABLE_SYMVERS_FALSE@version_arg = +@ENABLE_SYMVERS_GNU_NAMESPACE_TRUE@@ENABLE_SYMVERS_TRUE@version_arg = -Wl,--version-script=libstdc++-symbols.ver +@ENABLE_SYMVERS_GNU_TRUE@@ENABLE_SYMVERS_TRUE@version_arg = -Wl,--version-script=libstdc++-symbols.ver +@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@version_dep = libstdc++-symbols.explist +@ENABLE_SYMVERS_FALSE@version_dep = +@ENABLE_SYMVERS_GNU_NAMESPACE_TRUE@@ENABLE_SYMVERS_TRUE@version_dep = libstdc++-symbols.ver +@ENABLE_SYMVERS_GNU_TRUE@@ENABLE_SYMVERS_TRUE@version_dep = libstdc++-symbols.ver # Source files linked in via configuration/make substitution for a # particular host. @@ -241,7 +322,6 @@ host_sources = \ numeric_members.cc \ time_members.cc - atomicity_file = ${glibcxx_srcdir}/$(ATOMICITY_SRCDIR)/atomicity.h # Source files linked in via configuration/make substitution for a @@ -250,17 +330,21 @@ host_sources_extra = \ basic_file.cc \ c++locale.cc +@GLIBCXX_LDBL_COMPAT_FALSE@ldbl_compat_sources = +@GLIBCXX_LDBL_COMPAT_TRUE@ldbl_compat_sources = compatibility-ldbl.cc # Sources present in the src directory. sources = \ - allocator.cc \ + bitmap_allocator.cc \ + pool_allocator.cc \ + mt_allocator.cc \ codecvt.cc \ + compatibility.cc \ complex_io.cc \ ctype.cc \ debug.cc \ debug_list.cc \ functexcept.cc \ - globals_locale.cc \ globals_io.cc \ ios.cc \ ios_failure.cc \ @@ -279,31 +363,30 @@ sources = \ concept-inst.cc \ fstream-inst.cc \ ext-inst.cc \ - io-inst.cc \ + ios-inst.cc \ + iostream-inst.cc \ istream-inst.cc \ + istream.cc \ locale-inst.cc \ - locale-misc-inst.cc \ misc-inst.cc \ ostream-inst.cc \ sstream-inst.cc \ streambuf-inst.cc \ + streambuf.cc \ string-inst.cc \ valarray-inst.cc \ wlocale-inst.cc \ wstring-inst.cc \ ${host_sources} \ - ${host_sources_extra} - + ${host_sources_extra} \ + ${ldbl_compat_sources} libstdc___la_SOURCES = $(sources) - libstdc___la_LIBADD = \ $(top_builddir)/libmath/libmath.la \ $(top_builddir)/libsupc++/libsupc++convenience.la - libstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD) - libstdc___la_LDFLAGS = \ -version-info $(libtool_VERSION) ${version_arg} -lm @@ -343,8 +426,9 @@ AM_CXXFLAGS = \ # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to # attempt to infer which configuration to use LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) # 3) We'd have a problem when building the shared libstdc++ object if # the rules automake generates would be used. We cannot allow g++ to @@ -353,78 +437,66 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \ # directory to configure libstdc++-v3 to use gcc as the C++ # compilation driver. CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ - + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ debugdir = debug -subdir = src -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(toolexeclib_LTLIBRARIES) - -am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \ - ctype_members.lo messages_members.lo monetary_members.lo \ - numeric_members.lo time_members.lo -am__objects_2 = basic_file.lo c++locale.lo -am__objects_3 = allocator.lo codecvt.lo complex_io.lo ctype.lo debug.lo \ - debug_list.lo functexcept.lo globals_locale.lo globals_io.lo \ - ios.lo ios_failure.lo ios_init.lo ios_locale.lo limits.lo \ - list.lo locale.lo locale_init.lo locale_facets.lo localename.lo \ - stdexcept.lo strstream.lo tree.lo allocator-inst.lo \ - concept-inst.lo fstream-inst.lo ext-inst.lo io-inst.lo \ - istream-inst.lo locale-inst.lo locale-misc-inst.lo misc-inst.lo \ - ostream-inst.lo sstream-inst.lo streambuf-inst.lo \ - string-inst.lo valarray-inst.lo wlocale-inst.lo wstring-inst.lo \ - $(am__objects_1) $(am__objects_2) -am_libstdc___la_OBJECTS = $(am__objects_3) -libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = -am__depfiles_maybe = -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -DIST_SOURCES = $(libstdc___la_SOURCES) -DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/fragment.am \ - Makefile.am -SOURCES = $(libstdc___la_SOURCES) - all: all-am .SUFFIXES: .SUFFIXES: .cc .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/fragment.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/fragment.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps src/Makefile'; \ cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) -toolexeclibLTLIBRARIES_INSTALL = $(INSTALL) + $(AUTOMAKE) --foreign --ignore-deps src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir) + test -z "$(toolexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(toolexeclibdir)" @list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=install $(toolexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(toolexeclibdir)/$$f"; \ - $(LIBTOOL) --mode=install $(toolexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(toolexeclibdir)/$$f; \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(toolexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(toolexeclibdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(toolexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(toolexeclibdir)/$$f"; \ else :; fi; \ done uninstall-toolexeclibLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(toolexeclibdir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(toolexeclibdir)/$$p; \ + @set -x; list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(toolexeclibdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(toolexeclibdir)/$$p"; \ done clean-toolexeclibLTLIBRARIES: -test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES) @list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ + test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done @@ -432,19 +504,19 @@ libstdc++.la: $(libstdc___la_OBJECTS) $(libstdc___la_DEPENDENCIES) $(CXXLINK) -rpath $(toolexeclibdir) $(libstdc___la_LDFLAGS) $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c .cc.o: - $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + $(CXXCOMPILE) -c -o $@ $< .cc.obj: - $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cc.lo: - $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -456,14 +528,6 @@ distclean-libtool: -rm -f libtool uninstall-info-am: -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -472,6 +536,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique +tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -483,10 +548,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -509,13 +575,9 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - $(mkinstalldirs) $(distdir)/.. + $(mkdir_p) $(distdir)/.. @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ @@ -527,7 +589,7 @@ distdir: $(DISTFILES) dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ @@ -545,9 +607,10 @@ distdir: $(DISTFILES) check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) all-local - installdirs: - $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir) + for dir in "$(DESTDIR)$(toolexeclibdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done install: install-am install-exec: install-exec-am install-data: install-data-am @@ -559,7 +622,7 @@ install-am: all-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -567,7 +630,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -586,6 +649,8 @@ dvi: dvi-am dvi-am: +html: html-am + info: info-am info-am: @@ -621,25 +686,43 @@ uninstall-am: uninstall-info-am uninstall-toolexeclibLTLIBRARIES .PHONY: CTAGS GTAGS all all-am all-local check check-am clean \ clean-generic clean-libtool clean-toolexeclibLTLIBRARIES ctags \ - distclean distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-data-local \ - install-exec install-exec-am install-info install-info-am \ - install-man install-strip install-toolexeclibLTLIBRARIES \ - installcheck installcheck-am installdirs maintainer-clean \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-data-local install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip install-toolexeclibLTLIBRARIES installcheck \ + installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-info-am \ uninstall-toolexeclibLTLIBRARIES -@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP) -@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver -@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ if test "x$(port_specific_symbol_files)" != x; then \ -@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \ -@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \ -@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \ -@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ rm tmp.top tmp.bottom; \ -@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ fi + +# Symbol versioning for shared libraries. +@ENABLE_SYMVERS_TRUE@libstdc++-symbols.ver: ${glibcxx_srcdir}/$(SYMVER_FILE) \ +@ENABLE_SYMVERS_TRUE@ $(port_specific_symbol_files) +@ENABLE_SYMVERS_TRUE@ cp ${glibcxx_srcdir}/$(SYMVER_FILE) ./libstdc++-symbols.ver +@ENABLE_SYMVERS_TRUE@ if test "x$(port_specific_symbol_files)" != x; then \ +@ENABLE_SYMVERS_TRUE@ if grep '^# Appended to version file.' \ +@ENABLE_SYMVERS_TRUE@ $(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then \ +@ENABLE_SYMVERS_TRUE@ cat $(port_specific_symbol_files) >> $@; \ +@ENABLE_SYMVERS_TRUE@ else \ +@ENABLE_SYMVERS_TRUE@ sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \ +@ENABLE_SYMVERS_TRUE@ sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \ +@ENABLE_SYMVERS_TRUE@ cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \ +@ENABLE_SYMVERS_TRUE@ rm tmp.top tmp.bottom; \ +@ENABLE_SYMVERS_TRUE@ fi; \ +@ENABLE_SYMVERS_TRUE@ fi +@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@libstdc++-symbols.explist : libstdc++-symbols.ver \ +@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@ ${glibcxx_srcdir}/scripts/make_exports.pl \ +@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@ $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) +@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@ perl ${glibcxx_srcdir}/scripts/make_exports.pl \ +@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@ libstdc++-symbols.ver \ +@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@ $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \ +@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@ `echo $(libstdc___la_LIBADD) | \ +@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@ sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \ +@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@ > $@ || (rm -f $@ ; exit 1) codecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC) $(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true @@ -682,6 +765,13 @@ concept-inst.lo: concept-inst.cc concept-inst.o: concept-inst.cc $(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $< +# Use special rules for compatibility-ldbl.cc compilation, as we need to +# pass -mlong-double-64. +@GLIBCXX_LDBL_COMPAT_TRUE@compatibility-ldbl.lo: compatibility-ldbl.cc +@GLIBCXX_LDBL_COMPAT_TRUE@ $(LTCXXCOMPILE) -mlong-double-64 -c $< +@GLIBCXX_LDBL_COMPAT_TRUE@compatibility-ldbl.o: compatibility-ldbl.cc +@GLIBCXX_LDBL_COMPAT_TRUE@ $(CXXCOMPILE) -mlong-double-64 -c $< + # Added bits to build debug library. @GLIBCXX_BUILD_DEBUG_TRUE@all-local: build_debug @GLIBCXX_BUILD_DEBUG_TRUE@install-data-local: install_debug diff --git a/contrib/libstdc++/src/allocator-inst.cc b/contrib/libstdc++/src/allocator-inst.cc index 40d7049..aca019c 100644 --- a/contrib/libstdc++/src/allocator-inst.cc +++ b/contrib/libstdc++/src/allocator-inst.cc @@ -1,6 +1,7 @@ // Explicit instantiation file. -// Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +// Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -15,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -32,20 +33,10 @@ // #include <memory> -#include <ext/mt_allocator.h> -#include <ext/pool_allocator.h> -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + template class allocator<char>; template class allocator<wchar_t>; -} // namespace std - -namespace __gnu_cxx -{ - template class __mt_alloc<char>; - template class __mt_alloc<wchar_t>; - template class __pool_alloc<char>; - template class __pool_alloc<wchar_t>; -} // namespace __gnu_cxx +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/bitmap_allocator.cc b/contrib/libstdc++/src/bitmap_allocator.cc new file mode 100644 index 0000000..46b4d3c --- /dev/null +++ b/contrib/libstdc++/src/bitmap_allocator.cc @@ -0,0 +1,126 @@ +// Bitmap Allocator. Out of line function definitions. -*- C++ -*- + +// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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 library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <ext/bitmap_allocator.h> + +_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + + namespace __detail + { + template class __mini_vector< + std::pair<bitmap_allocator<char>::_Alloc_block*, + bitmap_allocator<char>::_Alloc_block*> >; + + template class __mini_vector< + std::pair<bitmap_allocator<wchar_t>::_Alloc_block*, + bitmap_allocator<wchar_t>::_Alloc_block*> >; + + template class __mini_vector<size_t*>; + + template size_t** __lower_bound(size_t**, size_t**, size_t const&, + free_list::_LT_pointer_compare); + } + + size_t* + free_list:: + _M_get(size_t __sz) throw(std::bad_alloc) + { +#if defined __GTHREADS + __mutex_type& __bfl_mutex = _M_get_mutex(); +#endif + const vector_type& __free_list = _M_get_free_list(); + using __gnu_cxx::__detail::__lower_bound; + iterator __tmp = __lower_bound(__free_list.begin(), __free_list.end(), + __sz, _LT_pointer_compare()); + + if (__tmp == __free_list.end() || !_M_should_i_give(**__tmp, __sz)) + { + // We release the lock here, because operator new is + // guaranteed to be thread-safe by the underlying + // implementation. +#if defined __GTHREADS + __bfl_mutex.unlock(); +#endif + // Try twice to get the memory: once directly, and the 2nd + // time after clearing the free list. If both fail, then throw + // std::bad_alloc(). + int __ctr = 2; + while (__ctr) + { + size_t* __ret = 0; + --__ctr; + try + { + __ret = reinterpret_cast<size_t*> + (::operator new(__sz + sizeof(size_t))); + } + catch(...) + { + this->_M_clear(); + } + if (!__ret) + continue; + *__ret = __sz; + return __ret + 1; + } + std::__throw_bad_alloc(); + } + else + { + size_t* __ret = *__tmp; + _M_get_free_list().erase(__tmp); +#if defined __GTHREADS + __bfl_mutex.unlock(); +#endif + return __ret + 1; + } + } + + void + free_list:: + _M_clear() + { +#if defined __GTHREADS + __gnu_cxx::__scoped_lock __bfl_lock(_M_get_mutex()); +#endif + vector_type& __free_list = _M_get_free_list(); + iterator __iter = __free_list.begin(); + while (__iter != __free_list.end()) + { + ::operator delete((void*)*__iter); + ++__iter; + } + __free_list.clear(); + } + + // Instantiations. + template class bitmap_allocator<char>; + template class bitmap_allocator<wchar_t>; + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/codecvt.cc b/contrib/libstdc++/src/codecvt.cc index 2010593..e602c75 100644 --- a/contrib/libstdc++/src/codecvt.cc +++ b/contrib/libstdc++/src/codecvt.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc. +// Copyright (C) 2000, 2002, 2004, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -25,12 +25,12 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -// Written by Benjamin Kosnik <bkoz@cygnus.com> +// Written by Benjamin Kosnik <bkoz@redhat.com> #include <locale> -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + // Definitions for locale::id of standard facets that are specialized. locale::id codecvt<char, char, mbstate_t>::id; @@ -38,11 +38,6 @@ namespace std locale::id codecvt<wchar_t, char, mbstate_t>::id; #endif -#ifdef _GLIBCXX_USE___ENC_TRAITS - // Definitions for static const data members of __enc_traits. - const int __enc_traits::_S_max_size; -#endif - codecvt<char, char, mbstate_t>:: codecvt(size_t __refs) : __codecvt_abstract_base<char, char, mbstate_t>(__refs), @@ -154,4 +149,5 @@ namespace std do_always_noconv() const throw() { return false; } #endif // _GLIBCXX_USE_WCHAR_T -} // namespace std + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/compatibility-ldbl.cc b/contrib/libstdc++/src/compatibility-ldbl.cc new file mode 100644 index 0000000..108790e --- /dev/null +++ b/contrib/libstdc++/src/compatibility-ldbl.cc @@ -0,0 +1,73 @@ +// Compatibility symbols for -mlong-double-64 compatibility -*- C++ -*- + +// Copyright (C) 2006 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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 library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <locale> + +#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT + +#ifdef __LONG_DOUBLE_128__ +#error "compatibility-ldbl.cc must be compiled with -mlong-double-64" +#endif + +namespace std +{ +#define C char + template class num_get<C, istreambuf_iterator<C> >; + template class num_put<C, ostreambuf_iterator<C> >; + template class money_get<C, istreambuf_iterator<C> >; + template class money_put<C, ostreambuf_iterator<C> >; + template const num_put<C>& use_facet<num_put<C> >(const locale&); + template const num_get<C>& use_facet<num_get<C> >(const locale&); + template const money_put<C>& use_facet<money_put<C> >(const locale&); + template const money_get<C>& use_facet<money_get<C> >(const locale&); + template bool has_facet<num_put<C> >(const locale&); + template bool has_facet<num_get<C> >(const locale&); + template bool has_facet<money_put<C> >(const locale&); + template bool has_facet<money_get<C> >(const locale&); +#undef C +#ifdef _GLIBCXX_USE_WCHAR_T +#define C wchar_t + template class num_get<C, istreambuf_iterator<C> >; + template class num_put<C, ostreambuf_iterator<C> >; + template class money_get<C, istreambuf_iterator<C> >; + template class money_put<C, ostreambuf_iterator<C> >; + template const num_put<C>& use_facet<num_put<C> >(const locale&); + template const num_get<C>& use_facet<num_get<C> >(const locale&); + template const money_put<C>& use_facet<money_put<C> >(const locale&); + template const money_get<C>& use_facet<money_get<C> >(const locale&); + template bool has_facet<num_put<C> >(const locale&); + template bool has_facet<num_get<C> >(const locale&); + template bool has_facet<money_put<C> >(const locale&); + template bool has_facet<money_get<C> >(const locale&); +#undef C +#endif +} + +#endif diff --git a/contrib/libstdc++/src/compatibility.cc b/contrib/libstdc++/src/compatibility.cc new file mode 100644 index 0000000..f88fbc7 --- /dev/null +++ b/contrib/libstdc++/src/compatibility.cc @@ -0,0 +1,528 @@ +// Compatibility symbols for previous versions -*- C++ -*- + +// Copyright (C) 2005, 2006 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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 library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <bits/c++config.h> + +#if defined(_GLIBCXX_SYMVER_GNU) && defined(PIC) +#define istreambuf_iterator istreambuf_iteratorXX +#define basic_fstream basic_fstreamXX +#define basic_ifstream basic_ifstreamXX +#define basic_ofstream basic_ofstreamXX +#define _M_copy(a, b, c) _M_copyXX(a, b, c) +#define _M_move(a, b, c) _M_moveXX(a, b, c) +#define _M_assign(a, b, c) _M_assignXX(a, b, c) +#define _M_disjunct(a) _M_disjunctXX(a) +#define _M_check_length(a, b, c) _M_check_lengthXX(a, b, c) +#define _M_set_length_and_sharable(a) _M_set_length_and_sharableXX(a) +#define ignore ignoreXX +#define eq eqXX +#define _List_node_base _List_node_baseXX +#endif + +#include <string> +#include <istream> +#include <fstream> +#include <sstream> +#include <cmath> + +_GLIBCXX_BEGIN_NAMESPACE(std) + + // std::istream ignore explicit specializations. + template<> + basic_istream<char>& + basic_istream<char>:: + ignore(streamsize __n) + { + if (__n == 1) + return ignore(); + + _M_gcount = 0; + sentry __cerb(*this, true); + if (__cerb && __n > 0) + { + ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); + try + { + const int_type __eof = traits_type::eof(); + __streambuf_type* __sb = this->rdbuf(); + int_type __c = __sb->sgetc(); + + // See comment in istream.tcc. + bool __large_ignore = false; + while (true) + { + while (_M_gcount < __n + && !traits_type::eq_int_type(__c, __eof)) + { + streamsize __size = std::min(streamsize(__sb->egptr() + - __sb->gptr()), + streamsize(__n - _M_gcount)); + if (__size > 1) + { + __sb->gbump(__size); + _M_gcount += __size; + __c = __sb->sgetc(); + } + else + { + ++_M_gcount; + __c = __sb->snextc(); + } + } + if (__n == numeric_limits<streamsize>::max() + && !traits_type::eq_int_type(__c, __eof)) + { + _M_gcount = numeric_limits<streamsize>::min(); + __large_ignore = true; + } + else + break; + } + + if (__large_ignore) + _M_gcount = numeric_limits<streamsize>::max(); + + if (traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + } + catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + basic_istream<wchar_t>& + basic_istream<wchar_t>:: + ignore(streamsize __n) + { + if (__n == 1) + return ignore(); + + _M_gcount = 0; + sentry __cerb(*this, true); + if (__cerb && __n > 0) + { + ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); + try + { + const int_type __eof = traits_type::eof(); + __streambuf_type* __sb = this->rdbuf(); + int_type __c = __sb->sgetc(); + + bool __large_ignore = false; + while (true) + { + while (_M_gcount < __n + && !traits_type::eq_int_type(__c, __eof)) + { + streamsize __size = std::min(streamsize(__sb->egptr() + - __sb->gptr()), + streamsize(__n - _M_gcount)); + if (__size > 1) + { + __sb->gbump(__size); + _M_gcount += __size; + __c = __sb->sgetc(); + } + else + { + ++_M_gcount; + __c = __sb->snextc(); + } + } + if (__n == numeric_limits<streamsize>::max() + && !traits_type::eq_int_type(__c, __eof)) + { + _M_gcount = numeric_limits<streamsize>::min(); + __large_ignore = true; + } + else + break; + } + + if (__large_ignore) + _M_gcount = numeric_limits<streamsize>::max(); + + if (traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + } + catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } +#endif + +_GLIBCXX_END_NAMESPACE + + +// NB: These symbols renames should go into the shared library only, +// and only those shared libraries that support versioning. +#if defined(_GLIBCXX_SYMVER_GNU) && defined(PIC) + +/* gcc-3.4.4 +_ZNSt19istreambuf_iteratorIcSt11char_traitsIcEEppEv +_ZNSt19istreambuf_iteratorIwSt11char_traitsIwEEppEv + */ + +_GLIBCXX_BEGIN_NAMESPACE(std) + + template + istreambuf_iterator<char>& + istreambuf_iterator<char>::operator++(); + +#ifdef _GLIBCXX_USE_WCHAR_T + template + istreambuf_iterator<wchar_t>& + istreambuf_iterator<wchar_t>::operator++(); +#endif + +_GLIBCXX_END_NAMESPACE + + +/* gcc-4.0.0 +_ZNSs4_Rep26_M_set_length_and_sharableEj +_ZNSs7_M_copyEPcPKcj +_ZNSs7_M_moveEPcPKcj +_ZNSs9_M_assignEPcjc +_ZNKSs11_M_disjunctEPKc +_ZNKSs15_M_check_lengthEjjPKc +_ZNSbIwSt11char_traitsIwESaIwEE4_Rep26_M_set_length_and_sharableEj +_ZNSbIwSt11char_traitsIwESaIwEE7_M_copyEPwPKwj +_ZNSbIwSt11char_traitsIwESaIwEE7_M_moveEPwPKwj +_ZNSbIwSt11char_traitsIwESaIwEE9_M_assignEPwjw +_ZNKSbIwSt11char_traitsIwESaIwEE11_M_disjunctEPKw +_ZNKSbIwSt11char_traitsIwESaIwEE15_M_check_lengthEjjPKc + +_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv +_ZNKSt13basic_fstreamIwSt11char_traitsIwEE7is_openEv +_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv +_ZNKSt14basic_ifstreamIwSt11char_traitsIwEE7is_openEv +_ZNKSt14basic_ofstreamIcSt11char_traitsIcEE7is_openEv +_ZNKSt14basic_ofstreamIwSt11char_traitsIwEE7is_openEv + +_ZNSi6ignoreEi +_ZNSi6ignoreEv +_ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEi +_ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEv + +_ZNSt11char_traitsIcE2eqERKcS2_ +_ZNSt11char_traitsIwE2eqERKwS2_ + */ +_GLIBCXX_BEGIN_NAMESPACE(std) + + // std::char_traits is explicitly specialized + bool (* __p1)(const char&, const char&) = &char_traits<char>::eq; + + // std::string + template + void + basic_string<char>::_M_copy(char*, const char*, size_t); + + template + void + basic_string<char>::_M_move(char*, const char*, size_t); + + template + void + basic_string<char>::_M_assign(char*, size_t, char); + + template + bool + basic_string<char>::_M_disjunct(const char*) const; + + template + void + basic_string<char>::_M_check_length(size_t, size_t, const char*) const; + + template + void + basic_string<char>::_Rep::_M_set_length_and_sharable(size_t); + + + // std::istream + template + basic_istream<char>& + basic_istream<char>::ignore(); + + template + bool + basic_fstream<char>::is_open() const; + + template + bool + basic_ifstream<char>::is_open() const; + + template + bool + basic_ofstream<char>::is_open() const; + +#ifdef _GLIBCXX_USE_WCHAR_T + bool (* __p2)(const wchar_t&, const wchar_t&) = &char_traits<wchar_t>::eq; + + // std::wstring + template + void + basic_string<wchar_t>::_M_copy(wchar_t*, const wchar_t*, size_t); + + template + void + basic_string<wchar_t>::_M_move(wchar_t*, const wchar_t*, size_t); + + template + void + basic_string<wchar_t>::_M_assign(wchar_t*, size_t, wchar_t); + + template + bool + basic_string<wchar_t>::_M_disjunct(const wchar_t*) const; + + template + void + basic_string<wchar_t>::_M_check_length(size_t, size_t, + const char*) const; + + template + void + basic_string<wchar_t>::_Rep::_M_set_length_and_sharable(size_t); + + template + basic_istream<wchar_t>& + basic_istream<wchar_t>::ignore(); + + template + bool + basic_fstream<wchar_t>::is_open() const; + + template + bool + basic_ifstream<wchar_t>::is_open() const; + + template + bool + basic_ofstream<wchar_t>::is_open() const; +#endif + +_GLIBCXX_END_NAMESPACE + +// The rename syntax for default exported names is +// asm (".symver name1,exportedname@GLIBCXX_3.4") +// asm (".symver name2,exportedname@@GLIBCXX_3.4.5") +// In the future, GLIBCXX_ABI > 6 should remove all uses of +// _GLIBCXX_*_SYMVER macros in this file. + +#define _GLIBCXX_3_4_SYMVER(XXname, name) \ + extern "C" void \ + _X##name() \ + __attribute__ ((alias(#XXname))); \ + asm (".symver " "_X" #name "," #name "@GLIBCXX_3.4"); + +#define _GLIBCXX_3_4_5_SYMVER(XXname, name) \ + extern "C" void \ + _Y##name() \ + __attribute__ ((alias(#XXname))); \ + asm (".symver " "_Y" #name "," #name "@@GLIBCXX_3.4.5"); + +#define _GLIBCXX_ASM_SYMVER(cur, old, version) \ + asm (".symver " #cur "," #old "@@" #version); + +#define _GLIBCXX_APPLY_SYMVER _GLIBCXX_3_4_SYMVER +#include <bits/compatibility.h> +#undef _GLIBCXX_APPLY_SYMVER + +#define _GLIBCXX_APPLY_SYMVER _GLIBCXX_3_4_5_SYMVER +#include <bits/compatibility.h> +#undef _GLIBCXX_APPLY_SYMVER + + +/* gcc-3.4.0 +_ZN10__gnu_norm15_List_node_base4hookEPS0_; +_ZN10__gnu_norm15_List_node_base4swapERS0_S1_; +_ZN10__gnu_norm15_List_node_base6unhookEv; +_ZN10__gnu_norm15_List_node_base7reverseEv; +_ZN10__gnu_norm15_List_node_base8transferEPS0_S1_; +*/ +#include "list.cc" +_GLIBCXX_ASM_SYMVER(_ZNSt17_List_node_baseXX4hookEPS_, \ +_ZN10__gnu_norm15_List_node_base4hookEPS0_, \ +GLIBCXX_3.4) + +_GLIBCXX_ASM_SYMVER(_ZNSt17_List_node_baseXX4swapERS_S0_, \ +_ZN10__gnu_norm15_List_node_base4swapERS0_S1_, \ +GLIBCXX_3.4) + +_GLIBCXX_ASM_SYMVER(_ZNSt17_List_node_baseXX6unhookEv, \ +_ZN10__gnu_norm15_List_node_base6unhookEv, \ +GLIBCXX_3.4) + +_GLIBCXX_ASM_SYMVER(_ZNSt17_List_node_baseXX7reverseEv, \ +_ZN10__gnu_norm15_List_node_base7reverseEv, \ +GLIBCXX_3.4) + +_GLIBCXX_ASM_SYMVER(_ZNSt17_List_node_baseXX8transferEPS_S0_, \ +_ZN10__gnu_norm15_List_node_base8transferEPS0_S1_, \ +GLIBCXX_3.4) +#undef _List_node_base + +// gcc-4.1.0 +#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT +#define _GLIBCXX_MATHL_WRAPPER(name, argdecl, args, ver) \ +extern "C" double \ +__ ## name ## l_wrapper argdecl \ +{ \ + return name args; \ +} \ +asm (".symver __" #name "l_wrapper, " #name "l@" #ver) + +#define _GLIBCXX_MATHL_WRAPPER1(name, ver) \ + _GLIBCXX_MATHL_WRAPPER (name, (double x), (x), ver) + +#define _GLIBCXX_MATHL_WRAPPER2(name, ver) \ + _GLIBCXX_MATHL_WRAPPER (name, (double x, double y), (x, y), ver) + +#ifdef _GLIBCXX_HAVE_ACOSL +_GLIBCXX_MATHL_WRAPPER1 (acos, GLIBCXX_3.4.3); +#endif +#ifdef _GLIBCXX_HAVE_ASINL +_GLIBCXX_MATHL_WRAPPER1 (asin, GLIBCXX_3.4.3); +#endif +#ifdef _GLIBCXX_HAVE_ATAN2L +_GLIBCXX_MATHL_WRAPPER2 (atan2, GLIBCXX_3.4); +#endif +#ifdef _GLIBCXX_HAVE_ATANL +_GLIBCXX_MATHL_WRAPPER1 (atan, GLIBCXX_3.4.3); +#endif +#ifdef _GLIBCXX_HAVE_CEILL +_GLIBCXX_MATHL_WRAPPER1 (ceil, GLIBCXX_3.4.3); +#endif +#ifdef _GLIBCXX_HAVE_COSHL +_GLIBCXX_MATHL_WRAPPER1 (cosh, GLIBCXX_3.4); +#endif +#ifdef _GLIBCXX_HAVE_COSL +_GLIBCXX_MATHL_WRAPPER1 (cos, GLIBCXX_3.4); +#endif +#ifdef _GLIBCXX_HAVE_EXPL +_GLIBCXX_MATHL_WRAPPER1 (exp, GLIBCXX_3.4); +#endif +#ifdef _GLIBCXX_HAVE_FLOORL +_GLIBCXX_MATHL_WRAPPER1 (floor, GLIBCXX_3.4.3); +#endif +#ifdef _GLIBCXX_HAVE_FMODL +_GLIBCXX_MATHL_WRAPPER2 (fmod, GLIBCXX_3.4.3); +#endif +#ifdef _GLIBCXX_HAVE_FREXPL +_GLIBCXX_MATHL_WRAPPER (frexp, (double x, int *y), (x, y), GLIBCXX_3.4.3); +#endif +#ifdef _GLIBCXX_HAVE_HYPOTL +_GLIBCXX_MATHL_WRAPPER2 (hypot, GLIBCXX_3.4); +#endif +#ifdef _GLIBCXX_HAVE_LDEXPL +_GLIBCXX_MATHL_WRAPPER (ldexp, (double x, int y), (x, y), GLIBCXX_3.4.3); +#endif +#ifdef _GLIBCXX_HAVE_LOG10L +_GLIBCXX_MATHL_WRAPPER1 (log10, GLIBCXX_3.4); +#endif +#ifdef _GLIBCXX_HAVE_LOGL +_GLIBCXX_MATHL_WRAPPER1 (log, GLIBCXX_3.4); +#endif +#ifdef _GLIBCXX_HAVE_MODFL +_GLIBCXX_MATHL_WRAPPER (modf, (double x, double *y), (x, y), GLIBCXX_3.4.3); +#endif +#ifdef _GLIBCXX_HAVE_POWL +_GLIBCXX_MATHL_WRAPPER2 (pow, GLIBCXX_3.4); +#endif +#ifdef _GLIBCXX_HAVE_SINHL +_GLIBCXX_MATHL_WRAPPER1 (sinh, GLIBCXX_3.4); +#endif +#ifdef _GLIBCXX_HAVE_SINL +_GLIBCXX_MATHL_WRAPPER1 (sin, GLIBCXX_3.4); +#endif +#ifdef _GLIBCXX_HAVE_SQRTL +_GLIBCXX_MATHL_WRAPPER1 (sqrt, GLIBCXX_3.4); +#endif +#ifdef _GLIBCXX_HAVE_TANHL +_GLIBCXX_MATHL_WRAPPER1 (tanh, GLIBCXX_3.4); +#endif +#ifdef _GLIBCXX_HAVE_TANL +_GLIBCXX_MATHL_WRAPPER1 (tan, GLIBCXX_3.4); +#endif +#endif // _GLIBCXX_LONG_DOUBLE_COMPAT + +#endif + +#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT +extern void *_ZTVN10__cxxabiv123__fundamental_type_infoE[]; +extern void *_ZTVN10__cxxabiv119__pointer_type_infoE[]; +extern __attribute__((used, weak)) const char _ZTSe[2] = "e"; +extern __attribute__((used, weak)) const char _ZTSPe[3] = "Pe"; +extern __attribute__((used, weak)) const char _ZTSPKe[4] = "PKe"; +extern __attribute__((used, weak)) const void *_ZTIe[2] + = { (void *) &_ZTVN10__cxxabiv123__fundamental_type_infoE[2], + (void *) _ZTSe }; +extern __attribute__((used, weak)) const void *_ZTIPe[4] + = { (void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2], + (void *) _ZTSPe, (void *) 0L, (void *) _ZTIe }; +extern __attribute__((used, weak)) const void *_ZTIPKe[4] + = { (void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2], + (void *) _ZTSPKe, (void *) 1L, (void *) _ZTIe }; +#endif // _GLIBCXX_LONG_DOUBLE_COMPAT + + + +#ifdef _GLIBCXX_SYMVER_DARWIN +#if (defined(__ppc__) || defined(__ppc64__)) && defined(PIC) +/* __eprintf shouldn't have been made visible from libstdc++, or + anywhere, but on Mac OS X 10.4 it was defined in + libstdc++.6.0.3.dylib; so on that platform we have to keep defining + it to keep binary compatibility. We can't just put the libgcc + version in the export list, because that doesn't work; once a + symbol is marked as hidden, it stays that way. */ + +#include <cstdio> +#include <cstdlib> + +using namespace std; + +extern "C" void +__eprintf(const char *string, const char *expression, + unsigned int line, const char *filename) +{ + fprintf(stderr, string, expression, line, filename); + fflush(stderr); + abort(); +} +#endif +#endif diff --git a/contrib/libstdc++/src/complex_io.cc b/contrib/libstdc++/src/complex_io.cc index 6d2ca56..e65a22d 100644 --- a/contrib/libstdc++/src/complex_io.cc +++ b/contrib/libstdc++/src/complex_io.cc @@ -1,6 +1,6 @@ // The template and inlines for the -*- C++ -*- complex number classes. -// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// Copyright (C) 2000, 2001, 2005, 2006 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -29,8 +29,8 @@ #include <complex> -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + template basic_istream<char, char_traits<char> >& operator>>(basic_istream<char, char_traits<char> >&, complex<float>&); @@ -90,4 +90,22 @@ namespace std operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&); #endif //_GLIBCXX_USE_WCHAR_T -} // namespace std + +_GLIBCXX_END_NAMESPACE + +// XXX GLIBCXX_ABI Deprecated +#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT + +#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \ + extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak)) + +_GLIBCXX_LDBL_COMPAT (_ZStlsIdcSt11char_traitsIcEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E, + _ZStlsIecSt11char_traitsIcEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E); +_GLIBCXX_LDBL_COMPAT (_ZStlsIdwSt11char_traitsIwEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E, + _ZStlsIewSt11char_traitsIwEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E); +_GLIBCXX_LDBL_COMPAT (_ZStrsIdcSt11char_traitsIcEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E, + _ZStrsIecSt11char_traitsIcEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E); +_GLIBCXX_LDBL_COMPAT (_ZStrsIdwSt11char_traitsIwEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E, + _ZStrsIewSt11char_traitsIwEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E); + +#endif // _GLIBCXX_LONG_DOUBLE_COMPAT diff --git a/contrib/libstdc++/src/concept-inst.cc b/contrib/libstdc++/src/concept-inst.cc index c8a3dd4..904f72b 100644 --- a/contrib/libstdc++/src/concept-inst.cc +++ b/contrib/libstdc++/src/concept-inst.cc @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -44,8 +44,8 @@ #define _Instantiate(...) template void __function_requires< __VA_ARGS__ > () -namespace __gnu_cxx -{ +_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + template void __aux_require_boolean_expr<bool>(bool const&); _Instantiate(_ConvertibleConcept<unsigned, unsigned> ); @@ -105,7 +105,8 @@ namespace __gnu_cxx _Instantiate(_RandomAccessIteratorConcept<wchar_t const*> ); #endif -} // namespace __gnu_cxx + +_GLIBCXX_END_NAMESPACE #undef _Instantiate diff --git a/contrib/libstdc++/src/ctype.cc b/contrib/libstdc++/src/ctype.cc index 777ff41..634c135 100644 --- a/contrib/libstdc++/src/ctype.cc +++ b/contrib/libstdc++/src/ctype.cc @@ -1,4 +1,4 @@ -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -28,8 +28,8 @@ #include <locale> -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + // Definitions for static const data members of ctype_base. const ctype_base::mask ctype_base::space; const ctype_base::mask ctype_base::print; @@ -110,5 +110,5 @@ namespace std } } #endif -} // namespace std +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/debug.cc b/contrib/libstdc++/src/debug.cc index 415fcbf..be5ba01 100644 --- a/contrib/libstdc++/src/debug.cc +++ b/contrib/libstdc++/src/debug.cc @@ -1,6 +1,6 @@ // Debugging mode support code -*- C++ -*- -// Copyright (C) 2003, 2004 +// Copyright (C) 2003, 2004, 2005, 2006 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -32,19 +32,16 @@ #include <debug/safe_sequence.h> #include <debug/safe_iterator.h> #include <algorithm> -#include <cstdlib> #include <cassert> #include <cstring> -#include <cstdio> #include <cctype> -#include <bits/concurrence.h> using namespace std; -namespace __gnu_internal +namespace { - __glibcxx_mutex_define_initialized(iterator_base_mutex); -} // namespace __gnu_internal + __gnu_cxx::__mutex safe_base_mutex; +} // anonymous namespace namespace __gnu_debug { @@ -109,68 +106,67 @@ namespace __gnu_debug "attempt to increment an end-of-stream istreambuf_iterator" }; - void + void _Safe_sequence_base:: _M_detach_all() { - for (_Safe_iterator_base* __iter = _M_iterators; __iter; ) + __gnu_cxx::__scoped_lock sentry(safe_base_mutex); + for (_Safe_iterator_base* __iter = _M_iterators; __iter;) { _Safe_iterator_base* __old = __iter; __iter = __iter->_M_next; - __old->_M_attach(0, false); + __old->_M_detach_single(); } - for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2; ) + for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;) { _Safe_iterator_base* __old = __iter2; __iter2 = __iter2->_M_next; - __old->_M_attach(0, true); + __old->_M_detach_single(); } } - void + void _Safe_sequence_base:: _M_detach_singular() { - for (_Safe_iterator_base* __iter = _M_iterators; __iter; ) + __gnu_cxx::__scoped_lock sentry(safe_base_mutex); + for (_Safe_iterator_base* __iter = _M_iterators; __iter;) { _Safe_iterator_base* __old = __iter; __iter = __iter->_M_next; if (__old->_M_singular()) - __old->_M_attach(0, false); + __old->_M_detach_single(); } - for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2; ) + for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;) { _Safe_iterator_base* __old = __iter2; __iter2 = __iter2->_M_next; if (__old->_M_singular()) - __old->_M_attach(0, true); + __old->_M_detach_single(); } } - - void + + void _Safe_sequence_base:: _M_revalidate_singular() { - _Safe_iterator_base* __iter; - for (__iter = _M_iterators; __iter; __iter = __iter->_M_next) - { - __iter->_M_version = _M_version; - __iter = __iter->_M_next; - } - - for (__iter = _M_const_iterators; __iter; __iter = __iter->_M_next) - { - __iter->_M_version = _M_version; - __iter = __iter->_M_next; - } + __gnu_cxx::__scoped_lock sentry(safe_base_mutex); + for (_Safe_iterator_base* __iter = _M_iterators; __iter; + __iter = __iter->_M_next) + __iter->_M_version = _M_version; + + for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2; + __iter2 = __iter2->_M_next) + __iter2->_M_version = _M_version; } - void + void _Safe_sequence_base:: _M_swap(_Safe_sequence_base& __x) { + __gnu_cxx::__scoped_lock sentry(safe_base_mutex); swap(_M_iterators, __x._M_iterators); swap(_M_const_iterators, __x._M_const_iterators); swap(_M_version, __x._M_version); @@ -184,17 +180,29 @@ namespace __gnu_debug for (__iter = __x._M_const_iterators; __iter; __iter = __iter->_M_next) __iter->_M_sequence = &__x; } - - void + + __gnu_cxx::__mutex& + _Safe_sequence_base:: + _M_get_mutex() + { return safe_base_mutex; } + + void _Safe_iterator_base:: _M_attach(_Safe_sequence_base* __seq, bool __constant) { - _M_detach(); + __gnu_cxx::__scoped_lock sentry(safe_base_mutex); + _M_attach_single(__seq, __constant); + } + + void + _Safe_iterator_base:: + _M_attach_single(_Safe_sequence_base* __seq, bool __constant) + { + _M_detach_single(); // Attach to the new sequence (if there is one) if (__seq) { - __gnu_cxx::lock sentry(__gnu_internal::iterator_base_mutex); _M_sequence = __seq; _M_version = _M_sequence->_M_version; _M_prior = 0; @@ -215,11 +223,18 @@ namespace __gnu_debug } } - void + void _Safe_iterator_base:: _M_detach() { - __gnu_cxx::lock sentry(__gnu_internal::iterator_base_mutex); + __gnu_cxx::__scoped_lock sentry(safe_base_mutex); + _M_detach_single(); + } + + void + _Safe_iterator_base:: + _M_detach_single() + { if (_M_sequence) { // Remove us from this sequence's list @@ -239,7 +254,7 @@ namespace __gnu_debug _M_prior = 0; _M_next = 0; } - + bool _Safe_iterator_base:: _M_singular() const @@ -249,10 +264,15 @@ namespace __gnu_debug _Safe_iterator_base:: _M_can_compare(const _Safe_iterator_base& __x) const { - return (!_M_singular() && !__x._M_singular() - && _M_sequence == __x._M_sequence); + return (!_M_singular() + && !__x._M_singular() && _M_sequence == __x._M_sequence); } + __gnu_cxx::__mutex& + _Safe_iterator_base:: + _M_get_mutex() + { return safe_base_mutex; } + void _Error_formatter::_Parameter:: _M_print_field(const _Error_formatter* __formatter, const char* __name) const @@ -507,7 +527,7 @@ namespace __gnu_debug template<typename _Tp> void _Error_formatter::_M_format_word(char* __buf, - int __n __attribute__((__unused__)), + int __n __attribute__ ((__unused__)), const char* __fmt, _Tp __s) const { #ifdef _GLIBCXX_USE_C99 @@ -567,7 +587,7 @@ namespace __gnu_debug _M_print_string(const char* __string) const { const char* __start = __string; - const char* __end = __start; + const char* __finish = __start; const int __bufsize = 128; char __buf[__bufsize]; @@ -575,21 +595,21 @@ namespace __gnu_debug { if (*__start != '%') { - // [__start, __end) denotes the next word - __end = __start; - while (isalnum(*__end)) - ++__end; - if (__start == __end) - ++__end; - if (isspace(*__end)) - ++__end; + // [__start, __finish) denotes the next word + __finish = __start; + while (isalnum(*__finish)) + ++__finish; + if (__start == __finish) + ++__finish; + if (isspace(*__finish)) + ++__finish; - const ptrdiff_t __len = __end - __start; + const ptrdiff_t __len = __finish - __start; assert(__len < __bufsize); memcpy(__buf, __start, __len); __buf[__len] = '\0'; _M_print_word(__buf); - __start = __end; + __start = __finish; // Skip extra whitespace while (*__start == ' ') @@ -653,21 +673,20 @@ namespace __gnu_debug // Instantiations. template void - _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt, - const void* __s) const; + _Error_formatter::_M_format_word(char*, int, const char*, + const void*) const; template void - _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt, - long __s) const; + _Error_formatter::_M_format_word(char*, int, const char*, long) const; template void - _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt, - std::size_t __s) const; + _Error_formatter::_M_format_word(char*, int, const char*, + std::size_t) const; template void - _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt, - const char* __s) const; + _Error_formatter::_M_format_word(char*, int, const char*, + const char*) const; } // namespace __gnu_debug diff --git a/contrib/libstdc++/src/debug_list.cc b/contrib/libstdc++/src/debug_list.cc index 3d14b28..cec2c38 100644 --- a/contrib/libstdc++/src/debug_list.cc +++ b/contrib/libstdc++/src/debug_list.cc @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -29,6 +29,5 @@ #define _GLIBCXX_DEBUG -#include <bits/c++config.h> - #include "list.cc" + diff --git a/contrib/libstdc++/src/ext-inst.cc b/contrib/libstdc++/src/ext-inst.cc index 4be3fed6..7f98b41 100644 --- a/contrib/libstdc++/src/ext-inst.cc +++ b/contrib/libstdc++/src/ext-inst.cc @@ -1,6 +1,6 @@ // Explicit instantiation file. -// Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -34,14 +34,12 @@ #include <ext/rope> #include <ext/stdio_filebuf.h> -namespace __gnu_internal -{ - const int min_len = __gnu_cxx::_Rope_constants::_S_max_rope_depth + 1; -} +_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) -namespace __gnu_cxx -{ - using namespace __gnu_internal; + namespace + { + const int min_len = __detail::_S_max_rope_depth + 1; + } template const unsigned long @@ -66,4 +64,5 @@ namespace __gnu_cxx template class stdio_filebuf<wchar_t>; #endif -} // namespace __gnu_cxx + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/fstream-inst.cc b/contrib/libstdc++/src/fstream-inst.cc index 4d9eae5..762ccb8 100644 --- a/contrib/libstdc++/src/fstream-inst.cc +++ b/contrib/libstdc++/src/fstream-inst.cc @@ -1,6 +1,6 @@ // Explicit instantiation file. -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2005 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -34,29 +34,18 @@ #include <fstream> -namespace std -{ - // filebuf - template class basic_filebuf<char, char_traits<char> >; -#ifdef _GLIBCXX_USE_WCHAR_T - template class basic_filebuf<wchar_t, char_traits<wchar_t> >; -#endif +_GLIBCXX_BEGIN_NAMESPACE(std) - // ifstream + template class basic_filebuf<char, char_traits<char> >; template class basic_ifstream<char>; -#ifdef _GLIBCXX_USE_WCHAR_T - template class basic_ifstream<wchar_t>; -#endif - - // ofstream template class basic_ofstream<char>; -#ifdef _GLIBCXX_USE_WCHAR_T - template class basic_ofstream<wchar_t>; -#endif - - // fstream template class basic_fstream<char>; + #ifdef _GLIBCXX_USE_WCHAR_T + template class basic_filebuf<wchar_t, char_traits<wchar_t> >; + template class basic_ifstream<wchar_t>; + template class basic_ofstream<wchar_t>; template class basic_fstream<wchar_t>; #endif -} // namespace std + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/functexcept.cc b/contrib/libstdc++/src/functexcept.cc index fb158a6..5e53f05 100644 --- a/contrib/libstdc++/src/functexcept.cc +++ b/contrib/libstdc++/src/functexcept.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -32,6 +32,7 @@ #include <new> #include <typeinfo> #include <ios> + #ifdef _GLIBCXX_USE_NLS # include <libintl.h> # define _(msgid) gettext (msgid) @@ -39,8 +40,8 @@ # define _(msgid) (msgid) #endif -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + #if __EXCEPTIONS void __throw_bad_exception(void) @@ -100,58 +101,59 @@ namespace std #else void __throw_bad_exception(void) - { abort(); } + { std::abort(); } void __throw_bad_alloc(void) - { abort(); } + { std::abort(); } void __throw_bad_cast(void) - { abort(); } + { std::abort(); } void __throw_bad_typeid(void) - { abort(); } + { std::abort(); } void __throw_logic_error(const char*) - { abort(); } + { std::abort(); } void __throw_domain_error(const char*) - { abort(); } + { std::abort(); } void __throw_invalid_argument(const char*) - { abort(); } + { std::abort(); } void __throw_length_error(const char*) - { abort(); } + { std::abort(); } void __throw_out_of_range(const char*) - { abort(); } + { std::abort(); } void __throw_runtime_error(const char*) - { abort(); } + { std::abort(); } void __throw_range_error(const char*) - { abort(); } + { std::abort(); } void __throw_overflow_error(const char*) - { abort(); } + { std::abort(); } void __throw_underflow_error(const char*) - { abort(); } + { std::abort(); } void __throw_ios_failure(const char*) - { abort(); } + { std::abort(); } #endif //__EXCEPTIONS -} + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/globals_io.cc b/contrib/libstdc++/src/globals_io.cc index bf70f47c..3d67cf5 100644 --- a/contrib/libstdc++/src/globals_io.cc +++ b/contrib/libstdc++/src/globals_io.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -13,7 +14,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -26,7 +27,6 @@ // the GNU General Public License. #include "bits/c++config.h" -#include "bits/gthr.h" #include <fstream> #include <istream> #include <ostream> @@ -49,8 +49,8 @@ // In macro form: // _GLIBCXX_ASM_SYMVER(currentname, oldname, GLIBCXX_3.2) -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + // Standard stream objects. // NB: Iff <iostream> is included, these definitions become wonky. typedef char fake_istream[sizeof(istream)] @@ -72,9 +72,10 @@ namespace std fake_wostream wcerr; fake_wostream wclog; #endif -} // namespace std -namespace __gnu_internal +_GLIBCXX_END_NAMESPACE + +namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden) { using namespace std; using namespace __gnu_cxx; @@ -106,24 +107,4 @@ namespace __gnu_internal fake_wfilebuf buf_wcin; fake_wfilebuf buf_wcerr; #endif - - // Globals for once-only runtime initialization of mutex objects. This - // allows static initialization of these objects on systems that need a - // function call to initialize a mutex. For example, see stl_threads.h. -#ifdef __GTHREAD_MUTEX_INIT -#elif defined(__GTHREAD_MUTEX_INIT_FUNCTION) - __gthread_once_t _GLIBCXX_once = __GTHREAD_ONCE_INIT; - __gthread_mutex_t _GLIBCXX_mutex; - __gthread_mutex_t *_GLIBCXX_mutex_address; - - // Once-only initializer function for _GLIBCXX_mutex. - void - _GLIBCXX_mutex_init () - { __GTHREAD_MUTEX_INIT_FUNCTION (&_GLIBCXX_mutex); } - - // Once-only initializer function for _GLIBCXX_mutex_address. - void - _GLIBCXX_mutex_address_init () - { __GTHREAD_MUTEX_INIT_FUNCTION (_GLIBCXX_mutex_address); } -#endif } // namespace __gnu_internal diff --git a/contrib/libstdc++/src/ios-inst.cc b/contrib/libstdc++/src/ios-inst.cc new file mode 100644 index 0000000..27f3e5b --- /dev/null +++ b/contrib/libstdc++/src/ios-inst.cc @@ -0,0 +1,45 @@ +// Explicit instantiation file. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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 library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: +// + +#include <ios> + +_GLIBCXX_BEGIN_NAMESPACE(std) + + template class basic_ios<char>; + +#ifdef _GLIBCXX_USE_WCHAR_T + template class basic_ios<wchar_t>; +#endif + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/ios.cc b/contrib/libstdc++/src/ios.cc index e68ee54..3fbee2c 100644 --- a/contrib/libstdc++/src/ios.cc +++ b/contrib/libstdc++/src/ios.cc @@ -1,6 +1,6 @@ // Iostreams base classes -*- C++ -*- -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -34,41 +34,8 @@ #include <ios> #include <limits> -#include <bits/atomicity.h> - -namespace std -{ - // XXX GLIBCXX_ABI Deprecated - // Definitions for static const data members of __ios_flags. - const __ios_flags::__int_type __ios_flags::_S_boolalpha; - const __ios_flags::__int_type __ios_flags::_S_dec; - const __ios_flags::__int_type __ios_flags::_S_fixed; - const __ios_flags::__int_type __ios_flags::_S_hex; - const __ios_flags::__int_type __ios_flags::_S_internal; - const __ios_flags::__int_type __ios_flags::_S_left; - const __ios_flags::__int_type __ios_flags::_S_oct; - const __ios_flags::__int_type __ios_flags::_S_right; - const __ios_flags::__int_type __ios_flags::_S_scientific; - const __ios_flags::__int_type __ios_flags::_S_showbase; - const __ios_flags::__int_type __ios_flags::_S_showpoint; - const __ios_flags::__int_type __ios_flags::_S_showpos; - const __ios_flags::__int_type __ios_flags::_S_skipws; - const __ios_flags::__int_type __ios_flags::_S_unitbuf; - const __ios_flags::__int_type __ios_flags::_S_uppercase; - const __ios_flags::__int_type __ios_flags::_S_adjustfield; - const __ios_flags::__int_type __ios_flags::_S_basefield; - const __ios_flags::__int_type __ios_flags::_S_floatfield; - - const __ios_flags::__int_type __ios_flags::_S_badbit; - const __ios_flags::__int_type __ios_flags::_S_eofbit; - const __ios_flags::__int_type __ios_flags::_S_failbit; - - const __ios_flags::__int_type __ios_flags::_S_app; - const __ios_flags::__int_type __ios_flags::_S_ate; - const __ios_flags::__int_type __ios_flags::_S_bin; - const __ios_flags::__int_type __ios_flags::_S_in; - const __ios_flags::__int_type __ios_flags::_S_out; - const __ios_flags::__int_type __ios_flags::_S_trunc; + +_GLIBCXX_BEGIN_NAMESPACE(std) // Definitions for static const members of ios_base. const ios_base::fmtflags ios_base::boolalpha; @@ -106,8 +73,6 @@ namespace std const ios_base::seekdir ios_base::cur; const ios_base::seekdir ios_base::end; - const int ios_base::_S_local_word_size; - _Atomic_word ios_base::Init::_S_refcount; bool ios_base::Init::_S_synced_with_stdio = true; @@ -141,7 +106,7 @@ namespace std // Implementation note: Initialize top to zero to ensure that // initialization occurs before main() is started. static _Atomic_word _S_top = 0; - return __gnu_cxx::__exchange_and_add(&_S_top, 1) + 4; + return __gnu_cxx::__exchange_and_add_dispatch(&_S_top, 1) + 4; } void @@ -150,32 +115,32 @@ namespace std // 27.4.2.5 iword/pword storage ios_base::_Words& - ios_base::_M_grow_words(int ix, bool iword) + ios_base::_M_grow_words(int __ix, bool __iword) { - // Precondition: _M_word_size <= ix - int newsize = _S_local_word_size; - _Words* words = _M_local_word; - if (ix > _S_local_word_size - 1) + // Precondition: _M_word_size <= __ix + int __newsize = _S_local_word_size; + _Words* __words = _M_local_word; + if (__ix > _S_local_word_size - 1) { - if (ix < numeric_limits<int>::max()) + if (__ix < numeric_limits<int>::max()) { - newsize = ix + 1; + __newsize = __ix + 1; try - { words = new _Words[newsize]; } + { __words = new _Words[__newsize]; } catch (...) { _M_streambuf_state |= badbit; if (_M_streambuf_state & _M_exception) __throw_ios_failure(__N("ios_base::_M_grow_words " "allocation failed")); - if (iword) + if (__iword) _M_word_zero._M_iword = 0; else _M_word_zero._M_pword = 0; return _M_word_zero; } - for (int i = 0; i < _M_word_size; i++) - words[i] = _M_word[i]; + for (int __i = 0; __i < _M_word_size; __i++) + __words[__i] = _M_word[__i]; if (_M_word && _M_word != _M_local_word) { delete [] _M_word; @@ -187,16 +152,16 @@ namespace std _M_streambuf_state |= badbit; if (_M_streambuf_state & _M_exception) __throw_ios_failure(__N("ios_base::_M_grow_words is not valid")); - if (iword) + if (__iword) _M_word_zero._M_iword = 0; else _M_word_zero._M_pword = 0; return _M_word_zero; } } - _M_word = words; - _M_word_size = newsize; - return _M_word[ix]; + _M_word = __words; + _M_word_size = __newsize; + return _M_word[__ix]; } void @@ -225,4 +190,5 @@ namespace std } _M_callbacks = 0; } -} // namespace std + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/ios_failure.cc b/contrib/libstdc++/src/ios_failure.cc index 0d99ba3..33d7ffc 100644 --- a/contrib/libstdc++/src/ios_failure.cc +++ b/contrib/libstdc++/src/ios_failure.cc @@ -1,6 +1,6 @@ // Iostreams base classes -*- C++ -*- -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -34,8 +34,8 @@ #include <ios> -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + ios_base::failure::failure(const string& __str) throw() : _M_msg(__str) { } @@ -45,4 +45,5 @@ namespace std const char* ios_base::failure::what() const throw() { return _M_msg.c_str(); } -} // namespace std + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/ios_init.cc b/contrib/libstdc++/src/ios_init.cc index 346ed4e..5c7ab2e 100644 --- a/contrib/libstdc++/src/ios_init.cc +++ b/contrib/libstdc++/src/ios_init.cc @@ -1,6 +1,6 @@ // Iostreams base classes -*- C++ -*- -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -36,11 +36,10 @@ #include <ostream> #include <istream> #include <fstream> -#include <bits/atomicity.h> #include <ext/stdio_filebuf.h> #include <ext/stdio_sync_filebuf.h> -namespace __gnu_internal +namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden) { using namespace __gnu_cxx; @@ -64,8 +63,8 @@ namespace __gnu_internal #endif } // namespace __gnu_internal -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + using namespace __gnu_internal; extern istream cin; @@ -82,7 +81,7 @@ namespace std ios_base::Init::Init() { - if (__gnu_cxx::__exchange_and_add(&_S_refcount, 1) == 0) + if (__gnu_cxx::__exchange_and_add_dispatch(&_S_refcount, 1) == 0) { // Standard streams default to synced with "C" operations. _S_synced_with_stdio = true; @@ -99,7 +98,10 @@ namespace std new (&clog) ostream(&buf_cerr_sync); cin.tie(&cout); cerr.flags(ios_base::unitbuf); - + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 455. cerr::tie() and wcerr::tie() are overspecified. + cerr.tie(&cout); + #ifdef _GLIBCXX_USE_WCHAR_T new (&buf_wcout_sync) stdio_sync_filebuf<wchar_t>(stdout); new (&buf_wcin_sync) stdio_sync_filebuf<wchar_t>(stdin); @@ -111,19 +113,20 @@ namespace std new (&wclog) wostream(&buf_wcerr_sync); wcin.tie(&wcout); wcerr.flags(ios_base::unitbuf); + wcerr.tie(&wcout); #endif // NB: Have to set refcount above one, so that standard // streams are not re-initialized with uses of ios_base::Init // besides <iostream> static object, ie just using <ios> with // ios_base::Init objects. - __gnu_cxx::__atomic_add(&_S_refcount, 1); + __gnu_cxx::__atomic_add_dispatch(&_S_refcount, 1); } } ios_base::Init::~Init() { - if (__gnu_cxx::__exchange_and_add(&_S_refcount, -1) == 2) + if (__gnu_cxx::__exchange_and_add_dispatch(&_S_refcount, -1) == 2) { // Catch any exceptions thrown by basic_ostream::flush() try @@ -196,4 +199,5 @@ namespace std } return __ret; } -} // namespace std + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/ios_locale.cc b/contrib/libstdc++/src/ios_locale.cc index 008a485..5be1c92 100644 --- a/contrib/libstdc++/src/ios_locale.cc +++ b/contrib/libstdc++/src/ios_locale.cc @@ -1,6 +1,6 @@ // Iostreams base classes -*- C++ -*- -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -35,8 +35,8 @@ #include <ios> #include <locale> -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + // Called only by basic_ios<>::init. void ios_base::_M_init() @@ -57,4 +57,5 @@ namespace std _M_call_callbacks(imbue_event); return __old; } -} // namespace std + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/iostream-inst.cc b/contrib/libstdc++/src/iostream-inst.cc new file mode 100644 index 0000000..7e1df3d --- /dev/null +++ b/contrib/libstdc++/src/iostream-inst.cc @@ -0,0 +1,49 @@ +// Explicit instantiation file. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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 library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: +// + +#include <iomanip> + +_GLIBCXX_BEGIN_NAMESPACE(std) + + template class _Setfill<char>; + template _Setfill<char> setfill(char); + template class basic_iostream<char>; + +#ifdef _GLIBCXX_USE_WCHAR_T + template class _Setfill<wchar_t>; + template _Setfill<wchar_t> setfill(wchar_t); + template class basic_iostream<wchar_t>; +#endif + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/istream-inst.cc b/contrib/libstdc++/src/istream-inst.cc index 6b454ee..7140ab2 100644 --- a/contrib/libstdc++/src/istream-inst.cc +++ b/contrib/libstdc++/src/istream-inst.cc @@ -1,6 +1,6 @@ // Explicit instantiation file. -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2005, 2006 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -35,9 +35,8 @@ #include <istream> #include <iomanip> -namespace std -{ - // istream +_GLIBCXX_BEGIN_NAMESPACE(std) + template class basic_istream<char>; template istream& ws(istream&); template istream& operator>>(istream&, char&); @@ -54,6 +53,20 @@ namespace std template istream& operator>>(istream&, _Setprecision); template istream& operator>>(istream&, _Setw); + template istream& istream::_M_extract(unsigned short&); + template istream& istream::_M_extract(unsigned int&); + template istream& istream::_M_extract(long&); + template istream& istream::_M_extract(unsigned long&); + template istream& istream::_M_extract(bool&); +#ifdef _GLIBCXX_USE_LONG_LONG + template istream& istream::_M_extract(long long&); + template istream& istream::_M_extract(unsigned long long&); +#endif + template istream& istream::_M_extract(float&); + template istream& istream::_M_extract(double&); + template istream& istream::_M_extract(long double&); + template istream& istream::_M_extract(void*&); + #ifdef _GLIBCXX_USE_WCHAR_T template class basic_istream<wchar_t>; template wistream& ws(wistream&); @@ -66,5 +79,35 @@ namespace std template wistream& operator>>(wistream&, _Setbase); template wistream& operator>>(wistream&, _Setprecision); template wistream& operator>>(wistream&, _Setw); + + template wistream& wistream::_M_extract(unsigned short&); + template wistream& wistream::_M_extract(unsigned int&); + template wistream& wistream::_M_extract(long&); + template wistream& wistream::_M_extract(unsigned long&); + template wistream& wistream::_M_extract(bool&); +#ifdef _GLIBCXX_USE_LONG_LONG + template wistream& wistream::_M_extract(long long&); + template wistream& wistream::_M_extract(unsigned long long&); +#endif + template wistream& wistream::_M_extract(float&); + template wistream& wistream::_M_extract(double&); + template wistream& wistream::_M_extract(long double&); + template wistream& wistream::_M_extract(void*&); #endif -} // namespace std + +_GLIBCXX_END_NAMESPACE + +// XXX GLIBCXX_ABI Deprecated +#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT + +#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \ + extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak)) +_GLIBCXX_LDBL_COMPAT (_ZNSirsERd, _ZNSirsERe); +_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_istreamIwSt11char_traitsIwEErsERd, + _ZNSt13basic_istreamIwSt11char_traitsIwEErsERe); +_GLIBCXX_LDBL_COMPAT (_ZNSi10_M_extractIdEERSiRT_, + _ZNSi10_M_extractIeEERSiRT_); +_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractIdEERS2_RT_, + _ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractIeEERS2_RT_); + +#endif // _GLIBCXX_LONG_DOUBLE_COMPAT diff --git a/contrib/libstdc++/src/istream.cc b/contrib/libstdc++/src/istream.cc new file mode 100644 index 0000000..688ad16 --- /dev/null +++ b/contrib/libstdc++/src/istream.cc @@ -0,0 +1,647 @@ +// Input streams -*- C++ -*- + +// Copyright (C) 2004, 2005 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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 library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 27.6.1 Input streams +// + +#include <istream> + +_GLIBCXX_BEGIN_NAMESPACE(std) + + template<> + basic_istream<char>& + basic_istream<char>:: + getline(char_type* __s, streamsize __n, char_type __delim) + { + _M_gcount = 0; + ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); + sentry __cerb(*this, true); + if (__cerb) + { + try + { + const int_type __idelim = traits_type::to_int_type(__delim); + const int_type __eof = traits_type::eof(); + __streambuf_type* __sb = this->rdbuf(); + int_type __c = __sb->sgetc(); + + while (_M_gcount + 1 < __n + && !traits_type::eq_int_type(__c, __eof) + && !traits_type::eq_int_type(__c, __idelim)) + { + streamsize __size = std::min(streamsize(__sb->egptr() + - __sb->gptr()), + streamsize(__n - _M_gcount + - 1)); + if (__size > 1) + { + const char_type* __p = traits_type::find(__sb->gptr(), + __size, + __delim); + if (__p) + __size = __p - __sb->gptr(); + traits_type::copy(__s, __sb->gptr(), __size); + __s += __size; + __sb->gbump(__size); + _M_gcount += __size; + __c = __sb->sgetc(); + } + else + { + *__s++ = traits_type::to_char_type(__c); + ++_M_gcount; + __c = __sb->snextc(); + } + } + + if (traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + else if (traits_type::eq_int_type(__c, __idelim)) + { + ++_M_gcount; + __sb->sbumpc(); + } + else + __err |= ios_base::failbit; + } + catch(...) + { this->_M_setstate(ios_base::badbit); } + } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 243. get and getline when sentry reports failure. + if (__n > 0) + *__s = char_type(); + if (!_M_gcount) + __err |= ios_base::failbit; + if (__err) + this->setstate(__err); + return *this; + } + + template<> + basic_istream<char>& + basic_istream<char>:: + ignore(streamsize __n, int_type __delim) + { + if (traits_type::eq_int_type(__delim, traits_type::eof())) + return ignore(__n); + + _M_gcount = 0; + sentry __cerb(*this, true); + if (__cerb && __n > 0) + { + ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); + try + { + const char_type __cdelim = traits_type::to_char_type(__delim); + const int_type __eof = traits_type::eof(); + __streambuf_type* __sb = this->rdbuf(); + int_type __c = __sb->sgetc(); + + bool __large_ignore = false; + while (true) + { + while (_M_gcount < __n + && !traits_type::eq_int_type(__c, __eof) + && !traits_type::eq_int_type(__c, __delim)) + { + streamsize __size = std::min(streamsize(__sb->egptr() + - __sb->gptr()), + streamsize(__n - _M_gcount)); + if (__size > 1) + { + const char_type* __p = traits_type::find(__sb->gptr(), + __size, + __cdelim); + if (__p) + __size = __p - __sb->gptr(); + __sb->gbump(__size); + _M_gcount += __size; + __c = __sb->sgetc(); + } + else + { + ++_M_gcount; + __c = __sb->snextc(); + } + } + if (__n == numeric_limits<streamsize>::max() + && !traits_type::eq_int_type(__c, __eof) + && !traits_type::eq_int_type(__c, __delim)) + { + _M_gcount = numeric_limits<streamsize>::min(); + __large_ignore = true; + } + else + break; + } + + if (__large_ignore) + _M_gcount = numeric_limits<streamsize>::max(); + + if (traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + else if (traits_type::eq_int_type(__c, __delim)) + { + if (_M_gcount < numeric_limits<streamsize>::max()) + ++_M_gcount; + __sb->sbumpc(); + } + } + catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template<> + basic_istream<char>& + operator>>(basic_istream<char>& __in, char* __s) + { + typedef basic_istream<char> __istream_type; + typedef __istream_type::int_type __int_type; + typedef __istream_type::char_type __char_type; + typedef __istream_type::traits_type __traits_type; + typedef __istream_type::__streambuf_type __streambuf_type; + typedef __istream_type::__ctype_type __ctype_type; + + streamsize __extracted = 0; + ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); + __istream_type::sentry __cerb(__in, false); + if (__cerb) + { + try + { + // Figure out how many characters to extract. + streamsize __num = __in.width(); + if (__num <= 0) + __num = numeric_limits<streamsize>::max(); + + const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); + + const __int_type __eof = __traits_type::eof(); + __streambuf_type* __sb = __in.rdbuf(); + __int_type __c = __sb->sgetc(); + + while (__extracted < __num - 1 + && !__traits_type::eq_int_type(__c, __eof) + && !__ct.is(ctype_base::space, + __traits_type::to_char_type(__c))) + { + streamsize __size = std::min(streamsize(__sb->egptr() + - __sb->gptr()), + streamsize(__num - __extracted + - 1)); + if (__size > 1) + { + __size = (__ct.scan_is(ctype_base::space, + __sb->gptr() + 1, + __sb->gptr() + __size) + - __sb->gptr()); + __traits_type::copy(__s, __sb->gptr(), __size); + __s += __size; + __sb->gbump(__size); + __extracted += __size; + __c = __sb->sgetc(); + } + else + { + *__s++ = __traits_type::to_char_type(__c); + ++__extracted; + __c = __sb->snextc(); + } + } + + if (__traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 68. Extractors for char* should store null at end + *__s = __char_type(); + __in.width(0); + } + catch(...) + { __in._M_setstate(ios_base::badbit); } + } + if (!__extracted) + __err |= ios_base::failbit; + if (__err) + __in.setstate(__err); + return __in; + } + + template<> + basic_istream<char>& + operator>>(basic_istream<char>& __in, basic_string<char>& __str) + { + typedef basic_istream<char> __istream_type; + typedef __istream_type::int_type __int_type; + typedef __istream_type::char_type __char_type; + typedef __istream_type::traits_type __traits_type; + typedef __istream_type::__streambuf_type __streambuf_type; + typedef __istream_type::__ctype_type __ctype_type; + typedef basic_string<char> __string_type; + typedef __string_type::size_type __size_type; + + __size_type __extracted = 0; + ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); + __istream_type::sentry __cerb(__in, false); + if (__cerb) + { + try + { + __str.erase(); + const streamsize __w = __in.width(); + const __size_type __n = __w > 0 ? static_cast<__size_type>(__w) + : __str.max_size(); + const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); + const __int_type __eof = __traits_type::eof(); + __streambuf_type* __sb = __in.rdbuf(); + __int_type __c = __sb->sgetc(); + + while (__extracted < __n + && !__traits_type::eq_int_type(__c, __eof) + && !__ct.is(ctype_base::space, + __traits_type::to_char_type(__c))) + { + streamsize __size = std::min(streamsize(__sb->egptr() + - __sb->gptr()), + streamsize(__n - __extracted)); + if (__size > 1) + { + __size = (__ct.scan_is(ctype_base::space, + __sb->gptr() + 1, + __sb->gptr() + __size) + - __sb->gptr()); + __str.append(__sb->gptr(), __size); + __sb->gbump(__size); + __extracted += __size; + __c = __sb->sgetc(); + } + else + { + __str += __traits_type::to_char_type(__c); + ++__extracted; + __c = __sb->snextc(); + } + } + + if (__traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + __in.width(0); + } + catch(...) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 91. Description of operator>> and getline() for string<> + // might cause endless loop + __in._M_setstate(ios_base::badbit); + } + } + if (!__extracted) + __err |= ios_base::failbit; + if (__err) + __in.setstate(__err); + return __in; + } + + template<> + basic_istream<char>& + getline(basic_istream<char>& __in, basic_string<char>& __str, + char __delim) + { + typedef basic_istream<char> __istream_type; + typedef __istream_type::int_type __int_type; + typedef __istream_type::char_type __char_type; + typedef __istream_type::traits_type __traits_type; + typedef __istream_type::__streambuf_type __streambuf_type; + typedef __istream_type::__ctype_type __ctype_type; + typedef basic_string<char> __string_type; + typedef __string_type::size_type __size_type; + + __size_type __extracted = 0; + const __size_type __n = __str.max_size(); + ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); + __istream_type::sentry __cerb(__in, true); + if (__cerb) + { + try + { + __str.erase(); + const __int_type __idelim = __traits_type::to_int_type(__delim); + const __int_type __eof = __traits_type::eof(); + __streambuf_type* __sb = __in.rdbuf(); + __int_type __c = __sb->sgetc(); + + while (__extracted < __n + && !__traits_type::eq_int_type(__c, __eof) + && !__traits_type::eq_int_type(__c, __idelim)) + { + streamsize __size = std::min(streamsize(__sb->egptr() + - __sb->gptr()), + streamsize(__n - __extracted)); + if (__size > 1) + { + const __char_type* __p = __traits_type::find(__sb->gptr(), + __size, + __delim); + if (__p) + __size = __p - __sb->gptr(); + __str.append(__sb->gptr(), __size); + __sb->gbump(__size); + __extracted += __size; + __c = __sb->sgetc(); + } + else + { + __str += __traits_type::to_char_type(__c); + ++__extracted; + __c = __sb->snextc(); + } + } + + if (__traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + else if (__traits_type::eq_int_type(__c, __idelim)) + { + ++__extracted; + __sb->sbumpc(); + } + else + __err |= ios_base::failbit; + } + catch(...) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 91. Description of operator>> and getline() for string<> + // might cause endless loop + __in._M_setstate(ios_base::badbit); + } + } + if (!__extracted) + __err |= ios_base::failbit; + if (__err) + __in.setstate(__err); + return __in; + } + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + basic_istream<wchar_t>& + basic_istream<wchar_t>:: + getline(char_type* __s, streamsize __n, char_type __delim) + { + _M_gcount = 0; + ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); + sentry __cerb(*this, true); + if (__cerb) + { + try + { + const int_type __idelim = traits_type::to_int_type(__delim); + const int_type __eof = traits_type::eof(); + __streambuf_type* __sb = this->rdbuf(); + int_type __c = __sb->sgetc(); + + while (_M_gcount + 1 < __n + && !traits_type::eq_int_type(__c, __eof) + && !traits_type::eq_int_type(__c, __idelim)) + { + streamsize __size = std::min(streamsize(__sb->egptr() + - __sb->gptr()), + streamsize(__n - _M_gcount + - 1)); + if (__size > 1) + { + const char_type* __p = traits_type::find(__sb->gptr(), + __size, + __delim); + if (__p) + __size = __p - __sb->gptr(); + traits_type::copy(__s, __sb->gptr(), __size); + __s += __size; + __sb->gbump(__size); + _M_gcount += __size; + __c = __sb->sgetc(); + } + else + { + *__s++ = traits_type::to_char_type(__c); + ++_M_gcount; + __c = __sb->snextc(); + } + } + + if (traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + else if (traits_type::eq_int_type(__c, __idelim)) + { + ++_M_gcount; + __sb->sbumpc(); + } + else + __err |= ios_base::failbit; + } + catch(...) + { this->_M_setstate(ios_base::badbit); } + } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 243. get and getline when sentry reports failure. + if (__n > 0) + *__s = char_type(); + if (!_M_gcount) + __err |= ios_base::failbit; + if (__err) + this->setstate(__err); + return *this; + } + + template<> + basic_istream<wchar_t>& + basic_istream<wchar_t>:: + ignore(streamsize __n, int_type __delim) + { + if (traits_type::eq_int_type(__delim, traits_type::eof())) + return ignore(__n); + + _M_gcount = 0; + sentry __cerb(*this, true); + if (__cerb && __n > 0) + { + ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); + try + { + const char_type __cdelim = traits_type::to_char_type(__delim); + const int_type __eof = traits_type::eof(); + __streambuf_type* __sb = this->rdbuf(); + int_type __c = __sb->sgetc(); + + bool __large_ignore = false; + while (true) + { + while (_M_gcount < __n + && !traits_type::eq_int_type(__c, __eof) + && !traits_type::eq_int_type(__c, __delim)) + { + streamsize __size = std::min(streamsize(__sb->egptr() + - __sb->gptr()), + streamsize(__n - _M_gcount)); + if (__size > 1) + { + const char_type* __p = traits_type::find(__sb->gptr(), + __size, + __cdelim); + if (__p) + __size = __p - __sb->gptr(); + __sb->gbump(__size); + _M_gcount += __size; + __c = __sb->sgetc(); + } + else + { + ++_M_gcount; + __c = __sb->snextc(); + } + } + if (__n == numeric_limits<streamsize>::max() + && !traits_type::eq_int_type(__c, __eof) + && !traits_type::eq_int_type(__c, __delim)) + { + _M_gcount = numeric_limits<streamsize>::min(); + __large_ignore = true; + } + else + break; + } + + if (__large_ignore) + _M_gcount = numeric_limits<streamsize>::max(); + + if (traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + else if (traits_type::eq_int_type(__c, __delim)) + { + if (_M_gcount < numeric_limits<streamsize>::max()) + ++_M_gcount; + __sb->sbumpc(); + } + } + catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template<> + basic_istream<wchar_t>& + getline(basic_istream<wchar_t>& __in, basic_string<wchar_t>& __str, + wchar_t __delim) + { + typedef basic_istream<wchar_t> __istream_type; + typedef __istream_type::int_type __int_type; + typedef __istream_type::char_type __char_type; + typedef __istream_type::traits_type __traits_type; + typedef __istream_type::__streambuf_type __streambuf_type; + typedef __istream_type::__ctype_type __ctype_type; + typedef basic_string<wchar_t> __string_type; + typedef __string_type::size_type __size_type; + + __size_type __extracted = 0; + const __size_type __n = __str.max_size(); + ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); + __istream_type::sentry __cerb(__in, true); + if (__cerb) + { + try + { + __str.erase(); + const __int_type __idelim = __traits_type::to_int_type(__delim); + const __int_type __eof = __traits_type::eof(); + __streambuf_type* __sb = __in.rdbuf(); + __int_type __c = __sb->sgetc(); + + while (__extracted < __n + && !__traits_type::eq_int_type(__c, __eof) + && !__traits_type::eq_int_type(__c, __idelim)) + { + streamsize __size = std::min(streamsize(__sb->egptr() + - __sb->gptr()), + streamsize(__n - __extracted)); + if (__size > 1) + { + const __char_type* __p = __traits_type::find(__sb->gptr(), + __size, + __delim); + if (__p) + __size = __p - __sb->gptr(); + __str.append(__sb->gptr(), __size); + __sb->gbump(__size); + __extracted += __size; + __c = __sb->sgetc(); + } + else + { + __str += __traits_type::to_char_type(__c); + ++__extracted; + __c = __sb->snextc(); + } + } + + if (__traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + else if (__traits_type::eq_int_type(__c, __idelim)) + { + ++__extracted; + __sb->sbumpc(); + } + else + __err |= ios_base::failbit; + } + catch(...) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 91. Description of operator>> and getline() for string<> + // might cause endless loop + __in._M_setstate(ios_base::badbit); + } + } + if (!__extracted) + __err |= ios_base::failbit; + if (__err) + __in.setstate(__err); + return __in; + } +#endif + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/limits.cc b/contrib/libstdc++/src/limits.cc index 700009c..5771bc3 100644 --- a/contrib/libstdc++/src/limits.cc +++ b/contrib/libstdc++/src/limits.cc @@ -1,6 +1,6 @@ // Static data members of -*- C++ -*- numeric_limits classes -// Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. +// Copyright (C) 1999, 2001, 2002, 2005, 2006 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -36,8 +36,8 @@ #include <limits> -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + const bool __numeric_limits_base::is_specialized; const int __numeric_limits_base::digits; const int __numeric_limits_base::digits10; @@ -446,4 +446,36 @@ namespace std const bool numeric_limits<long double>::traps; const bool numeric_limits<long double>::tinyness_before; const float_round_style numeric_limits<long double>::round_style; -} // namespace std + +_GLIBCXX_END_NAMESPACE + +// XXX GLIBCXX_ABI Deprecated +#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT + +#define _GLIBCXX_NUM_LIM_COMPAT(type, member, len) \ + extern "C" type _ZNSt14numeric_limitsIeE ## len ## member ## E \ + __attribute__ ((alias ("_ZNSt14numeric_limitsIdE" #len #member "E"))) +_GLIBCXX_NUM_LIM_COMPAT (bool, is_specialized, 14); +_GLIBCXX_NUM_LIM_COMPAT (int, digits, 6); +_GLIBCXX_NUM_LIM_COMPAT (int, digits10, 8); +_GLIBCXX_NUM_LIM_COMPAT (bool, is_signed, 9); +_GLIBCXX_NUM_LIM_COMPAT (bool, is_integer, 10); +_GLIBCXX_NUM_LIM_COMPAT (bool, is_exact, 8); +_GLIBCXX_NUM_LIM_COMPAT (int, radix, 5); +_GLIBCXX_NUM_LIM_COMPAT (int, min_exponent, 12); +_GLIBCXX_NUM_LIM_COMPAT (int, min_exponent10, 14); +_GLIBCXX_NUM_LIM_COMPAT (int, max_exponent, 12); +_GLIBCXX_NUM_LIM_COMPAT (int, max_exponent10, 14); +_GLIBCXX_NUM_LIM_COMPAT (bool, has_infinity, 12); +_GLIBCXX_NUM_LIM_COMPAT (bool, has_quiet_NaN, 13); +_GLIBCXX_NUM_LIM_COMPAT (bool, has_signaling_NaN, 17); +_GLIBCXX_NUM_LIM_COMPAT (std::float_denorm_style, has_denorm, 10); +_GLIBCXX_NUM_LIM_COMPAT (bool, has_denorm_loss, 15); +_GLIBCXX_NUM_LIM_COMPAT (bool, is_iec559, 9); +_GLIBCXX_NUM_LIM_COMPAT (bool, is_bounded, 10); +_GLIBCXX_NUM_LIM_COMPAT (bool, is_modulo, 9); +_GLIBCXX_NUM_LIM_COMPAT (bool, traps, 5); +_GLIBCXX_NUM_LIM_COMPAT (bool, tinyness_before, 15); +_GLIBCXX_NUM_LIM_COMPAT (std::float_round_style, round_style, 11); + +#endif // _GLIBCXX_LONG_DOUBLE_COMPAT diff --git a/contrib/libstdc++/src/list.cc b/contrib/libstdc++/src/list.cc index ec94053..fe68ba1 100644 --- a/contrib/libstdc++/src/list.cc +++ b/contrib/libstdc++/src/list.cc @@ -1,6 +1,6 @@ // std::list utilities implementation -*- C++ -*- -// Copyright (C) 2003 Free Software Foundation, Inc. +// Copyright (C) 2003, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -55,8 +55,8 @@ #include <list> -namespace _GLIBCXX_STD -{ +_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) + void _List_node_base::swap(_List_node_base& __x, _List_node_base& __y) { @@ -137,5 +137,5 @@ namespace _GLIBCXX_STD __prev_node->_M_next = __next_node; __next_node->_M_prev = __prev_node; } -} // namespace std +_GLIBCXX_END_NESTED_NAMESPACE diff --git a/contrib/libstdc++/src/locale-inst.cc b/contrib/libstdc++/src/locale-inst.cc index 3aeb553..790e614 100644 --- a/contrib/libstdc++/src/locale-inst.cc +++ b/contrib/libstdc++/src/locale-inst.cc @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -37,10 +37,11 @@ // Instantiation configuration. #ifndef C # define C char +# define C_is_char #endif -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + // moneypunct, money_get, and money_put template class moneypunct<C, false>; template class moneypunct<C, true>; @@ -48,6 +49,7 @@ namespace std template struct __moneypunct_cache<C, true>; template class moneypunct_byname<C, false>; template class moneypunct_byname<C, true>; +_GLIBCXX_BEGIN_LDBL_NAMESPACE template class money_get<C, istreambuf_iterator<C> >; template class money_put<C, ostreambuf_iterator<C> >; template @@ -73,11 +75,13 @@ namespace std money_put<C, ostreambuf_iterator<C> >:: _M_insert<false>(ostreambuf_iterator<C>, ios_base&, C, const string_type&) const; +_GLIBCXX_END_LDBL_NAMESPACE // numpunct, numpunct_byname, num_get, and num_put template class numpunct<C>; template struct __numpunct_cache<C>; template class numpunct_byname<C>; +_GLIBCXX_BEGIN_LDBL_NAMESPACE template class num_get<C, istreambuf_iterator<C> >; template class num_put<C, ostreambuf_iterator<C> >; template @@ -161,7 +165,8 @@ namespace std num_put<C, ostreambuf_iterator<C> >:: _M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char, long double) const; - +_GLIBCXX_END_LDBL_NAMESPACE + // time_get and time_put template class __timepunct<C>; template struct __timepunct_cache<C>; @@ -313,4 +318,46 @@ namespace std __int_to_char(C*, unsigned long long, const C*, ios_base::fmtflags, bool); #endif -} // namespace std + +_GLIBCXX_END_NAMESPACE + +// XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined C_is_char + +#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \ + extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak)) + +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, + _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIjEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, + _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIlEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, + _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, + _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intItEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, + _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIxEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, + _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIyEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES4_S4_RSt8ios_basecT_, + _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES3_S3_RSt8ios_basecT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intImEES4_S4_RSt8ios_basecT_, + _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intImEES3_S3_RSt8ios_basecT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIxEES4_S4_RSt8ios_basecT_, + _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIxEES3_S3_RSt8ios_basecT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIyEES4_S4_RSt8ios_basecT_, + _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIyEES3_S3_RSt8ios_basecT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES4_S4_RSt8ios_baseccT_, + _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_, + _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIeEES3_S3_RSt8ios_baseccT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb0EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs, + _ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb0EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb1EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs, + _ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb1EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb0EEES4_S4_RSt8ios_basecRKSs, + _ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb0EEES3_S3_RSt8ios_basecRKSs); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb1EEES4_S4_RSt8ios_basecRKSs, + _ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb1EEES3_S3_RSt8ios_basecRKSs); + +#endif // _GLIBCXX_LONG_DOUBLE_COMPAT diff --git a/contrib/libstdc++/src/locale.cc b/contrib/libstdc++/src/locale.cc index 623eb26..12070eb 100644 --- a/contrib/libstdc++/src/locale.cc +++ b/contrib/libstdc++/src/locale.cc @@ -1,4 +1,4 @@ -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -32,10 +32,30 @@ #include <cctype> #include <cwctype> // For towupper, etc. #include <locale> -#include <bits/atomicity.h> +#include <ext/concurrence.h> -namespace std +namespace { + __gnu_cxx::__mutex locale_cache_mutex; +} // anonymous namespace + +// XXX GLIBCXX_ABI Deprecated +#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT +# define _GLIBCXX_LOC_ID(mangled) extern std::locale::id mangled +_GLIBCXX_LOC_ID (_ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE); +_GLIBCXX_LOC_ID (_ZNSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE); +_GLIBCXX_LOC_ID (_ZNSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE); +_GLIBCXX_LOC_ID (_ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE); +# ifdef _GLIBCXX_USE_WCHAR_T +_GLIBCXX_LOC_ID (_ZNSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE); +_GLIBCXX_LOC_ID (_ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE); +_GLIBCXX_LOC_ID (_ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE); +_GLIBCXX_LOC_ID (_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE); +# endif +#endif + +_GLIBCXX_BEGIN_NAMESPACE(std) + // Definitions for static const data members of locale. const locale::category locale::none; const locale::category locale::ctype; @@ -49,7 +69,6 @@ namespace std // These are no longer exported. locale::_Impl* locale::_S_classic; locale::_Impl* locale::_S_global; - const size_t locale::_S_categories_size; #ifdef __GTHREADS __gthread_once_t locale::_S_once = __GTHREAD_ONCE_INIT; @@ -71,15 +90,21 @@ namespace std bool locale::operator==(const locale& __rhs) const throw() { - bool __ret = false; + // Deal first with the common cases, fast to process: refcopies, + // unnamed (i.e., !_M_names[0]), "simple" (!_M_names[1] => all the + // categories same name, i.e., _M_names[0]). Otherwise fall back + // to the general locale::name(). + bool __ret; if (_M_impl == __rhs._M_impl) __ret = true; + else if (!_M_impl->_M_names[0] || !__rhs._M_impl->_M_names[0] + || std::strcmp(_M_impl->_M_names[0], + __rhs._M_impl->_M_names[0]) != 0) + __ret = false; + else if (!_M_impl->_M_names[1] && !__rhs._M_impl->_M_names[1]) + __ret = true; else - { - const string __name = this->name(); - if (__name != "*" && __name == __rhs.name()) - __ret = true; - } + __ret = this->name() == __rhs.name(); return __ret; } @@ -96,10 +121,13 @@ namespace std locale::name() const { string __ret; - if (_M_impl->_M_check_same_name()) + if (!_M_impl->_M_names[0]) + __ret = '*'; + else if (_M_impl->_M_check_same_name()) __ret = _M_impl->_M_names[0]; else { + __ret.reserve(128); __ret += _S_categories[0]; __ret += '='; __ret += _M_impl->_M_names[0]; @@ -242,12 +270,13 @@ namespace std for (size_t __k = 0; __k < _S_categories_size; ++__k) _M_names[__k] = 0; - // Name all the categories. - for (size_t __l = 0; __l < _S_categories_size; ++__l) + // Name the categories. + for (size_t __l = 0; (__l < _S_categories_size + && __imp._M_names[__l]); ++__l) { - char* __new = new char[std::strlen(__imp._M_names[__l]) + 1]; - std::strcpy(__new, __imp._M_names[__l]); - _M_names[__l] = __new; + const size_t __len = std::strlen(__imp._M_names[__l]) + 1; + _M_names[__l] = new char[__len]; + std::memcpy(_M_names[__l], __imp._M_names[__l], __len); } } catch(...) @@ -356,6 +385,22 @@ namespace std } } + void + locale::_Impl:: + _M_install_cache(const facet* __cache, size_t __index) + { + __gnu_cxx::__scoped_lock sentry(locale_cache_mutex); + if (_M_caches[__index] != 0) + { + // Some other thread got in first. + delete __cache; + } + else + { + __cache->_M_add_reference(); + _M_caches[__index] = __cache; + } + } // locale::id // Definitions for static const data members of locale::id @@ -365,9 +410,31 @@ namespace std locale::id::_M_id() const { if (!_M_index) - _M_index = 1 + __gnu_cxx::__exchange_and_add(&_S_refcount, 1); + { + // XXX GLIBCXX_ABI Deprecated +#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT + locale::id *f = 0; +# define _GLIBCXX_SYNC_ID(facet, mangled) \ + if (this == &::mangled) \ + f = &facet::id + _GLIBCXX_SYNC_ID (num_get<char>, _ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE); + _GLIBCXX_SYNC_ID (num_put<char>, _ZNSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE); + _GLIBCXX_SYNC_ID (money_get<char>, _ZNSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE); + _GLIBCXX_SYNC_ID (money_put<char>, _ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE); +# ifdef _GLIBCXX_USE_WCHAR_T + _GLIBCXX_SYNC_ID (num_get<wchar_t>, _ZNSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE); + _GLIBCXX_SYNC_ID (num_put<wchar_t>, _ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE); + _GLIBCXX_SYNC_ID (money_get<wchar_t>, _ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE); + _GLIBCXX_SYNC_ID (money_put<wchar_t>, _ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE); +# endif + if (f) + _M_index = 1 + f->_M_id(); + else +#endif + _M_index = 1 + __gnu_cxx::__exchange_and_add_dispatch(&_S_refcount, + 1); + } return _M_index - 1; } -} // namespace std - +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/locale_facets.cc b/contrib/libstdc++/src/locale_facets.cc index db8c9e0..46de583 100644 --- a/contrib/libstdc++/src/locale_facets.cc +++ b/contrib/libstdc++/src/locale_facets.cc @@ -1,4 +1,4 @@ -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -28,8 +28,8 @@ #include <locale> -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + // Definitions for static const data members of time_base. template<> const char* @@ -89,5 +89,6 @@ namespace std *__fptr++ = (__flags & ios_base::uppercase) ? 'G' : 'g'; *__fptr = '\0'; } -} // namespace std + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/locale_init.cc b/contrib/libstdc++/src/locale_init.cc index b2c8ea2..28ee484 100644 --- a/contrib/libstdc++/src/locale_init.cc +++ b/contrib/libstdc++/src/locale_init.cc @@ -1,4 +1,4 @@ -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -32,75 +32,187 @@ #include <cctype> #include <cwctype> // For towupper, etc. #include <locale> -#include <bits/atomicity.h> -#include <bits/concurrence.h> +#include <ext/concurrence.h> -namespace __gnu_internal +namespace { - // Defined in globals.cc. - extern std::locale c_locale; - extern std::locale::_Impl c_locale_impl; - - extern std::locale::facet* facet_vec[_GLIBCXX_NUM_FACETS]; - extern char* name_vec[6 + _GLIBCXX_NUM_CATEGORIES]; - extern char name_c[6 + _GLIBCXX_NUM_CATEGORIES][2]; - - extern std::ctype<char> ctype_c; - extern std::collate<char> collate_c; - extern std::numpunct<char> numpunct_c; - extern std::num_get<char> num_get_c; - extern std::num_put<char> num_put_c; - extern std::codecvt<char, char, mbstate_t> codecvt_c; - extern std::moneypunct<char, false> moneypunct_cf; - extern std::moneypunct<char, true> moneypunct_ct; - extern std::money_get<char> money_get_c; - extern std::money_put<char> money_put_c; - extern std::__timepunct<char> timepunct_c; - extern std::time_get<char> time_get_c; - extern std::time_put<char> time_put_c; - extern std::messages<char> messages_c; -#ifdef _GLIBCXX_USE_WCHAR_T - extern std::ctype<wchar_t> ctype_w; - extern std::collate<wchar_t> collate_w; - extern std::numpunct<wchar_t> numpunct_w; - extern std::num_get<wchar_t> num_get_w; - extern std::num_put<wchar_t> num_put_w; - extern std::codecvt<wchar_t, char, mbstate_t> codecvt_w; - extern std::moneypunct<wchar_t, false> moneypunct_wf; - extern std::moneypunct<wchar_t, true> moneypunct_wt; - extern std::money_get<wchar_t> money_get_w; - extern std::money_put<wchar_t> money_put_w; - extern std::__timepunct<wchar_t> timepunct_w; - extern std::time_get<wchar_t> time_get_w; - extern std::time_put<wchar_t> time_put_w; - extern std::messages<wchar_t> messages_w; -#endif + __gnu_cxx::__mutex& + get_locale_mutex() + { + static __gnu_cxx::__mutex locale_mutex; + return locale_mutex; + } + + using namespace std; + + typedef char fake_locale_Impl[sizeof(locale::_Impl)] + __attribute__ ((aligned(__alignof__(locale::_Impl)))); + fake_locale_Impl c_locale_impl; + + typedef char fake_locale[sizeof(locale)] + __attribute__ ((aligned(__alignof__(locale)))); + fake_locale c_locale; + + typedef char fake_name_vec[sizeof(char*)] + __attribute__ ((aligned(__alignof__(char*)))); + fake_name_vec name_vec[6 + _GLIBCXX_NUM_CATEGORIES]; + + typedef char fake_names[sizeof(char[2])] + __attribute__ ((aligned(__alignof__(char[2])))); + fake_names name_c[6 + _GLIBCXX_NUM_CATEGORIES]; + + typedef char fake_facet_vec[sizeof(locale::facet*)] + __attribute__ ((aligned(__alignof__(locale::facet*)))); + fake_facet_vec facet_vec[_GLIBCXX_NUM_FACETS]; + + typedef char fake_cache_vec[sizeof(locale::facet*)] + __attribute__ ((aligned(__alignof__(locale::facet*)))); + fake_cache_vec cache_vec[_GLIBCXX_NUM_FACETS]; + + typedef char fake_ctype_c[sizeof(std::ctype<char>)] + __attribute__ ((aligned(__alignof__(std::ctype<char>)))); + fake_ctype_c ctype_c; + + typedef char fake_collate_c[sizeof(std::collate<char>)] + __attribute__ ((aligned(__alignof__(std::collate<char>)))); + fake_collate_c collate_c; + + typedef char fake_numpunct_c[sizeof(numpunct<char>)] + __attribute__ ((aligned(__alignof__(numpunct<char>)))); + fake_numpunct_c numpunct_c; + + typedef char fake_num_get_c[sizeof(num_get<char>)] + __attribute__ ((aligned(__alignof__(num_get<char>)))); + fake_num_get_c num_get_c; + + typedef char fake_num_put_c[sizeof(num_put<char>)] + __attribute__ ((aligned(__alignof__(num_put<char>)))); + fake_num_put_c num_put_c; + + typedef char fake_codecvt_c[sizeof(codecvt<char, char, mbstate_t>)] + __attribute__ ((aligned(__alignof__(codecvt<char, char, mbstate_t>)))); + fake_codecvt_c codecvt_c; + + typedef char fake_moneypunct_c[sizeof(moneypunct<char, true>)] + __attribute__ ((aligned(__alignof__(moneypunct<char, true>)))); + fake_moneypunct_c moneypunct_ct; + fake_moneypunct_c moneypunct_cf; + + typedef char fake_money_get_c[sizeof(money_get<char>)] + __attribute__ ((aligned(__alignof__(money_get<char>)))); + fake_money_get_c money_get_c; + + typedef char fake_money_put_c[sizeof(money_put<char>)] + __attribute__ ((aligned(__alignof__(money_put<char>)))); + fake_money_put_c money_put_c; + + typedef char fake_timepunct_c[sizeof(__timepunct<char>)] + __attribute__ ((aligned(__alignof__(__timepunct<char>)))); + fake_timepunct_c timepunct_c; + + typedef char fake_time_get_c[sizeof(time_get<char>)] + __attribute__ ((aligned(__alignof__(time_get<char>)))); + fake_time_get_c time_get_c; + + typedef char fake_time_put_c[sizeof(time_put<char>)] + __attribute__ ((aligned(__alignof__(time_put<char>)))); + fake_time_put_c time_put_c; + + typedef char fake_messages_c[sizeof(messages<char>)] + __attribute__ ((aligned(__alignof__(messages<char>)))); + fake_messages_c messages_c; - // And the caches.... - extern std::locale::facet* cache_vec[_GLIBCXX_NUM_FACETS]; - extern std::__numpunct_cache<char> numpunct_cache_c; - extern std::__moneypunct_cache<char, false> moneypunct_cache_cf; - extern std::__moneypunct_cache<char, true> moneypunct_cache_ct; - extern std::__timepunct_cache<char> timepunct_cache_c; #ifdef _GLIBCXX_USE_WCHAR_T - extern std::__numpunct_cache<wchar_t> numpunct_cache_w; - extern std::__moneypunct_cache<wchar_t, false> moneypunct_cache_wf; - extern std::__moneypunct_cache<wchar_t, true> moneypunct_cache_wt; - extern std::__timepunct_cache<wchar_t> timepunct_cache_w; + typedef char fake_wtype_w[sizeof(std::ctype<wchar_t>)] + __attribute__ ((aligned(__alignof__(std::ctype<wchar_t>)))); + fake_wtype_w ctype_w; + + typedef char fake_wollate_w[sizeof(std::collate<wchar_t>)] + __attribute__ ((aligned(__alignof__(std::collate<wchar_t>)))); + fake_wollate_w collate_w; + + typedef char fake_numpunct_w[sizeof(numpunct<wchar_t>)] + __attribute__ ((aligned(__alignof__(numpunct<wchar_t>)))); + fake_numpunct_w numpunct_w; + + typedef char fake_num_get_w[sizeof(num_get<wchar_t>)] + __attribute__ ((aligned(__alignof__(num_get<wchar_t>)))); + fake_num_get_w num_get_w; + + typedef char fake_num_put_w[sizeof(num_put<wchar_t>)] + __attribute__ ((aligned(__alignof__(num_put<wchar_t>)))); + fake_num_put_w num_put_w; + + typedef char fake_wodecvt_w[sizeof(codecvt<wchar_t, char, mbstate_t>)] + __attribute__ ((aligned(__alignof__(codecvt<wchar_t, char, mbstate_t>)))); + fake_wodecvt_w codecvt_w; + + typedef char fake_moneypunct_w[sizeof(moneypunct<wchar_t, true>)] + __attribute__ ((aligned(__alignof__(moneypunct<wchar_t, true>)))); + fake_moneypunct_w moneypunct_wt; + fake_moneypunct_w moneypunct_wf; + + typedef char fake_money_get_w[sizeof(money_get<wchar_t>)] + __attribute__ ((aligned(__alignof__(money_get<wchar_t>)))); + fake_money_get_w money_get_w; + + typedef char fake_money_put_w[sizeof(money_put<wchar_t>)] + __attribute__ ((aligned(__alignof__(money_put<wchar_t>)))); + fake_money_put_w money_put_w; + + typedef char fake_timepunct_w[sizeof(__timepunct<wchar_t>)] + __attribute__ ((aligned(__alignof__(__timepunct<wchar_t>)))); + fake_timepunct_w timepunct_w; + + typedef char fake_time_get_w[sizeof(time_get<wchar_t>)] + __attribute__ ((aligned(__alignof__(time_get<wchar_t>)))); + fake_time_get_w time_get_w; + + typedef char fake_time_put_w[sizeof(time_put<wchar_t>)] + __attribute__ ((aligned(__alignof__(time_put<wchar_t>)))); + fake_time_put_w time_put_w; + + typedef char fake_messages_w[sizeof(messages<wchar_t>)] + __attribute__ ((aligned(__alignof__(messages<wchar_t>)))); + fake_messages_w messages_w; #endif - // Mutex object for locale initialization. - __glibcxx_mutex_define_initialized(locale_mutex); -} // namespace __gnu_internal + // Storage for "C" locale caches. + typedef char fake_num_cache_c[sizeof(std::__numpunct_cache<char>)] + __attribute__ ((aligned(__alignof__(std::__numpunct_cache<char>)))); + fake_num_cache_c numpunct_cache_c; -namespace std -{ - using namespace __gnu_internal; + typedef char fake_money_cache_c[sizeof(std::__moneypunct_cache<char, true>)] + __attribute__ ((aligned(__alignof__(std::__moneypunct_cache<char, true>)))); + fake_money_cache_c moneypunct_cache_ct; + fake_money_cache_c moneypunct_cache_cf; + + typedef char fake_time_cache_c[sizeof(std::__timepunct_cache<char>)] + __attribute__ ((aligned(__alignof__(std::__timepunct_cache<char>)))); + fake_time_cache_c timepunct_cache_c; + +#ifdef _GLIBCXX_USE_WCHAR_T + typedef char fake_num_cache_w[sizeof(std::__numpunct_cache<wchar_t>)] + __attribute__ ((aligned(__alignof__(std::__numpunct_cache<wchar_t>)))); + fake_num_cache_w numpunct_cache_w; + + typedef char fake_money_cache_w[sizeof(std::__moneypunct_cache<wchar_t,true>)] + __attribute__ ((aligned(__alignof__(std::__moneypunct_cache<wchar_t,true>)))); + fake_money_cache_w moneypunct_cache_wt; + fake_money_cache_w moneypunct_cache_wf; + + typedef char fake_time_cache_w[sizeof(std::__timepunct_cache<wchar_t>)] + __attribute__ ((aligned(__alignof__(std::__timepunct_cache<wchar_t>)))); + fake_time_cache_w timepunct_cache_w; +#endif +} // anonymous namespace + +_GLIBCXX_BEGIN_NAMESPACE(std) locale::locale() throw() : _M_impl(0) { - _S_initialize(); - __gnu_cxx::lock sentry(__gnu_internal::locale_mutex); + _S_initialize(); + __gnu_cxx::__scoped_lock sentry(get_locale_mutex()); _S_global->_M_add_reference(); _M_impl = _S_global; } @@ -111,12 +223,13 @@ namespace std _S_initialize(); _Impl* __old; { - __gnu_cxx::lock sentry(__gnu_internal::locale_mutex); + __gnu_cxx::__scoped_lock sentry(get_locale_mutex()); __old = _S_global; __other._M_impl->_M_add_reference(); - _S_global = __other._M_impl; - if (__other.name() != "*") - setlocale(LC_ALL, __other.name().c_str()); + _S_global = __other._M_impl; + const string __other_name = __other.name(); + if (__other_name != "*") + setlocale(LC_ALL, __other_name.c_str()); } // Reference count sanity check: one reference removed for the @@ -131,7 +244,7 @@ namespace std locale::classic() { _S_initialize(); - return c_locale; + return reinterpret_cast<const locale&>(c_locale); } void @@ -256,13 +369,12 @@ namespace std for (size_t __i = 0; __i < _M_facets_size; ++__i) _M_facets[__i] = _M_caches[__i] = 0; - // Name all the categories. + // Name the categories. _M_names = new (&name_vec) char*[_S_categories_size]; - for (size_t __j = 0; __j < _S_categories_size; ++__j) - { - _M_names[__j] = new (&name_c[__j]) char[2]; - std::strcpy(_M_names[__j], locale::facet::_S_get_c_name()); - } + _M_names[0] = new (&name_c[0]) char[2]; + std::memcpy(_M_names[0], locale::facet::_S_get_c_name(), 2); + for (size_t __j = 1; __j < _S_categories_size; ++__j) + _M_names[__j] = 0; // This is needed as presently the C++ version of "C" locales // != data in the underlying locale model for __timepunct, @@ -344,4 +456,5 @@ namespace std _M_caches[__timepunct<wchar_t>::id._M_id()] = __tpw; #endif } -} // namespace std + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/localename.cc b/contrib/libstdc++/src/localename.cc index 9c40c68..ff8c369 100644 --- a/contrib/libstdc++/src/localename.cc +++ b/contrib/libstdc++/src/localename.cc @@ -1,4 +1,4 @@ -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -30,11 +30,10 @@ #include <cstring> #include <locale> -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + using namespace __gnu_cxx; - locale::locale(const char* __s) : _M_impl(0) { if (__s) @@ -60,19 +59,19 @@ namespace std else { // LANG may set a default different from "C". - string __res; - char* __env = std::getenv("LANG"); + string __lang; + __env = std::getenv("LANG"); if (!__env || std::strcmp(__env, "") == 0 || std::strcmp(__env, "C") == 0 || std::strcmp(__env, "POSIX") == 0) - __res = "C"; + __lang = "C"; else - __res = __env; + __lang = __env; // Scan the categories looking for the first one // different from LANG. size_t __i = 0; - if (__res == "C") + if (__lang == "C") for (; __i < _S_categories_size; ++__i) { __env = std::getenv(_S_categories[__i]); @@ -86,7 +85,7 @@ namespace std { __env = std::getenv(_S_categories[__i]); if (__env && std::strcmp(__env, "") != 0 - && __res != __env) + && __lang != __env) break; } @@ -95,37 +94,34 @@ namespace std if (__i < _S_categories_size) { string __str; + __str.reserve(128); for (size_t __j = 0; __j < __i; ++__j) { __str += _S_categories[__j]; __str += '='; - __str += __res; + __str += __lang; __str += ';'; } __str += _S_categories[__i]; __str += '='; __str += __env; __str += ';'; - __i++; + ++__i; for (; __i < _S_categories_size; ++__i) { __env = std::getenv(_S_categories[__i]); + __str += _S_categories[__i]; if (!__env || std::strcmp(__env, "") == 0) { - __str += _S_categories[__i]; __str += '='; - __str += __res; + __str += __lang; __str += ';'; } else if (std::strcmp(__env, "C") == 0 || std::strcmp(__env, "POSIX") == 0) - { - __str += _S_categories[__i]; - __str += "=C;"; - } + __str += "=C;"; else { - __str += _S_categories[__i]; __str += '='; __str += __env; __str += ';'; @@ -136,10 +132,10 @@ namespace std } // ... otherwise either an additional instance of // the "C" locale or LANG. - else if (__res == "C") + else if (__lang == "C") (_M_impl = _S_classic)->_M_add_reference(); else - _M_impl = new _Impl(__res.c_str(), 1); + _M_impl = new _Impl(__lang.c_str(), 1); } } } @@ -179,9 +175,9 @@ namespace std // Construct named _Impl. locale::_Impl:: - _Impl(const char* __s, size_t __refs) + _Impl(const char* __s, size_t __refs) : _M_refcount(__refs), _M_facets(0), _M_facets_size(_GLIBCXX_NUM_FACETS), - _M_caches(0), _M_names(0) + _M_caches(0), _M_names(0) { // Initialize the underlying locale model, which also checks to // see if the given name is valid. @@ -200,15 +196,12 @@ namespace std for (size_t __k = 0; __k < _S_categories_size; ++__k) _M_names[__k] = 0; - // Name all the categories. + // Name the categories. const size_t __len = std::strlen(__s); - if (!std::strchr(__s, ';')) + if (!std::memchr(__s, ';', __len)) { - for (size_t __i = 0; __i < _S_categories_size; ++__i) - { - _M_names[__i] = new char[__len + 1]; - std::strcpy(_M_names[__i], __s); - } + _M_names[0] = new char[__len + 1]; + std::memcpy(_M_names[0], __s, __len + 1); } else { @@ -219,10 +212,9 @@ namespace std __end = std::strchr(__beg, ';'); if (!__end) __end = __s + __len; - char* __new = new char[__end - __beg + 1]; - std::memcpy(__new, __beg, __end - __beg); - __new[__end - __beg] = '\0'; - _M_names[__i] = __new; + _M_names[__i] = new char[__end - __beg + 1]; + std::memcpy(_M_names[__i], __beg, __end - __beg); + _M_names[__i][__end - __beg] = '\0'; } } @@ -272,23 +264,50 @@ namespace std locale::_Impl:: _M_replace_categories(const _Impl* __imp, category __cat) { - for (size_t __ix = 0; __ix < _S_categories_size; ++__ix) + category __mask = 1; + const bool __have_names = _M_names[0] && __imp->_M_names[0]; + for (size_t __ix = 0; __ix < _S_categories_size; ++__ix, __mask <<= 1) { - const category __mask = 1 << __ix; if (__mask & __cat) { // Need to replace entry in _M_facets with other locale's info. _M_replace_category(__imp, _S_facet_categories[__ix]); // If both have names, go ahead and mangle. - if (std::strcmp(_M_names[__ix], "*") != 0 - && std::strcmp(__imp->_M_names[__ix], "*") != 0) + if (__have_names) { - char* __new = new char[std::strlen(__imp->_M_names[__ix]) + 1]; - std::strcpy(__new, __imp->_M_names[__ix]); - delete [] _M_names[__ix]; - _M_names[__ix] = __new; + if (!_M_names[1]) + { + // A full set of _M_names must be prepared, all identical + // to _M_names[0] to begin with. Then, below, a few will + // be replaced by the corresponding __imp->_M_names. I.e., + // not a "simple" locale anymore (see locale::operator==). + const size_t __len = std::strlen(_M_names[0]) + 1; + for (size_t __i = 1; __i < _S_categories_size; ++__i) + { + _M_names[__i] = new char[__len]; + std::memcpy(_M_names[__i], _M_names[0], __len); + } + } + + // FIXME: Hack for libstdc++/29217: the numerical encodings + // of the time and collate categories are swapped vs the + // order of the names in locale::_S_categories. We'd like to + // adjust the former (the latter is dictated by compatibility + // with glibc) but we can't for binary compatibility. + size_t __ix_name = __ix; + if (__ix == 2 || __ix == 3) + __ix_name = 5 - __ix; + + char* __src = __imp->_M_names[__ix_name] ? + __imp->_M_names[__ix_name] : __imp->_M_names[0]; + const size_t __len = std::strlen(__src) + 1; + char* __new = new char[__len]; + std::memcpy(__new, __src, __len); + delete [] _M_names[__ix_name]; + _M_names[__ix_name] = __new; } } } } -} // namespace std + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/misc-inst.cc b/contrib/libstdc++/src/misc-inst.cc index b9bc298..8cc39e3 100644 --- a/contrib/libstdc++/src/misc-inst.cc +++ b/contrib/libstdc++/src/misc-inst.cc @@ -1,6 +1,6 @@ // Explicit instantiation file. -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -35,13 +35,10 @@ #include <string> #include <istream> #include <ostream> -#include <algorithm> -#include <vector> -#include <bits/atomicity.h> #include <ext/stdio_sync_filebuf.h> -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + // string related to iostreams template basic_istream<char>& @@ -69,14 +66,16 @@ namespace std basic_istream<wchar_t>& getline(basic_istream<wchar_t>&, wstring&); #endif -} // namespace std -namespace __gnu_cxx -{ +_GLIBCXX_END_NAMESPACE + +_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + template class stdio_sync_filebuf<char>; #ifdef _GLIBCXX_USE_WCHAR_T template class stdio_sync_filebuf<wchar_t>; #endif -} // namespace __gnu_cxx + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/mt_allocator.cc b/contrib/libstdc++/src/mt_allocator.cc new file mode 100644 index 0000000..da0b09c --- /dev/null +++ b/contrib/libstdc++/src/mt_allocator.cc @@ -0,0 +1,804 @@ +// Allocator details. + +// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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 library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: +// + +#include <bits/c++config.h> +#include <ext/concurrence.h> +#include <ext/mt_allocator.h> +#include <cstring> + +namespace +{ +#ifdef __GTHREADS + struct __freelist + { + typedef __gnu_cxx::__pool<true>::_Thread_record _Thread_record; + _Thread_record* _M_thread_freelist; + _Thread_record* _M_thread_freelist_array; + size_t _M_max_threads; + __gthread_key_t _M_key; + + ~__freelist() + { + if (_M_thread_freelist_array) + { + __gthread_key_delete(_M_key); + ::operator delete(static_cast<void*>(_M_thread_freelist_array)); + } + } + }; + + // Ensure freelist is constructed first. + static __freelist freelist; + __gnu_cxx::__mutex freelist_mutex; + + static void + _M_destroy_thread_key(void* __id) + { + // Return this thread id record to the front of thread_freelist. + __gnu_cxx::__scoped_lock sentry(freelist_mutex); + size_t _M_id = reinterpret_cast<size_t>(__id); + + typedef __gnu_cxx::__pool<true>::_Thread_record _Thread_record; + _Thread_record* __tr = &freelist._M_thread_freelist_array[_M_id - 1]; + __tr->_M_next = freelist._M_thread_freelist; + freelist._M_thread_freelist = __tr; + } +#endif +} // anonymous namespace + +_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + + void + __pool<false>::_M_destroy() throw() + { + if (_M_init && !_M_options._M_force_new) + { + for (size_t __n = 0; __n < _M_bin_size; ++__n) + { + _Bin_record& __bin = _M_bin[__n]; + while (__bin._M_address) + { + _Block_address* __tmp = __bin._M_address->_M_next; + ::operator delete(__bin._M_address->_M_initial); + __bin._M_address = __tmp; + } + ::operator delete(__bin._M_first); + } + ::operator delete(_M_bin); + ::operator delete(_M_binmap); + } + } + + void + __pool<false>::_M_reclaim_block(char* __p, size_t __bytes) + { + // Round up to power of 2 and figure out which bin to use. + const size_t __which = _M_binmap[__bytes]; + _Bin_record& __bin = _M_bin[__which]; + + char* __c = __p - _M_get_align(); + _Block_record* __block = reinterpret_cast<_Block_record*>(__c); + + // Single threaded application - return to global pool. + __block->_M_next = __bin._M_first[0]; + __bin._M_first[0] = __block; + } + + char* + __pool<false>::_M_reserve_block(size_t __bytes, const size_t __thread_id) + { + // Round up to power of 2 and figure out which bin to use. + const size_t __which = _M_binmap[__bytes]; + _Bin_record& __bin = _M_bin[__which]; + const _Tune& __options = _M_get_options(); + const size_t __bin_size = (__options._M_min_bin << __which) + + __options._M_align; + size_t __block_count = __options._M_chunk_size - sizeof(_Block_address); + __block_count /= __bin_size; + + // Get a new block dynamically, set it up for use. + void* __v = ::operator new(__options._M_chunk_size); + _Block_address* __address = static_cast<_Block_address*>(__v); + __address->_M_initial = __v; + __address->_M_next = __bin._M_address; + __bin._M_address = __address; + + char* __c = static_cast<char*>(__v) + sizeof(_Block_address); + _Block_record* __block = reinterpret_cast<_Block_record*>(__c); + __bin._M_first[__thread_id] = __block; + while (--__block_count > 0) + { + __c += __bin_size; + __block->_M_next = reinterpret_cast<_Block_record*>(__c); + __block = __block->_M_next; + } + __block->_M_next = NULL; + + __block = __bin._M_first[__thread_id]; + __bin._M_first[__thread_id] = __block->_M_next; + + // NB: For alignment reasons, we can't use the first _M_align + // bytes, even when sizeof(_Block_record) < _M_align. + return reinterpret_cast<char*>(__block) + __options._M_align; + } + + void + __pool<false>::_M_initialize() + { + // _M_force_new must not change after the first allocate(), which + // in turn calls this method, so if it's false, it's false forever + // and we don't need to return here ever again. + if (_M_options._M_force_new) + { + _M_init = true; + return; + } + + // Create the bins. + // Calculate the number of bins required based on _M_max_bytes. + // _M_bin_size is statically-initialized to one. + size_t __bin_size = _M_options._M_min_bin; + while (_M_options._M_max_bytes > __bin_size) + { + __bin_size <<= 1; + ++_M_bin_size; + } + + // Setup the bin map for quick lookup of the relevant bin. + const size_t __j = (_M_options._M_max_bytes + 1) * sizeof(_Binmap_type); + _M_binmap = static_cast<_Binmap_type*>(::operator new(__j)); + _Binmap_type* __bp = _M_binmap; + _Binmap_type __bin_max = _M_options._M_min_bin; + _Binmap_type __bint = 0; + for (_Binmap_type __ct = 0; __ct <= _M_options._M_max_bytes; ++__ct) + { + if (__ct > __bin_max) + { + __bin_max <<= 1; + ++__bint; + } + *__bp++ = __bint; + } + + // Initialize _M_bin and its members. + void* __v = ::operator new(sizeof(_Bin_record) * _M_bin_size); + _M_bin = static_cast<_Bin_record*>(__v); + for (size_t __n = 0; __n < _M_bin_size; ++__n) + { + _Bin_record& __bin = _M_bin[__n]; + __v = ::operator new(sizeof(_Block_record*)); + __bin._M_first = static_cast<_Block_record**>(__v); + __bin._M_first[0] = NULL; + __bin._M_address = NULL; + } + _M_init = true; + } + + +#ifdef __GTHREADS + void + __pool<true>::_M_destroy() throw() + { + if (_M_init && !_M_options._M_force_new) + { + if (__gthread_active_p()) + { + for (size_t __n = 0; __n < _M_bin_size; ++__n) + { + _Bin_record& __bin = _M_bin[__n]; + while (__bin._M_address) + { + _Block_address* __tmp = __bin._M_address->_M_next; + ::operator delete(__bin._M_address->_M_initial); + __bin._M_address = __tmp; + } + ::operator delete(__bin._M_first); + ::operator delete(__bin._M_free); + ::operator delete(__bin._M_used); + ::operator delete(__bin._M_mutex); + } + } + else + { + for (size_t __n = 0; __n < _M_bin_size; ++__n) + { + _Bin_record& __bin = _M_bin[__n]; + while (__bin._M_address) + { + _Block_address* __tmp = __bin._M_address->_M_next; + ::operator delete(__bin._M_address->_M_initial); + __bin._M_address = __tmp; + } + ::operator delete(__bin._M_first); + } + } + ::operator delete(_M_bin); + ::operator delete(_M_binmap); + } + } + + void + __pool<true>::_M_reclaim_block(char* __p, size_t __bytes) + { + // Round up to power of 2 and figure out which bin to use. + const size_t __which = _M_binmap[__bytes]; + const _Bin_record& __bin = _M_bin[__which]; + + // Know __p not null, assume valid block. + char* __c = __p - _M_get_align(); + _Block_record* __block = reinterpret_cast<_Block_record*>(__c); + if (__gthread_active_p()) + { + // Calculate the number of records to remove from our freelist: + // in order to avoid too much contention we wait until the + // number of records is "high enough". + const size_t __thread_id = _M_get_thread_id(); + const _Tune& __options = _M_get_options(); + const size_t __limit = (100 * (_M_bin_size - __which) + * __options._M_freelist_headroom); + + size_t __remove = __bin._M_free[__thread_id]; + __remove *= __options._M_freelist_headroom; + + // NB: We assume that reads of _Atomic_words are atomic. + const size_t __max_threads = __options._M_max_threads + 1; + _Atomic_word* const __reclaimed_base = + reinterpret_cast<_Atomic_word*>(__bin._M_used + __max_threads); + const _Atomic_word __reclaimed = __reclaimed_base[__thread_id]; + const size_t __net_used = __bin._M_used[__thread_id] - __reclaimed; + + // NB: For performance sake we don't resync every time, in order + // to spare atomic ops. Note that if __reclaimed increased by, + // say, 1024, since the last sync, it means that the other + // threads executed the atomic in the else below at least the + // same number of times (at least, because _M_reserve_block may + // have decreased the counter), therefore one more cannot hurt. + if (__reclaimed > 1024) + { + __bin._M_used[__thread_id] -= __reclaimed; + __atomic_add(&__reclaimed_base[__thread_id], -__reclaimed); + } + + if (__remove >= __net_used) + __remove -= __net_used; + else + __remove = 0; + if (__remove > __limit && __remove > __bin._M_free[__thread_id]) + { + _Block_record* __first = __bin._M_first[__thread_id]; + _Block_record* __tmp = __first; + __remove /= __options._M_freelist_headroom; + const size_t __removed = __remove; + while (--__remove > 0) + __tmp = __tmp->_M_next; + __bin._M_first[__thread_id] = __tmp->_M_next; + __bin._M_free[__thread_id] -= __removed; + + __gthread_mutex_lock(__bin._M_mutex); + __tmp->_M_next = __bin._M_first[0]; + __bin._M_first[0] = __first; + __bin._M_free[0] += __removed; + __gthread_mutex_unlock(__bin._M_mutex); + } + + // Return this block to our list and update counters and + // owner id as needed. + if (__block->_M_thread_id == __thread_id) + --__bin._M_used[__thread_id]; + else + __atomic_add(&__reclaimed_base[__block->_M_thread_id], 1); + + __block->_M_next = __bin._M_first[__thread_id]; + __bin._M_first[__thread_id] = __block; + + ++__bin._M_free[__thread_id]; + } + else + { + // Not using threads, so single threaded application - return + // to global pool. + __block->_M_next = __bin._M_first[0]; + __bin._M_first[0] = __block; + } + } + + char* + __pool<true>::_M_reserve_block(size_t __bytes, const size_t __thread_id) + { + // Round up to power of 2 and figure out which bin to use. + const size_t __which = _M_binmap[__bytes]; + const _Tune& __options = _M_get_options(); + const size_t __bin_size = ((__options._M_min_bin << __which) + + __options._M_align); + size_t __block_count = __options._M_chunk_size - sizeof(_Block_address); + __block_count /= __bin_size; + + // Are we using threads? + // - Yes, check if there are free blocks on the global + // list. If so, grab up to __block_count blocks in one + // lock and change ownership. If the global list is + // empty, we allocate a new chunk and add those blocks + // directly to our own freelist (with us as owner). + // - No, all operations are made directly to global pool 0 + // no need to lock or change ownership but check for free + // blocks on global list (and if not add new ones) and + // get the first one. + _Bin_record& __bin = _M_bin[__which]; + _Block_record* __block = NULL; + if (__gthread_active_p()) + { + // Resync the _M_used counters. + const size_t __max_threads = __options._M_max_threads + 1; + _Atomic_word* const __reclaimed_base = + reinterpret_cast<_Atomic_word*>(__bin._M_used + __max_threads); + const _Atomic_word __reclaimed = __reclaimed_base[__thread_id]; + __bin._M_used[__thread_id] -= __reclaimed; + __atomic_add(&__reclaimed_base[__thread_id], -__reclaimed); + + __gthread_mutex_lock(__bin._M_mutex); + if (__bin._M_first[0] == NULL) + { + void* __v = ::operator new(__options._M_chunk_size); + _Block_address* __address = static_cast<_Block_address*>(__v); + __address->_M_initial = __v; + __address->_M_next = __bin._M_address; + __bin._M_address = __address; + __gthread_mutex_unlock(__bin._M_mutex); + + // No need to hold the lock when we are adding a whole + // chunk to our own list. + char* __c = static_cast<char*>(__v) + sizeof(_Block_address); + __block = reinterpret_cast<_Block_record*>(__c); + __bin._M_free[__thread_id] = __block_count; + __bin._M_first[__thread_id] = __block; + while (--__block_count > 0) + { + __c += __bin_size; + __block->_M_next = reinterpret_cast<_Block_record*>(__c); + __block = __block->_M_next; + } + __block->_M_next = NULL; + } + else + { + // Is the number of required blocks greater than or equal + // to the number that can be provided by the global free + // list? + __bin._M_first[__thread_id] = __bin._M_first[0]; + if (__block_count >= __bin._M_free[0]) + { + __bin._M_free[__thread_id] = __bin._M_free[0]; + __bin._M_free[0] = 0; + __bin._M_first[0] = NULL; + } + else + { + __bin._M_free[__thread_id] = __block_count; + __bin._M_free[0] -= __block_count; + __block = __bin._M_first[0]; + while (--__block_count > 0) + __block = __block->_M_next; + __bin._M_first[0] = __block->_M_next; + __block->_M_next = NULL; + } + __gthread_mutex_unlock(__bin._M_mutex); + } + } + else + { + void* __v = ::operator new(__options._M_chunk_size); + _Block_address* __address = static_cast<_Block_address*>(__v); + __address->_M_initial = __v; + __address->_M_next = __bin._M_address; + __bin._M_address = __address; + + char* __c = static_cast<char*>(__v) + sizeof(_Block_address); + __block = reinterpret_cast<_Block_record*>(__c); + __bin._M_first[0] = __block; + while (--__block_count > 0) + { + __c += __bin_size; + __block->_M_next = reinterpret_cast<_Block_record*>(__c); + __block = __block->_M_next; + } + __block->_M_next = NULL; + } + + __block = __bin._M_first[__thread_id]; + __bin._M_first[__thread_id] = __block->_M_next; + + if (__gthread_active_p()) + { + __block->_M_thread_id = __thread_id; + --__bin._M_free[__thread_id]; + ++__bin._M_used[__thread_id]; + } + + // NB: For alignment reasons, we can't use the first _M_align + // bytes, even when sizeof(_Block_record) < _M_align. + return reinterpret_cast<char*>(__block) + __options._M_align; + } + + void + __pool<true>::_M_initialize() + { + // _M_force_new must not change after the first allocate(), + // which in turn calls this method, so if it's false, it's false + // forever and we don't need to return here ever again. + if (_M_options._M_force_new) + { + _M_init = true; + return; + } + + // Create the bins. + // Calculate the number of bins required based on _M_max_bytes. + // _M_bin_size is statically-initialized to one. + size_t __bin_size = _M_options._M_min_bin; + while (_M_options._M_max_bytes > __bin_size) + { + __bin_size <<= 1; + ++_M_bin_size; + } + + // Setup the bin map for quick lookup of the relevant bin. + const size_t __j = (_M_options._M_max_bytes + 1) * sizeof(_Binmap_type); + _M_binmap = static_cast<_Binmap_type*>(::operator new(__j)); + _Binmap_type* __bp = _M_binmap; + _Binmap_type __bin_max = _M_options._M_min_bin; + _Binmap_type __bint = 0; + for (_Binmap_type __ct = 0; __ct <= _M_options._M_max_bytes; ++__ct) + { + if (__ct > __bin_max) + { + __bin_max <<= 1; + ++__bint; + } + *__bp++ = __bint; + } + + // Initialize _M_bin and its members. + void* __v = ::operator new(sizeof(_Bin_record) * _M_bin_size); + _M_bin = static_cast<_Bin_record*>(__v); + + // If __gthread_active_p() create and initialize the list of + // free thread ids. Single threaded applications use thread id 0 + // directly and have no need for this. + if (__gthread_active_p()) + { + { + __gnu_cxx::__scoped_lock sentry(freelist_mutex); + + if (!freelist._M_thread_freelist_array + || freelist._M_max_threads < _M_options._M_max_threads) + { + const size_t __k = sizeof(_Thread_record) + * _M_options._M_max_threads; + __v = ::operator new(__k); + _M_thread_freelist = static_cast<_Thread_record*>(__v); + + // NOTE! The first assignable thread id is 1 since the + // global pool uses id 0 + size_t __i; + for (__i = 1; __i < _M_options._M_max_threads; ++__i) + { + _Thread_record& __tr = _M_thread_freelist[__i - 1]; + __tr._M_next = &_M_thread_freelist[__i]; + __tr._M_id = __i; + } + + // Set last record. + _M_thread_freelist[__i - 1]._M_next = NULL; + _M_thread_freelist[__i - 1]._M_id = __i; + + if (!freelist._M_thread_freelist_array) + { + // Initialize per thread key to hold pointer to + // _M_thread_freelist. + __gthread_key_create(&freelist._M_key, + ::_M_destroy_thread_key); + freelist._M_thread_freelist = _M_thread_freelist; + } + else + { + _Thread_record* _M_old_freelist + = freelist._M_thread_freelist; + _Thread_record* _M_old_array + = freelist._M_thread_freelist_array; + freelist._M_thread_freelist + = &_M_thread_freelist[_M_old_freelist - _M_old_array]; + while (_M_old_freelist) + { + size_t next_id; + if (_M_old_freelist->_M_next) + next_id = _M_old_freelist->_M_next - _M_old_array; + else + next_id = freelist._M_max_threads; + _M_thread_freelist[_M_old_freelist->_M_id - 1]._M_next + = &_M_thread_freelist[next_id]; + _M_old_freelist = _M_old_freelist->_M_next; + } + ::operator delete(static_cast<void*>(_M_old_array)); + } + freelist._M_thread_freelist_array = _M_thread_freelist; + freelist._M_max_threads = _M_options._M_max_threads; + } + } + + const size_t __max_threads = _M_options._M_max_threads + 1; + for (size_t __n = 0; __n < _M_bin_size; ++__n) + { + _Bin_record& __bin = _M_bin[__n]; + __v = ::operator new(sizeof(_Block_record*) * __max_threads); + std::memset(__v, 0, sizeof(_Block_record*) * __max_threads); + __bin._M_first = static_cast<_Block_record**>(__v); + + __bin._M_address = NULL; + + __v = ::operator new(sizeof(size_t) * __max_threads); + std::memset(__v, 0, sizeof(size_t) * __max_threads); + + __bin._M_free = static_cast<size_t*>(__v); + + __v = ::operator new(sizeof(size_t) * __max_threads + + sizeof(_Atomic_word) * __max_threads); + std::memset(__v, 0, (sizeof(size_t) * __max_threads + + sizeof(_Atomic_word) * __max_threads)); + __bin._M_used = static_cast<size_t*>(__v); + + __v = ::operator new(sizeof(__gthread_mutex_t)); + __bin._M_mutex = static_cast<__gthread_mutex_t*>(__v); + +#ifdef __GTHREAD_MUTEX_INIT + { + // Do not copy a POSIX/gthr mutex once in use. + __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT; + *__bin._M_mutex = __tmp; + } +#else + { __GTHREAD_MUTEX_INIT_FUNCTION(__bin._M_mutex); } +#endif + } + } + else + { + for (size_t __n = 0; __n < _M_bin_size; ++__n) + { + _Bin_record& __bin = _M_bin[__n]; + __v = ::operator new(sizeof(_Block_record*)); + __bin._M_first = static_cast<_Block_record**>(__v); + __bin._M_first[0] = NULL; + __bin._M_address = NULL; + } + } + _M_init = true; + } + + size_t + __pool<true>::_M_get_thread_id() + { + // If we have thread support and it's active we check the thread + // key value and return its id or if it's not set we take the + // first record from _M_thread_freelist and sets the key and + // returns it's id. + if (__gthread_active_p()) + { + void* v = __gthread_getspecific(freelist._M_key); + size_t _M_id = (size_t)v; + if (_M_id == 0) + { + { + __gnu_cxx::__scoped_lock sentry(freelist_mutex); + if (freelist._M_thread_freelist) + { + _M_id = freelist._M_thread_freelist->_M_id; + freelist._M_thread_freelist + = freelist._M_thread_freelist->_M_next; + } + } + + __gthread_setspecific(freelist._M_key, (void*)_M_id); + } + return _M_id >= _M_options._M_max_threads ? 0 : _M_id; + } + + // Otherwise (no thread support or inactive) all requests are + // served from the global pool 0. + return 0; + } + + // XXX GLIBCXX_ABI Deprecated + void + __pool<true>::_M_destroy_thread_key(void*) { } + + // XXX GLIBCXX_ABI Deprecated + void + __pool<true>::_M_initialize(__destroy_handler) + { + // _M_force_new must not change after the first allocate(), + // which in turn calls this method, so if it's false, it's false + // forever and we don't need to return here ever again. + if (_M_options._M_force_new) + { + _M_init = true; + return; + } + + // Create the bins. + // Calculate the number of bins required based on _M_max_bytes. + // _M_bin_size is statically-initialized to one. + size_t __bin_size = _M_options._M_min_bin; + while (_M_options._M_max_bytes > __bin_size) + { + __bin_size <<= 1; + ++_M_bin_size; + } + + // Setup the bin map for quick lookup of the relevant bin. + const size_t __j = (_M_options._M_max_bytes + 1) * sizeof(_Binmap_type); + _M_binmap = static_cast<_Binmap_type*>(::operator new(__j)); + _Binmap_type* __bp = _M_binmap; + _Binmap_type __bin_max = _M_options._M_min_bin; + _Binmap_type __bint = 0; + for (_Binmap_type __ct = 0; __ct <= _M_options._M_max_bytes; ++__ct) + { + if (__ct > __bin_max) + { + __bin_max <<= 1; + ++__bint; + } + *__bp++ = __bint; + } + + // Initialize _M_bin and its members. + void* __v = ::operator new(sizeof(_Bin_record) * _M_bin_size); + _M_bin = static_cast<_Bin_record*>(__v); + + // If __gthread_active_p() create and initialize the list of + // free thread ids. Single threaded applications use thread id 0 + // directly and have no need for this. + if (__gthread_active_p()) + { + { + __gnu_cxx::__scoped_lock sentry(freelist_mutex); + + if (!freelist._M_thread_freelist_array + || freelist._M_max_threads < _M_options._M_max_threads) + { + const size_t __k = sizeof(_Thread_record) + * _M_options._M_max_threads; + __v = ::operator new(__k); + _M_thread_freelist = static_cast<_Thread_record*>(__v); + + // NOTE! The first assignable thread id is 1 since the + // global pool uses id 0 + size_t __i; + for (__i = 1; __i < _M_options._M_max_threads; ++__i) + { + _Thread_record& __tr = _M_thread_freelist[__i - 1]; + __tr._M_next = &_M_thread_freelist[__i]; + __tr._M_id = __i; + } + + // Set last record. + _M_thread_freelist[__i - 1]._M_next = NULL; + _M_thread_freelist[__i - 1]._M_id = __i; + + if (!freelist._M_thread_freelist_array) + { + // Initialize per thread key to hold pointer to + // _M_thread_freelist. + __gthread_key_create(&freelist._M_key, + ::_M_destroy_thread_key); + freelist._M_thread_freelist = _M_thread_freelist; + } + else + { + _Thread_record* _M_old_freelist + = freelist._M_thread_freelist; + _Thread_record* _M_old_array + = freelist._M_thread_freelist_array; + freelist._M_thread_freelist + = &_M_thread_freelist[_M_old_freelist - _M_old_array]; + while (_M_old_freelist) + { + size_t next_id; + if (_M_old_freelist->_M_next) + next_id = _M_old_freelist->_M_next - _M_old_array; + else + next_id = freelist._M_max_threads; + _M_thread_freelist[_M_old_freelist->_M_id - 1]._M_next + = &_M_thread_freelist[next_id]; + _M_old_freelist = _M_old_freelist->_M_next; + } + ::operator delete(static_cast<void*>(_M_old_array)); + } + freelist._M_thread_freelist_array = _M_thread_freelist; + freelist._M_max_threads = _M_options._M_max_threads; + } + } + + const size_t __max_threads = _M_options._M_max_threads + 1; + for (size_t __n = 0; __n < _M_bin_size; ++__n) + { + _Bin_record& __bin = _M_bin[__n]; + __v = ::operator new(sizeof(_Block_record*) * __max_threads); + std::memset(__v, 0, sizeof(_Block_record*) * __max_threads); + __bin._M_first = static_cast<_Block_record**>(__v); + + __bin._M_address = NULL; + + __v = ::operator new(sizeof(size_t) * __max_threads); + std::memset(__v, 0, sizeof(size_t) * __max_threads); + __bin._M_free = static_cast<size_t*>(__v); + + __v = ::operator new(sizeof(size_t) * __max_threads + + sizeof(_Atomic_word) * __max_threads); + std::memset(__v, 0, (sizeof(size_t) * __max_threads + + sizeof(_Atomic_word) * __max_threads)); + __bin._M_used = static_cast<size_t*>(__v); + + __v = ::operator new(sizeof(__gthread_mutex_t)); + __bin._M_mutex = static_cast<__gthread_mutex_t*>(__v); + +#ifdef __GTHREAD_MUTEX_INIT + { + // Do not copy a POSIX/gthr mutex once in use. + __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT; + *__bin._M_mutex = __tmp; + } +#else + { __GTHREAD_MUTEX_INIT_FUNCTION(__bin._M_mutex); } +#endif + } + } + else + { + for (size_t __n = 0; __n < _M_bin_size; ++__n) + { + _Bin_record& __bin = _M_bin[__n]; + __v = ::operator new(sizeof(_Block_record*)); + __bin._M_first = static_cast<_Block_record**>(__v); + __bin._M_first[0] = NULL; + __bin._M_address = NULL; + } + } + _M_init = true; + } +#endif + + // Instantiations. + template class __mt_alloc<char>; + template class __mt_alloc<wchar_t>; + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/ostream-inst.cc b/contrib/libstdc++/src/ostream-inst.cc index c4e2394..33c6815 100644 --- a/contrib/libstdc++/src/ostream-inst.cc +++ b/contrib/libstdc++/src/ostream-inst.cc @@ -1,6 +1,6 @@ // Explicit instantiation file. -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -35,8 +35,8 @@ #include <ostream> #include <iomanip> -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + // ostream template class basic_ostream<char>; template ostream& endl(ostream&); @@ -55,6 +55,18 @@ namespace std template ostream& operator<<(ostream&, _Setbase); template ostream& operator<<(ostream&, _Setprecision); template ostream& operator<<(ostream&, _Setw); + template ostream& __ostream_insert(ostream&, const char*, streamsize); + + template ostream& ostream::_M_insert(long); + template ostream& ostream::_M_insert(unsigned long); + template ostream& ostream::_M_insert(bool); +#ifdef _GLIBCXX_USE_LONG_LONG + template ostream& ostream::_M_insert(long long); + template ostream& ostream::_M_insert(unsigned long long); +#endif + template ostream& ostream::_M_insert(double); + template ostream& ostream::_M_insert(long double); + template ostream& ostream::_M_insert(const void*); #ifdef _GLIBCXX_USE_WCHAR_T template class basic_ostream<wchar_t>; @@ -72,5 +84,33 @@ namespace std template wostream& operator<<(wostream&, _Setbase); template wostream& operator<<(wostream&, _Setprecision); template wostream& operator<<(wostream&, _Setw); + template wostream& __ostream_insert(wostream&, const wchar_t*, streamsize); + + template wostream& wostream::_M_insert(long); + template wostream& wostream::_M_insert(unsigned long); + template wostream& wostream::_M_insert(bool); +#ifdef _GLIBCXX_USE_LONG_LONG + template wostream& wostream::_M_insert(long long); + template wostream& wostream::_M_insert(unsigned long long); +#endif + template wostream& wostream::_M_insert(double); + template wostream& wostream::_M_insert(long double); + template wostream& wostream::_M_insert(const void*); #endif -} // namespace std + +_GLIBCXX_END_NAMESPACE + +// XXX GLIBCXX_ABI Deprecated +#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT + +#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \ + extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak)) +_GLIBCXX_LDBL_COMPAT (_ZNSolsEd, _ZNSolsEe); +_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_ostreamIwSt11char_traitsIwEElsEd, + _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEe); +_GLIBCXX_LDBL_COMPAT (_ZNSo9_M_insertIdEERSoT_, + _ZNSo9_M_insertIeEERSoT_); +_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIdEERS2_T_, + _ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIeEERS2_T_); + +#endif // _GLIBCXX_LONG_DOUBLE_COMPAT diff --git a/contrib/libstdc++/src/pool_allocator.cc b/contrib/libstdc++/src/pool_allocator.cc new file mode 100644 index 0000000..c759327 --- /dev/null +++ b/contrib/libstdc++/src/pool_allocator.cc @@ -0,0 +1,174 @@ +// Allocator details. + +// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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 library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: +// + +#include <bits/c++config.h> +#include <cstdlib> +#include <ext/pool_allocator.h> + +namespace +{ + __gnu_cxx::__mutex palloc_init_mutex; +} // anonymous namespace + +_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + + // Definitions for __pool_alloc_base. + __pool_alloc_base::_Obj* volatile* + __pool_alloc_base::_M_get_free_list(size_t __bytes) + { + size_t __i = ((__bytes + (size_t)_S_align - 1) / (size_t)_S_align - 1); + return _S_free_list + __i; + } + + __mutex& + __pool_alloc_base::_M_get_mutex() + { return palloc_init_mutex; } + + // Allocate memory in large chunks in order to avoid fragmenting the + // heap too much. Assume that __n is properly aligned. We hold the + // allocation lock. + char* + __pool_alloc_base::_M_allocate_chunk(size_t __n, int& __nobjs) + { + char* __result; + size_t __total_bytes = __n * __nobjs; + size_t __bytes_left = _S_end_free - _S_start_free; + + if (__bytes_left >= __total_bytes) + { + __result = _S_start_free; + _S_start_free += __total_bytes; + return __result ; + } + else if (__bytes_left >= __n) + { + __nobjs = (int)(__bytes_left / __n); + __total_bytes = __n * __nobjs; + __result = _S_start_free; + _S_start_free += __total_bytes; + return __result; + } + else + { + // Try to make use of the left-over piece. + if (__bytes_left > 0) + { + _Obj* volatile* __free_list = _M_get_free_list(__bytes_left); + ((_Obj*)(void*)_S_start_free)->_M_free_list_link = *__free_list; + *__free_list = (_Obj*)(void*)_S_start_free; + } + + size_t __bytes_to_get = (2 * __total_bytes + + _M_round_up(_S_heap_size >> 4)); + try + { + _S_start_free = static_cast<char*>(::operator new(__bytes_to_get)); + } + catch (...) + { + // Try to make do with what we have. That can't hurt. We + // do not try smaller requests, since that tends to result + // in disaster on multi-process machines. + size_t __i = __n; + for (; __i <= (size_t) _S_max_bytes; __i += (size_t) _S_align) + { + _Obj* volatile* __free_list = _M_get_free_list(__i); + _Obj* __p = *__free_list; + if (__p != 0) + { + *__free_list = __p->_M_free_list_link; + _S_start_free = (char*)__p; + _S_end_free = _S_start_free + __i; + return _M_allocate_chunk(__n, __nobjs); + // Any leftover piece will eventually make it to the + // right free list. + } + } + // What we have wasn't enough. Rethrow. + _S_start_free = _S_end_free = 0; // We have no chunk. + __throw_exception_again; + } + _S_heap_size += __bytes_to_get; + _S_end_free = _S_start_free + __bytes_to_get; + return _M_allocate_chunk(__n, __nobjs); + } + } + + // Returns an object of size __n, and optionally adds to "size + // __n"'s free list. We assume that __n is properly aligned. We + // hold the allocation lock. + void* + __pool_alloc_base::_M_refill(size_t __n) + { + int __nobjs = 20; + char* __chunk = _M_allocate_chunk(__n, __nobjs); + _Obj* volatile* __free_list; + _Obj* __result; + _Obj* __current_obj; + _Obj* __next_obj; + + if (__nobjs == 1) + return __chunk; + __free_list = _M_get_free_list(__n); + + // Build free list in chunk. + __result = (_Obj*)(void*)__chunk; + *__free_list = __next_obj = (_Obj*)(void*)(__chunk + __n); + for (int __i = 1; ; __i++) + { + __current_obj = __next_obj; + __next_obj = (_Obj*)(void*)((char*)__next_obj + __n); + if (__nobjs - 1 == __i) + { + __current_obj->_M_free_list_link = 0; + break; + } + else + __current_obj->_M_free_list_link = __next_obj; + } + return __result; + } + + __pool_alloc_base::_Obj* volatile __pool_alloc_base::_S_free_list[_S_free_list_size]; + + char* __pool_alloc_base::_S_start_free = 0; + + char* __pool_alloc_base::_S_end_free = 0; + + size_t __pool_alloc_base::_S_heap_size = 0; + + // Instantiations. + template class __pool_alloc<char>; + template class __pool_alloc<wchar_t>; + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/sstream-inst.cc b/contrib/libstdc++/src/sstream-inst.cc index 3295c2f..a6f41ba 100644 --- a/contrib/libstdc++/src/sstream-inst.cc +++ b/contrib/libstdc++/src/sstream-inst.cc @@ -1,6 +1,6 @@ // Explicit instantiation file. -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2005 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -34,29 +34,18 @@ #include <sstream> -namespace std -{ - // stringbuf - template class basic_stringbuf<char>; -#ifdef _GLIBCXX_USE_WCHAR_T - template class basic_stringbuf<wchar_t>; -#endif +_GLIBCXX_BEGIN_NAMESPACE(std) - // istringstream + template class basic_stringbuf<char>; template class basic_istringstream<char>; -#ifdef _GLIBCXX_USE_WCHAR_T - template class basic_istringstream<wchar_t>; -#endif - - // ostringstream template class basic_ostringstream<char>; -#ifdef _GLIBCXX_USE_WCHAR_T - template class basic_ostringstream<wchar_t>; -#endif - - // stringstream template class basic_stringstream<char>; + #ifdef _GLIBCXX_USE_WCHAR_T + template class basic_stringbuf<wchar_t>; + template class basic_istringstream<wchar_t>; + template class basic_ostringstream<wchar_t>; template class basic_stringstream<wchar_t>; #endif -} // namespace std + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/stdexcept.cc b/contrib/libstdc++/src/stdexcept.cc index 5db7c68..19ac577 100644 --- a/contrib/libstdc++/src/stdexcept.cc +++ b/contrib/libstdc++/src/stdexcept.cc @@ -1,6 +1,6 @@ // Methods for Exception Support for -*- C++ -*- -// Copyright (C) 1997, 1999, 2001, 2002 Free Software Foundation, Inc. +// Copyright (C) 1997, 1999, 2001, 2002, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -34,8 +34,8 @@ #include <string> #include <stdexcept> -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + logic_error::logic_error(const string& __arg) : exception(), _M_msg(__arg) { } @@ -74,5 +74,6 @@ namespace std underflow_error::underflow_error(const string& __arg) : runtime_error(__arg) { } -} // namespace std + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/streambuf-inst.cc b/contrib/libstdc++/src/streambuf-inst.cc index 5d1879a..38fb0d4 100644 --- a/contrib/libstdc++/src/streambuf-inst.cc +++ b/contrib/libstdc++/src/streambuf-inst.cc @@ -1,6 +1,6 @@ // Explicit instantiation file. -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -35,22 +35,32 @@ #include <ios> #include <streambuf> -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + // streambuf template class basic_streambuf<char>; + + template + streamsize + __copy_streambufs(basic_streambuf<char>*, basic_streambuf<char>*); + + template + streamsize + __copy_streambufs_eof(basic_streambuf<char>*, + basic_streambuf<char>*, bool&); + #ifdef _GLIBCXX_USE_WCHAR_T + // wstreambuf template class basic_streambuf<wchar_t>; -#endif template streamsize - __copy_streambufs(basic_streambuf<char>*, - basic_streambuf<char>*); -#ifdef _GLIBCXX_USE_WCHAR_T + __copy_streambufs(basic_streambuf<wchar_t>*, basic_streambuf<wchar_t>*); + template streamsize - __copy_streambufs(basic_streambuf<wchar_t>*, - basic_streambuf<wchar_t>*); + __copy_streambufs_eof(basic_streambuf<wchar_t>*, + basic_streambuf<wchar_t>*, bool&); #endif -} //std + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/streambuf.cc b/contrib/libstdc++/src/streambuf.cc new file mode 100644 index 0000000..3186314 --- /dev/null +++ b/contrib/libstdc++/src/streambuf.cc @@ -0,0 +1,118 @@ +// Stream buffer classes -*- C++ -*- + +// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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 library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 27.5 Stream buffers +// + +#include <streambuf> + +_GLIBCXX_BEGIN_NAMESPACE(std) + + template<> + streamsize + __copy_streambufs_eof(basic_streambuf<char>* __sbin, + basic_streambuf<char>* __sbout, bool& __ineof) + { + typedef basic_streambuf<char>::traits_type traits_type; + streamsize __ret = 0; + __ineof = true; + traits_type::int_type __c = __sbin->sgetc(); + while (!traits_type::eq_int_type(__c, traits_type::eof())) + { + const streamsize __n = __sbin->egptr() - __sbin->gptr(); + if (__n > 1) + { + const streamsize __wrote = __sbout->sputn(__sbin->gptr(), __n); + __sbin->gbump(__wrote); + __ret += __wrote; + if (__wrote < __n) + { + __ineof = false; + break; + } + __c = __sbin->underflow(); + } + else + { + __c = __sbout->sputc(traits_type::to_char_type(__c)); + if (traits_type::eq_int_type(__c, traits_type::eof())) + { + __ineof = false; + break; + } + ++__ret; + __c = __sbin->snextc(); + } + } + return __ret; + } + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + streamsize + __copy_streambufs_eof(basic_streambuf<wchar_t>* __sbin, + basic_streambuf<wchar_t>* __sbout, bool& __ineof) + { + typedef basic_streambuf<wchar_t>::traits_type traits_type; + streamsize __ret = 0; + __ineof = true; + traits_type::int_type __c = __sbin->sgetc(); + while (!traits_type::eq_int_type(__c, traits_type::eof())) + { + const streamsize __n = __sbin->egptr() - __sbin->gptr(); + if (__n > 1) + { + const streamsize __wrote = __sbout->sputn(__sbin->gptr(), __n); + __sbin->gbump(__wrote); + __ret += __wrote; + if (__wrote < __n) + { + __ineof = false; + break; + } + __c = __sbin->underflow(); + } + else + { + __c = __sbout->sputc(traits_type::to_char_type(__c)); + if (traits_type::eq_int_type(__c, traits_type::eof())) + { + __ineof = false; + break; + } + ++__ret; + __c = __sbin->snextc(); + } + } + return __ret; + } +#endif + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/string-inst.cc b/contrib/libstdc++/src/string-inst.cc index e01dbca..c17862b 100644 --- a/contrib/libstdc++/src/string-inst.cc +++ b/contrib/libstdc++/src/string-inst.cc @@ -1,6 +1,6 @@ // Components for manipulating sequences of characters -*- C++ -*- -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -42,8 +42,8 @@ # define C char #endif -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + typedef basic_string<C> S; template class basic_string<C>; @@ -76,11 +76,13 @@ namespace std C* S::_S_construct(const C*, const C*, const allocator<C>&, forward_iterator_tag); -} // namespace std -namespace __gnu_cxx -{ +_GLIBCXX_END_NAMESPACE + +_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + using std::S; template bool operator==(const S::iterator&, const S::iterator&); template bool operator==(const S::const_iterator&, const S::const_iterator&); -} // namespace __gnu_cxx + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/strstream.cc b/contrib/libstdc++/src/strstream.cc index 832a19c..5bbb33a 100644 --- a/contrib/libstdc++/src/strstream.cc +++ b/contrib/libstdc++/src/strstream.cc @@ -1,6 +1,6 @@ // strstream definitions -*- C++ -*- -// Copyright (C) 2001, 2002, 2003 Free Software Foundation +// Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -53,8 +53,8 @@ #include <string.h> #include <limits.h> -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + strstreambuf::strstreambuf(streamsize initial_capacity) : _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(true), _M_frozen(false), _M_constant(false) @@ -413,4 +413,5 @@ namespace std char* strstream::str() { return _M_buf.str(); } -} // namespace std + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/tree.cc b/contrib/libstdc++/src/tree.cc index 0cef30c..38a3037 100644 --- a/contrib/libstdc++/src/tree.cc +++ b/contrib/libstdc++/src/tree.cc @@ -1,6 +1,6 @@ // RB tree utilities implementation -*- C++ -*- -// Copyright (C) 2003 Free Software Foundation, Inc. +// Copyright (C) 2003, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -57,8 +57,8 @@ #include <bits/stl_tree.h> -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + _Rb_tree_node_base* _Rb_tree_increment(_Rb_tree_node_base* __x) { @@ -428,4 +428,5 @@ namespace std while (1); return __sum; } -} // namespace std + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/valarray-inst.cc b/contrib/libstdc++/src/valarray-inst.cc index a45a616..c13e1a2 100644 --- a/contrib/libstdc++/src/valarray-inst.cc +++ b/contrib/libstdc++/src/valarray-inst.cc @@ -1,6 +1,6 @@ // Explicit instantiation file. -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -33,8 +33,8 @@ #include <valarray> -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + // Some explicit instantiations. template void __valarray_fill(size_t* __restrict__, size_t, const size_t&); @@ -48,7 +48,6 @@ namespace std template size_t valarray<size_t>::size() const; template size_t& valarray<size_t>::operator[](size_t); - inline size_t __valarray_product(const valarray<size_t>& __a) { @@ -110,7 +109,8 @@ namespace std gslice::_Indexer::_Indexer(size_t __o, const valarray<size_t>& __l, const valarray<size_t>& __s) - : _M_count(1), _M_start(__o), _M_size(__l), _M_stride(__s), - _M_index(__l.size() == 0 ? 0 : __valarray_product(__l)) + : _M_count(1), _M_start(__o), _M_size(__l), _M_stride(__s), + _M_index(__l.size() == 0 ? 0 : __valarray_product(__l)) { __gslice_to_index(__o, __l, __s, _M_index); } -} // namespace std + +_GLIBCXX_END_NAMESPACE diff --git a/contrib/libstdc++/src/wlocale-inst.cc b/contrib/libstdc++/src/wlocale-inst.cc index fa5059d..b776cd2 100644 --- a/contrib/libstdc++/src/wlocale-inst.cc +++ b/contrib/libstdc++/src/wlocale-inst.cc @@ -1,6 +1,7 @@ // Locale support -*- C++ -*- -// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2006 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -15,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -36,4 +37,45 @@ #ifdef _GLIBCXX_USE_WCHAR_T #define C wchar_t #include "locale-inst.cc" + +// XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT + +#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \ + extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak)) + +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, + _ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIjEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, + _ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIlEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, + _ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intImEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, + _ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intItEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, + _ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIxEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, + _ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIyEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIlEES4_S4_RSt8ios_basewT_, + _ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIlEES3_S3_RSt8ios_basewT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intImEES4_S4_RSt8ios_basewT_, + _ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intImEES3_S3_RSt8ios_basewT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIxEES4_S4_RSt8ios_basewT_, + _ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIxEES3_S3_RSt8ios_basewT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIyEES4_S4_RSt8ios_basewT_, + _ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIyEES3_S3_RSt8ios_basewT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE15_M_insert_floatIdEES4_S4_RSt8ios_basewcT_, + _ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE15_M_insert_floatIdEES3_S3_RSt8ios_basewcT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE15_M_insert_floatIdEES3_S3_RSt8ios_basewcT_, + _ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE15_M_insert_floatIeEES3_S3_RSt8ios_basewcT_); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE10_M_extractILb0EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs, + _ZNKSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE10_M_extractILb0EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE10_M_extractILb1EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs, + _ZNKSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE10_M_extractILb1EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb0EEES4_S4_RSt8ios_basewRKSbIwS3_SaIwEE, + _ZNKSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb0EEES3_S3_RSt8ios_basewRKSbIwS2_SaIwEE); +_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb1EEES4_S4_RSt8ios_basewRKSbIwS3_SaIwEE, + _ZNKSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb1EEES3_S3_RSt8ios_basewRKSbIwS2_SaIwEE); + +#endif // _GLIBCXX_LONG_DOUBLE_COMPAT #endif diff --git a/contrib/libstdc++/src/wstring-inst.cc b/contrib/libstdc++/src/wstring-inst.cc index 2bcdcfc..576a20a 100644 --- a/contrib/libstdc++/src/wstring-inst.cc +++ b/contrib/libstdc++/src/wstring-inst.cc @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software |