summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/src/c++98
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2012-01-23 23:12:01 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2012-01-23 23:12:01 +0000
commitc1e8b3edf7b5038f070c7a9732e58d066081a636 (patch)
tree200164266c0ab8f9433667f716a8c4d1276e8473 /libstdc++-v3/src/c++98
parenta837ff93f96778825f244575af91b64a7fff760e (diff)
downloadppe42-gcc-c1e8b3edf7b5038f070c7a9732e58d066081a636.tar.gz
ppe42-gcc-c1e8b3edf7b5038f070c7a9732e58d066081a636.zip
2012-01-20 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/49829 Add libc++98convenience.la, libc++11convenience.la. * src/c++98: New directory. * src/c++11: New directory. * acinclude.m4: (GLIBCXX_CONFIGURE): Add src-c++98, src-c++11. * configure: Regenerated. * Makefile.am (hosted_source): Add src-c++98, src-c++11 to SUBDIRS. * Makefile.in: Regenerate. * libsupc++/Makefile.am (AM_CXXFLAGS): USe XTEMPLATE_FLAGS for -fno-implicit-templates. * libsupc++/Makefile.in: Regenerate. * src/Makefile.am (inst_sources): Move... C++11 files into separate directory for libstdc++11convenience.la. Files are: fstream-inst.cc, string-inst.cc, wlocale-inst.cc, wstring-inst.cc). (sources): Move C++11 files. Files are: compatibility-c++0x.cc, compatibility-atomic-c++0x.cc, debug.cc, functexcept.cc, functional.cc, hash_c++0x.cc, hashtable_c++0x.cc, limits.cc, system_error.cc, placeholders.cc, regex.cc, shared_ptr.cc, mutex.cc, condition_variable.cc, chrono.cc, thread.cc, future.cc. (libstdc++convenience.la): Add new target. (SUBDIRS): Add c++11, c++98. * src/Makefile.in: Regenerate. * src/c++11/Makefile.am: New. * src/c++11/Makefile.in: Generate. * src/c++98/Makefile.am: New, C++98 files. * src/c++98/Makefile.in: Generate. 2012-01-23 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/49829 Add libc++98convenience.la, libc++11convenience.la. * src/c++98: New directory. * src/c++11: New directory. * acinclude.m4: (GLIBCXX_CONFIGURE): Add src-c++98, src-c++11. * configure: Regenerated. * Makefile.am (hosted_source): Add src-c++98, src-c++11 to SUBDIRS. * Makefile.in: Regenerate. * libsupc++/Makefile.am (AM_CXXFLAGS): USe XTEMPLATE_FLAGS for -fno-implicit-templates. * libsupc++/Makefile.in: Regenerate. * src/Makefile.am (inst_sources): Move... C++11 files into separate directory for libstdc++11convenience.la. Files are: fstream-inst.cc, string-inst.cc, wlocale-inst.cc, wstring-inst.cc). (sources): Move C++11 files. Files are: compatibility-c++0x.cc, compatibility-atomic-c++0x.cc, debug.cc, functexcept.cc, functional.cc, hash_c++0x.cc, hashtable_c++0x.cc, limits.cc, system_error.cc, placeholders.cc, regex.cc, shared_ptr.cc, mutex.cc, condition_variable.cc, chrono.cc, thread.cc, future.cc. (libstdc++convenience.la): Add new target. (SUBDIRS): Add c++11, c++98. * src/Makefile.in: Regenerate. * src/c++11/Makefile.am: New. * src/c++11/Makefile.in: Generate. * src/c++98/Makefile.am: New, C++98 files. * src/c++98/Makefile.in: Generate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183457 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/src/c++98')
-rw-r--r--libstdc++-v3/src/c++98/Makefile.am253
-rw-r--r--libstdc++-v3/src/c++98/Makefile.in828
-rw-r--r--libstdc++-v3/src/c++98/allocator-inst.cc40
-rw-r--r--libstdc++-v3/src/c++98/bitmap_allocator.cc128
-rw-r--r--libstdc++-v3/src/c++98/codecvt.cc151
-rw-r--r--libstdc++-v3/src/c++98/compatibility-debug_list-2.cc28
-rw-r--r--libstdc++-v3/src/c++98/compatibility-debug_list.cc28
-rw-r--r--libstdc++-v3/src/c++98/compatibility-ldbl.cc80
-rw-r--r--libstdc++-v3/src/c++98/compatibility-list-2.cc113
-rw-r--r--libstdc++-v3/src/c++98/compatibility-list.cc146
-rw-r--r--libstdc++-v3/src/c++98/compatibility-parallel_list-2.cc28
-rw-r--r--libstdc++-v3/src/c++98/compatibility-parallel_list.cc28
-rw-r--r--libstdc++-v3/src/c++98/compatibility.cc554
-rw-r--r--libstdc++-v3/src/c++98/complex_io.cc113
-rw-r--r--libstdc++-v3/src/c++98/concept-inst.cc111
-rw-r--r--libstdc++-v3/src/c++98/ctype.cc134
-rw-r--r--libstdc++-v3/src/c++98/ext-inst.cc66
-rw-r--r--libstdc++-v3/src/c++98/globals_io.cc108
-rw-r--r--libstdc++-v3/src/c++98/hash-long-double-tr1-aux.cc56
-rw-r--r--libstdc++-v3/src/c++98/hash_tr1.cc58
-rw-r--r--libstdc++-v3/src/c++98/hashtable_tr1.cc33
-rw-r--r--libstdc++-v3/src/c++98/ios-inst.cc43
-rw-r--r--libstdc++-v3/src/c++98/ios.cc193
-rw-r--r--libstdc++-v3/src/c++98/ios_failure.cc47
-rw-r--r--libstdc++-v3/src/c++98/ios_init.cc205
-rw-r--r--libstdc++-v3/src/c++98/ios_locale.cc60
-rw-r--r--libstdc++-v3/src/c++98/iostream-inst.cc49
-rw-r--r--libstdc++-v3/src/c++98/istream-inst.cc115
-rw-r--r--libstdc++-v3/src/c++98/istream.cc687
-rw-r--r--libstdc++-v3/src/c++98/list.cc147
-rw-r--r--libstdc++-v3/src/c++98/locale-inst.cc364
-rw-r--r--libstdc++-v3/src/c++98/locale.cc444
-rw-r--r--libstdc++-v3/src/c++98/locale_facets.cc118
-rw-r--r--libstdc++-v3/src/c++98/locale_init.cc474
-rw-r--r--libstdc++-v3/src/c++98/localename.cc354
-rw-r--r--libstdc++-v3/src/c++98/math_stubs_float.cc224
-rw-r--r--libstdc++-v3/src/c++98/math_stubs_long_double.cc224
-rw-r--r--libstdc++-v3/src/c++98/misc-inst.cc82
-rw-r--r--libstdc++-v3/src/c++98/mt_allocator.cc818
-rw-r--r--libstdc++-v3/src/c++98/ostream-inst.cc118
-rw-r--r--libstdc++-v3/src/c++98/parallel_settings.cc42
-rw-r--r--libstdc++-v3/src/c++98/pool_allocator.cc177
-rw-r--r--libstdc++-v3/src/c++98/sstream-inst.cc49
-rw-r--r--libstdc++-v3/src/c++98/stdexcept.cc91
-rw-r--r--libstdc++-v3/src/c++98/streambuf-inst.cc64
-rw-r--r--libstdc++-v3/src/c++98/streambuf.cc117
-rw-r--r--libstdc++-v3/src/c++98/strstream.cc418
-rw-r--r--libstdc++-v3/src/c++98/tree.cc454
-rw-r--r--libstdc++-v3/src/c++98/valarray.cc108
-rw-r--r--libstdc++-v3/src/c++98/wlocale-inst.cc76
50 files changed, 9446 insertions, 0 deletions
diff --git a/libstdc++-v3/src/c++98/Makefile.am b/libstdc++-v3/src/c++98/Makefile.am
new file mode 100644
index 00000000000..fe39f23750c
--- /dev/null
+++ b/libstdc++-v3/src/c++98/Makefile.am
@@ -0,0 +1,253 @@
+## Makefile for the C++03 sources of the GNU C++ Standard library.
+##
+## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+## 2006, 2007, 2008, 2009, 2010, 2011, 2012
+## Free Software Foundation, Inc.
+##
+## This file is part of the libstdc++ version 3 distribution.
+## Process this file with automake to produce Makefile.in.
+
+## 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 3, 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 COPYING3. If not see
+## <http://www.gnu.org/licenses/>.
+
+include $(top_srcdir)/fragment.am
+
+# Convenience library for C++98 runtime.
+toolexeclib_LTLIBRARIES = libc++98.la
+noinst_LTLIBRARIES = libc++98convenience.la
+
+headers =
+
+# Source files linked in via configuration/make substitution for a
+# particular host.
+host_sources = \
+ atomicity.cc \
+ codecvt_members.cc \
+ collate_members.cc \
+ ctype_configure_char.cc \
+ ctype_members.cc \
+ messages_members.cc \
+ monetary_members.cc \
+ numeric_members.cc \
+ time_members.cc
+
+codecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true
+
+collate_members.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) . || true
+
+ctype_configure_char.cc: ${glibcxx_srcdir}/$(OS_INC_SRCDIR)/ctype_configure_char.cc
+ $(LN_S) ${glibcxx_srcdir}/$(OS_INC_SRCDIR)/ctype_configure_char.cc . || true
+
+ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
+
+messages_members.cc: ${glibcxx_srcdir}/$(CMESSAGES_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_CC) . || true
+
+monetary_members.cc: ${glibcxx_srcdir}/$(CMONEY_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CMONEY_CC) . || true
+
+numeric_members.cc: ${glibcxx_srcdir}/$(CNUMERIC_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CNUMERIC_CC) . || true
+
+time_members.cc: ${glibcxx_srcdir}/$(CTIME_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CTIME_CC) . || true
+
+atomicity_file = ${glibcxx_srcdir}/$(ATOMICITY_SRCDIR)/atomicity.h
+atomicity.cc: ${atomicity_file}
+ $(LN_S) ${atomicity_file} ./atomicity.cc || true
+
+# Source files linked in via configuration/make substitution for a
+# particular host, but with ad hoc naming rules.
+host_sources_extra = \
+ basic_file.cc c++locale.cc \
+ ${inst_sources} ${ldbl_compat_sources} ${parallel_sources}
+
+c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CLOCALE_CC) ./$@ || true
+
+basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true
+
+if ENABLE_PARALLEL
+parallel_sources = parallel_settings.cc \
+ compatibility-parallel_list.cc \
+ compatibility-parallel_list-2.cc
+else
+parallel_sources =
+endif
+
+if GLIBCXX_LDBL_COMPAT
+ldbl_compat_sources = compatibility-ldbl.cc
+else
+ldbl_compat_sources =
+endif
+
+if ENABLE_EXTERN_TEMPLATE
+XTEMPLATE_FLAGS = -fno-implicit-templates
+inst_sources = \
+ allocator-inst.cc \
+ concept-inst.cc \
+ ext-inst.cc \
+ ios-inst.cc \
+ iostream-inst.cc \
+ istream-inst.cc \
+ locale-inst.cc \
+ misc-inst.cc \
+ ostream-inst.cc \
+ sstream-inst.cc \
+ streambuf-inst.cc \
+ wlocale-inst.cc
+else
+XTEMPLATE_FLAGS =
+inst_sources =
+endif
+
+# Sources present in the src directory, always present.
+sources = \
+ bitmap_allocator.cc \
+ pool_allocator.cc \
+ mt_allocator.cc \
+ codecvt.cc \
+ compatibility.cc \
+ compatibility-debug_list.cc \
+ compatibility-debug_list-2.cc \
+ compatibility-list.cc \
+ compatibility-list-2.cc \
+ complex_io.cc \
+ ctype.cc \
+ globals_io.cc \
+ hash_tr1.cc \
+ hashtable_tr1.cc \
+ ios.cc \
+ ios_failure.cc \
+ ios_init.cc \
+ ios_locale.cc \
+ list.cc \
+ locale.cc \
+ locale_init.cc \
+ locale_facets.cc \
+ localename.cc \
+ math_stubs_float.cc \
+ math_stubs_long_double.cc \
+ stdexcept.cc \
+ strstream.cc \
+ tree.cc \
+ istream.cc \
+ streambuf.cc \
+ valarray.cc \
+ ${host_sources} \
+ ${host_sources_extra}
+
+vpath % $(top_srcdir)/src/c++98
+vpath % $(top_srcdir)
+
+libc__98_la_SOURCES = $(sources) $(inst_sources)
+libc__98convenience_la_SOURCES = $(sources) $(inst_sources)
+
+# Use special rules for the deprecated source files so that they find
+# deprecated include files.
+GLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include
+strstream.lo: strstream.cc
+ $(LTCXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
+strstream.o: strstream.cc
+ $(CXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
+
+# Use special rules for the concept-checking instantiations so that all
+# the generated template functions are also instantiated. Force the checks
+# to be on so that the instantiations are actually seen.
+concept-inst.lo: concept-inst.cc
+ $(LTCXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
+concept-inst.o: concept-inst.cc
+ $(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
+
+# Use special rules for parallel mode compilation.
+PARALLEL_FLAGS = -fopenmp -D_GLIBCXX_PARALLEL -I$(glibcxx_builddir)/../libgomp
+parallel_settings.lo: parallel_settings.cc
+ $(LTCXXCOMPILE) $(PARALLEL_FLAGS) -c $<
+parallel_settings.o: parallel_settings.cc
+ $(CXXCOMPILE) $(PARALLEL_FLAGS) -c $<
+
+compatibility-parallel_list.lo: compatibility-parallel_list.cc
+ $(LTCXXCOMPILE) -c $<
+compatibility-parallel_list.o: compatibility-parallel_list.cc
+ $(CXXCOMPILE) -c $<
+
+compatibility-parallel_list-2.lo: compatibility-parallel_list-2.cc
+ $(LTCXXCOMPILE) -c $<
+compatibility-parallel_list-2.o: compatibility-parallel_list-2.cc
+ $(CXXCOMPILE) -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
+# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
+# as the occasion calls for it.
+AM_CXXFLAGS = \
+ $(PIC_CXXFLAGS) \
+ $(XTEMPLATE_FLAGS) \
+ $(WARN_CXXFLAGS) \
+ $(OPTIMIZE_CXXFLAGS) \
+ $(CONFIG_CXXFLAGS)
+
+AM_MAKEFLAGS = \
+ "gxx_include_dir=$(gxx_include_dir)"
+
+# Libtool notes
+
+# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
+# last. (That way, things like -O2 passed down from the toplevel can
+# be overridden by --enable-debug.)
+
+# 2) In general, libtool expects an argument such as `--tag=CXX' when
+# using the C++ compiler, because that will enable the settings
+# detected when C++ support was being configured. However, when no
+# such flag is given in the command line, libtool attempts to figure
+# it out by matching the compiler name in each configuration section
+# against a prefix of the command line. The problem is that, if the
+# compiler name and its initial flags stored in the libtool
+# configuration file don't match those in the command line, libtool
+# can't decide which configuration to use, and it gives up. The
+# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
+# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
+# attempt to infer which configuration to use.
+# We have to put --tag disable-shared after --tag CXX lest things
+# CXX undo the affect of disable-shared.
+LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
+ $(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
+# be used since this would add -lstdc++ to the link line which of
+# course is problematic at this point. So, we get the top-level
+# directory to configure libstdc++-v3 to use gcc as the C++
+# compilation driver.
+CXXLINK = $(LIBTOOL) --tag CXX --tag disable-shared $(LIBTOOLFLAGS) \
+ --mode=link $(CXX) \
+ $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
diff --git a/libstdc++-v3/src/c++98/Makefile.in b/libstdc++-v3/src/c++98/Makefile.in
new file mode 100644
index 00000000000..dae6f26ff29
--- /dev/null
+++ b/libstdc++-v3/src/c++98/Makefile.in
@@ -0,0 +1,828 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+DIST_COMMON = $(top_srcdir)/fragment.am $(srcdir)/Makefile.in \
+ $(srcdir)/Makefile.am
+subdir = src/c++98
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/enable.m4 \
+ $(top_srcdir)/../config/futex.m4 \
+ $(top_srcdir)/../config/iconv.m4 \
+ $(top_srcdir)/../config/lead-dot.m4 \
+ $(top_srcdir)/../config/lib-ld.m4 \
+ $(top_srcdir)/../config/lib-link.m4 \
+ $(top_srcdir)/../config/lib-prefix.m4 \
+ $(top_srcdir)/../config/lthostflags.m4 \
+ $(top_srcdir)/../config/multi.m4 \
+ $(top_srcdir)/../config/no-executables.m4 \
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../config/stdint.m4 \
+ $(top_srcdir)/../config/unwind_ipinfo.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/crossconfig.m4 \
+ $(top_srcdir)/linkage.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/../config/gc++filt.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 =
+CONFIG_CLEAN_VPATH_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 = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
+LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
+libc__98_la_LIBADD =
+am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \
+ ctype_configure_char.lo ctype_members.lo messages_members.lo \
+ monetary_members.lo numeric_members.lo time_members.lo
+@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_2 = allocator-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ concept-inst.lo ext-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ ios-inst.lo iostream-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ istream-inst.lo locale-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ misc-inst.lo ostream-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ sstream-inst.lo streambuf-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ wlocale-inst.lo
+@GLIBCXX_LDBL_COMPAT_TRUE@am__objects_3 = compatibility-ldbl.lo
+@ENABLE_PARALLEL_TRUE@am__objects_4 = parallel_settings.lo \
+@ENABLE_PARALLEL_TRUE@ compatibility-parallel_list.lo \
+@ENABLE_PARALLEL_TRUE@ compatibility-parallel_list-2.lo
+am__objects_5 = basic_file.lo c++locale.lo $(am__objects_2) \
+ $(am__objects_3) $(am__objects_4)
+am__objects_6 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \
+ codecvt.lo compatibility.lo compatibility-debug_list.lo \
+ compatibility-debug_list-2.lo compatibility-list.lo \
+ compatibility-list-2.lo complex_io.lo ctype.lo globals_io.lo \
+ hash_tr1.lo hashtable_tr1.lo ios.lo ios_failure.lo ios_init.lo \
+ ios_locale.lo list.lo locale.lo locale_init.lo \
+ locale_facets.lo localename.lo math_stubs_float.lo \
+ math_stubs_long_double.lo stdexcept.lo strstream.lo tree.lo \
+ istream.lo streambuf.lo valarray.lo $(am__objects_1) \
+ $(am__objects_5)
+am_libc__98_la_OBJECTS = $(am__objects_6) $(am__objects_2)
+libc__98_la_OBJECTS = $(am_libc__98_la_OBJECTS)
+libc__98convenience_la_LIBADD =
+am_libc__98convenience_la_OBJECTS = $(am__objects_6) $(am__objects_2)
+libc__98convenience_la_OBJECTS = $(am_libc__98convenience_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp =
+am__depfiles_maybe =
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+SOURCES = $(libc__98_la_SOURCES) $(libc__98convenience_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@
+ACLOCAL = @ACLOCAL@
+ALLOCATOR_H = @ALLOCATOR_H@
+ALLOCATOR_NAME = @ALLOCATOR_NAME@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+ATOMICITY_SRCDIR = @ATOMICITY_SRCDIR@
+ATOMIC_FLAGS = @ATOMIC_FLAGS@
+ATOMIC_WORD_SRCDIR = @ATOMIC_WORD_SRCDIR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASIC_FILE_CC = @BASIC_FILE_CC@
+BASIC_FILE_H = @BASIC_FILE_H@
+CC = @CC@
+CCODECVT_CC = @CCODECVT_CC@
+CCOLLATE_CC = @CCOLLATE_CC@
+CCTYPE_CC = @CCTYPE_CC@
+CFLAGS = @CFLAGS@
+CLOCALE_CC = @CLOCALE_CC@
+CLOCALE_H = @CLOCALE_H@
+CLOCALE_INTERNAL_H = @CLOCALE_INTERNAL_H@
+CMESSAGES_CC = @CMESSAGES_CC@
+CMESSAGES_H = @CMESSAGES_H@
+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@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFILT = @CXXFILT@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+C_INCLUDE_DIR = @C_INCLUDE_DIR@
+DBLATEX = @DBLATEX@
+DEBUG_FLAGS = @DEBUG_FLAGS@
+DEFS = @DEFS@
+DOT = @DOT@
+DOXYGEN = @DOXYGEN@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@
+EXEEXT = @EXEEXT@
+EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
+FGREP = @FGREP@
+GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
+GLIBCXX_LIBS = @GLIBCXX_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
+OPT_LDFLAGS = @OPT_LDFLAGS@
+OS_INC_SRCDIR = @OS_INC_SRCDIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PDFLATEX = @PDFLATEX@
+PIC_CXXFLAGS = @PIC_CXXFLAGS@
+RANLIB = @RANLIB@
+SECTION_FLAGS = @SECTION_FLAGS@
+SECTION_LDFLAGS = @SECTION_LDFLAGS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SYMVER_FILE = @SYMVER_FILE@
+TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+WARN_FLAGS = @WARN_FLAGS@
+WERROR = @WERROR@
+XMLLINT = @XMLLINT@
+XSLTPROC = @XSLTPROC@
+XSL_STYLE_DIR = @XSL_STYLE_DIR@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+baseline_dir = @baseline_dir@
+baseline_subdir_switch = @baseline_subdir_switch@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+check_msgfmt = @check_msgfmt@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+glibcxx_MOFILES = @glibcxx_MOFILES@
+glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@
+glibcxx_POFILES = @glibcxx_POFILES@
+glibcxx_builddir = @glibcxx_builddir@
+glibcxx_localedir = @glibcxx_localedir@
+glibcxx_prefixdir = @glibcxx_prefixdir@
+glibcxx_srcdir = @glibcxx_srcdir@
+glibcxx_toolexecdir = @glibcxx_toolexecdir@
+glibcxx_toolexeclibdir = @glibcxx_toolexeclibdir@
+gxx_include_dir = @gxx_include_dir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libtool_VERSION = @libtool_VERSION@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_host_flags = @lt_host_flags@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+port_specific_symbol_files = @port_specific_symbol_files@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+toplevel_builddir = @toplevel_builddir@
+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)
+
+# These bits are all figured out from configure. Look in acinclude.m4
+# or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS.
+CONFIG_CXXFLAGS = \
+ $(SECTION_FLAGS) $(EXTRA_CXX_FLAGS) -frandom-seed=$@
+
+WARN_CXXFLAGS = \
+ $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once -Wabi
+
+
+# -I/-D flags to pass when compiling.
+AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
+
+# Convenience library for C++98 runtime.
+toolexeclib_LTLIBRARIES = libc++98.la
+noinst_LTLIBRARIES = libc++98convenience.la
+headers =
+
+# Source files linked in via configuration/make substitution for a
+# particular host.
+host_sources = \
+ atomicity.cc \
+ codecvt_members.cc \
+ collate_members.cc \
+ ctype_configure_char.cc \
+ ctype_members.cc \
+ messages_members.cc \
+ monetary_members.cc \
+ numeric_members.cc \
+ time_members.cc
+
+atomicity_file = ${glibcxx_srcdir}/$(ATOMICITY_SRCDIR)/atomicity.h
+
+# Source files linked in via configuration/make substitution for a
+# particular host, but with ad hoc naming rules.
+host_sources_extra = \
+ basic_file.cc c++locale.cc \
+ ${inst_sources} ${ldbl_compat_sources} ${parallel_sources}
+
+@ENABLE_PARALLEL_FALSE@parallel_sources =
+@ENABLE_PARALLEL_TRUE@parallel_sources = parallel_settings.cc \
+@ENABLE_PARALLEL_TRUE@ compatibility-parallel_list.cc \
+@ENABLE_PARALLEL_TRUE@ compatibility-parallel_list-2.cc
+
+@GLIBCXX_LDBL_COMPAT_FALSE@ldbl_compat_sources =
+@GLIBCXX_LDBL_COMPAT_TRUE@ldbl_compat_sources = compatibility-ldbl.cc
+@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS =
+@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates
+@ENABLE_EXTERN_TEMPLATE_FALSE@inst_sources =
+@ENABLE_EXTERN_TEMPLATE_TRUE@inst_sources = \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ allocator-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ concept-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ ext-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ ios-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ iostream-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ istream-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ locale-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ misc-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ ostream-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ sstream-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ streambuf-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ wlocale-inst.cc
+
+
+# Sources present in the src directory, always present.
+sources = \
+ bitmap_allocator.cc \
+ pool_allocator.cc \
+ mt_allocator.cc \
+ codecvt.cc \
+ compatibility.cc \
+ compatibility-debug_list.cc \
+ compatibility-debug_list-2.cc \
+ compatibility-list.cc \
+ compatibility-list-2.cc \
+ complex_io.cc \
+ ctype.cc \
+ globals_io.cc \
+ hash_tr1.cc \
+ hashtable_tr1.cc \
+ ios.cc \
+ ios_failure.cc \
+ ios_init.cc \
+ ios_locale.cc \
+ list.cc \
+ locale.cc \
+ locale_init.cc \
+ locale_facets.cc \
+ localename.cc \
+ math_stubs_float.cc \
+ math_stubs_long_double.cc \
+ stdexcept.cc \
+ strstream.cc \
+ tree.cc \
+ istream.cc \
+ streambuf.cc \
+ valarray.cc \
+ ${host_sources} \
+ ${host_sources_extra}
+
+libc__98_la_SOURCES = $(sources) $(inst_sources)
+libc__98convenience_la_SOURCES = $(sources) $(inst_sources)
+
+# Use special rules for the deprecated source files so that they find
+# deprecated include files.
+GLIBCXX_INCLUDE_DIR = $(glibcxx_builddir)/include
+
+# Use special rules for parallel mode compilation.
+PARALLEL_FLAGS = -fopenmp -D_GLIBCXX_PARALLEL -I$(glibcxx_builddir)/../libgomp
+
+# 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
+# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
+# as the occasion calls for it.
+AM_CXXFLAGS = \
+ $(PIC_CXXFLAGS) \
+ $(XTEMPLATE_FLAGS) \
+ $(WARN_CXXFLAGS) \
+ $(OPTIMIZE_CXXFLAGS) \
+ $(CONFIG_CXXFLAGS)
+
+AM_MAKEFLAGS = \
+ "gxx_include_dir=$(gxx_include_dir)"
+
+
+# Libtool notes
+
+# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
+# last. (That way, things like -O2 passed down from the toplevel can
+# be overridden by --enable-debug.)
+
+# 2) In general, libtool expects an argument such as `--tag=CXX' when
+# using the C++ compiler, because that will enable the settings
+# detected when C++ support was being configured. However, when no
+# such flag is given in the command line, libtool attempts to figure
+# it out by matching the compiler name in each configuration section
+# against a prefix of the command line. The problem is that, if the
+# compiler name and its initial flags stored in the libtool
+# configuration file don't match those in the command line, libtool
+# can't decide which configuration to use, and it gives up. The
+# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
+# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
+# attempt to infer which configuration to use.
+# We have to put --tag disable-shared after --tag CXX lest things
+# CXX undo the affect of disable-shared.
+LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
+ $(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
+# be used since this would add -lstdc++ to the link line which of
+# course is problematic at this point. So, we get the top-level
+# directory to configure libstdc++-v3 to use gcc as the C++
+# compilation driver.
+CXXLINK = $(LIBTOOL) --tag CXX --tag disable-shared $(LIBTOOLFLAGS) \
+ --mode=link $(CXX) \
+ $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .lo .o .obj
+$(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 ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps src/c++98/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign --ignore-deps src/c++98/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
+$(am__aclocal_m4_deps):
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)"
+ @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(toolexeclibdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(toolexeclibdir)"; \
+ }
+
+uninstall-toolexeclibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(toolexeclibdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(toolexeclibdir)/$$f"; \
+ 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=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libc++98.la: $(libc__98_la_OBJECTS) $(libc__98_la_DEPENDENCIES)
+ $(CXXLINK) -rpath $(toolexeclibdir) $(libc__98_la_OBJECTS) $(libc__98_la_LIBADD) $(LIBS)
+libc++98convenience.la: $(libc__98convenience_la_OBJECTS) $(libc__98convenience_la_DEPENDENCIES)
+ $(CXXLINK) $(libc__98convenience_la_OBJECTS) $(libc__98convenience_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+.cc.o:
+ $(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cc.lo:
+ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ 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
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ clean-toolexeclibLTLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-toolexeclibLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-toolexeclibLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES \
+ clean-toolexeclibLTLIBRARIES ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags dvi dvi-am \
+ html html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am 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-toolexeclibLTLIBRARIES
+
+
+codecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true
+
+collate_members.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) . || true
+
+ctype_configure_char.cc: ${glibcxx_srcdir}/$(OS_INC_SRCDIR)/ctype_configure_char.cc
+ $(LN_S) ${glibcxx_srcdir}/$(OS_INC_SRCDIR)/ctype_configure_char.cc . || true
+
+ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
+
+messages_members.cc: ${glibcxx_srcdir}/$(CMESSAGES_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_CC) . || true
+
+monetary_members.cc: ${glibcxx_srcdir}/$(CMONEY_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CMONEY_CC) . || true
+
+numeric_members.cc: ${glibcxx_srcdir}/$(CNUMERIC_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CNUMERIC_CC) . || true
+
+time_members.cc: ${glibcxx_srcdir}/$(CTIME_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CTIME_CC) . || true
+atomicity.cc: ${atomicity_file}
+ $(LN_S) ${atomicity_file} ./atomicity.cc || true
+
+c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CLOCALE_CC) ./$@ || true
+
+basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true
+
+vpath % $(top_srcdir)/src/c++98
+vpath % $(top_srcdir)
+strstream.lo: strstream.cc
+ $(LTCXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
+strstream.o: strstream.cc
+ $(CXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
+
+# Use special rules for the concept-checking instantiations so that all
+# the generated template functions are also instantiated. Force the checks
+# to be on so that the instantiations are actually seen.
+concept-inst.lo: concept-inst.cc
+ $(LTCXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
+concept-inst.o: concept-inst.cc
+ $(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
+parallel_settings.lo: parallel_settings.cc
+ $(LTCXXCOMPILE) $(PARALLEL_FLAGS) -c $<
+parallel_settings.o: parallel_settings.cc
+ $(CXXCOMPILE) $(PARALLEL_FLAGS) -c $<
+
+compatibility-parallel_list.lo: compatibility-parallel_list.cc
+ $(LTCXXCOMPILE) -c $<
+compatibility-parallel_list.o: compatibility-parallel_list.cc
+ $(CXXCOMPILE) -c $<
+
+compatibility-parallel_list-2.lo: compatibility-parallel_list-2.cc
+ $(LTCXXCOMPILE) -c $<
+compatibility-parallel_list-2.o: compatibility-parallel_list-2.cc
+ $(CXXCOMPILE) -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 $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libstdc++-v3/src/c++98/allocator-inst.cc b/libstdc++-v3/src/c++98/allocator-inst.cc
new file mode 100644
index 00000000000..801468016d2
--- /dev/null
+++ b/libstdc++-v3/src/c++98/allocator-inst.cc
@@ -0,0 +1,40 @@
+// Explicit instantiation file.
+
+// Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2009
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <memory>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ template class allocator<char>;
+ template class allocator<wchar_t>;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/bitmap_allocator.cc b/libstdc++-v3/src/c++98/bitmap_allocator.cc
new file mode 100644
index 00000000000..a9f3a77ba2d
--- /dev/null
+++ b/libstdc++-v3/src/c++98/bitmap_allocator.cc
@@ -0,0 +1,128 @@
+// Bitmap Allocator. Out of line function definitions. -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <ext/bitmap_allocator.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+ namespace __detail
+ {
+ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ 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);
+ _GLIBCXX_END_NAMESPACE_VERSION
+ }
+
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ size_t*
+ free_list::
+ _M_get(size_t __sz) throw(std::bad_alloc)
+ {
+#if defined __GTHREADS
+ __mutex_type& __bfl_mutex = _M_get_mutex();
+ __bfl_mutex.lock();
+#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(const std::bad_alloc&)
+ {
+ 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_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/codecvt.cc b/libstdc++-v3/src/c++98/codecvt.cc
new file mode 100644
index 00000000000..fdb0896caa2
--- /dev/null
+++ b/libstdc++-v3/src/c++98/codecvt.cc
@@ -0,0 +1,151 @@
+// Copyright (C) 2000, 2002, 2004, 2005, 2009 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#include <locale>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // Definitions for locale::id of standard facets that are specialized.
+ locale::id codecvt<char, char, mbstate_t>::id;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ locale::id codecvt<wchar_t, char, mbstate_t>::id;
+#endif
+
+ codecvt<char, char, mbstate_t>::
+ codecvt(size_t __refs)
+ : __codecvt_abstract_base<char, char, mbstate_t>(__refs),
+ _M_c_locale_codecvt(_S_get_c_locale())
+ { }
+
+ codecvt<char, char, mbstate_t>::
+ codecvt(__c_locale __cloc, size_t __refs)
+ : __codecvt_abstract_base<char, char, mbstate_t>(__refs),
+ _M_c_locale_codecvt(_S_clone_c_locale(__cloc))
+ { }
+
+ codecvt<char, char, mbstate_t>::
+ ~codecvt()
+ { _S_destroy_c_locale(_M_c_locale_codecvt); }
+
+ codecvt_base::result
+ codecvt<char, char, mbstate_t>::
+ do_out(state_type&, const intern_type* __from,
+ const intern_type*, const intern_type*& __from_next,
+ extern_type* __to, extern_type*,
+ extern_type*& __to_next) const
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // According to the resolution of DR19, "If returns noconv [...]
+ // there are no changes to the values in [to, to_limit)."
+ __from_next = __from;
+ __to_next = __to;
+ return noconv;
+ }
+
+ codecvt_base::result
+ codecvt<char, char, mbstate_t>::
+ do_unshift(state_type&, extern_type* __to,
+ extern_type*, extern_type*& __to_next) const
+ {
+ __to_next = __to;
+ return noconv;
+ }
+
+ codecvt_base::result
+ codecvt<char, char, mbstate_t>::
+ do_in(state_type&, const extern_type* __from,
+ const extern_type*, const extern_type*& __from_next,
+ intern_type* __to, intern_type*, intern_type*& __to_next) const
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // According to the resolution of DR19, "If returns noconv [...]
+ // there are no changes to the values in [to, to_limit)."
+ __from_next = __from;
+ __to_next = __to;
+ return noconv;
+ }
+
+ int
+ codecvt<char, char, mbstate_t>::
+ do_encoding() const throw()
+ { return 1; }
+
+ bool
+ codecvt<char, char, mbstate_t>::
+ do_always_noconv() const throw()
+ { return true; }
+
+ int
+ codecvt<char, char, mbstate_t>::
+ do_length (state_type&, const extern_type* __from,
+ const extern_type* __end, size_t __max) const
+ {
+ size_t __d = static_cast<size_t>(__end - __from);
+ return std::min(__max, __d);
+ }
+
+ int
+ codecvt<char, char, mbstate_t>::
+ do_max_length() const throw()
+ { return 1; }
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ // codecvt<wchar_t, char, mbstate_t> required specialization
+ codecvt<wchar_t, char, mbstate_t>::
+ codecvt(size_t __refs)
+ : __codecvt_abstract_base<wchar_t, char, mbstate_t>(__refs),
+ _M_c_locale_codecvt(_S_get_c_locale())
+ { }
+
+ codecvt<wchar_t, char, mbstate_t>::
+ codecvt(__c_locale __cloc, size_t __refs)
+ : __codecvt_abstract_base<wchar_t, char, mbstate_t>(__refs),
+ _M_c_locale_codecvt(_S_clone_c_locale(__cloc))
+ { }
+
+ codecvt<wchar_t, char, mbstate_t>::
+ ~codecvt()
+ { _S_destroy_c_locale(_M_c_locale_codecvt); }
+
+ codecvt_base::result
+ codecvt<wchar_t, char, mbstate_t>::
+ do_unshift(state_type&, extern_type* __to,
+ extern_type*, extern_type*& __to_next) const
+ {
+ // XXX Probably wrong for stateful encodings
+ __to_next = __to;
+ return noconv;
+ }
+
+ bool
+ codecvt<wchar_t, char, mbstate_t>::
+ do_always_noconv() const throw()
+ { return false; }
+#endif // _GLIBCXX_USE_WCHAR_T
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/compatibility-debug_list-2.cc b/libstdc++-v3/src/c++98/compatibility-debug_list-2.cc
new file mode 100644
index 00000000000..c032ff8598b
--- /dev/null
+++ b/libstdc++-v3/src/c++98/compatibility-debug_list-2.cc
@@ -0,0 +1,28 @@
+// Compatibility symbols for previous versions, debug list -*- C++ -*-
+
+// Copyright (C) 2011 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#define _GLIBCXX_BEGIN_NAMESPACE_COMPAT namespace __norm {
+#define _GLIBCXX_END_NAMESPACE_COMPAT }
+
+#include "compatibility-list-2.cc"
diff --git a/libstdc++-v3/src/c++98/compatibility-debug_list.cc b/libstdc++-v3/src/c++98/compatibility-debug_list.cc
new file mode 100644
index 00000000000..76cceec7205
--- /dev/null
+++ b/libstdc++-v3/src/c++98/compatibility-debug_list.cc
@@ -0,0 +1,28 @@
+// Compatibility symbols for previous versions, debug list -*- C++ -*-
+
+// Copyright (C) 2010, 2011 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#define _GLIBCXX_BEGIN_NAMESPACE_COMPAT namespace __norm {
+#define _GLIBCXX_END_NAMESPACE_COMPAT }
+
+#include "compatibility-list.cc"
diff --git a/libstdc++-v3/src/c++98/compatibility-ldbl.cc b/libstdc++-v3/src/c++98/compatibility-ldbl.cc
new file mode 100644
index 00000000000..a103856adfa
--- /dev/null
+++ b/libstdc++-v3/src/c++98/compatibility-ldbl.cc
@@ -0,0 +1,80 @@
+// Compatibility symbols for -mlong-double-64 compatibility -*- C++ -*-
+
+// Copyright (C) 2006, 2008, 2009, 2010, 2011
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <locale>
+#include <cmath>
+#include <tr1/functional>
+
+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
+
+#ifdef __LONG_DOUBLE_128__
+#error "compatibility-ldbl.cc must be compiled with -mlong-double-64"
+#endif
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+#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
+}
+
+// For std::tr1::hash<long double>::operator()
+#define _GLIBCXX_LONG_DOUBLE_COMPAT_IMPL
+#include "hash-long-double-tr1-aux.cc"
+
+// std::tr1::hash<long double>::operator()
+// and std::hash<long double>::operator()
+// are the same, no need to duplicate them.
+extern "C" void _ZNKSt4hashIeEclEe (void)
+ __attribute__((alias ("_ZNKSt3tr14hashIeEclEe")));
+
+#endif
diff --git a/libstdc++-v3/src/c++98/compatibility-list-2.cc b/libstdc++-v3/src/c++98/compatibility-list-2.cc
new file mode 100644
index 00000000000..ac69798740d
--- /dev/null
+++ b/libstdc++-v3/src/c++98/compatibility-list-2.cc
@@ -0,0 +1,113 @@
+// Compatibility symbols for previous versions, list bits -*- C++ -*-
+
+// Copyright (C) 2011 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <bits/move.h>
+
+#ifndef _GLIBCXX_BEGIN_NAMESPACE_COMPAT
+# define _GLIBCXX_BEGIN_NAMESPACE_COMPAT
+#endif
+
+#ifndef _GLIBCXX_END_NAMESPACE_COMPAT
+# define _GLIBCXX_END_NAMESPACE_COMPAT
+#endif
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_COMPAT
+
+ struct _List_node_base
+ {
+ _List_node_base* _M_next;
+ _List_node_base* _M_prev;
+
+ void
+ _M_transfer(_List_node_base * const __first,
+ _List_node_base * const __last) _GLIBCXX_USE_NOEXCEPT;
+
+ void
+ _M_reverse() _GLIBCXX_USE_NOEXCEPT;
+
+ void
+ _M_hook(_List_node_base * const __position) _GLIBCXX_USE_NOEXCEPT;
+
+ void
+ _M_unhook() _GLIBCXX_USE_NOEXCEPT;
+ };
+
+ void
+ _List_node_base::
+ _M_transfer(_List_node_base * const __first,
+ _List_node_base * const __last) _GLIBCXX_USE_NOEXCEPT
+ {
+ if (this != __last)
+ {
+ // Remove [first, last) from its old position.
+ __last->_M_prev->_M_next = this;
+ __first->_M_prev->_M_next = __last;
+ this->_M_prev->_M_next = __first;
+
+ // Splice [first, last) into its new position.
+ _List_node_base* const __tmp = this->_M_prev;
+ this->_M_prev = __last->_M_prev;
+ __last->_M_prev = __first->_M_prev;
+ __first->_M_prev = __tmp;
+ }
+ }
+
+ void
+ _List_node_base::_M_reverse() _GLIBCXX_USE_NOEXCEPT
+ {
+ _List_node_base* __tmp = this;
+ do
+ {
+ std::swap(__tmp->_M_next, __tmp->_M_prev);
+
+ // Old next node is now prev.
+ __tmp = __tmp->_M_prev;
+ }
+ while (__tmp != this);
+ }
+
+ void
+ _List_node_base::
+ _M_hook(_List_node_base* const __position) _GLIBCXX_USE_NOEXCEPT
+ {
+ this->_M_next = __position;
+ this->_M_prev = __position->_M_prev;
+ __position->_M_prev->_M_next = this;
+ __position->_M_prev = this;
+ }
+
+ void
+ _List_node_base::_M_unhook() _GLIBCXX_USE_NOEXCEPT
+ {
+ _List_node_base* const __next_node = this->_M_next;
+ _List_node_base* const __prev_node = this->_M_prev;
+ __prev_node->_M_next = __next_node;
+ __next_node->_M_prev = __prev_node;
+ }
+
+_GLIBCXX_END_NAMESPACE_COMPAT
+
+} // namespace std
diff --git a/libstdc++-v3/src/c++98/compatibility-list.cc b/libstdc++-v3/src/c++98/compatibility-list.cc
new file mode 100644
index 00000000000..a0d706b27a9
--- /dev/null
+++ b/libstdc++-v3/src/c++98/compatibility-list.cc
@@ -0,0 +1,146 @@
+// Compatibility symbols for previous versions, list bits -*- C++ -*-
+
+// Copyright (C) 2010, 2011 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <bits/move.h>
+
+#ifndef _GLIBCXX_BEGIN_NAMESPACE_COMPAT
+# define _GLIBCXX_BEGIN_NAMESPACE_COMPAT
+#endif
+
+#ifndef _GLIBCXX_END_NAMESPACE_COMPAT
+# define _GLIBCXX_END_NAMESPACE_COMPAT
+#endif
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_COMPAT
+
+ struct _List_node_base
+ {
+ _List_node_base* _M_next;
+ _List_node_base* _M_prev;
+
+ static void
+ swap(_List_node_base& __x, _List_node_base& __y) throw ();
+
+ void
+ transfer(_List_node_base * const __first,
+ _List_node_base * const __last) throw ();
+
+ void
+ reverse() throw ();
+
+ void
+ hook(_List_node_base * const __position) throw ();
+
+ void
+ unhook() throw ();
+ };
+
+ void
+ _List_node_base::swap(_List_node_base& __x, _List_node_base& __y) throw()
+ {
+ if ( __x._M_next != &__x )
+ {
+ if ( __y._M_next != &__y )
+ {
+ // Both __x and __y are not empty.
+ std::swap(__x._M_next,__y._M_next);
+ std::swap(__x._M_prev,__y._M_prev);
+ __x._M_next->_M_prev = __x._M_prev->_M_next = &__x;
+ __y._M_next->_M_prev = __y._M_prev->_M_next = &__y;
+ }
+ else
+ {
+ // __x is not empty, __y is empty.
+ __y._M_next = __x._M_next;
+ __y._M_prev = __x._M_prev;
+ __y._M_next->_M_prev = __y._M_prev->_M_next = &__y;
+ __x._M_next = __x._M_prev = &__x;
+ }
+ }
+ else if ( __y._M_next != &__y )
+ {
+ // __x is empty, __y is not empty.
+ __x._M_next = __y._M_next;
+ __x._M_prev = __y._M_prev;
+ __x._M_next->_M_prev = __x._M_prev->_M_next = &__x;
+ __y._M_next = __y._M_prev = &__y;
+ }
+ }
+
+ void
+ _List_node_base::transfer(_List_node_base * const __first,
+ _List_node_base * const __last) throw ()
+ {
+ if (this != __last)
+ {
+ // Remove [first, last) from its old position.
+ __last->_M_prev->_M_next = this;
+ __first->_M_prev->_M_next = __last;
+ this->_M_prev->_M_next = __first;
+
+ // Splice [first, last) into its new position.
+ _List_node_base* const __tmp = this->_M_prev;
+ this->_M_prev = __last->_M_prev;
+ __last->_M_prev = __first->_M_prev;
+ __first->_M_prev = __tmp;
+ }
+ }
+
+ void
+ _List_node_base::reverse() throw ()
+ {
+ _List_node_base* __tmp = this;
+ do
+ {
+ std::swap(__tmp->_M_next, __tmp->_M_prev);
+
+ // Old next node is now prev.
+ __tmp = __tmp->_M_prev;
+ }
+ while (__tmp != this);
+ }
+
+ void
+ _List_node_base::hook(_List_node_base* const __position) throw ()
+ {
+ this->_M_next = __position;
+ this->_M_prev = __position->_M_prev;
+ __position->_M_prev->_M_next = this;
+ __position->_M_prev = this;
+ }
+
+ void
+ _List_node_base::unhook() throw ()
+ {
+ _List_node_base* const __next_node = this->_M_next;
+ _List_node_base* const __prev_node = this->_M_prev;
+ __prev_node->_M_next = __next_node;
+ __next_node->_M_prev = __prev_node;
+ }
+
+_GLIBCXX_END_NAMESPACE_COMPAT
+
+} // namespace std
diff --git a/libstdc++-v3/src/c++98/compatibility-parallel_list-2.cc b/libstdc++-v3/src/c++98/compatibility-parallel_list-2.cc
new file mode 100644
index 00000000000..8dc837a361a
--- /dev/null
+++ b/libstdc++-v3/src/c++98/compatibility-parallel_list-2.cc
@@ -0,0 +1,28 @@
+// Compatibility symbols for previous versions, parallel list -*- C++ -*-
+
+// Copyright (C) 2011 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#define _GLIBCXX_BEGIN_NAMESPACE_COMPAT namespace __cxx1998 {
+#define _GLIBCXX_END_NAMESPACE_COMPAT }
+
+#include "compatibility-list-2.cc"
diff --git a/libstdc++-v3/src/c++98/compatibility-parallel_list.cc b/libstdc++-v3/src/c++98/compatibility-parallel_list.cc
new file mode 100644
index 00000000000..05e50fa569d
--- /dev/null
+++ b/libstdc++-v3/src/c++98/compatibility-parallel_list.cc
@@ -0,0 +1,28 @@
+// Compatibility symbols for previous versions, parallel list -*- C++ -*-
+
+// Copyright (C) 2010, 2011 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#define _GLIBCXX_BEGIN_NAMESPACE_COMPAT namespace __cxx1998 {
+#define _GLIBCXX_END_NAMESPACE_COMPAT }
+
+#include "compatibility-list.cc"
diff --git a/libstdc++-v3/src/c++98/compatibility.cc b/libstdc++-v3/src/c++98/compatibility.cc
new file mode 100644
index 00000000000..d4cf5d7c122
--- /dev/null
+++ b/libstdc++-v3/src/c++98/compatibility.cc
@@ -0,0 +1,554 @@
+// Compatibility symbols for previous versions -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <bits/c++config.h>
+
+#if defined(_GLIBCXX_SYMVER_GNU) && defined(PIC) \
+ && defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE)\
+ && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
+#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>
+#include <ext/numeric_traits.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // 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 ( __n > 0 && __cerb)
+ {
+ ios_base::iostate __err = 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->__safe_gbump(__size);
+ _M_gcount += __size;
+ __c = __sb->sgetc();
+ }
+ else
+ {
+ ++_M_gcount;
+ __c = __sb->snextc();
+ }
+ }
+ if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
+ && !traits_type::eq_int_type(__c, __eof))
+ {
+ _M_gcount =
+ __gnu_cxx::__numeric_traits<streamsize>::__min;
+ __large_ignore = true;
+ }
+ else
+ break;
+ }
+
+ if (__large_ignore)
+ _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
+
+ if (traits_type::eq_int_type(__c, __eof))
+ __err |= ios_base::eofbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __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 (__n > 0 && __cerb)
+ {
+ ios_base::iostate __err = 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->__safe_gbump(__size);
+ _M_gcount += __size;
+ __c = __sb->sgetc();
+ }
+ else
+ {
+ ++_M_gcount;
+ __c = __sb->snextc();
+ }
+ }
+ if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
+ && !traits_type::eq_int_type(__c, __eof))
+ {
+ _M_gcount =
+ __gnu_cxx::__numeric_traits<streamsize>::__min;
+ __large_ignore = true;
+ }
+ else
+ break;
+ }
+
+ if (__large_ignore)
+ _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
+
+ if (traits_type::eq_int_type(__c, __eof))
+ __err |= ios_base::eofbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ }
+ return *this;
+ }
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // 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) \
+ && defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \
+ && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
+
+/* gcc-3.4.4
+_ZNSt19istreambuf_iteratorIcSt11char_traitsIcEEppEv
+_ZNSt19istreambuf_iteratorIwSt11char_traitsIwEEppEv
+ */
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ 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_VERSION
+} // 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_
+ */
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // 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_VERSION
+} // 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(_ZNSt8__detail17_List_node_baseXX7_M_hookEPS0_, \
+_ZN10__gnu_norm15_List_node_base4hookEPS0_, \
+GLIBCXX_3.4)
+
+_GLIBCXX_ASM_SYMVER(_ZNSt8__detail17_List_node_baseXX4swapERS0_S1_, \
+_ZN10__gnu_norm15_List_node_base4swapERS0_S1_, \
+GLIBCXX_3.4)
+
+_GLIBCXX_ASM_SYMVER(_ZNSt8__detail17_List_node_baseXX9_M_unhookEv, \
+_ZN10__gnu_norm15_List_node_base6unhookEv, \
+GLIBCXX_3.4)
+
+_GLIBCXX_ASM_SYMVER(_ZNSt8__detail17_List_node_baseXX10_M_reverseEv, \
+_ZN10__gnu_norm15_List_node_base7reverseEv, \
+GLIBCXX_3.4)
+
+_GLIBCXX_ASM_SYMVER(_ZNSt8__detail17_List_node_baseXX11_M_transferEPS0_S1_, \
+_ZN10__gnu_norm15_List_node_base8transferEPS0_S1_, \
+GLIBCXX_3.4)
+#undef _List_node_base
+
+// gcc-4.1.0
+// Long double versions of "C" math functions.
+#if defined (_GLIBCXX_LONG_DOUBLE_COMPAT) \
+ || (defined (__arm__) && defined (__linux__) && defined (__ARM_EABI__)) \
+ || (defined (__hppa__) && defined (__linux__)) \
+ || (defined (__m68k__) && defined (__mcoldfire__) && defined (__linux__)) \
+ || (defined (__mips__) && defined (_ABIO32) && defined (__linux__)) \
+ || (defined (__sh__) && defined (__linux__) && __SIZEOF_SIZE_T__ == 4) \
+
+#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 * const _ZTIe[2]
+ = { (void *) &_ZTVN10__cxxabiv123__fundamental_type_infoE[2],
+ (void *) _ZTSe };
+extern __attribute__((used, weak)) const void * const _ZTIPe[4]
+ = { (void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2],
+ (void *) _ZTSPe, (void *) 0L, (void *) _ZTIe };
+extern __attribute__((used, weak)) const void * const _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/libstdc++-v3/src/c++98/complex_io.cc b/libstdc++-v3/src/c++98/complex_io.cc
new file mode 100644
index 00000000000..4e4aeef46f7
--- /dev/null
+++ b/libstdc++-v3/src/c++98/complex_io.cc
@@ -0,0 +1,113 @@
+// The template and inlines for the -*- C++ -*- complex number classes.
+
+// Copyright (C) 2000, 2001, 2005, 2006, 2009 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <complex>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ template
+ basic_istream<char, char_traits<char> >&
+ operator>>(basic_istream<char, char_traits<char> >&, complex<float>&);
+
+ template
+ basic_ostream<char, char_traits<char> >&
+ operator<<(basic_ostream<char, char_traits<char> >&,
+ const complex<float>&);
+
+ template
+ basic_istream<char, char_traits<char> >&
+ operator>>(basic_istream<char, char_traits<char> >&, complex<double>&);
+
+ template
+ basic_ostream<char, char_traits<char> >&
+ operator<<(basic_ostream<char, char_traits<char> >&,
+ const complex<double>&);
+
+ template
+ basic_istream<char, char_traits<char> >&
+ operator>>(basic_istream<char, char_traits<char> >&,
+ complex<long double>&);
+
+ template
+ basic_ostream<char, char_traits<char> >&
+ operator<<(basic_ostream<char, char_traits<char> >&,
+ const complex<long double>&);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template
+ basic_istream<wchar_t, char_traits<wchar_t> >&
+ operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&,
+ complex<float>&);
+
+ template
+ basic_ostream<wchar_t, char_traits<wchar_t> >&
+ operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&,
+ const complex<float>&);
+
+ template
+ basic_istream<wchar_t, char_traits<wchar_t> >&
+ operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&,
+ complex<double>&);
+
+ template
+ basic_ostream<wchar_t, char_traits<wchar_t> >&
+ operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&,
+ const complex<double>&);
+
+ template
+ basic_istream<wchar_t, char_traits<wchar_t> >&
+ operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&,
+ complex<long double>&);
+
+ template
+ basic_ostream<wchar_t, char_traits<wchar_t> >&
+ operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&,
+ const complex<long double>&);
+#endif //_GLIBCXX_USE_WCHAR_T
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // 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);
+#ifdef _GLIBCXX_USE_WCHAR_T
+_GLIBCXX_LDBL_COMPAT (_ZStlsIdwSt11char_traitsIwEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E,
+ _ZStlsIewSt11char_traitsIwEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E);
+#endif
+_GLIBCXX_LDBL_COMPAT (_ZStrsIdcSt11char_traitsIcEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E,
+ _ZStrsIecSt11char_traitsIcEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E);
+#ifdef _GLIBCXX_USE_WCHAR_T
+_GLIBCXX_LDBL_COMPAT (_ZStrsIdwSt11char_traitsIwEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E,
+ _ZStrsIewSt11char_traitsIwEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E);
+#endif
+
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
diff --git a/libstdc++-v3/src/c++98/concept-inst.cc b/libstdc++-v3/src/c++98/concept-inst.cc
new file mode 100644
index 00000000000..829d0db0b68
--- /dev/null
+++ b/libstdc++-v3/src/c++98/concept-inst.cc
@@ -0,0 +1,111 @@
+// Concept checking instantiations -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2009 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// The implementation of some of the more complex checks uses the simple
+// checks (good reuse of code), thereby requiring that the simple checks
+// be instantiated somewhere. The simple checks use other simple checks,
+// and so on, until a couple hundred symbols all need instantiations. We
+// explicitly instantiate the initial set of symbols; compiling this file
+// with -fimplicit-templates will take care of the rest for us.
+
+#include <bits/concept_check.h>
+
+#ifdef _GLIBCXX_CONCEPT_CHECKS
+
+#include <memory>
+#include <iterator>
+#include <ostream>
+
+#define _Instantiate(...) template void __function_requires< __VA_ARGS__ > ()
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ template void __aux_require_boolean_expr<bool>(bool const&);
+
+ _Instantiate(_ConvertibleConcept<unsigned, unsigned> );
+
+ _Instantiate(_InputIteratorConcept<char*> );
+
+ _Instantiate(_InputIteratorConcept<char const*> );
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ _Instantiate(_InputIteratorConcept<wchar_t*> );
+
+ _Instantiate(_InputIteratorConcept<wchar_t const*> );
+
+ _Instantiate(_LessThanComparableConcept<wchar_t*> );
+#endif
+
+ _Instantiate(_LessThanComparableConcept<char*> );
+
+ _Instantiate(_LessThanComparableConcept<int> );
+
+ _Instantiate(_LessThanComparableConcept<long> );
+
+ _Instantiate(_LessThanComparableConcept<long long> );
+
+ _Instantiate(_LessThanComparableConcept<unsigned> );
+
+ _Instantiate(_OutputIteratorConcept<std::ostreambuf_iterator<
+ char, std::char_traits<char> >, char> );
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ _Instantiate(_OutputIteratorConcept<std::ostreambuf_iterator<
+ wchar_t, std::char_traits<wchar_t> >, wchar_t> );
+#endif
+
+ _Instantiate(_RandomAccessIteratorConcept<char*> );
+
+ _Instantiate(_RandomAccessIteratorConcept<char const*> );
+
+ _Instantiate(_RandomAccessIteratorConcept<
+ __normal_iterator<char const*, std::string> > );
+
+ _Instantiate(_RandomAccessIteratorConcept<
+ __normal_iterator<char*, std::string> > );
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ _Instantiate(_RandomAccessIteratorConcept<
+ __normal_iterator<wchar_t const*,
+ std::basic_string<wchar_t, std::char_traits<wchar_t>,
+ std::allocator<wchar_t> > > > );
+
+ _Instantiate(_RandomAccessIteratorConcept<
+ __normal_iterator<wchar_t*,
+ std::basic_string<wchar_t, std::char_traits<wchar_t>,
+ std::allocator<wchar_t> > > > );
+
+ _Instantiate(_RandomAccessIteratorConcept<wchar_t*> );
+
+ _Instantiate(_RandomAccessIteratorConcept<wchar_t const*> );
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#undef _Instantiate
+
+#endif
diff --git a/libstdc++-v3/src/c++98/ctype.cc b/libstdc++-v3/src/c++98/ctype.cc
new file mode 100644
index 00000000000..e246bea10dd
--- /dev/null
+++ b/libstdc++-v3/src/c++98/ctype.cc
@@ -0,0 +1,134 @@
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // Definitions for static const data members of ctype_base.
+ const ctype_base::mask ctype_base::space;
+ const ctype_base::mask ctype_base::print;
+ const ctype_base::mask ctype_base::cntrl;
+ const ctype_base::mask ctype_base::upper;
+ const ctype_base::mask ctype_base::lower;
+ const ctype_base::mask ctype_base::alpha;
+ const ctype_base::mask ctype_base::digit;
+ const ctype_base::mask ctype_base::punct;
+ const ctype_base::mask ctype_base::xdigit;
+ const ctype_base::mask ctype_base::alnum;
+ const ctype_base::mask ctype_base::graph;
+
+ // Definitions for locale::id of standard facets that are specialized.
+ locale::id ctype<char>::id;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ locale::id ctype<wchar_t>::id;
+#endif
+
+ const size_t ctype<char>::table_size;
+
+ ctype<char>::~ctype()
+ {
+ _S_destroy_c_locale(_M_c_locale_ctype);
+ if (_M_del)
+ delete[] this->table();
+ }
+
+ // Fill in the narrowing cache and flag whether all values are
+ // valid or not. _M_narrow_ok is set to 2 if memcpy can't
+ // be used.
+ void
+ ctype<char>::
+ _M_narrow_init() const
+ {
+ char __tmp[sizeof(_M_narrow)];
+ for (size_t __i = 0; __i < sizeof(_M_narrow); ++__i)
+ __tmp[__i] = __i;
+ do_narrow(__tmp, __tmp + sizeof(__tmp), 0, _M_narrow);
+
+ _M_narrow_ok = 1;
+ if (__builtin_memcmp(__tmp, _M_narrow, sizeof(_M_narrow)))
+ _M_narrow_ok = 2;
+ else
+ {
+ // Deal with the special case of zero: renarrow with a
+ // different default and compare.
+ char __c;
+ do_narrow(__tmp, __tmp + 1, 1, &__c);
+ if (__c == 1)
+ _M_narrow_ok = 2;
+ }
+ }
+
+ void
+ ctype<char>::
+ _M_widen_init() const
+ {
+ char __tmp[sizeof(_M_widen)];
+ for (size_t __i = 0; __i < sizeof(_M_widen); ++__i)
+ __tmp[__i] = __i;
+ do_widen(__tmp, __tmp + sizeof(__tmp), _M_widen);
+
+ _M_widen_ok = 1;
+ // Set _M_widen_ok to 2 if memcpy can't be used.
+ if (__builtin_memcmp(__tmp, _M_widen, sizeof(_M_widen)))
+ _M_widen_ok = 2;
+ }
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ ctype<wchar_t>::ctype(size_t __refs)
+ : __ctype_abstract_base<wchar_t>(__refs),
+ _M_c_locale_ctype(_S_get_c_locale()), _M_narrow_ok(false)
+ { _M_initialize_ctype(); }
+
+ ctype<wchar_t>::ctype(__c_locale __cloc, size_t __refs)
+ : __ctype_abstract_base<wchar_t>(__refs),
+ _M_c_locale_ctype(_S_clone_c_locale(__cloc)), _M_narrow_ok(false)
+ { _M_initialize_ctype(); }
+
+ ctype<wchar_t>::~ctype()
+ { _S_destroy_c_locale(_M_c_locale_ctype); }
+
+ ctype_byname<wchar_t>::ctype_byname(const char* __s, size_t __refs)
+ : ctype<wchar_t>(__refs)
+ {
+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
+ {
+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
+ this->_M_initialize_ctype();
+ }
+ }
+
+ ctype_byname<wchar_t>::~ctype_byname()
+ { }
+
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/ext-inst.cc b/libstdc++-v3/src/c++98/ext-inst.cc
new file mode 100644
index 00000000000..831f37cf14e
--- /dev/null
+++ b/libstdc++-v3/src/c++98/ext-inst.cc
@@ -0,0 +1,66 @@
+// Explicit instantiation file.
+
+// Copyright (C) 2001, 2002, 2004, 2006, 2009 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <ext/rope>
+#include <ext/stdio_filebuf.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ namespace
+ {
+ const int min_len = __detail::_S_max_rope_depth + 1;
+ }
+
+ template
+ const unsigned long
+ rope<char, std::allocator<char> >::_S_min_len[min_len];
+
+ template
+ char
+ rope<char, std::allocator<char> >::
+ _S_fetch(_Rope_RopeRep<char, std::allocator<char> >*, size_type);
+
+ template class stdio_filebuf<char>;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template
+ const unsigned long
+ rope<wchar_t, std::allocator<wchar_t> >::_S_min_len[min_len];
+
+ template
+ wchar_t
+ rope<wchar_t, std::allocator<wchar_t> >::
+ _S_fetch(_Rope_RopeRep<wchar_t, std::allocator<wchar_t> >*, size_type);
+
+ template class stdio_filebuf<wchar_t>;
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/globals_io.cc b/libstdc++-v3/src/c++98/globals_io.cc
new file mode 100644
index 00000000000..722abacbe84
--- /dev/null
+++ b/libstdc++-v3/src/c++98/globals_io.cc
@@ -0,0 +1,108 @@
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2011
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include "bits/c++config.h"
+#include <fstream>
+#include <istream>
+#include <ostream>
+#include <ext/stdio_filebuf.h>
+#include <ext/stdio_sync_filebuf.h>
+
+// On AIX, and perhaps other systems, library initialization order is
+// not guaranteed. For example, the static initializers for the main
+// program might run before the static initializers for this library.
+// That means that we cannot rely on static initialization in the
+// library; there is no guarantee that things will get initialized in
+// time. This file contains definitions of all global variables that
+// require initialization as arrays of characters.
+
+// NB: asm directives can rename these non-exported, namespace
+// __gnu_cxx symbols into exported, namespace std symbols with the
+// appropriate symbol version name.
+// The rename syntax is
+// asm (".symver currentname,oldname@@GLIBCXX_3.2")
+// In macro form:
+// _GLIBCXX_ASM_SYMVER(currentname, oldname, GLIBCXX_3.2)
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // Standard stream objects.
+ // NB: Iff <iostream> is included, these definitions become wonky.
+ typedef char fake_istream[sizeof(istream)]
+ __attribute__ ((aligned(__alignof__(istream))));
+ typedef char fake_ostream[sizeof(ostream)]
+ __attribute__ ((aligned(__alignof__(ostream))));
+ fake_istream cin;
+ fake_ostream cout;
+ fake_ostream cerr;
+ fake_ostream clog;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ typedef char fake_wistream[sizeof(wistream)]
+ __attribute__ ((aligned(__alignof__(wistream))));
+ typedef char fake_wostream[sizeof(wostream)]
+ __attribute__ ((aligned(__alignof__(wostream))));
+ fake_wistream wcin;
+ fake_wostream wcout;
+ fake_wostream wcerr;
+ fake_wostream wclog;
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden)
+{
+ using namespace std;
+ using namespace __gnu_cxx;
+
+ // We use different stream buffer types depending on whether
+ // ios_base::sync_with_stdio(false) has been called.
+ typedef char fake_stdiobuf[sizeof(stdio_sync_filebuf<char>)]
+ __attribute__ ((aligned(__alignof__(stdio_sync_filebuf<char>))));
+ fake_stdiobuf buf_cout_sync;
+ fake_stdiobuf buf_cin_sync;
+ fake_stdiobuf buf_cerr_sync;
+
+ typedef char fake_filebuf[sizeof(stdio_filebuf<char>)]
+ __attribute__ ((aligned(__alignof__(stdio_filebuf<char>))));
+ fake_filebuf buf_cout;
+ fake_filebuf buf_cin;
+ fake_filebuf buf_cerr;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ typedef char fake_wstdiobuf[sizeof(stdio_sync_filebuf<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(stdio_sync_filebuf<wchar_t>))));
+ fake_wstdiobuf buf_wcout_sync;
+ fake_wstdiobuf buf_wcin_sync;
+ fake_wstdiobuf buf_wcerr_sync;
+
+ typedef char fake_wfilebuf[sizeof(stdio_filebuf<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(stdio_filebuf<wchar_t>))));
+ fake_wfilebuf buf_wcout;
+ fake_wfilebuf buf_wcin;
+ fake_wfilebuf buf_wcerr;
+#endif
+} // namespace __gnu_internal
diff --git a/libstdc++-v3/src/c++98/hash-long-double-tr1-aux.cc b/libstdc++-v3/src/c++98/hash-long-double-tr1-aux.cc
new file mode 100644
index 00000000000..70ed45bbfbe
--- /dev/null
+++ b/libstdc++-v3/src/c++98/hash-long-double-tr1-aux.cc
@@ -0,0 +1,56 @@
+// std::tr1::hash definitions, long double bits -*- C++ -*-
+
+// Copyright (C) 2010, 2011 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+ namespace tr1
+ {
+ // For long double, careful with random padding bits (e.g., on x86,
+ // 10 bytes -> 12 bytes) and resort to frexp.
+ template<>
+ size_t
+ hash<long double>::operator()(long double __val) const
+ {
+ // 0 and -0 both hash to zero.
+ if (__val == 0.0L)
+ return 0;
+
+ int __exponent;
+ __val = __builtin_frexpl(__val, &__exponent);
+ __val = __val < 0.0l ? -(__val + 0.5l) : __val;
+
+ const long double __mult = __SIZE_MAX__ + 1.0l;
+ __val *= __mult;
+
+ // Try to use all the bits of the mantissa (really necessary only
+ // on 32-bit targets, at least for 80-bit floating point formats).
+ const size_t __hibits = (size_t)__val;
+ __val = (__val - (long double)__hibits) * __mult;
+
+ const size_t __coeff = __SIZE_MAX__ / __LDBL_MAX_EXP__;
+
+ return __hibits + (size_t)__val + __coeff * __exponent;
+ }
+ }
+}
diff --git a/libstdc++-v3/src/c++98/hash_tr1.cc b/libstdc++-v3/src/c++98/hash_tr1.cc
new file mode 100644
index 00000000000..a5ac87e585b
--- /dev/null
+++ b/libstdc++-v3/src/c++98/hash_tr1.cc
@@ -0,0 +1,58 @@
+// std::tr1::hash definitions -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+#include <tr1/functional>
+
+#include "hash-long-double-tr1-aux.cc"
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+ namespace tr1
+ {
+#ifndef _GLIBCXX_LONG_DOUBLE_COMPAT_IMPL
+ template<>
+ size_t
+ hash<string>::operator()(string __s) const
+ { return _Fnv_hash::hash(__s.data(), __s.length()); }
+
+ template<>
+ size_t
+ hash<const string&>::operator()(const string& __s) const
+ { return _Fnv_hash::hash(__s.data(), __s.length()); }
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ size_t
+ hash<wstring>::operator()(wstring __s) const
+ { return _Fnv_hash::hash(__s.data(), __s.length() * sizeof(wchar_t)); }
+
+ template<>
+ size_t
+ hash<const wstring&>::operator()(const wstring& __s) const
+ { return _Fnv_hash::hash(__s.data(), __s.length() * sizeof(wchar_t)); }
+#endif
+#endif
+ }
+}
diff --git a/libstdc++-v3/src/c++98/hashtable_tr1.cc b/libstdc++-v3/src/c++98/hashtable_tr1.cc
new file mode 100644
index 00000000000..53b5e5db4d1
--- /dev/null
+++ b/libstdc++-v3/src/c++98/hashtable_tr1.cc
@@ -0,0 +1,33 @@
+// std::__detail definitions -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <bits/c++config.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+ namespace tr1
+ {
+#include "../shared/hashtable-aux.cc"
+ }
+}
diff --git a/libstdc++-v3/src/c++98/ios-inst.cc b/libstdc++-v3/src/c++98/ios-inst.cc
new file mode 100644
index 00000000000..10fdaf7cd92
--- /dev/null
+++ b/libstdc++-v3/src/c++98/ios-inst.cc
@@ -0,0 +1,43 @@
+// Explicit instantiation file.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2009
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <ios>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ template class basic_ios<char>;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template class basic_ios<wchar_t>;
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/ios.cc b/libstdc++-v3/src/c++98/ios.cc
new file mode 100644
index 00000000000..292f1f8d02f
--- /dev/null
+++ b/libstdc++-v3/src/c++98/ios.cc
@@ -0,0 +1,193 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 27.4 Iostreams base classes
+//
+
+#include <ios>
+#include <limits>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // Definitions for static const members of ios_base.
+ const ios_base::fmtflags ios_base::boolalpha;
+ const ios_base::fmtflags ios_base::dec;
+ const ios_base::fmtflags ios_base::fixed;
+ const ios_base::fmtflags ios_base::hex;
+ const ios_base::fmtflags ios_base::internal;
+ const ios_base::fmtflags ios_base::left;
+ const ios_base::fmtflags ios_base::oct;
+ const ios_base::fmtflags ios_base::right;
+ const ios_base::fmtflags ios_base::scientific;
+ const ios_base::fmtflags ios_base::showbase;
+ const ios_base::fmtflags ios_base::showpoint;
+ const ios_base::fmtflags ios_base::showpos;
+ const ios_base::fmtflags ios_base::skipws;
+ const ios_base::fmtflags ios_base::unitbuf;
+ const ios_base::fmtflags ios_base::uppercase;
+ const ios_base::fmtflags ios_base::adjustfield;
+ const ios_base::fmtflags ios_base::basefield;
+ const ios_base::fmtflags ios_base::floatfield;
+
+ const ios_base::iostate ios_base::badbit;
+ const ios_base::iostate ios_base::eofbit;
+ const ios_base::iostate ios_base::failbit;
+ const ios_base::iostate ios_base::goodbit;
+
+ const ios_base::openmode ios_base::app;
+ const ios_base::openmode ios_base::ate;
+ const ios_base::openmode ios_base::binary;
+ const ios_base::openmode ios_base::in;
+ const ios_base::openmode ios_base::out;
+ const ios_base::openmode ios_base::trunc;
+
+ const ios_base::seekdir ios_base::beg;
+ const ios_base::seekdir ios_base::cur;
+ const ios_base::seekdir ios_base::end;
+
+ _Atomic_word ios_base::Init::_S_refcount;
+
+ bool ios_base::Init::_S_synced_with_stdio = true;
+
+ ios_base::ios_base() throw()
+ : _M_precision(), _M_width(), _M_flags(), _M_exception(),
+ _M_streambuf_state(), _M_callbacks(0), _M_word_zero(),
+ _M_word_size(_S_local_word_size), _M_word(_M_local_word), _M_ios_locale()
+ {
+ // Do nothing: basic_ios::init() does it.
+ // NB: _M_callbacks and _M_word must be zero for non-initialized
+ // ios_base to go through ~ios_base gracefully.
+ }
+
+ // 27.4.2.7 ios_base constructors/destructors
+ ios_base::~ios_base()
+ {
+ _M_call_callbacks(erase_event);
+ _M_dispose_callbacks();
+ if (_M_word != _M_local_word)
+ {
+ delete [] _M_word;
+ _M_word = 0;
+ }
+ }
+
+ // 27.4.2.5 ios_base storage functions
+ int
+ ios_base::xalloc() throw()
+ {
+ // 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_dispatch(&_S_top, 1) + 4;
+ }
+
+ void
+ ios_base::register_callback(event_callback __fn, int __index)
+ { _M_callbacks = new _Callback_list(__fn, __index, _M_callbacks); }
+
+ // 27.4.2.5 iword/pword storage
+ ios_base::_Words&
+ 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)
+ {
+ if (__ix < numeric_limits<int>::max())
+ {
+ __newsize = __ix + 1;
+ __try
+ { __words = new _Words[__newsize]; }
+ __catch(const std::bad_alloc&)
+ {
+ _M_streambuf_state |= badbit;
+ if (_M_streambuf_state & _M_exception)
+ __throw_ios_failure(__N("ios_base::_M_grow_words "
+ "allocation failed"));
+ 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];
+ if (_M_word && _M_word != _M_local_word)
+ {
+ delete [] _M_word;
+ _M_word = 0;
+ }
+ }
+ else
+ {
+ _M_streambuf_state |= badbit;
+ if (_M_streambuf_state & _M_exception)
+ __throw_ios_failure(__N("ios_base::_M_grow_words is not valid"));
+ 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];
+ }
+
+ void
+ ios_base::_M_call_callbacks(event __e) throw()
+ {
+ _Callback_list* __p = _M_callbacks;
+ while (__p)
+ {
+ __try
+ { (*__p->_M_fn) (__e, *this, __p->_M_index); }
+ __catch(...)
+ { }
+ __p = __p->_M_next;
+ }
+ }
+
+ void
+ ios_base::_M_dispose_callbacks(void) throw()
+ {
+ _Callback_list* __p = _M_callbacks;
+ while (__p && __p->_M_remove_reference() == 0)
+ {
+ _Callback_list* __next = __p->_M_next;
+ delete __p;
+ __p = __next;
+ }
+ _M_callbacks = 0;
+ }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/ios_failure.cc b/libstdc++-v3/src/c++98/ios_failure.cc
new file mode 100644
index 00000000000..1c42f01eddd
--- /dev/null
+++ b/libstdc++-v3/src/c++98/ios_failure.cc
@@ -0,0 +1,47 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2009
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 27.4.2.1.1 Class ios_base::failure
+//
+
+#include <ios>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ ios_base::failure::failure(const string& __str) throw()
+ : _M_msg(__str) { }
+
+ ios_base::failure::~failure() throw()
+ { }
+
+ const char*
+ ios_base::failure::what() const throw()
+ { return _M_msg.c_str(); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/ios_init.cc b/libstdc++-v3/src/c++98/ios_init.cc
new file mode 100644
index 00000000000..a811daf00cc
--- /dev/null
+++ b/libstdc++-v3/src/c++98/ios_init.cc
@@ -0,0 +1,205 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 27.4 Iostreams base classes
+//
+
+#include <ios>
+#include <ostream>
+#include <istream>
+#include <fstream>
+#include <ext/stdio_filebuf.h>
+#include <ext/stdio_sync_filebuf.h>
+
+namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden)
+{
+ using namespace __gnu_cxx;
+
+ // Extern declarations for global objects in src/globals.cc.
+ extern stdio_sync_filebuf<char> buf_cout_sync;
+ extern stdio_sync_filebuf<char> buf_cin_sync;
+ extern stdio_sync_filebuf<char> buf_cerr_sync;
+
+ extern stdio_filebuf<char> buf_cout;
+ extern stdio_filebuf<char> buf_cin;
+ extern stdio_filebuf<char> buf_cerr;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern stdio_sync_filebuf<wchar_t> buf_wcout_sync;
+ extern stdio_sync_filebuf<wchar_t> buf_wcin_sync;
+ extern stdio_sync_filebuf<wchar_t> buf_wcerr_sync;
+
+ extern stdio_filebuf<wchar_t> buf_wcout;
+ extern stdio_filebuf<wchar_t> buf_wcin;
+ extern stdio_filebuf<wchar_t> buf_wcerr;
+#endif
+} // namespace __gnu_internal
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ using namespace __gnu_internal;
+
+ extern istream cin;
+ extern ostream cout;
+ extern ostream cerr;
+ extern ostream clog;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern wistream wcin;
+ extern wostream wcout;
+ extern wostream wcerr;
+ extern wostream wclog;
+#endif
+
+ ios_base::Init::Init()
+ {
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_S_refcount, 1) == 0)
+ {
+ // Standard streams default to synced with "C" operations.
+ _S_synced_with_stdio = true;
+
+ new (&buf_cout_sync) stdio_sync_filebuf<char>(stdout);
+ new (&buf_cin_sync) stdio_sync_filebuf<char>(stdin);
+ new (&buf_cerr_sync) stdio_sync_filebuf<char>(stderr);
+
+ // The standard streams are constructed once only and never
+ // destroyed.
+ new (&cout) ostream(&buf_cout_sync);
+ new (&cin) istream(&buf_cin_sync);
+ new (&cerr) ostream(&buf_cerr_sync);
+ new (&clog) ostream(&buf_cerr_sync);
+ cin.tie(&cout);
+ cerr.setf(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);
+ new (&buf_wcerr_sync) stdio_sync_filebuf<wchar_t>(stderr);
+
+ new (&wcout) wostream(&buf_wcout_sync);
+ new (&wcin) wistream(&buf_wcin_sync);
+ new (&wcerr) wostream(&buf_wcerr_sync);
+ new (&wclog) wostream(&buf_wcerr_sync);
+ wcin.tie(&wcout);
+ wcerr.setf(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_dispatch(&_S_refcount, 1);
+ }
+ }
+
+ ios_base::Init::~Init()
+ {
+ // Be race-detector-friendly. For more info see bits/c++config.
+ _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_S_refcount);
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_S_refcount, -1) == 2)
+ {
+ _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_S_refcount);
+ // Catch any exceptions thrown by basic_ostream::flush()
+ __try
+ {
+ // Flush standard output streams as required by 27.4.2.1.6
+ cout.flush();
+ cerr.flush();
+ clog.flush();
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ wcout.flush();
+ wcerr.flush();
+ wclog.flush();
+#endif
+ }
+ __catch(...)
+ { }
+ }
+ }
+
+ bool
+ ios_base::sync_with_stdio(bool __sync)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 49. Underspecification of ios_base::sync_with_stdio
+ bool __ret = ios_base::Init::_S_synced_with_stdio;
+
+ // Turn off sync with C FILE* for cin, cout, cerr, clog iff
+ // currently synchronized.
+ if (!__sync && __ret)
+ {
+ // Make sure the standard streams are constructed.
+ ios_base::Init __init;
+
+ ios_base::Init::_S_synced_with_stdio = __sync;
+
+ // Explicitly call dtors to free any memory that is
+ // dynamically allocated by filebuf ctor or member functions,
+ // but don't deallocate all memory by calling operator delete.
+ buf_cout_sync.~stdio_sync_filebuf<char>();
+ buf_cin_sync.~stdio_sync_filebuf<char>();
+ buf_cerr_sync.~stdio_sync_filebuf<char>();
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ buf_wcout_sync.~stdio_sync_filebuf<wchar_t>();
+ buf_wcin_sync.~stdio_sync_filebuf<wchar_t>();
+ buf_wcerr_sync.~stdio_sync_filebuf<wchar_t>();
+#endif
+
+ // Create stream buffers for the standard streams and use
+ // those buffers without destroying and recreating the
+ // streams.
+ new (&buf_cout) stdio_filebuf<char>(stdout, ios_base::out);
+ new (&buf_cin) stdio_filebuf<char>(stdin, ios_base::in);
+ new (&buf_cerr) stdio_filebuf<char>(stderr, ios_base::out);
+ cout.rdbuf(&buf_cout);
+ cin.rdbuf(&buf_cin);
+ cerr.rdbuf(&buf_cerr);
+ clog.rdbuf(&buf_cerr);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ new (&buf_wcout) stdio_filebuf<wchar_t>(stdout, ios_base::out);
+ new (&buf_wcin) stdio_filebuf<wchar_t>(stdin, ios_base::in);
+ new (&buf_wcerr) stdio_filebuf<wchar_t>(stderr, ios_base::out);
+ wcout.rdbuf(&buf_wcout);
+ wcin.rdbuf(&buf_wcin);
+ wcerr.rdbuf(&buf_wcerr);
+ wclog.rdbuf(&buf_wcerr);
+#endif
+ }
+ return __ret;
+ }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/ios_locale.cc b/libstdc++-v3/src/c++98/ios_locale.cc
new file mode 100644
index 00000000000..b98b96c6222
--- /dev/null
+++ b/libstdc++-v3/src/c++98/ios_locale.cc
@@ -0,0 +1,60 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005,
+// 2009, 2010
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 27.4 Iostreams base classes
+//
+
+#include <ios>
+#include <locale>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // Called only by basic_ios<>::init.
+ void
+ ios_base::_M_init() throw()
+ {
+ // NB: May be called more than once
+ _M_precision = 6;
+ _M_width = 0;
+ _M_flags = skipws | dec;
+ _M_ios_locale = locale();
+ }
+
+ // 27.4.2.3 ios_base locale functions
+ locale
+ ios_base::imbue(const locale& __loc) throw()
+ {
+ locale __old = _M_ios_locale;
+ _M_ios_locale = __loc;
+ _M_call_callbacks(imbue_event);
+ return __old;
+ }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/iostream-inst.cc b/libstdc++-v3/src/c++98/iostream-inst.cc
new file mode 100644
index 00000000000..60f52061e06
--- /dev/null
+++ b/libstdc++-v3/src/c++98/iostream-inst.cc
@@ -0,0 +1,49 @@
+// Explicit instantiation file.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2009
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <iomanip>
+#include <istream>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ 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_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/istream-inst.cc b/libstdc++-v3/src/c++98/istream-inst.cc
new file mode 100644
index 00000000000..4d3bc1a74dc
--- /dev/null
+++ b/libstdc++-v3/src/c++98/istream-inst.cc
@@ -0,0 +1,115 @@
+// Explicit instantiation file.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2005, 2006, 2009
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <istream>
+#include <iomanip>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ template class basic_istream<char>;
+ template istream& ws(istream&);
+ template istream& operator>>(istream&, char&);
+ template istream& operator>>(istream&, unsigned char&);
+ template istream& operator>>(istream&, signed char&);
+ template istream& operator>>(istream&, char*);
+ template istream& operator>>(istream&, unsigned char*);
+ template istream& operator>>(istream&, signed char*);
+
+ template istream& operator>>(istream&, _Setfill<char>);
+ template istream& operator>>(istream&, _Setiosflags);
+ template istream& operator>>(istream&, _Resetiosflags);
+ template istream& operator>>(istream&, _Setbase);
+ 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&);
+ template wistream& operator>>(wistream&, wchar_t&);
+ template wistream& operator>>(wistream&, wchar_t*);
+
+ template wistream& operator>>(wistream&, _Setfill<wchar_t>);
+ template wistream& operator>>(wistream&, _Setiosflags);
+ template wistream& operator>>(wistream&, _Resetiosflags);
+ 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
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // 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);
+#ifdef _GLIBCXX_USE_WCHAR_T
+_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_istreamIwSt11char_traitsIwEErsERd,
+ _ZNSt13basic_istreamIwSt11char_traitsIwEErsERe);
+#endif
+_GLIBCXX_LDBL_COMPAT (_ZNSi10_M_extractIdEERSiRT_,
+ _ZNSi10_M_extractIeEERSiRT_);
+#ifdef _GLIBCXX_USE_WCHAR_T
+_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractIdEERS2_RT_,
+ _ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractIeEERS2_RT_);
+#endif
+
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
diff --git a/libstdc++-v3/src/c++98/istream.cc b/libstdc++-v3/src/c++98/istream.cc
new file mode 100644
index 00000000000..6bcf2dbf346
--- /dev/null
+++ b/libstdc++-v3/src/c++98/istream.cc
@@ -0,0 +1,687 @@
+// Input streams -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 27.6.1 Input streams
+//
+
+#include <istream>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ 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::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->__safe_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(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __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 (__n > 0 && __cerb)
+ {
+ ios_base::iostate __err = 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->__safe_gbump(__size);
+ _M_gcount += __size;
+ __c = __sb->sgetc();
+ }
+ else
+ {
+ ++_M_gcount;
+ __c = __sb->snextc();
+ }
+ }
+ if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
+ && !traits_type::eq_int_type(__c, __eof)
+ && !traits_type::eq_int_type(__c, __delim))
+ {
+ _M_gcount =
+ __gnu_cxx::__numeric_traits<streamsize>::__min;
+ __large_ignore = true;
+ }
+ else
+ break;
+ }
+
+ if (__large_ignore)
+ _M_gcount = __gnu_cxx::__numeric_traits<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
+ < __gnu_cxx::__numeric_traits<streamsize>::__max)
+ ++_M_gcount;
+ __sb->sbumpc();
+ }
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __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::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 = __gnu_cxx::__numeric_traits<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->__safe_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(__cxxabiv1::__forced_unwind&)
+ {
+ __in._M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __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::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::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->__safe_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(__cxxabiv1::__forced_unwind&)
+ {
+ __in._M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __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 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::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->__safe_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(__cxxabiv1::__forced_unwind&)
+ {
+ __in._M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __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::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->__safe_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(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __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 (__n > 0 && __cerb)
+ {
+ ios_base::iostate __err = 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->__safe_gbump(__size);
+ _M_gcount += __size;
+ __c = __sb->sgetc();
+ }
+ else
+ {
+ ++_M_gcount;
+ __c = __sb->snextc();
+ }
+ }
+ if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
+ && !traits_type::eq_int_type(__c, __eof)
+ && !traits_type::eq_int_type(__c, __delim))
+ {
+ _M_gcount =
+ __gnu_cxx::__numeric_traits<streamsize>::__min;
+ __large_ignore = true;
+ }
+ else
+ break;
+ }
+
+ if (__large_ignore)
+ _M_gcount = __gnu_cxx::__numeric_traits<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
+ < __gnu_cxx::__numeric_traits<streamsize>::__max)
+ ++_M_gcount;
+ __sb->sbumpc();
+ }
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __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 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::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->__safe_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(__cxxabiv1::__forced_unwind&)
+ {
+ __in._M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __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_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/list.cc b/libstdc++-v3/src/c++98/list.cc
new file mode 100644
index 00000000000..6dbad69ac64
--- /dev/null
+++ b/libstdc++-v3/src/c++98/list.cc
@@ -0,0 +1,147 @@
+// std::list utilities implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2005, 2009, 2010, 2011 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#include <list>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+ namespace __detail
+ {
+ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ void
+ _List_node_base::swap(_List_node_base& __x,
+ _List_node_base& __y) _GLIBCXX_USE_NOEXCEPT
+ {
+ if ( __x._M_next != &__x )
+ {
+ if ( __y._M_next != &__y )
+ {
+ // Both __x and __y are not empty.
+ std::swap(__x._M_next,__y._M_next);
+ std::swap(__x._M_prev,__y._M_prev);
+ __x._M_next->_M_prev = __x._M_prev->_M_next = &__x;
+ __y._M_next->_M_prev = __y._M_prev->_M_next = &__y;
+ }
+ else
+ {
+ // __x is not empty, __y is empty.
+ __y._M_next = __x._M_next;
+ __y._M_prev = __x._M_prev;
+ __y._M_next->_M_prev = __y._M_prev->_M_next = &__y;
+ __x._M_next = __x._M_prev = &__x;
+ }
+ }
+ else if ( __y._M_next != &__y )
+ {
+ // __x is empty, __y is not empty.
+ __x._M_next = __y._M_next;
+ __x._M_prev = __y._M_prev;
+ __x._M_next->_M_prev = __x._M_prev->_M_next = &__x;
+ __y._M_next = __y._M_prev = &__y;
+ }
+ }
+
+ void
+ _List_node_base::
+ _M_transfer(_List_node_base * const __first,
+ _List_node_base * const __last) _GLIBCXX_USE_NOEXCEPT
+ {
+ if (this != __last)
+ {
+ // Remove [first, last) from its old position.
+ __last->_M_prev->_M_next = this;
+ __first->_M_prev->_M_next = __last;
+ this->_M_prev->_M_next = __first;
+
+ // Splice [first, last) into its new position.
+ _List_node_base* const __tmp = this->_M_prev;
+ this->_M_prev = __last->_M_prev;
+ __last->_M_prev = __first->_M_prev;
+ __first->_M_prev = __tmp;
+ }
+ }
+
+ void
+ _List_node_base::_M_reverse() _GLIBCXX_USE_NOEXCEPT
+ {
+ _List_node_base* __tmp = this;
+ do
+ {
+ std::swap(__tmp->_M_next, __tmp->_M_prev);
+
+ // Old next node is now prev.
+ __tmp = __tmp->_M_prev;
+ }
+ while (__tmp != this);
+ }
+
+ void
+ _List_node_base::
+ _M_hook(_List_node_base* const __position) _GLIBCXX_USE_NOEXCEPT
+ {
+ this->_M_next = __position;
+ this->_M_prev = __position->_M_prev;
+ __position->_M_prev->_M_next = this;
+ __position->_M_prev = this;
+ }
+
+ void
+ _List_node_base::_M_unhook() _GLIBCXX_USE_NOEXCEPT
+ {
+ _List_node_base* const __next_node = this->_M_next;
+ _List_node_base* const __prev_node = this->_M_prev;
+ __prev_node->_M_next = __next_node;
+ __next_node->_M_prev = __prev_node;
+ }
+
+ _GLIBCXX_END_NAMESPACE_VERSION
+ } // namespace __detail
+} // namespace std
diff --git a/libstdc++-v3/src/c++98/locale-inst.cc b/libstdc++-v3/src/c++98/locale-inst.cc
new file mode 100644
index 00000000000..e77c5c95d69
--- /dev/null
+++ b/libstdc++-v3/src/c++98/locale-inst.cc
@@ -0,0 +1,364 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2011 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+#include <locale>
+
+// Instantiation configuration.
+#ifndef C
+# define C char
+# define C_is_char
+#endif
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // moneypunct, money_get, and money_put
+ template class moneypunct<C, false>;
+ template class moneypunct<C, true>;
+ template struct __moneypunct_cache<C, false>;
+ template struct __moneypunct_cache<C, true>;
+ template class moneypunct_byname<C, false>;
+ template class moneypunct_byname<C, true>;
+_GLIBCXX_BEGIN_NAMESPACE_LDBL
+ template class money_get<C, istreambuf_iterator<C> >;
+ template class money_put<C, ostreambuf_iterator<C> >;
+ template
+ istreambuf_iterator<C>
+ money_get<C, istreambuf_iterator<C> >::
+ _M_extract<true>(istreambuf_iterator<C>, istreambuf_iterator<C>,
+ ios_base&, ios_base::iostate&, string&) const;
+
+ template
+ istreambuf_iterator<C>
+ money_get<C, istreambuf_iterator<C> >::
+ _M_extract<false>(istreambuf_iterator<C>, istreambuf_iterator<C>,
+ ios_base&, ios_base::iostate&, string&) const;
+
+ template
+ ostreambuf_iterator<C>
+ money_put<C, ostreambuf_iterator<C> >::
+ _M_insert<true>(ostreambuf_iterator<C>, ios_base&, C,
+ const string_type&) const;
+
+ template
+ ostreambuf_iterator<C>
+ money_put<C, ostreambuf_iterator<C> >::
+ _M_insert<false>(ostreambuf_iterator<C>, ios_base&, C,
+ const string_type&) const;
+_GLIBCXX_END_NAMESPACE_LDBL
+
+ // numpunct, numpunct_byname, num_get, and num_put
+ template class numpunct<C>;
+ template struct __numpunct_cache<C>;
+ template class numpunct_byname<C>;
+_GLIBCXX_BEGIN_NAMESPACE_LDBL
+ template class num_get<C, istreambuf_iterator<C> >;
+ template class num_put<C, ostreambuf_iterator<C> >;
+ template
+ istreambuf_iterator<C>
+ num_get<C, istreambuf_iterator<C> >::
+ _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
+ ios_base&, ios_base::iostate&,
+ long&) const;
+
+ template
+ istreambuf_iterator<C>
+ num_get<C, istreambuf_iterator<C> >::
+ _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
+ ios_base&, ios_base::iostate&,
+ unsigned short&) const;
+
+ template
+ istreambuf_iterator<C>
+ num_get<C, istreambuf_iterator<C> >::
+ _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
+ ios_base&, ios_base::iostate&,
+ unsigned int&) const;
+
+ template
+ istreambuf_iterator<C>
+ num_get<C, istreambuf_iterator<C> >::
+ _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
+ ios_base&, ios_base::iostate&,
+ unsigned long&) const;
+
+#ifdef _GLIBCXX_USE_LONG_LONG
+ template
+ istreambuf_iterator<C>
+ num_get<C, istreambuf_iterator<C> >::
+ _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
+ ios_base&, ios_base::iostate&,
+ long long&) const;
+
+ template
+ istreambuf_iterator<C>
+ num_get<C, istreambuf_iterator<C> >::
+ _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
+ ios_base&, ios_base::iostate&,
+ unsigned long long&) const;
+#endif
+
+ template
+ ostreambuf_iterator<C>
+ num_put<C, ostreambuf_iterator<C> >::
+ _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
+ long) const;
+
+ template
+ ostreambuf_iterator<C>
+ num_put<C, ostreambuf_iterator<C> >::
+ _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
+ unsigned long) const;
+
+#ifdef _GLIBCXX_USE_LONG_LONG
+ template
+ ostreambuf_iterator<C>
+ num_put<C, ostreambuf_iterator<C> >::
+ _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
+ long long) const;
+
+ template
+ ostreambuf_iterator<C>
+ num_put<C, ostreambuf_iterator<C> >::
+ _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
+ unsigned long long) const;
+#endif
+
+ template
+ ostreambuf_iterator<C>
+ num_put<C, ostreambuf_iterator<C> >::
+ _M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char,
+ double) const;
+
+ template
+ ostreambuf_iterator<C>
+ num_put<C, ostreambuf_iterator<C> >::
+ _M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char,
+ long double) const;
+_GLIBCXX_END_NAMESPACE_LDBL
+
+ // time_get and time_put
+ template class __timepunct<C>;
+ template struct __timepunct_cache<C>;
+ template class time_put<C, ostreambuf_iterator<C> >;
+ template class time_put_byname<C, ostreambuf_iterator<C> >;
+ template class time_get<C, istreambuf_iterator<C> >;
+ template class time_get_byname<C, istreambuf_iterator<C> >;
+
+ // messages
+ template class messages<C>;
+ template class messages_byname<C>;
+
+ // ctype
+ inline template class __ctype_abstract_base<C>;
+ template class ctype_byname<C>;
+
+ // codecvt
+ inline template class __codecvt_abstract_base<C, char, mbstate_t>;
+ template class codecvt_byname<C, char, mbstate_t>;
+
+ // collate
+ template class collate<C>;
+ template class collate_byname<C>;
+
+ // use_facet
+ template
+ const ctype<C>&
+ use_facet<ctype<C> >(const locale&);
+
+ template
+ const codecvt<C, char, mbstate_t>&
+ use_facet<codecvt<C, char, mbstate_t> >(const locale&);
+
+ template
+ const collate<C>&
+ use_facet<collate<C> >(const locale&);
+
+ template
+ const numpunct<C>&
+ use_facet<numpunct<C> >(const locale&);
+
+ 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 moneypunct<C, true>&
+ use_facet<moneypunct<C, true> >(const locale&);
+
+ template
+ const moneypunct<C, false>&
+ use_facet<moneypunct<C, false> >(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
+ const __timepunct<C>&
+ use_facet<__timepunct<C> >(const locale&);
+
+ template
+ const time_put<C>&
+ use_facet<time_put<C> >(const locale&);
+
+ template
+ const time_get<C>&
+ use_facet<time_get<C> >(const locale&);
+
+ template
+ const messages<C>&
+ use_facet<messages<C> >(const locale&);
+
+ // has_facet
+ template
+ bool
+ has_facet<ctype<C> >(const locale&);
+
+ template
+ bool
+ has_facet<codecvt<C, char, mbstate_t> >(const locale&);
+
+ template
+ bool
+ has_facet<collate<C> >(const locale&);
+
+ template
+ bool
+ has_facet<numpunct<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<moneypunct<C> >(const locale&);
+
+ template
+ bool
+ has_facet<money_put<C> >(const locale&);
+
+ template
+ bool
+ has_facet<money_get<C> >(const locale&);
+
+ template
+ bool
+ has_facet<__timepunct<C> >(const locale&);
+
+ template
+ bool
+ has_facet<time_put<C> >(const locale&);
+
+ template
+ bool
+ has_facet<time_get<C> >(const locale&);
+
+ template
+ bool
+ has_facet<messages<C> >(const locale&);
+
+
+ // locale functions.
+ template
+ C*
+ __add_grouping<C>(C*, C, char const*, size_t,
+ C const*, C const*);
+
+ template class __pad<C, char_traits<C> >;
+
+ template
+ int
+ __int_to_char(C*, unsigned long, const C*,
+ ios_base::fmtflags, bool);
+
+#ifdef _GLIBCXX_USE_LONG_LONG
+ template
+ int
+ __int_to_char(C*, unsigned long long, const C*,
+ ios_base::fmtflags, bool);
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // 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/libstdc++-v3/src/c++98/locale.cc b/libstdc++-v3/src/c++98/locale.cc
new file mode 100644
index 00000000000..09dccf0d7d3
--- /dev/null
+++ b/libstdc++-v3/src/c++98/locale.cc
@@ -0,0 +1,444 @@
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <clocale>
+#include <cstring>
+#include <cstdlib> // For getenv
+#include <cctype>
+#include <cwctype> // For towupper, etc.
+#include <locale>
+#include <ext/concurrence.h>
+
+namespace
+{
+ __gnu_cxx::__mutex&
+ get_locale_cache_mutex()
+ {
+ static __gnu_cxx::__mutex locale_cache_mutex;
+ return 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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // Definitions for static const data members of locale.
+ const locale::category locale::none;
+ const locale::category locale::ctype;
+ const locale::category locale::numeric;
+ const locale::category locale::collate;
+ const locale::category locale::time;
+ const locale::category locale::monetary;
+ const locale::category locale::messages;
+ const locale::category locale::all;
+
+ // These are no longer exported.
+ locale::_Impl* locale::_S_classic;
+ locale::_Impl* locale::_S_global;
+
+#ifdef __GTHREADS
+ __gthread_once_t locale::_S_once = __GTHREAD_ONCE_INIT;
+#endif
+
+ locale::locale(const locale& __other) throw()
+ : _M_impl(__other._M_impl)
+ { _M_impl->_M_add_reference(); }
+
+ // This is used to initialize global and classic locales, and
+ // assumes that the _Impl objects are constructed correctly.
+ // The lack of a reference increment is intentional.
+ locale::locale(_Impl* __ip) throw() : _M_impl(__ip)
+ { }
+
+ locale::~locale() throw()
+ { _M_impl->_M_remove_reference(); }
+
+ bool
+ locale::operator==(const locale& __rhs) const throw()
+ {
+ // 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
+ __ret = this->name() == __rhs.name();
+ return __ret;
+ }
+
+ const locale&
+ locale::operator=(const locale& __other) throw()
+ {
+ __other._M_impl->_M_add_reference();
+ _M_impl->_M_remove_reference();
+ _M_impl = __other._M_impl;
+ return *this;
+ }
+
+ string
+ locale::name() const
+ {
+ string __ret;
+ 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];
+ for (size_t __i = 1; __i < _S_categories_size; ++__i)
+ {
+ __ret += ';';
+ __ret += _S_categories[__i];
+ __ret += '=';
+ __ret += _M_impl->_M_names[__i];
+ }
+ }
+ return __ret;
+ }
+
+ locale::category
+ locale::_S_normalize_category(category __cat)
+ {
+ int __ret = 0;
+ if (__cat == none || ((__cat & all) && !(__cat & ~all)))
+ __ret = __cat;
+ else
+ {
+ // NB: May be a C-style "LC_ALL" category; convert.
+ switch (__cat)
+ {
+ case LC_COLLATE:
+ __ret = collate;
+ break;
+ case LC_CTYPE:
+ __ret = ctype;
+ break;
+ case LC_MONETARY:
+ __ret = monetary;
+ break;
+ case LC_NUMERIC:
+ __ret = numeric;
+ break;
+ case LC_TIME:
+ __ret = time;
+ break;
+#ifdef _GLIBCXX_HAVE_LC_MESSAGES
+ case LC_MESSAGES:
+ __ret = messages;
+ break;
+#endif
+ case LC_ALL:
+ __ret = all;
+ break;
+ default:
+ __throw_runtime_error(__N("locale::_S_normalize_category "
+ "category not found"));
+ }
+ }
+ return __ret;
+ }
+
+ // locale::facet
+ __c_locale locale::facet::_S_c_locale;
+
+ const char locale::facet::_S_c_name[2] = "C";
+
+#ifdef __GTHREADS
+ __gthread_once_t locale::facet::_S_once = __GTHREAD_ONCE_INIT;
+#endif
+
+ void
+ locale::facet::_S_initialize_once()
+ {
+ // Initialize the underlying locale model.
+ _S_create_c_locale(_S_c_locale, _S_c_name);
+ }
+
+ __c_locale
+ locale::facet::_S_get_c_locale()
+ {
+#ifdef __GHTREADS
+ if (__gthread_active_p())
+ __gthread_once(&_S_once, _S_initialize_once);
+ else
+#endif
+ {
+ if (!_S_c_locale)
+ _S_initialize_once();
+ }
+ return _S_c_locale;
+ }
+
+ const char*
+ locale::facet::_S_get_c_name() throw()
+ { return _S_c_name; }
+
+ locale::facet::
+ ~facet() { }
+
+ // locale::_Impl
+ locale::_Impl::
+ ~_Impl() throw()
+ {
+ if (_M_facets)
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ if (_M_facets[__i])
+ _M_facets[__i]->_M_remove_reference();
+ delete [] _M_facets;
+
+ if (_M_caches)
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ if (_M_caches[__i])
+ _M_caches[__i]->_M_remove_reference();
+ delete [] _M_caches;
+
+ if (_M_names)
+ for (size_t __i = 0; __i < _S_categories_size; ++__i)
+ delete [] _M_names[__i];
+ delete [] _M_names;
+ }
+
+ // Clone existing _Impl object.
+ locale::_Impl::
+ _Impl(const _Impl& __imp, size_t __refs)
+ : _M_refcount(__refs), _M_facets(0), _M_facets_size(__imp._M_facets_size),
+ _M_caches(0), _M_names(0)
+ {
+ __try
+ {
+ _M_facets = new const facet*[_M_facets_size];
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ {
+ _M_facets[__i] = __imp._M_facets[__i];
+ if (_M_facets[__i])
+ _M_facets[__i]->_M_add_reference();
+ }
+ _M_caches = new const facet*[_M_facets_size];
+ for (size_t __j = 0; __j < _M_facets_size; ++__j)
+ {
+ _M_caches[__j] = __imp._M_caches[__j];
+ if (_M_caches[__j])
+ _M_caches[__j]->_M_add_reference();
+ }
+ _M_names = new char*[_S_categories_size];
+ for (size_t __k = 0; __k < _S_categories_size; ++__k)
+ _M_names[__k] = 0;
+
+ // Name the categories.
+ for (size_t __l = 0; (__l < _S_categories_size
+ && __imp._M_names[__l]); ++__l)
+ {
+ 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(...)
+ {
+ this->~_Impl();
+ __throw_exception_again;
+ }
+ }
+
+ void
+ locale::_Impl::
+ _M_replace_category(const _Impl* __imp,
+ const locale::id* const* __idpp)
+ {
+ for (; *__idpp; ++__idpp)
+ _M_replace_facet(__imp, *__idpp);
+ }
+
+ void
+ locale::_Impl::
+ _M_replace_facet(const _Impl* __imp, const locale::id* __idp)
+ {
+ size_t __index = __idp->_M_id();
+ if ((__index > (__imp->_M_facets_size - 1))
+ || !__imp->_M_facets[__index])
+ __throw_runtime_error(__N("locale::_Impl::_M_replace_facet"));
+ _M_install_facet(__idp, __imp->_M_facets[__index]);
+ }
+
+ void
+ locale::_Impl::
+ _M_install_facet(const locale::id* __idp, const facet* __fp)
+ {
+ if (__fp)
+ {
+ size_t __index = __idp->_M_id();
+
+ // Check size of facet vector to ensure adequate room.
+ if (__index > _M_facets_size - 1)
+ {
+ const size_t __new_size = __index + 4;
+
+ // New facet array.
+ const facet** __oldf = _M_facets;
+ const facet** __newf;
+ __newf = new const facet*[__new_size];
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ __newf[__i] = _M_facets[__i];
+ for (size_t __l = _M_facets_size; __l < __new_size; ++__l)
+ __newf[__l] = 0;
+
+ // New cache array.
+ const facet** __oldc = _M_caches;
+ const facet** __newc;
+ __try
+ {
+ __newc = new const facet*[__new_size];
+ }
+ __catch(...)
+ {
+ delete [] __newf;
+ __throw_exception_again;
+ }
+ for (size_t __j = 0; __j < _M_facets_size; ++__j)
+ __newc[__j] = _M_caches[__j];
+ for (size_t __k = _M_facets_size; __k < __new_size; ++__k)
+ __newc[__k] = 0;
+
+ _M_facets_size = __new_size;
+ _M_facets = __newf;
+ _M_caches = __newc;
+ delete [] __oldf;
+ delete [] __oldc;
+ }
+
+ __fp->_M_add_reference();
+ const facet*& __fpr = _M_facets[__index];
+ if (__fpr)
+ {
+ // Replacing an existing facet. Order matters.
+ __fpr->_M_remove_reference();
+ __fpr = __fp;
+ }
+ else
+ {
+ // Installing a newly created facet into an empty
+ // _M_facets container, say a newly-constructed,
+ // swanky-fresh _Impl.
+ _M_facets[__index] = __fp;
+ }
+
+ // Ideally, it would be nice to only remove the caches that
+ // are now incorrect. However, some of the caches depend on
+ // multiple facets, and we only know about one facet
+ // here. It's no great loss: the first use of the new facet
+ // will create a new, correctly cached facet anyway.
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ {
+ const facet* __cpr = _M_caches[__i];
+ if (__cpr)
+ {
+ __cpr->_M_remove_reference();
+ _M_caches[__i] = 0;
+ }
+ }
+ }
+ }
+
+ void
+ locale::_Impl::
+ _M_install_cache(const facet* __cache, size_t __index)
+ {
+ __gnu_cxx::__scoped_lock sentry(get_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
+ _Atomic_word locale::id::_S_refcount; // init'd to 0 by linker
+
+ size_t
+ locale::id::_M_id() const throw()
+ {
+ if (!_M_index)
+ {
+ // 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;
+ }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/locale_facets.cc b/libstdc++-v3/src/c++98/locale_facets.cc
new file mode 100644
index 00000000000..92552227f80
--- /dev/null
+++ b/libstdc++-v3/src/c++98/locale_facets.cc
@@ -0,0 +1,118 @@
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <locale>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // Definitions for static const data members of time_base.
+ template<>
+ const char*
+ __timepunct_cache<char>::_S_timezones[14] =
+ {
+ "GMT", "HST", "AKST", "PST", "MST", "CST", "EST", "AST", "NST", "CET",
+ "IST", "EET", "CST", "JST"
+ };
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ const wchar_t*
+ __timepunct_cache<wchar_t>::_S_timezones[14] =
+ {
+ L"GMT", L"HST", L"AKST", L"PST", L"MST", L"CST", L"EST", L"AST",
+ L"NST", L"CET", L"IST", L"EET", L"CST", L"JST"
+ };
+#endif
+
+ // Definitions for static const data members of money_base.
+ const money_base::pattern
+ money_base::_S_default_pattern = { {symbol, sign, none, value} };
+
+ const char* money_base::_S_atoms = "-0123456789";
+
+ const char* __num_base::_S_atoms_in = "-+xX0123456789abcdefABCDEF";
+ const char* __num_base::_S_atoms_out ="-+xX0123456789abcdef0123456789ABCDEF";
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // According to the resolution of DR 231, about 22.2.2.2.2, p11,
+ // "str.precision() is specified in the conversion specification".
+ void
+ __num_base::_S_format_float(const ios_base& __io, char* __fptr,
+ char __mod) throw()
+ {
+ ios_base::fmtflags __flags = __io.flags();
+ *__fptr++ = '%';
+ // [22.2.2.2.2] Table 60
+ if (__flags & ios_base::showpos)
+ *__fptr++ = '+';
+ if (__flags & ios_base::showpoint)
+ *__fptr++ = '#';
+
+ // As per DR 231: _always_, not only when
+ // __flags & ios_base::fixed || __prec > 0
+ *__fptr++ = '.';
+ *__fptr++ = '*';
+
+ if (__mod)
+ *__fptr++ = __mod;
+ ios_base::fmtflags __fltfield = __flags & ios_base::floatfield;
+ // [22.2.2.2.2] Table 58
+ if (__fltfield == ios_base::fixed)
+ *__fptr++ = 'f';
+ else if (__fltfield == ios_base::scientific)
+ *__fptr++ = (__flags & ios_base::uppercase) ? 'E' : 'e';
+ else
+ *__fptr++ = (__flags & ios_base::uppercase) ? 'G' : 'g';
+ *__fptr = '\0';
+ }
+
+ bool
+ __verify_grouping(const char* __grouping, size_t __grouping_size,
+ const string& __grouping_tmp) throw()
+ {
+ const size_t __n = __grouping_tmp.size() - 1;
+ const size_t __min = std::min(__n, size_t(__grouping_size - 1));
+ size_t __i = __n;
+ bool __test = true;
+
+ // Parsed number groupings have to match the
+ // numpunct::grouping string exactly, starting at the
+ // right-most point of the parsed sequence of elements ...
+ for (size_t __j = 0; __j < __min && __test; --__i, ++__j)
+ __test = __grouping_tmp[__i] == __grouping[__j];
+ for (; __i && __test; --__i)
+ __test = __grouping_tmp[__i] == __grouping[__min];
+ // ... but the first parsed grouping can be <= numpunct
+ // grouping (only do the check if the numpunct char is > 0
+ // because <= 0 means any size is ok).
+ if (static_cast<signed char>(__grouping[__min]) > 0
+ && __grouping[__min] != __gnu_cxx::__numeric_traits<char>::__max)
+ __test &= __grouping_tmp[0] <= __grouping[__min];
+ return __test;
+ }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/locale_init.cc b/libstdc++-v3/src/c++98/locale_init.cc
new file mode 100644
index 00000000000..98c228cf15f
--- /dev/null
+++ b/libstdc++-v3/src/c++98/locale_init.cc
@@ -0,0 +1,474 @@
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+// 2009, 2010
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <clocale>
+#include <cstring>
+#include <cstdlib> // For getenv, free.
+#include <cctype>
+#include <cwctype> // For towupper, etc.
+#include <locale>
+#include <ext/concurrence.h>
+
+namespace
+{
+ __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;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ 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
+
+ // 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;
+
+ 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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ locale::locale() throw() : _M_impl(0)
+ {
+ _S_initialize();
+
+ // Checked locking to optimize the common case where _S_global
+ // still points to _S_classic (locale::_S_initialize_once()):
+ // - If they are the same, just increment the reference count and
+ // we are done. This effectively constructs a C locale object
+ // identical to the static c_locale.
+ // - Otherwise, _S_global can and may be destroyed due to
+ // locale::global() call on another thread, in which case we
+ // fall back to lock protected access to both _S_global and
+ // its reference count.
+ _M_impl = _S_global;
+ if (_M_impl == _S_classic)
+ _M_impl->_M_add_reference();
+ else
+ {
+ __gnu_cxx::__scoped_lock sentry(get_locale_mutex());
+ _S_global->_M_add_reference();
+ _M_impl = _S_global;
+ }
+ }
+
+ locale
+ locale::global(const locale& __other)
+ {
+ _S_initialize();
+ _Impl* __old;
+ {
+ __gnu_cxx::__scoped_lock sentry(get_locale_mutex());
+ __old = _S_global;
+ __other._M_impl->_M_add_reference();
+ _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
+ // subsition of __other locale, one added by return-by-value. Net
+ // difference: zero. When the returned locale object's destrutor
+ // is called, then the reference count is decremented and possibly
+ // destroyed.
+ return locale(__old);
+ }
+
+ const locale&
+ locale::classic()
+ {
+ _S_initialize();
+ return *(new (&c_locale) locale(_S_classic));
+ }
+
+ void
+ locale::_S_initialize_once() throw()
+ {
+ // 2 references.
+ // One reference for _S_classic, one for _S_global
+ _S_classic = new (&c_locale_impl) _Impl(2);
+ _S_global = _S_classic;
+ }
+
+ void
+ locale::_S_initialize()
+ {
+#ifdef __GTHREADS
+ if (__gthread_active_p())
+ __gthread_once(&_S_once, _S_initialize_once);
+#endif
+ if (!_S_classic)
+ _S_initialize_once();
+ }
+
+ // Definitions for static const data members of locale::_Impl
+ const locale::id* const
+ locale::_Impl::_S_id_ctype[] =
+ {
+ &std::ctype<char>::id,
+ &codecvt<char, char, mbstate_t>::id,
+#ifdef _GLIBCXX_USE_WCHAR_T
+ &std::ctype<wchar_t>::id,
+ &codecvt<wchar_t, char, mbstate_t>::id,
+#endif
+ 0
+ };
+
+ const locale::id* const
+ locale::_Impl::_S_id_numeric[] =
+ {
+ &num_get<char>::id,
+ &num_put<char>::id,
+ &numpunct<char>::id,
+#ifdef _GLIBCXX_USE_WCHAR_T
+ &num_get<wchar_t>::id,
+ &num_put<wchar_t>::id,
+ &numpunct<wchar_t>::id,
+#endif
+ 0
+ };
+
+ const locale::id* const
+ locale::_Impl::_S_id_collate[] =
+ {
+ &std::collate<char>::id,
+#ifdef _GLIBCXX_USE_WCHAR_T
+ &std::collate<wchar_t>::id,
+#endif
+ 0
+ };
+
+ const locale::id* const
+ locale::_Impl::_S_id_time[] =
+ {
+ &__timepunct<char>::id,
+ &time_get<char>::id,
+ &time_put<char>::id,
+#ifdef _GLIBCXX_USE_WCHAR_T
+ &__timepunct<wchar_t>::id,
+ &time_get<wchar_t>::id,
+ &time_put<wchar_t>::id,
+#endif
+ 0
+ };
+
+ const locale::id* const
+ locale::_Impl::_S_id_monetary[] =
+ {
+ &money_get<char>::id,
+ &money_put<char>::id,
+ &moneypunct<char, false>::id,
+ &moneypunct<char, true >::id,
+#ifdef _GLIBCXX_USE_WCHAR_T
+ &money_get<wchar_t>::id,
+ &money_put<wchar_t>::id,
+ &moneypunct<wchar_t, false>::id,
+ &moneypunct<wchar_t, true >::id,
+#endif
+ 0
+ };
+
+ const locale::id* const
+ locale::_Impl::_S_id_messages[] =
+ {
+ &std::messages<char>::id,
+#ifdef _GLIBCXX_USE_WCHAR_T
+ &std::messages<wchar_t>::id,
+#endif
+ 0
+ };
+
+ const locale::id* const* const
+ locale::_Impl::_S_facet_categories[] =
+ {
+ // Order must match the decl order in class locale.
+ locale::_Impl::_S_id_ctype,
+ locale::_Impl::_S_id_numeric,
+ locale::_Impl::_S_id_collate,
+ locale::_Impl::_S_id_time,
+ locale::_Impl::_S_id_monetary,
+ locale::_Impl::_S_id_messages,
+ 0
+ };
+
+ // Construct "C" _Impl.
+ locale::_Impl::
+ _Impl(size_t __refs) throw()
+ : _M_refcount(__refs), _M_facets(0), _M_facets_size(_GLIBCXX_NUM_FACETS),
+ _M_caches(0), _M_names(0)
+ {
+ _M_facets = new (&facet_vec) const facet*[_M_facets_size];
+ _M_caches = new (&cache_vec) const facet*[_M_facets_size];
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ _M_facets[__i] = _M_caches[__i] = 0;
+
+ // Name the categories.
+ _M_names = new (&name_vec) char*[_S_categories_size];
+ _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,
+ // numpunct, and moneypunct. Also, the "C" locales must be
+ // constructed in a way such that they are pre-allocated.
+ // NB: Set locale::facets(ref) count to one so that each individual
+ // facet is not destroyed when the locale (and thus locale::_Impl) is
+ // destroyed.
+ _M_init_facet(new (&ctype_c) std::ctype<char>(0, false, 1));
+ _M_init_facet(new (&codecvt_c) codecvt<char, char, mbstate_t>(1));
+
+ typedef __numpunct_cache<char> num_cache_c;
+ num_cache_c* __npc = new (&numpunct_cache_c) num_cache_c(2);
+ _M_init_facet(new (&numpunct_c) numpunct<char>(__npc, 1));
+
+ _M_init_facet(new (&num_get_c) num_get<char>(1));
+ _M_init_facet(new (&num_put_c) num_put<char>(1));
+ _M_init_facet(new (&collate_c) std::collate<char>(1));
+
+ typedef __moneypunct_cache<char, false> money_cache_cf;
+ typedef __moneypunct_cache<char, true> money_cache_ct;
+ money_cache_cf* __mpcf = new (&moneypunct_cache_cf) money_cache_cf(2);
+ _M_init_facet(new (&moneypunct_cf) moneypunct<char, false>(__mpcf, 1));
+ money_cache_ct* __mpct = new (&moneypunct_cache_ct) money_cache_ct(2);
+ _M_init_facet(new (&moneypunct_ct) moneypunct<char, true>(__mpct, 1));
+
+ _M_init_facet(new (&money_get_c) money_get<char>(1));
+ _M_init_facet(new (&money_put_c) money_put<char>(1));
+
+ typedef __timepunct_cache<char> time_cache_c;
+ time_cache_c* __tpc = new (&timepunct_cache_c) time_cache_c(2);
+ _M_init_facet(new (&timepunct_c) __timepunct<char>(__tpc, 1));
+
+ _M_init_facet(new (&time_get_c) time_get<char>(1));
+ _M_init_facet(new (&time_put_c) time_put<char>(1));
+ _M_init_facet(new (&messages_c) std::messages<char>(1));
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ _M_init_facet(new (&ctype_w) std::ctype<wchar_t>(1));
+ _M_init_facet(new (&codecvt_w) codecvt<wchar_t, char, mbstate_t>(1));
+
+ typedef __numpunct_cache<wchar_t> num_cache_w;
+ num_cache_w* __npw = new (&numpunct_cache_w) num_cache_w(2);
+ _M_init_facet(new (&numpunct_w) numpunct<wchar_t>(__npw, 1));
+
+ _M_init_facet(new (&num_get_w) num_get<wchar_t>(1));
+ _M_init_facet(new (&num_put_w) num_put<wchar_t>(1));
+ _M_init_facet(new (&collate_w) std::collate<wchar_t>(1));
+
+ typedef __moneypunct_cache<wchar_t, false> money_cache_wf;
+ typedef __moneypunct_cache<wchar_t, true> money_cache_wt;
+ money_cache_wf* __mpwf = new (&moneypunct_cache_wf) money_cache_wf(2);
+ _M_init_facet(new (&moneypunct_wf) moneypunct<wchar_t, false>(__mpwf, 1));
+ money_cache_wt* __mpwt = new (&moneypunct_cache_wt) money_cache_wt(2);
+ _M_init_facet(new (&moneypunct_wt) moneypunct<wchar_t, true>(__mpwt, 1));
+
+ _M_init_facet(new (&money_get_w) money_get<wchar_t>(1));
+ _M_init_facet(new (&money_put_w) money_put<wchar_t>(1));
+
+ typedef __timepunct_cache<wchar_t> time_cache_w;
+ time_cache_w* __tpw = new (&timepunct_cache_w) time_cache_w(2);
+ _M_init_facet(new (&timepunct_w) __timepunct<wchar_t>(__tpw, 1));
+
+ _M_init_facet(new (&time_get_w) time_get<wchar_t>(1));
+ _M_init_facet(new (&time_put_w) time_put<wchar_t>(1));
+ _M_init_facet(new (&messages_w) std::messages<wchar_t>(1));
+#endif
+
+ // This locale is safe to pre-cache, after all the facets have
+ // been created and installed.
+ _M_caches[numpunct<char>::id._M_id()] = __npc;
+ _M_caches[moneypunct<char, false>::id._M_id()] = __mpcf;
+ _M_caches[moneypunct<char, true>::id._M_id()] = __mpct;
+ _M_caches[__timepunct<char>::id._M_id()] = __tpc;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ _M_caches[numpunct<wchar_t>::id._M_id()] = __npw;
+ _M_caches[moneypunct<wchar_t, false>::id._M_id()] = __mpwf;
+ _M_caches[moneypunct<wchar_t, true>::id._M_id()] = __mpwt;
+ _M_caches[__timepunct<wchar_t>::id._M_id()] = __tpw;
+#endif
+ }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/localename.cc b/libstdc++-v3/src/c++98/localename.cc
new file mode 100644
index 00000000000..52e22828191
--- /dev/null
+++ b/libstdc++-v3/src/c++98/localename.cc
@@ -0,0 +1,354 @@
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <clocale>
+#include <cstring>
+#include <cstdlib>
+#include <locale>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ using namespace __gnu_cxx;
+
+ locale::locale(const char* __s) : _M_impl(0)
+ {
+ if (__s)
+ {
+ _S_initialize();
+ if (std::strcmp(__s, "C") == 0 || std::strcmp(__s, "POSIX") == 0)
+ (_M_impl = _S_classic)->_M_add_reference();
+ else if (std::strcmp(__s, "") != 0)
+ _M_impl = new _Impl(__s, 1);
+ else
+ {
+ // Get it from the environment.
+ char* __env = std::getenv("LC_ALL");
+ // If LC_ALL is set we are done.
+ if (__env && std::strcmp(__env, "") != 0)
+ {
+ if (std::strcmp(__env, "C") == 0
+ || std::strcmp(__env, "POSIX") == 0)
+ (_M_impl = _S_classic)->_M_add_reference();
+ else
+ _M_impl = new _Impl(__env, 1);
+ }
+ else
+ {
+ // LANG may set a default different from "C".
+ string __lang;
+ __env = std::getenv("LANG");
+ if (!__env || std::strcmp(__env, "") == 0
+ || std::strcmp(__env, "C") == 0
+ || std::strcmp(__env, "POSIX") == 0)
+ __lang = "C";
+ else
+ __lang = __env;
+
+ // Scan the categories looking for the first one
+ // different from LANG.
+ size_t __i = 0;
+ if (__lang == "C")
+ for (; __i < _S_categories_size; ++__i)
+ {
+ __env = std::getenv(_S_categories[__i]);
+ if (__env && std::strcmp(__env, "") != 0
+ && std::strcmp(__env, "C") != 0
+ && std::strcmp(__env, "POSIX") != 0)
+ break;
+ }
+ else
+ for (; __i < _S_categories_size; ++__i)
+ {
+ __env = std::getenv(_S_categories[__i]);
+ if (__env && std::strcmp(__env, "") != 0
+ && __lang != __env)
+ break;
+ }
+
+ // If one is found, build the complete string of
+ // the form LC_CTYPE=xxx;LC_NUMERIC=yyy; and so on...
+ if (__i < _S_categories_size)
+ {
+ string __str;
+ __str.reserve(128);
+ for (size_t __j = 0; __j < __i; ++__j)
+ {
+ __str += _S_categories[__j];
+ __str += '=';
+ __str += __lang;
+ __str += ';';
+ }
+ __str += _S_categories[__i];
+ __str += '=';
+ __str += __env;
+ __str += ';';
+ ++__i;
+ for (; __i < _S_categories_size; ++__i)
+ {
+ __env = std::getenv(_S_categories[__i]);
+ __str += _S_categories[__i];
+ if (!__env || std::strcmp(__env, "") == 0)
+ {
+ __str += '=';
+ __str += __lang;
+ __str += ';';
+ }
+ else if (std::strcmp(__env, "C") == 0
+ || std::strcmp(__env, "POSIX") == 0)
+ __str += "=C;";
+ else
+ {
+ __str += '=';
+ __str += __env;
+ __str += ';';
+ }
+ }
+ __str.erase(__str.end() - 1);
+ _M_impl = new _Impl(__str.c_str(), 1);
+ }
+ // ... otherwise either an additional instance of
+ // the "C" locale or LANG.
+ else if (__lang == "C")
+ (_M_impl = _S_classic)->_M_add_reference();
+ else
+ _M_impl = new _Impl(__lang.c_str(), 1);
+ }
+ }
+ }
+ else
+ __throw_runtime_error(__N("locale::locale null not valid"));
+ }
+
+ locale::locale(const locale& __base, const char* __s, category __cat)
+ : _M_impl(0)
+ {
+ // NB: There are complicated, yet more efficient ways to do
+ // this. Building up locales on a per-category way is tedious, so
+ // let's do it this way until people complain.
+ locale __add(__s);
+ _M_coalesce(__base, __add, __cat);
+ }
+
+ locale::locale(const locale& __base, const locale& __add, category __cat)
+ : _M_impl(0)
+ { _M_coalesce(__base, __add, __cat); }
+
+ void
+ locale::_M_coalesce(const locale& __base, const locale& __add,
+ category __cat)
+ {
+ __cat = _S_normalize_category(__cat);
+ _M_impl = new _Impl(*__base._M_impl, 1);
+
+ __try
+ { _M_impl->_M_replace_categories(__add._M_impl, __cat); }
+ __catch(...)
+ {
+ _M_impl->_M_remove_reference();
+ __throw_exception_again;
+ }
+ }
+
+ // Construct named _Impl.
+ locale::_Impl::
+ _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)
+ {
+ // Initialize the underlying locale model, which also checks to
+ // see if the given name is valid.
+ __c_locale __cloc;
+ locale::facet::_S_create_c_locale(__cloc, __s);
+ __c_locale __clocm = __cloc;
+
+ __try
+ {
+ _M_facets = new const facet*[_M_facets_size];
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ _M_facets[__i] = 0;
+ _M_caches = new const facet*[_M_facets_size];
+ for (size_t __j = 0; __j < _M_facets_size; ++__j)
+ _M_caches[__j] = 0;
+ _M_names = new char*[_S_categories_size];
+ for (size_t __k = 0; __k < _S_categories_size; ++__k)
+ _M_names[__k] = 0;
+
+ // Name the categories.
+ const char* __smon = __s;
+ const size_t __len = std::strlen(__s);
+ if (!std::memchr(__s, ';', __len))
+ {
+ _M_names[0] = new char[__len + 1];
+ std::memcpy(_M_names[0], __s, __len + 1);
+ }
+ else
+ {
+ const char* __end = __s;
+ bool __found_ctype = false;
+ bool __found_monetary = false;
+ size_t __ci = 0, __mi = 0;
+ for (size_t __i = 0; __i < _S_categories_size; ++__i)
+ {
+ const char* __beg = std::strchr(__end + 1, '=') + 1;
+ __end = std::strchr(__beg, ';');
+ if (!__end)
+ __end = __s + __len;
+ _M_names[__i] = new char[__end - __beg + 1];
+ std::memcpy(_M_names[__i], __beg, __end - __beg);
+ _M_names[__i][__end - __beg] = '\0';
+ if (!__found_ctype
+ && *(__beg - 2) == 'E' && *(__beg - 3) == 'P')
+ {
+ __found_ctype = true;
+ __ci = __i;
+ }
+ else if (!__found_monetary && *(__beg - 2) == 'Y')
+ {
+ __found_monetary = true;
+ __mi = __i;
+ }
+ }
+
+ if (std::strcmp(_M_names[__ci], _M_names[__mi]))
+ {
+ __smon = _M_names[__mi];
+ __clocm = locale::facet::_S_lc_ctype_c_locale(__cloc,
+ __smon);
+ }
+ }
+
+ // Construct all standard facets and add them to _M_facets.
+ _M_init_facet(new std::ctype<char>(__cloc, 0, false));
+ _M_init_facet(new codecvt<char, char, mbstate_t>(__cloc));
+ _M_init_facet(new numpunct<char>(__cloc));
+ _M_init_facet(new num_get<char>);
+ _M_init_facet(new num_put<char>);
+ _M_init_facet(new std::collate<char>(__cloc));
+ _M_init_facet(new moneypunct<char, false>(__cloc, 0));
+ _M_init_facet(new moneypunct<char, true>(__cloc, 0));
+ _M_init_facet(new money_get<char>);
+ _M_init_facet(new money_put<char>);
+ _M_init_facet(new __timepunct<char>(__cloc, __s));
+ _M_init_facet(new time_get<char>);
+ _M_init_facet(new time_put<char>);
+ _M_init_facet(new std::messages<char>(__cloc, __s));
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ _M_init_facet(new std::ctype<wchar_t>(__cloc));
+ _M_init_facet(new codecvt<wchar_t, char, mbstate_t>(__cloc));
+ _M_init_facet(new numpunct<wchar_t>(__cloc));
+ _M_init_facet(new num_get<wchar_t>);
+ _M_init_facet(new num_put<wchar_t>);
+ _M_init_facet(new std::collate<wchar_t>(__cloc));
+ _M_init_facet(new moneypunct<wchar_t, false>(__clocm, __smon));
+ _M_init_facet(new moneypunct<wchar_t, true>(__clocm, __smon));
+ _M_init_facet(new money_get<wchar_t>);
+ _M_init_facet(new money_put<wchar_t>);
+ _M_init_facet(new __timepunct<wchar_t>(__cloc, __s));
+ _M_init_facet(new time_get<wchar_t>);
+ _M_init_facet(new time_put<wchar_t>);
+ _M_init_facet(new std::messages<wchar_t>(__cloc, __s));
+#endif
+ locale::facet::_S_destroy_c_locale(__cloc);
+ if (__clocm != __cloc)
+ locale::facet::_S_destroy_c_locale(__clocm);
+ }
+ __catch(...)
+ {
+ locale::facet::_S_destroy_c_locale(__cloc);
+ if (__clocm != __cloc)
+ locale::facet::_S_destroy_c_locale(__clocm);
+ this->~_Impl();
+ __throw_exception_again;
+ }
+ }
+
+ void
+ locale::_Impl::
+ _M_replace_categories(const _Impl* __imp, category __cat)
+ {
+ category __mask = 1;
+ if (!_M_names[0] || !__imp->_M_names[0])
+ {
+ if (_M_names[0])
+ {
+ delete [] _M_names[0];
+ _M_names[0] = 0; // Unnamed.
+ }
+
+ for (size_t __ix = 0; __ix < _S_categories_size; ++__ix, __mask <<= 1)
+ {
+ if (__mask & __cat)
+ // Need to replace entry in _M_facets with other locale's info.
+ _M_replace_category(__imp, _S_facet_categories[__ix]);
+ }
+ }
+ else
+ {
+ 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);
+ }
+ }
+
+ for (size_t __ix = 0; __ix < _S_categories_size; ++__ix, __mask <<= 1)
+ {
+ if (__mask & __cat)
+ {
+ // Need to replace entry in _M_facets with other locale's info.
+ _M_replace_category(__imp, _S_facet_categories[__ix]);
+
+ // 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;
+ }
+ }
+ }
+ }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/math_stubs_float.cc b/libstdc++-v3/src/c++98/math_stubs_float.cc
new file mode 100644
index 00000000000..a226ce46f26
--- /dev/null
+++ b/libstdc++-v3/src/c++98/math_stubs_float.cc
@@ -0,0 +1,224 @@
+// Stub definitions for float math.
+
+// Copyright (C) 2001, 2002, 2003, 2009 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <cmath>
+
+// For targets which do not have support for float versions,
+// we use the following crude approximations. We keep saying that we'll do
+// better later, but never do.
+
+extern "C"
+{
+#ifndef _GLIBCXX_HAVE_FABSF
+ float
+ fabsf(float x)
+ {
+ return (float) fabs(x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_ACOSF
+ float
+ acosf(float x)
+ {
+ return (float) acos(x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_ASINF
+ float
+ asinf(float x)
+ {
+ return (float) asin(x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_ATANF
+ float
+ atanf(float x)
+ {
+ return (float) atan(x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_ATAN2F
+ float
+ atan2f(float x, float y)
+ {
+ return (float) atan2(x, y);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_CEILF
+ float
+ ceilf(float x)
+ {
+ return (float) ceil(x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_COSF
+ float
+ cosf(float x)
+ {
+ return (float) cos(x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_COSHF
+ float
+ coshf(float x)
+ {
+ return (float) cosh(x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_EXPF
+ float
+ expf(float x)
+ {
+ return (float) exp(x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_FLOORF
+ float
+ floorf(float x)
+ {
+ return (float) floor(x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_FMODF
+ float
+ fmodf(float x, float y)
+ {
+ return (float) fmod(x, y);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_FREXPF
+ float
+ frexpf(float x, int *exp)
+ {
+ return (float) frexp(x, exp);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_SQRTF
+ float
+ sqrtf(float x)
+ {
+ return (float) sqrt(x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_HYPOTF
+ float
+ hypotf(float x, float y)
+ {
+ float s = fabsf(x) + fabsf(y);
+ if (s == 0.0F)
+ return s;
+ x /= s; y /= s;
+ return s * sqrtf(x * x + y * y);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_LDEXPF
+ float
+ ldexpf(float x, int exp)
+ {
+ return (float) ldexp(x, exp);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_LOGF
+ float
+ logf(float x)
+ {
+ return (float) log(x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_LOG10F
+ float
+ log10f(float x)
+ {
+ return (float) log10(x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_MODFF
+ float
+ modff(float x, float *iptr)
+ {
+ double result, temp;
+
+ result = modf(x, &temp);
+ *iptr = (float) temp;
+ return (float) result;
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_POWF
+ float
+ powf(float x, float y)
+ {
+ return (float) pow(x, y);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_SINF
+ float
+ sinf(float x)
+ {
+ return (float) sin(x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_SINHF
+ float
+ sinhf(float x)
+ {
+ return (float) sinh(x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_TANF
+ float
+ tanf(float x)
+ {
+ return (float) tan(x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_TANHF
+ float
+ tanhf(float x)
+ {
+ return (float) tanh(x);
+ }
+#endif
+} // extern "C"
diff --git a/libstdc++-v3/src/c++98/math_stubs_long_double.cc b/libstdc++-v3/src/c++98/math_stubs_long_double.cc
new file mode 100644
index 00000000000..9f760cfb32f
--- /dev/null
+++ b/libstdc++-v3/src/c++98/math_stubs_long_double.cc
@@ -0,0 +1,224 @@
+// Stub definitions for long double math.
+
+// Copyright (C) 2001, 2002, 2003, 2009 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <cmath>
+
+// For targets which do not have support for long double versions,
+// we use the following crude approximations. We keep saying that we'll do
+// better later, but never do.
+
+extern "C"
+{
+#ifndef _GLIBCXX_HAVE_FABSL
+ long double
+ fabsl(long double x)
+ {
+ return fabs((double) x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_ACOSL
+ long double
+ acosl(long double x)
+ {
+ return acos((double) x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_ASINL
+ long double
+ asinl(long double x)
+ {
+ return asin((double) x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_ATANL
+ long double
+ atanl(long double x)
+ {
+ return atan ((double) x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_ATAN2L
+ long double
+ atan2l(long double x, long double y)
+ {
+ return atan2((double) x, (double) y);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_CEILL
+ long double
+ ceill(long double x)
+ {
+ return ceil((double) x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_COSL
+ long double
+ cosl(long double x)
+ {
+ return cos((double) x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_COSHL
+ long double
+ coshl(long double x)
+ {
+ return cosh((double) x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_EXPL
+ long double
+ expl(long double x)
+ {
+ return exp((double) x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_FLOORL
+ long double
+ floorl(long double x)
+ {
+ return floor((double) x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_FMODL
+ long double
+ fmodl(long double x, long double y)
+ {
+ return fmod((double) x, (double) y);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_FREXPL
+ long double
+ frexpl(long double x, int *exp)
+ {
+ return frexp((double) x, exp);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_SQRTL
+ long double
+ sqrtl(long double x)
+ {
+ return sqrt((double) x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_HYPOTL
+ long double
+ hypotl(long double x, long double y)
+ {
+ long double s = fabsl(x) + fabsl(y);
+ if (s == 0.0L)
+ return s;
+ x /= s; y /= s;
+ return s * sqrtl(x * x + y * y);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_LDEXPL
+ long double
+ ldexpl(long double x, int exp)
+ {
+ return ldexp((double) x, exp);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_LOGL
+ long double
+ logl(long double x)
+ {
+ return log((double) x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_LOG10L
+ long double
+ log10l(long double x)
+ {
+ return log10((double) x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_MODFL
+ long double
+ modfl(long double x, long double *iptr)
+ {
+ double result, temp;
+
+ result = modf((double) x, &temp);
+ *iptr = temp;
+ return result;
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_POWL
+ long double
+ powl(long double x, long double y)
+ {
+ return pow((double) x, (double) y);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_SINL
+ long double
+ sinl(long double x)
+ {
+ return sin((double) x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_SINHL
+ long double
+ sinhl(long double x)
+ {
+ return sinh((double) x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_TANL
+ long double
+ tanl(long double x)
+ {
+ return tan((double) x);
+ }
+#endif
+
+#ifndef _GLIBCXX_HAVE_TANHL
+ long double
+ tanhl(long double x)
+ {
+ return tanh((double) x);
+ }
+#endif
+} // extern "C"
diff --git a/libstdc++-v3/src/c++98/misc-inst.cc b/libstdc++-v3/src/c++98/misc-inst.cc
new file mode 100644
index 00000000000..ad09c9b84dd
--- /dev/null
+++ b/libstdc++-v3/src/c++98/misc-inst.cc
@@ -0,0 +1,82 @@
+// Explicit instantiation file.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <string>
+#include <istream>
+#include <ostream>
+#include <ext/stdio_sync_filebuf.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // string related to iostreams
+ template
+ basic_istream<char>&
+ operator>>(basic_istream<char>&, string&);
+ template
+ basic_ostream<char>&
+ operator<<(basic_ostream<char>&, const string&);
+ template
+ basic_istream<char>&
+ getline(basic_istream<char>&, string&, char);
+ template
+ basic_istream<char>&
+ getline(basic_istream<char>&, string&);
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template
+ basic_istream<wchar_t>&
+ operator>>(basic_istream<wchar_t>&, wstring&);
+ template
+ basic_ostream<wchar_t>&
+ operator<<(basic_ostream<wchar_t>&, const wstring&);
+ template
+ basic_istream<wchar_t>&
+ getline(basic_istream<wchar_t>&, wstring&, wchar_t);
+ template
+ basic_istream<wchar_t>&
+ getline(basic_istream<wchar_t>&, wstring&);
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ template class stdio_sync_filebuf<char>;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template class stdio_sync_filebuf<wchar_t>;
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+
diff --git a/libstdc++-v3/src/c++98/mt_allocator.cc b/libstdc++-v3/src/c++98/mt_allocator.cc
new file mode 100644
index 00000000000..16c2fb8063e
--- /dev/null
+++ b/libstdc++-v3/src/c++98/mt_allocator.cc
@@ -0,0 +1,818 @@
+// Allocator details.
+
+// Copyright (C) 2004, 2005, 2006, 2009, 2010 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// 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));
+ }
+ }
+ };
+
+ __freelist&
+ get_freelist()
+ {
+ static __freelist freelist;
+ return freelist;
+ }
+
+ __gnu_cxx::__mutex&
+ get_freelist_mutex()
+ {
+ static __gnu_cxx::__mutex freelist_mutex;
+ return freelist_mutex;
+ }
+
+ static void
+ _M_destroy_thread_key(void* __id)
+ {
+ // Return this thread id record to the front of thread_freelist.
+ __freelist& freelist = get_freelist();
+ {
+ __gnu_cxx::__scoped_lock sentry(get_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
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ 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) throw ()
+ {
+ // 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 = 0;
+
+ __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] = 0;
+ __bin._M_address = 0;
+ }
+ _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) throw ()
+ {
+ // 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 = 0;
+ 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] == 0)
+ {
+ 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 = 0;
+ }
+ 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] = 0;
+ }
+ 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 = 0;
+ }
+ __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 = 0;
+ }
+
+ __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())
+ {
+ __freelist& freelist = get_freelist();
+ {
+ __gnu_cxx::__scoped_lock sentry(get_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 = 0;
+ _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 = 0;
+
+ __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] = 0;
+ __bin._M_address = 0;
+ }
+ }
+ _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 its id.
+ if (__gthread_active_p())
+ {
+ __freelist& freelist = get_freelist();
+ void* v = __gthread_getspecific(freelist._M_key);
+ size_t _M_id = (size_t)v;
+ if (_M_id == 0)
+ {
+ {
+ __gnu_cxx::__scoped_lock sentry(get_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*) throw () { }
+
+ // 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())
+ {
+ __freelist& freelist = get_freelist();
+ {
+ __gnu_cxx::__scoped_lock sentry(get_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 = 0;
+ _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 = 0;
+
+ __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] = 0;
+ __bin._M_address = 0;
+ }
+ }
+ _M_init = true;
+ }
+#endif
+
+ // Instantiations.
+ template class __mt_alloc<char>;
+ template class __mt_alloc<wchar_t>;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/ostream-inst.cc b/libstdc++-v3/src/c++98/ostream-inst.cc
new file mode 100644
index 00000000000..9c25228771b
--- /dev/null
+++ b/libstdc++-v3/src/c++98/ostream-inst.cc
@@ -0,0 +1,118 @@
+// Explicit instantiation file.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+// 2009 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <ostream>
+#include <iomanip>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // ostream
+ template class basic_ostream<char>;
+ template ostream& endl(ostream&);
+ template ostream& ends(ostream&);
+ template ostream& flush(ostream&);
+ template ostream& operator<<(ostream&, char);
+ template ostream& operator<<(ostream&, unsigned char);
+ template ostream& operator<<(ostream&, signed char);
+ template ostream& operator<<(ostream&, const char*);
+ template ostream& operator<<(ostream&, const unsigned char*);
+ template ostream& operator<<(ostream&, const signed char*);
+
+ template ostream& operator<<(ostream&, _Setfill<char>);
+ template ostream& operator<<(ostream&, _Setiosflags);
+ template ostream& operator<<(ostream&, _Resetiosflags);
+ 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>;
+ template wostream& endl(wostream&);
+ template wostream& ends(wostream&);
+ template wostream& flush(wostream&);
+ template wostream& operator<<(wostream&, wchar_t);
+ template wostream& operator<<(wostream&, char);
+ template wostream& operator<<(wostream&, const wchar_t*);
+ template wostream& operator<<(wostream&, const char*);
+
+ template wostream& operator<<(wostream&, _Setfill<wchar_t>);
+ template wostream& operator<<(wostream&, _Setiosflags);
+ template wostream& operator<<(wostream&, _Resetiosflags);
+ 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
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // 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);
+#ifdef _GLIBCXX_USE_WCHAR_T
+_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_ostreamIwSt11char_traitsIwEElsEd,
+ _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEe);
+#endif
+_GLIBCXX_LDBL_COMPAT (_ZNSo9_M_insertIdEERSoT_,
+ _ZNSo9_M_insertIeEERSoT_);
+#ifdef _GLIBCXX_USE_WCHAR_T
+_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIdEERS2_T_,
+ _ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIeEERS2_T_);
+#endif
+
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
diff --git a/libstdc++-v3/src/c++98/parallel_settings.cc b/libstdc++-v3/src/c++98/parallel_settings.cc
new file mode 100644
index 00000000000..e183c97f45e
--- /dev/null
+++ b/libstdc++-v3/src/c++98/parallel_settings.cc
@@ -0,0 +1,42 @@
+// Default settings for parallel mode -*- C++ -*-
+
+// Copyright (C) 2007, 2009 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <parallel/settings.h>
+
+namespace
+{
+ __gnu_parallel::_Settings s;
+}
+
+namespace __gnu_parallel
+{
+ const _Settings&
+ _Settings::get() throw()
+ { return s; }
+
+ // XXX MT
+ void
+ _Settings::set(_Settings& obj) throw()
+ { s = obj; }
+}
diff --git a/libstdc++-v3/src/c++98/pool_allocator.cc b/libstdc++-v3/src/c++98/pool_allocator.cc
new file mode 100644
index 00000000000..f94656b03ba
--- /dev/null
+++ b/libstdc++-v3/src/c++98/pool_allocator.cc
@@ -0,0 +1,177 @@
+// Allocator details.
+
+// Copyright (C) 2004, 2005, 2006, 2009 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <bits/c++config.h>
+#include <cstdlib>
+#include <ext/pool_allocator.h>
+
+namespace
+{
+ __gnu_cxx::__mutex&
+ get_palloc_mutex()
+ {
+ static __gnu_cxx::__mutex palloc_mutex;
+ return palloc_mutex;
+ }
+} // anonymous namespace
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // Definitions for __pool_alloc_base.
+ __pool_alloc_base::_Obj* volatile*
+ __pool_alloc_base::_M_get_free_list(size_t __bytes) throw ()
+ {
+ 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() throw ()
+ { return get_palloc_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(const std::bad_alloc&)
+ {
+ // 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_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/sstream-inst.cc b/libstdc++-v3/src/c++98/sstream-inst.cc
new file mode 100644
index 00000000000..5c6877904dd
--- /dev/null
+++ b/libstdc++-v3/src/c++98/sstream-inst.cc
@@ -0,0 +1,49 @@
+// Explicit instantiation file.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2005, 2009
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <sstream>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ template class basic_stringbuf<char>;
+ template class basic_istringstream<char>;
+ template class basic_ostringstream<char>;
+ 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
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/stdexcept.cc b/libstdc++-v3/src/c++98/stdexcept.cc
new file mode 100644
index 00000000000..dbc8f408e2f
--- /dev/null
+++ b/libstdc++-v3/src/c++98/stdexcept.cc
@@ -0,0 +1,91 @@
+// Methods for Exception Support for -*- C++ -*-
+
+// Copyright (C) 1997, 1999, 2001, 2002, 2005, 2009, 2011
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 19.1 Exception classes
+//
+
+#include <string>
+#include <stdexcept>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ logic_error::logic_error(const string& __arg)
+ : exception(), _M_msg(__arg) { }
+
+ logic_error::~logic_error() _GLIBCXX_USE_NOEXCEPT { }
+
+ const char*
+ logic_error::what() const _GLIBCXX_USE_NOEXCEPT
+ { return _M_msg.c_str(); }
+
+ domain_error::domain_error(const string& __arg)
+ : logic_error(__arg) { }
+
+ domain_error::~domain_error() _GLIBCXX_USE_NOEXCEPT { }
+
+ invalid_argument::invalid_argument(const string& __arg)
+ : logic_error(__arg) { }
+
+ invalid_argument::~invalid_argument() _GLIBCXX_USE_NOEXCEPT { }
+
+ length_error::length_error(const string& __arg)
+ : logic_error(__arg) { }
+
+ length_error::~length_error() _GLIBCXX_USE_NOEXCEPT { }
+
+ out_of_range::out_of_range(const string& __arg)
+ : logic_error(__arg) { }
+
+ out_of_range::~out_of_range() _GLIBCXX_USE_NOEXCEPT { }
+
+ runtime_error::runtime_error(const string& __arg)
+ : exception(), _M_msg(__arg) { }
+
+ runtime_error::~runtime_error() _GLIBCXX_USE_NOEXCEPT { }
+
+ const char*
+ runtime_error::what() const _GLIBCXX_USE_NOEXCEPT
+ { return _M_msg.c_str(); }
+
+ range_error::range_error(const string& __arg)
+ : runtime_error(__arg) { }
+
+ range_error::~range_error() _GLIBCXX_USE_NOEXCEPT { }
+
+ overflow_error::overflow_error(const string& __arg)
+ : runtime_error(__arg) { }
+
+ overflow_error::~overflow_error() _GLIBCXX_USE_NOEXCEPT { }
+
+ underflow_error::underflow_error(const string& __arg)
+ : runtime_error(__arg) { }
+
+ underflow_error::~underflow_error() _GLIBCXX_USE_NOEXCEPT { }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/streambuf-inst.cc b/libstdc++-v3/src/c++98/streambuf-inst.cc
new file mode 100644
index 00000000000..5b563c8e173
--- /dev/null
+++ b/libstdc++-v3/src/c++98/streambuf-inst.cc
@@ -0,0 +1,64 @@
+// Explicit instantiation file.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+// 2009 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <ios>
+#include <streambuf>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // 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>;
+
+ template
+ streamsize
+ __copy_streambufs(basic_streambuf<wchar_t>*, basic_streambuf<wchar_t>*);
+
+ template
+ streamsize
+ __copy_streambufs_eof(basic_streambuf<wchar_t>*,
+ basic_streambuf<wchar_t>*, bool&);
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/streambuf.cc b/libstdc++-v3/src/c++98/streambuf.cc
new file mode 100644
index 00000000000..5bcd0ea8d58
--- /dev/null
+++ b/libstdc++-v3/src/c++98/streambuf.cc
@@ -0,0 +1,117 @@
+// Stream buffer classes -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 27.5 Stream buffers
+//
+
+#include <streambuf>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ 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->__safe_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->__safe_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_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/strstream.cc b/libstdc++-v3/src/c++98/strstream.cc
new file mode 100644
index 00000000000..c76fc60e0ac
--- /dev/null
+++ b/libstdc++-v3/src/c++98/strstream.cc
@@ -0,0 +1,418 @@
+// strstream definitions -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2005, 2009, 2010, 2011
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ * Copyright (c) 1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+// Implementation of the classes in header <strstream>.
+// WARNING: The classes defined in <strstream> are DEPRECATED. This
+// header is defined in section D.7.1 of the C++ standard, and it
+// MAY BE REMOVED in a future standard revision. You should use the
+// header <sstream> instead.
+
+#include <strstream>
+#include <algorithm>
+#include <new>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ strstreambuf::strstreambuf(streamsize initial_capacity)
+ : _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(true),
+ _M_frozen(false), _M_constant(false)
+ {
+ streamsize n = std::max(initial_capacity, streamsize(16));
+
+ char* buf = _M_alloc(n);
+ if (buf)
+ {
+ setp(buf, buf + n);
+ setg(buf, buf, buf);
+ }
+ }
+
+ strstreambuf::strstreambuf(void* (*alloc_f)(size_t), void (*free_f)(void*))
+ : _Base(), _M_alloc_fun(alloc_f), _M_free_fun(free_f), _M_dynamic(true),
+ _M_frozen(false), _M_constant(false)
+ {
+ streamsize n = 16;
+
+ char* buf = _M_alloc(n);
+ if (buf)
+ {
+ setp(buf, buf + n);
+ setg(buf, buf, buf);
+ }
+ }
+
+ strstreambuf::strstreambuf(char* get, streamsize n, char* put) throw ()
+ : _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
+ _M_frozen(false), _M_constant(false)
+ { _M_setup(get, put, n); }
+
+ strstreambuf::strstreambuf(signed char* get, streamsize n, signed char* put) throw ()
+ : _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
+ _M_frozen(false), _M_constant(false)
+ { _M_setup(reinterpret_cast<char*>(get), reinterpret_cast<char*>(put), n); }
+
+ strstreambuf::strstreambuf(unsigned char* get, streamsize n,
+ unsigned char* put) throw ()
+ : _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
+ _M_frozen(false), _M_constant(false)
+ { _M_setup(reinterpret_cast<char*>(get), reinterpret_cast<char*>(put), n); }
+
+ strstreambuf::strstreambuf(const char* get, streamsize n) throw ()
+ : _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
+ _M_frozen(false), _M_constant(true)
+ { _M_setup(const_cast<char*>(get), 0, n); }
+
+ strstreambuf::strstreambuf(const signed char* get, streamsize n) throw ()
+ : _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
+ _M_frozen(false), _M_constant(true)
+ { _M_setup(reinterpret_cast<char*>(const_cast<signed char*>(get)), 0, n); }
+
+ strstreambuf::strstreambuf(const unsigned char* get, streamsize n) throw ()
+ : _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
+ _M_frozen(false), _M_constant(true)
+ { _M_setup(reinterpret_cast<char*>(const_cast<unsigned char*>(get)), 0, n); }
+
+ strstreambuf::~strstreambuf()
+ {
+ if (_M_dynamic && !_M_frozen)
+ _M_free(eback());
+ }
+
+ void
+ strstreambuf::freeze(bool frozenflag) throw ()
+ {
+ if (_M_dynamic)
+ _M_frozen = frozenflag;
+ }
+
+ char*
+ strstreambuf::str() throw ()
+ {
+ freeze(true);
+ return eback();
+ }
+
+ int
+ strstreambuf::pcount() const throw ()
+ { return pptr() ? pptr() - pbase() : 0; }
+
+ strstreambuf::int_type
+ strstreambuf::overflow(int_type c)
+ {
+ if (c == traits_type::eof())
+ return traits_type::not_eof(c);
+
+ // Try to expand the buffer.
+ if (pptr() == epptr() && _M_dynamic && !_M_frozen && !_M_constant)
+ {
+ ptrdiff_t old_size = epptr() - pbase();
+ ptrdiff_t new_size = std::max(ptrdiff_t(2 * old_size), ptrdiff_t(1));
+
+ char* buf = _M_alloc(new_size);
+ if (buf)
+ {
+ memcpy(buf, pbase(), old_size);
+ char* old_buffer = pbase();
+ bool reposition_get = false;
+ ptrdiff_t old_get_offset;
+ if (gptr() != 0)
+ {
+ reposition_get = true;
+ old_get_offset = gptr() - eback();
+ }
+
+ setp(buf, buf + new_size);
+ __safe_pbump(old_size);
+
+ if (reposition_get)
+ setg(buf, buf + old_get_offset, buf +
+ std::max(old_get_offset, old_size));
+
+ _M_free(old_buffer);
+ }
+ }
+
+ if (pptr() != epptr())
+ {
+ *pptr() = c;
+ pbump(1);
+ return c;
+ }
+ else
+ return traits_type::eof();
+ }
+
+ strstreambuf::int_type
+ strstreambuf::pbackfail(int_type c)
+ {
+ if (gptr() != eback())
+ {
+ if (c == _Traits::eof())
+ {
+ gbump(-1);
+ return _Traits::not_eof(c);
+ }
+ else if (c == _Traits::to_int_type(gptr()[-1]))
+ { // KLUDGE
+ gbump(-1);
+ return c;
+ }
+ else if (!_M_constant)
+ {
+ gbump(-1);
+ *gptr() = c;
+ return c;
+ }
+ }
+ return _Traits::eof();
+ }
+
+ strstreambuf::int_type
+ strstreambuf::underflow()
+ {
+ if (gptr() == egptr() && pptr() && pptr() > egptr())
+ setg(eback(), gptr(), pptr());
+
+ if (gptr() != egptr())
+ return (unsigned char) *gptr();
+ else
+ return _Traits::eof();
+ }
+
+ basic_streambuf<char, char_traits<char> >*
+ strstreambuf::setbuf(char*, streamsize)
+ { return this; }
+
+ strstreambuf::pos_type
+ strstreambuf::seekoff(off_type off, ios_base::seekdir dir,
+ ios_base::openmode mode)
+ {
+ bool do_get = false;
+ bool do_put = false;
+
+ if ((mode & (ios_base::in | ios_base::out))
+ == (ios_base::in | ios_base::out) &&
+ (dir == ios_base::beg || dir == ios_base::end))
+ do_get = do_put = true;
+ else if (mode & ios_base::in)
+ do_get = true;
+ else if (mode & ios_base::out)
+ do_put = true;
+
+ // !gptr() is here because, according to D.7.1 paragraph 4, the seekable
+ // area is undefined if there is no get area.
+ if ((!do_get && !do_put) || (do_put && !pptr()) || !gptr())
+ return pos_type(off_type(-1));
+
+ char* seeklow = eback();
+ char* seekhigh = epptr() ? epptr() : egptr();
+
+ off_type newoff;
+ switch (dir)
+ {
+ case ios_base::beg:
+ newoff = 0;
+ break;
+ case ios_base::end:
+ newoff = seekhigh - seeklow;
+ break;
+ case ios_base::cur:
+ newoff = do_put ? pptr() - seeklow : gptr() - seeklow;
+ break;
+ default:
+ return pos_type(off_type(-1));
+ }
+
+ off += newoff;
+ if (off < 0 || off > seekhigh - seeklow)
+ return pos_type(off_type(-1));
+
+ if (do_put)
+ {
+ if (seeklow + off < pbase())
+ {
+ setp(seeklow, epptr());
+ __safe_pbump(off);
+ }
+ else
+ {
+ setp(pbase(), epptr());
+ __safe_pbump(off - (pbase() - seeklow));
+ }
+ }
+ if (do_get)
+ {
+ if (off <= egptr() - seeklow)
+ setg(seeklow, seeklow + off, egptr());
+ else if (off <= pptr() - seeklow)
+ setg(seeklow, seeklow + off, pptr());
+ else
+ setg(seeklow, seeklow + off, epptr());
+ }
+ return pos_type(newoff);
+ }
+
+ strstreambuf::pos_type
+ strstreambuf::seekpos(pos_type pos, ios_base::openmode mode)
+ { return seekoff(pos - pos_type(off_type(0)), ios_base::beg, mode); }
+
+ char*
+ strstreambuf::_M_alloc(size_t n)
+ {
+ if (_M_alloc_fun)
+ return static_cast<char*>(_M_alloc_fun(n));
+ else
+ return new char[n];
+ }
+
+ void
+ strstreambuf::_M_free(char* p)
+ {
+ if (p)
+ {
+ if (_M_free_fun)
+ _M_free_fun(p);
+ else
+ delete[] p;
+ }
+ }
+
+ void
+ strstreambuf::_M_setup(char* get, char* put, streamsize n) throw ()
+ {
+ if (get)
+ {
+ size_t N = n > 0 ? size_t(n) : n == 0 ? strlen(get) : size_t(INT_MAX);
+
+ if (put)
+ {
+ setg(get, get, put);
+ setp(put, put + N);
+ }
+ else
+ setg(get, get, get + N);
+ }
+ }
+
+ istrstream::istrstream(char* s)
+ : basic_ios<char>(), basic_istream<char>(0), _M_buf(s, 0)
+ { basic_ios<char>::init(&_M_buf); }
+
+ istrstream::istrstream(const char* s)
+ : basic_ios<char>(), basic_istream<char>(0), _M_buf(s, 0)
+ { basic_ios<char>::init(&_M_buf); }
+
+ istrstream::istrstream(char* s, streamsize n)
+ : basic_ios<char>(), basic_istream<char>(0), _M_buf(s, n)
+ { basic_ios<char>::init(&_M_buf); }
+
+ istrstream::istrstream(const char* s, streamsize n)
+ : basic_ios<char>(), basic_istream<char>(0), _M_buf(s, n)
+ { basic_ios<char>::init(&_M_buf); }
+
+ istrstream::~istrstream() { }
+
+ strstreambuf*
+ istrstream::rdbuf() const throw ()
+ { return const_cast<strstreambuf*>(&_M_buf); }
+
+ char*
+ istrstream::str() throw ()
+ { return _M_buf.str(); }
+
+ ostrstream::ostrstream()
+ : basic_ios<char>(), basic_ostream<char>(0), _M_buf()
+ { basic_ios<char>::init(&_M_buf); }
+
+ ostrstream::ostrstream(char* s, int n, ios_base::openmode mode)
+ : basic_ios<char>(), basic_ostream<char>(0),
+ _M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s)
+ { basic_ios<char>::init(&_M_buf); }
+
+ ostrstream::~ostrstream() {}
+
+ strstreambuf*
+ ostrstream::rdbuf() const throw ()
+ { return const_cast<strstreambuf*>(&_M_buf); }
+
+ void
+ ostrstream::freeze(bool freezeflag) throw ()
+ { _M_buf.freeze(freezeflag); }
+
+ char*
+ ostrstream::str() throw ()
+ { return _M_buf.str(); }
+
+ int
+ ostrstream::pcount() const throw ()
+ { return _M_buf.pcount(); }
+
+ strstream::strstream()
+ : basic_ios<char>(), basic_iostream<char>(0), _M_buf()
+ { basic_ios<char>::init(&_M_buf); }
+
+ strstream::strstream(char* s, int n, ios_base::openmode mode)
+ : basic_ios<char>(), basic_iostream<char>(0),
+ _M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s)
+ { basic_ios<char>::init(&_M_buf); }
+
+ strstream::~strstream() { }
+
+ strstreambuf*
+ strstream::rdbuf() const throw ()
+ { return const_cast<strstreambuf*>(&_M_buf); }
+
+ void
+ strstream::freeze(bool freezeflag) throw ()
+ { _M_buf.freeze(freezeflag); }
+
+ int
+ strstream::pcount() const throw ()
+ { return _M_buf.pcount(); }
+
+ char*
+ strstream::str() throw ()
+ { return _M_buf.str(); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/tree.cc b/libstdc++-v3/src/c++98/tree.cc
new file mode 100644
index 00000000000..0a7f6f9e485
--- /dev/null
+++ b/libstdc++-v3/src/c++98/tree.cc
@@ -0,0 +1,454 @@
+// RB tree utilities implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2005, 2009 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ */
+
+#include <bits/stl_tree.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ _Rb_tree_node_base*
+ _Rb_tree_increment(_Rb_tree_node_base* __x) throw ()
+ {
+ if (__x->_M_right != 0)
+ {
+ __x = __x->_M_right;
+ while (__x->_M_left != 0)
+ __x = __x->_M_left;
+ }
+ else
+ {
+ _Rb_tree_node_base* __y = __x->_M_parent;
+ while (__x == __y->_M_right)
+ {
+ __x = __y;
+ __y = __y->_M_parent;
+ }
+ if (__x->_M_right != __y)
+ __x = __y;
+ }
+ return __x;
+ }
+
+ const _Rb_tree_node_base*
+ _Rb_tree_increment(const _Rb_tree_node_base* __x) throw ()
+ {
+ return _Rb_tree_increment(const_cast<_Rb_tree_node_base*>(__x));
+ }
+
+ _Rb_tree_node_base*
+ _Rb_tree_decrement(_Rb_tree_node_base* __x) throw ()
+ {
+ if (__x->_M_color == _S_red
+ && __x->_M_parent->_M_parent == __x)
+ __x = __x->_M_right;
+ else if (__x->_M_left != 0)
+ {
+ _Rb_tree_node_base* __y = __x->_M_left;
+ while (__y->_M_right != 0)
+ __y = __y->_M_right;
+ __x = __y;
+ }
+ else
+ {
+ _Rb_tree_node_base* __y = __x->_M_parent;
+ while (__x == __y->_M_left)
+ {
+ __x = __y;
+ __y = __y->_M_parent;
+ }
+ __x = __y;
+ }
+ return __x;
+ }
+
+ const _Rb_tree_node_base*
+ _Rb_tree_decrement(const _Rb_tree_node_base* __x) throw ()
+ {
+ return _Rb_tree_decrement(const_cast<_Rb_tree_node_base*>(__x));
+ }
+
+ static void
+ local_Rb_tree_rotate_left(_Rb_tree_node_base* const __x,
+ _Rb_tree_node_base*& __root)
+ {
+ _Rb_tree_node_base* const __y = __x->_M_right;
+
+ __x->_M_right = __y->_M_left;
+ if (__y->_M_left !=0)
+ __y->_M_left->_M_parent = __x;
+ __y->_M_parent = __x->_M_parent;
+
+ if (__x == __root)
+ __root = __y;
+ else if (__x == __x->_M_parent->_M_left)
+ __x->_M_parent->_M_left = __y;
+ else
+ __x->_M_parent->_M_right = __y;
+ __y->_M_left = __x;
+ __x->_M_parent = __y;
+ }
+
+ /* Static keyword was missing on _Rb_tree_rotate_left.
+ Export the symbol for backward compatibility until
+ next ABI change. */
+ void
+ _Rb_tree_rotate_left(_Rb_tree_node_base* const __x,
+ _Rb_tree_node_base*& __root)
+ {
+ local_Rb_tree_rotate_left (__x, __root);
+ }
+
+ static void
+ local_Rb_tree_rotate_right(_Rb_tree_node_base* const __x,
+ _Rb_tree_node_base*& __root)
+ {
+ _Rb_tree_node_base* const __y = __x->_M_left;
+
+ __x->_M_left = __y->_M_right;
+ if (__y->_M_right != 0)
+ __y->_M_right->_M_parent = __x;
+ __y->_M_parent = __x->_M_parent;
+
+ if (__x == __root)
+ __root = __y;
+ else if (__x == __x->_M_parent->_M_right)
+ __x->_M_parent->_M_right = __y;
+ else
+ __x->_M_parent->_M_left = __y;
+ __y->_M_right = __x;
+ __x->_M_parent = __y;
+ }
+
+ /* Static keyword was missing on _Rb_tree_rotate_right
+ Export the symbol for backward compatibility until
+ next ABI change. */
+ void
+ _Rb_tree_rotate_right(_Rb_tree_node_base* const __x,
+ _Rb_tree_node_base*& __root)
+ {
+ local_Rb_tree_rotate_right (__x, __root);
+ }
+
+ void
+ _Rb_tree_insert_and_rebalance(const bool __insert_left,
+ _Rb_tree_node_base* __x,
+ _Rb_tree_node_base* __p,
+ _Rb_tree_node_base& __header) throw ()
+ {
+ _Rb_tree_node_base *& __root = __header._M_parent;
+
+ // Initialize fields in new node to insert.
+ __x->_M_parent = __p;
+ __x->_M_left = 0;
+ __x->_M_right = 0;
+ __x->_M_color = _S_red;
+
+ // Insert.
+ // Make new node child of parent and maintain root, leftmost and
+ // rightmost nodes.
+ // N.B. First node is always inserted left.
+ if (__insert_left)
+ {
+ __p->_M_left = __x; // also makes leftmost = __x when __p == &__header
+
+ if (__p == &__header)
+ {
+ __header._M_parent = __x;
+ __header._M_right = __x;
+ }
+ else if (__p == __header._M_left)
+ __header._M_left = __x; // maintain leftmost pointing to min node
+ }
+ else
+ {
+ __p->_M_right = __x;
+
+ if (__p == __header._M_right)
+ __header._M_right = __x; // maintain rightmost pointing to max node
+ }
+ // Rebalance.
+ while (__x != __root
+ && __x->_M_parent->_M_color == _S_red)
+ {
+ _Rb_tree_node_base* const __xpp = __x->_M_parent->_M_parent;
+
+ if (__x->_M_parent == __xpp->_M_left)
+ {
+ _Rb_tree_node_base* const __y = __xpp->_M_right;
+ if (__y && __y->_M_color == _S_red)
+ {
+ __x->_M_parent->_M_color = _S_black;
+ __y->_M_color = _S_black;
+ __xpp->_M_color = _S_red;
+ __x = __xpp;
+ }
+ else
+ {
+ if (__x == __x->_M_parent->_M_right)
+ {
+ __x = __x->_M_parent;
+ local_Rb_tree_rotate_left(__x, __root);
+ }
+ __x->_M_parent->_M_color = _S_black;
+ __xpp->_M_color = _S_red;
+ local_Rb_tree_rotate_right(__xpp, __root);
+ }
+ }
+ else
+ {
+ _Rb_tree_node_base* const __y = __xpp->_M_left;
+ if (__y && __y->_M_color == _S_red)
+ {
+ __x->_M_parent->_M_color = _S_black;
+ __y->_M_color = _S_black;
+ __xpp->_M_color = _S_red;
+ __x = __xpp;
+ }
+ else
+ {
+ if (__x == __x->_M_parent->_M_left)
+ {
+ __x = __x->_M_parent;
+ local_Rb_tree_rotate_right(__x, __root);
+ }
+ __x->_M_parent->_M_color = _S_black;
+ __xpp->_M_color = _S_red;
+ local_Rb_tree_rotate_left(__xpp, __root);
+ }
+ }
+ }
+ __root->_M_color = _S_black;
+ }
+
+ _Rb_tree_node_base*
+ _Rb_tree_rebalance_for_erase(_Rb_tree_node_base* const __z,
+ _Rb_tree_node_base& __header) throw ()
+ {
+ _Rb_tree_node_base *& __root = __header._M_parent;
+ _Rb_tree_node_base *& __leftmost = __header._M_left;
+ _Rb_tree_node_base *& __rightmost = __header._M_right;
+ _Rb_tree_node_base* __y = __z;
+ _Rb_tree_node_base* __x = 0;
+ _Rb_tree_node_base* __x_parent = 0;
+
+ if (__y->_M_left == 0) // __z has at most one non-null child. y == z.
+ __x = __y->_M_right; // __x might be null.
+ else
+ if (__y->_M_right == 0) // __z has exactly one non-null child. y == z.
+ __x = __y->_M_left; // __x is not null.
+ else
+ {
+ // __z has two non-null children. Set __y to
+ __y = __y->_M_right; // __z's successor. __x might be null.
+ while (__y->_M_left != 0)
+ __y = __y->_M_left;
+ __x = __y->_M_right;
+ }
+ if (__y != __z)
+ {
+ // relink y in place of z. y is z's successor
+ __z->_M_left->_M_parent = __y;
+ __y->_M_left = __z->_M_left;
+ if (__y != __z->_M_right)
+ {
+ __x_parent = __y->_M_parent;
+ if (__x) __x->_M_parent = __y->_M_parent;
+ __y->_M_parent->_M_left = __x; // __y must be a child of _M_left
+ __y->_M_right = __z->_M_right;
+ __z->_M_right->_M_parent = __y;
+ }
+ else
+ __x_parent = __y;
+ if (__root == __z)
+ __root = __y;
+ else if (__z->_M_parent->_M_left == __z)
+ __z->_M_parent->_M_left = __y;
+ else
+ __z->_M_parent->_M_right = __y;
+ __y->_M_parent = __z->_M_parent;
+ std::swap(__y->_M_color, __z->_M_color);
+ __y = __z;
+ // __y now points to node to be actually deleted
+ }
+ else
+ { // __y == __z
+ __x_parent = __y->_M_parent;
+ if (__x)
+ __x->_M_parent = __y->_M_parent;
+ if (__root == __z)
+ __root = __x;
+ else
+ if (__z->_M_parent->_M_left == __z)
+ __z->_M_parent->_M_left = __x;
+ else
+ __z->_M_parent->_M_right = __x;
+ if (__leftmost == __z)
+ {
+ if (__z->_M_right == 0) // __z->_M_left must be null also
+ __leftmost = __z->_M_parent;
+ // makes __leftmost == _M_header if __z == __root
+ else
+ __leftmost = _Rb_tree_node_base::_S_minimum(__x);
+ }
+ if (__rightmost == __z)
+ {
+ if (__z->_M_left == 0) // __z->_M_right must be null also
+ __rightmost = __z->_M_parent;
+ // makes __rightmost == _M_header if __z == __root
+ else // __x == __z->_M_left
+ __rightmost = _Rb_tree_node_base::_S_maximum(__x);
+ }
+ }
+ if (__y->_M_color != _S_red)
+ {
+ while (__x != __root && (__x == 0 || __x->_M_color == _S_black))
+ if (__x == __x_parent->_M_left)
+ {
+ _Rb_tree_node_base* __w = __x_parent->_M_right;
+ if (__w->_M_color == _S_red)
+ {
+ __w->_M_color = _S_black;
+ __x_parent->_M_color = _S_red;
+ local_Rb_tree_rotate_left(__x_parent, __root);
+ __w = __x_parent->_M_right;
+ }
+ if ((__w->_M_left == 0 ||
+ __w->_M_left->_M_color == _S_black) &&
+ (__w->_M_right == 0 ||
+ __w->_M_right->_M_color == _S_black))
+ {
+ __w->_M_color = _S_red;
+ __x = __x_parent;
+ __x_parent = __x_parent->_M_parent;
+ }
+ else
+ {
+ if (__w->_M_right == 0
+ || __w->_M_right->_M_color == _S_black)
+ {
+ __w->_M_left->_M_color = _S_black;
+ __w->_M_color = _S_red;
+ local_Rb_tree_rotate_right(__w, __root);
+ __w = __x_parent->_M_right;
+ }
+ __w->_M_color = __x_parent->_M_color;
+ __x_parent->_M_color = _S_black;
+ if (__w->_M_right)
+ __w->_M_right->_M_color = _S_black;
+ local_Rb_tree_rotate_left(__x_parent, __root);
+ break;
+ }
+ }
+ else
+ {
+ // same as above, with _M_right <-> _M_left.
+ _Rb_tree_node_base* __w = __x_parent->_M_left;
+ if (__w->_M_color == _S_red)
+ {
+ __w->_M_color = _S_black;
+ __x_parent->_M_color = _S_red;
+ local_Rb_tree_rotate_right(__x_parent, __root);
+ __w = __x_parent->_M_left;
+ }
+ if ((__w->_M_right == 0 ||
+ __w->_M_right->_M_color == _S_black) &&
+ (__w->_M_left == 0 ||
+ __w->_M_left->_M_color == _S_black))
+ {
+ __w->_M_color = _S_red;
+ __x = __x_parent;
+ __x_parent = __x_parent->_M_parent;
+ }
+ else
+ {
+ if (__w->_M_left == 0 || __w->_M_left->_M_color == _S_black)
+ {
+ __w->_M_right->_M_color = _S_black;
+ __w->_M_color = _S_red;
+ local_Rb_tree_rotate_left(__w, __root);
+ __w = __x_parent->_M_left;
+ }
+ __w->_M_color = __x_parent->_M_color;
+ __x_parent->_M_color = _S_black;
+ if (__w->_M_left)
+ __w->_M_left->_M_color = _S_black;
+ local_Rb_tree_rotate_right(__x_parent, __root);
+ break;
+ }
+ }
+ if (__x) __x->_M_color = _S_black;
+ }
+ return __y;
+ }
+
+ unsigned int
+ _Rb_tree_black_count(const _Rb_tree_node_base* __node,
+ const _Rb_tree_node_base* __root) throw ()
+ {
+ if (__node == 0)
+ return 0;
+ unsigned int __sum = 0;
+ do
+ {
+ if (__node->_M_color == _S_black)
+ ++__sum;
+ if (__node == __root)
+ break;
+ __node = __node->_M_parent;
+ }
+ while (1);
+ return __sum;
+ }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/valarray.cc b/libstdc++-v3/src/c++98/valarray.cc
new file mode 100644
index 00000000000..5de146bc156
--- /dev/null
+++ b/libstdc++-v3/src/c++98/valarray.cc
@@ -0,0 +1,108 @@
+// Explicit instantiation file.
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <valarray>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // Some explicit instantiations.
+ template void
+ __valarray_fill(size_t* __restrict__, size_t, const size_t&);
+
+ template void
+ __valarray_copy(const size_t* __restrict__, size_t, size_t* __restrict__);
+
+ template valarray<size_t>::valarray(size_t);
+ template valarray<size_t>::valarray(const valarray<size_t>&);
+ template valarray<size_t>::~valarray();
+ 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)
+ {
+ const size_t __n = __a.size();
+ // XXX: This ugly cast is necessary because
+ // valarray::operator[]() const return a VALUE!
+ // Try to get the committee to correct that gross error.
+ valarray<size_t>& __t = const_cast<valarray<size_t>&>(__a);
+ return __valarray_product(&__t[0], &__t[0] + __n);
+ }
+
+ // Map a gslice, described by its multidimensional LENGTHS
+ // and corresponding STRIDES, to a linear array of INDEXES
+ // for the purpose of indexing a flat, one-dimensional array
+ // representation of a gslice_array.
+ void
+ __gslice_to_index(size_t __o, const valarray<size_t>& __l,
+ const valarray<size_t>& __s, valarray<size_t>& __i)
+ {
+ // There are as many dimensions as there are strides.
+ const size_t __n = __l.size();
+
+ // Holds current multi-index as we go through the gslice for the
+ // purpose of computing its linear-image.
+ valarray<size_t> __t(__l);
+
+ // Note that this should match the product of all numbers appearing
+ // in __l which describes the multidimensional sizes of the
+ // generalized slice.
+ const size_t __z = __i.size();
+
+ for (size_t __j = 0; __j < __z; ++__j)
+ {
+ // Compute the linear-index image of (t_0, ... t_{n-1}).
+ __i[__j] = __o;
+
+ --__t[__n - 1];
+ __o += __s[__n - 1];
+
+ // Process the next multi-index. The loop ought to be
+ // backward since we're making a lexicographical visit.
+ for (size_t __k2 = __n - 1; __k2 && !__t[__k2]; --__k2)
+ {
+ __o -= __s[__k2] * __l[__k2];
+ __t[__k2] = __l[__k2];
+
+ --__t[__k2 - 1];
+ __o += __s[__k2 - 1];
+ }
+ }
+ }
+
+ 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))
+ { __gslice_to_index(__o, __l, __s, _M_index); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++98/wlocale-inst.cc b/libstdc++-v3/src/c++98/wlocale-inst.cc
new file mode 100644
index 00000000000..cdfed0c3e3f
--- /dev/null
+++ b/libstdc++-v3/src/c++98/wlocale-inst.cc
@@ -0,0 +1,76 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2006, 2009
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+#include <bits/c++config.h>
+
+#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
OpenPOWER on IntegriCloud