This commit was generated by cvs2svn to compensate for changes in r107606,

which included commits to RCS files with non-trunk default branches.
This commit is contained in:
David E. O'Brien 2002-12-04 16:53:59 +00:00
commit 119366edf0
45 changed files with 1259 additions and 492 deletions

View File

@ -1,3 +1,296 @@
2002-11-19 Release Manager
* GCC 3.2.1 Released.
2002-11-19 Release Manager
* GCC 3.2.1 Released.
2002-11-18 Release Manager
* GCC 3.2.1 Released.
2002-11-17 Jakub Jelinek <jakub@redhat.com>
* config/linker-map.gnu: Export _S_construct even if size_t is
unsigned long. Collapse std::codecvt<char>::codecvt(size_t)
and std::codecvt<wchar_t>::codecvt(size_t) into one export pattern.
2002-11-13 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export all _S_construct.
2002-11-06 David Edelsohn <edelsohn@gnu.org>
PR 8362
* testsuite/abi_check.cc: Add guards to prevent -mpower ICE.
2002-11-05 Jonathan Wakely <cow@compsoc.man.ac.uk>
* include/std/std_sstream.h
(basic_stringbuf::str(const __string_type&)):
Prefer data() to c_str() thus avoiding assigning the
unnecessary NULL-terminator.
2002-11-05 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/8258
* include/bits/istream.tcc (istream::readsome): Don't set eofbit
for null buffer.
(istream::operator>>(_CharT*)): Use traits_type.
(istream::ws): Same.
(istream::operator>>(string)): Same.
* testsuite/27_io/istream_unformatted.cc (test11): Add.
2002-11-05 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/7219
* include/bits/ios_base.h (ios_base::streampos): Add.
(ios_base::streamoff): Add.
* testsuite/27_io/ios_base_type.cc: New.
2002-11-05 Paolo Carlini <pcarlini@unitus.it>
PR libstdc++/8466
* include/std/std_sstream.h
(basic_stringbuf::str(const __string_type&)):
Cannot use simple assignment since the COW-nature of v3
basic_string is not taken into account in basic_stringbuf.
* testsuite/27_io/stringstream_members.cc: Add test04 from PR.
2002-11-04 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export string operator+.
Export __default_alloc_template::_S_force_new.
* testsuite/abi_check.cc: Output tweaks.
2002-11-04 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/8172
* src/string-inst.cc: Add instantiation.
2002-11-04 Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>
PR libstdc++/8197
* config/link-map.gnu: Export math stubbs.
2002-11-04 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/8318
* include/std/std_iostream.h: Tweak.
* include/std/std_iosfwd.h: Add _GLIBCPP_USE_WCHAR_T.
* include/std/std_iomanip.h: Same.
* include/bits/stringfwd.h: Same.
* include/bits/basic_string.tcc: Same.
* include/bits/sstream.tcc: Same.
* include/bits/fstream.tcc: Same.
* include/bits/basic_ios.tcc: Same.
* include/bits/streambuf.tcc: Same.
* include/bits/locale_facets.tcc: Same.
2002-11-01 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/8348
* include/bits/istream.tcc (istream::tellg): Remove sentry bits.
(istream::seekg): Same.
* testsuite/27_io/istream_seeks.cc (test06): New.
2002-11-01 John Carter <john.carter@tait.co.nz>
PR libstdc++/7961
* include/bits/basic_string.tcc
(compare(const _CharT* __s)): Don't access __s past its length.
2002-11-01 Hans-Peter Nilsson <hp@bitrange.com>
PR other/3337
PR bootstrap/6763
PR bootstrap/8122
* testsuite/testsuite_hooks.h (__set_testsuite_memlimit): Use
__typeof__ (r.rlim_cur), not rlim_t in declaration of limit.
2002-10-29 Paolo Carlini <pcarlini@unitus.it>
PR libstdc++/8347
* include/bits/basic_string.tcc
(string::_S_construct(_InIter, _InIter, const _Alloc&,
forward_iterator_tag)): Do not throw logic error if
__beg == NULL && __end == __beg.
(string::string(const _CharT*, const _Alloc&)): Tweak.
* testsuite/21_strings/ctor_copy_dtor.cc: Add test05 from PR.
2002-10-23 Jakub Jelinek <jakub@redhat.com>
* testsuite/22_locale/num_put_members_char.cc (test01): Swap size
and decimal_point arguments of find.
* testsuite/22_locale/num_put_members_wchar_t.cc (test01): Likewise.
2002-10-22 Jakub Jelinek <jakub@redhat.com>
* Makefile.am (check-abi, new-abi-baseline): Use @glibcpp_srcdir@
instead of ${top_srcdir}.
* Makefile.in: Rebuilt.
2002-10-21 Phil Edwards <pme@gcc.gnu.org>
* configure.in: Use target, not target_alias, when matching triplet
patterns.
* configure: Regenerate.
2002-10-16 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (__timepunct::__timepunct): Allocate
_M_name_timepunct.
(__timepunct::~__timepunct): Deallocate, remove specialization
declarations.
(messages::messages): Allocate _M_name_messages.
(messages::~messages): Deallocate.
(messages_byname): Same.
* config/locale/gnu/time_members.cc (__timepunct::~__timepunct):
Remove.
* config/locale/generic/time_members.cc (__timepunct::~__timepunct):
Remove.
* docs/html/install.html: Add eqs_MX, en_PH to required locales list.
2002-10-16 Benjamin Kosnik <bkoz@redhat.com>
* src/globals.cc (__gnu_cxx::c_locale_impl_compat): Add, alias to
c_locale_impl.
* testsuite/abi_check.cc (line_to_symbol_info): Collect size info.
* docs/html/abi.txt: Update.
2002-10-16 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/22_locale/static_members.cc (test02): Less provincial.
2002-10-16 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/22_locale/static_members.cc (test02): Disable for
systems without named locale support.
* testsuite/22_locale/ctor_copy_dtor.cc (test04): Don't assume
running the testsuites in "C" environment.
Add new tests.
* docs/html/22_locale/locale.html: Update.
2002-10-16 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/abi_check.cc (hash<string>): Specialize.
Simplify. Check compatible symbol versions.
* config/linker-map.gnu: Clarify, explicitly export
std::codecvt::c* symbols.
* testsuite/22_locale/static_members.cc (test02): Avoid null strings.
2002-10-16 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/22_locale/static_members.cc (test02): Fix.
2002-10-16 Benjamin Kosnik <bkoz@redhat.com>
* acconfig.h (_GLIBCPP_SYMVER): Add.
(_GLIBCPP_ASM_SYMVER): Add.
* acinclude.m4 (GLIBCPP_ENABLE_SYMVERS): Define _GLIBCPP_SYMVER.
* aclocal.m4: Regenerate.
* config.h.in: Regenerate.
* configure: Regenerate.
* include/bits/c++config (_GLIBCPP_AT_AT): Define, as an expedient
hack around m4 issues with quoting '@'.
* src/locale.cc: Use _GLIBCPP_ASM_SYMVER.
* src/globals.cc (__gnu_cxx): Same.
* testsuite/22_locale/ctor_copy_dtor.cc (test04): Fix for
2002-10-16 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu (GLIBCPP_3.2.1): Add.
(GLIBCPP_3.2): Don't export locale::_S_*.
* src/ios.cc: Move globals into __gnu_cxx. Make old exported
symbols match.
* src/locale.cc: Same.
* src/localename.cc: Same.
2002-10-16 Benjamin Kosnik <bkoz@redhat.com>
* src/locale.cc: Fix comments, move ctors together.
* testsuite/22_locale/static_members.cc (test03): Add.
2002-10-16 Paolo Carlini <pcarlini@unitus.it>
Benjamin Kosnik <bkoz@redhat.com>
* include/bits/localefwd.h (class locale): Add static member
_S_num_extra_categories, encoding the number of additional
categories.
Change _S_num_categories to _S_categories_size.
(class locale::_Impl): Add _M_c_cats.
(class locale::_Impl::_M_names): Change to array of chars.
(class locale::_Impl::_M_check_same_name): Use
_S_extra_categories_size, tweak.
(locale::locale(const locale&, _Facet*)): Ditto.
* src/locale.cc (locale::locale(const char* )): Rewrite to deal
with the environment in a POSIX-compliant way while being thread
safe.
(locale::name()): Update to output POSIX environment strings.
* src/localename.cc
(locale::_Impl::_Impl(const _Impl&, size_t): Use
_S_categories_size_*, tweak.
(locale::_Impl::_Impl(facet**, size_t, bool)): Ditto.
(locale::_Impl::_Impl(const char*, size_t)): Name each category
individually.
(locale::_Impl::_M_replace_categories): Use strcpy.
* include/bits/locale_facets.h (numpunct::_M_initialize_numpunct):
Change default argument to NULL from _S_c_locale.
(timepunct::_M_initialize_timepunct): Same.
_S_c_locale cleanups.
* src/codecvt.c: _S_c_locale simplification.
* src/ctype.c: Same.
* src/globals.cc: Add fake_name.
* src/locale-inst.cc: Remove extra includes.
* src/locale.cc: Remove extra includes.
Add _S_extra_categories_size definition.
Correct "C" initialization.
(locale::facet::facet): Don't initialize _S_c_locale.
(locale::facet::_M_remove_reference): Adjust.
* src/localename: Use facet_vec, facet_name.
(locale::_Impl::_Impl(facet** __f, size_t __refs, bool)): Set
facet ref counts to one. Initialize _S_c_locale.
(locale::_Impl::_M_install_facet(id*, facet*)): Adjust facet ref
counts when installing unilaterally.
* config/locale/generic/c_locale.cc: Add _S_categories definition.
* config/locale/generic/c_locale.h: Add _GLIBCPP_NUM_CATEGORIES macro.
* config/locale/generic/time_members.cc: _S_c_locale cleanup.
* config/locale/gnu/c_locale.cc: Add _S_categories definition.
(_S_destroy_c_locale): Move checks against _S_c_locale here.
* config/locale/gnu/c_locale.h: Add _GLIBCPP_NUM_CATEGORIES macro.
* config/locale/gnu/ctype_members.cc: Simplify _S_destroy_c_locale
calls, _S_c_locale usage.
* config/locale/gnu/monetary_members.cc: Same, tweaks.
* config/locale/gnu/monetary_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Use locale::classic().
* docs/html/22_locale/locale.html: Add bits about global locales
and "C" setlocale.
* testsuite/22_locale/facet.cc (test02): Add.
* testsuite/22_locale/static_members.cc (test02): Add.
* testsuite/22_locale/ctor_copy_dtor.cc (test04): Add.
2002-10-11 Gabriel Dos Reis <gdr@integrable-solutions.net>
* include/std/std_limits.h (__glibcpp_char_digits10): Fix Typo.
(__glibcpp_char_digits10): Likewise.
2002-10-10 Jonathan Lennox <lennox@cs.columbia.edu>
PR libstdc++/8071, libstdc++/8127, c++/6745
* streambuf.tcc (__copy_streambufs): Handle cases where
__sbin->in_avail() returns 0, or where __sbin doesn't set gptr().
* testsuite/27_io/ostream_inserter_other.cc (test05): Add.
2002-10-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2002-10-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.am (all-multi): Fix multilib parallel build. * Makefile.am (all-multi): Fix multilib parallel build.

View File

@ -49,7 +49,7 @@ check-script-install: $(top_builddir)/mkcheck
baseline_file = @baseline_file@ baseline_file = @baseline_file@
check-abi: $(top_builddir)/testsuite/abi_check check-abi: $(top_builddir)/testsuite/abi_check
-@(cd testsuite; \ -@(cd testsuite; \
${top_srcdir}/config/abi/extract_symvers \ @glibcpp_srcdir@/config/abi/extract_symvers \
../src/.libs/libstdc++.so \ ../src/.libs/libstdc++.so \
./current_symbols.txt; \ ./current_symbols.txt; \
./abi_check --check ./current_symbols.txt ${baseline_file}) ./abi_check --check ./current_symbols.txt ${baseline_file})
@ -61,7 +61,7 @@ new-abi-baseline:
t=`echo $${output} | sed 's=.*config/abi/=='`; \ t=`echo $${output} | sed 's=.*config/abi/=='`; \
echo "Baseline file already exists, writing to $${t} instead."; \ echo "Baseline file already exists, writing to $${t} instead."; \
fi; \ fi; \
${top_srcdir}/config/abi/extract_symvers \ @glibcpp_srcdir@/config/abi/extract_symvers \
src/.libs/libstdc++.so $${output}) src/.libs/libstdc++.so $${output})
# These rules are messy, but are hella worth it. # These rules are messy, but are hella worth it.

View File

@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am # Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
@ -157,7 +157,44 @@ MULTICLEAN = true
# Work around what appears to be a GNU make bug handling MAKEFLAGS # Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and # values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile. # friends when we are called from the top level Makefile.
AM_MAKEFLAGS = "AR_FLAGS=$(AR_FLAGS)" "CC_FOR_BUILD=$(CC_FOR_BUILD)" "CC_FOR_TARGET=$(CC_FOR_TARGET)" "CFLAGS=$(CFLAGS)" "CXXFLAGS=$(CXXFLAGS)" "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" "INSTALL=$(INSTALL)" "INSTALL_DATA=$(INSTALL_DATA)" "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" "LDFLAGS=$(LDFLAGS)" "LIBCFLAGS=$(LIBCFLAGS)" "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" "MAKE=$(MAKE)" "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" "PICFLAG=$(PICFLAG)" "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" "SHELL=$(SHELL)" "RUNTESTFLAGS=$(RUNTESTFLAGS)" "exec_prefix=$(exec_prefix)" "infodir=$(infodir)" "libdir=$(libdir)" "includedir=$(includedir)" "prefix=$(prefix)" "tooldir=$(tooldir)" "AR=$(AR)" "AS=$(AS)" "LD=$(LD)" "LIBCFLAGS=$(LIBCFLAGS)" "PICFLAG=$(PICFLAG)" "RANLIB=$(RANLIB)" "NM=$(NM)" "NM_FOR_BUILD=$(NM_FOR_BUILD)" "NM_FOR_TARGET=$(NM_FOR_TARGET)" "DESTDIR=$(DESTDIR)" "WERROR=$(WERROR)" AM_MAKEFLAGS = \
"AR_FLAGS=$(AR_FLAGS)" \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CC_FOR_TARGET=$(CC_FOR_TARGET)" \
"CFLAGS=$(CFLAGS)" \
"CXXFLAGS=$(CXXFLAGS)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
"INSTALL=$(INSTALL)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
"MAKE=$(MAKE)" \
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
"SHELL=$(SHELL)" \
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
"exec_prefix=$(exec_prefix)" \
"infodir=$(infodir)" \
"libdir=$(libdir)" \
"includedir=$(includedir)" \
"prefix=$(prefix)" \
"tooldir=$(tooldir)" \
"AR=$(AR)" \
"AS=$(AS)" \
"LD=$(LD)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"RANLIB=$(RANLIB)" \
"NM=$(NM)" \
"NM_FOR_BUILD=$(NM_FOR_BUILD)" \
"NM_FOR_TARGET=$(NM_FOR_TARGET)" \
"DESTDIR=$(DESTDIR)" \
"WERROR=$(WERROR)"
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
CONFIG_HEADER = config.h CONFIG_HEADER = config.h
@ -169,7 +206,7 @@ mkcheck.in testsuite_flags.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar TAR = gtar
GZIP_ENV = --best GZIP_ENV = --best
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
@ -446,7 +483,7 @@ check-script-install: $(top_builddir)/mkcheck
@glibcpp_builddir@/mkcheck 1) @glibcpp_builddir@/mkcheck 1)
check-abi: $(top_builddir)/testsuite/abi_check check-abi: $(top_builddir)/testsuite/abi_check
-@(cd testsuite; \ -@(cd testsuite; \
${top_srcdir}/config/abi/extract_symvers \ @glibcpp_srcdir@/config/abi/extract_symvers \
../src/.libs/libstdc++.so \ ../src/.libs/libstdc++.so \
./current_symbols.txt; \ ./current_symbols.txt; \
./abi_check --check ./current_symbols.txt ${baseline_file}) ./abi_check --check ./current_symbols.txt ${baseline_file})
@ -458,7 +495,7 @@ new-abi-baseline:
t=`echo $${output} | sed 's=.*config/abi/=='`; \ t=`echo $${output} | sed 's=.*config/abi/=='`; \
echo "Baseline file already exists, writing to $${t} instead."; \ echo "Baseline file already exists, writing to $${t} instead."; \
fi; \ fi; \
${top_srcdir}/config/abi/extract_symvers \ @glibcpp_srcdir@/config/abi/extract_symvers \
src/.libs/libstdc++.so $${output}) src/.libs/libstdc++.so $${output})
# These rules are messy, but are hella worth it. # These rules are messy, but are hella worth it.

View File

@ -46,6 +46,20 @@
// Define if you have the copysignf function. // Define if you have the copysignf function.
#undef _GLIBCPP_HAVE_COPYSIGNF #undef _GLIBCPP_HAVE_COPYSIGNF
// Define to use symbol versioning in the shared library.
#undef _GLIBCPP_SYMVER
// Define symbol versioning in assember directives. If symbol
// versioning is beigng used, and the assembler supports this kind of
// thing, then use it.
// NB: _GLIBCPP_AT_AT is a hack to work around quoting issues in m4.
#if _GLIBCPP_SYMVER
#define _GLIBCPP_ASM_SYMVER(cur, old, version) \
asm (".symver " #cur "," #old _GLIBCPP_AT_AT #version);
#else
#define _GLIBCPP_ASM_SYMVER(cur, old, version)
#endif
// Define if mbstate_t exists in wchar.h. // Define if mbstate_t exists in wchar.h.
#undef HAVE_MBSTATE_T #undef HAVE_MBSTATE_T

View File

@ -2201,6 +2201,7 @@ case $enable_symvers in
;; ;;
gnu) gnu)
LINKER_MAP=config/linker-map.gnu LINKER_MAP=config/linker-map.gnu
AC_DEFINE(_GLIBCPP_SYMVER)
;; ;;
esac esac

View File

@ -2213,6 +2213,7 @@ case $enable_symvers in
;; ;;
gnu) gnu)
LINKER_MAP=config/linker-map.gnu LINKER_MAP=config/linker-map.gnu
AC_DEFINE(_GLIBCPP_SYMVER)
;; ;;
esac esac

View File

@ -24,6 +24,20 @@
// Define to use concept checking code from the boost libraries. // Define to use concept checking code from the boost libraries.
#undef _GLIBCPP_CONCEPT_CHECKS #undef _GLIBCPP_CONCEPT_CHECKS
// Define to use symbol versioning in the shared library.
#undef _GLIBCPP_SYMVER
// Define symbol versioning in assember directives. If symbol
// versioning is beigng used, and the assembler supports this kind of
// thing, then use it.
// NB: _GLIBCPP_AT_AT is a hack to work around quoting issues in m4.
#if _GLIBCPP_SYMVER
#define _GLIBCPP_ASM_SYMVER(cur, old, version) \
asm (".symver " #cur "," #old _GLIBCPP_AT_AT #version);
#else
#define _GLIBCPP_ASM_SYMVER(cur, old, version)
#endif
// Define if mbstate_t exists in wchar.h. // Define if mbstate_t exists in wchar.h.
#undef HAVE_MBSTATE_T #undef HAVE_MBSTATE_T

View File

@ -20,7 +20,6 @@
## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
## USA. ## USA.
GLIBCPP_3.2 { GLIBCPP_3.2 {
global: global:
@ -29,21 +28,120 @@ GLIBCPP_3.2 {
# All but the last are terminated with a semicolon. # All but the last are terminated with a semicolon.
extern "C++" extern "C++"
{ {
std::[A-Za-z]*; std::[A-Za]*;
std::ba[a-r]*;
std::basic_[a-r]*;
std::basic_streambuf*;
std::basic_stringbuf*;
std::basic_stringstream*;
std::basic_[t-z]*;
std::ba[t-z]*;
std::b[b-z]*;
std::c[a-n]*;
std::co[a-c]*;
std::codecvt_byname*;
std::codecvt::[A-Za-b]*;
std::codecvt::[A-Zd-z]*;
std::codecvt_c;
std::codecvt_w;
std::co[e-z]*;
std::c[p-z]*;
std::c_[a-z]*;
std::[A-Zd-k]*;
std::length_error*;
std::logic_error*;
std::locale::[A-Za-z]*;
std::locale::_[A-Ra-z]*;
std::locale::_S_classic;
std::locale::_S_global;
std::locale::_S_num_categories;
std::locale::_S_normalize_category*;
std::locale::_[T-Za-z]*;
std::[A-Zm-z]*;
std::__throw_*; std::__throw_*;
std::__basic_file*; std::__basic_file*;
std::__num_base*; std::__num_base*;
std::__timepunct*; std::__timepunct*;
std::__numeric_limits_base*; std::__numeric_limits_base*;
std::_S_bit_count; std::_S_bit_count;
std::_S_first_one; std::_S_first_one
std::__default_alloc_template*;
std::__malloc_alloc_template*
}; };
# Names not in an 'extern' block are mangled names. # Names not in an 'extern' block are mangled names.
# std::string minus binary operator plus
_ZNKSs*;
_ZNKSb*;
_ZNSs[A-Za-z]*;
_ZNSs[0-9][A-Za-z]*;
_ZNSs[0-9][0-9][A-Za-z]*;
_ZNSs[0-9]_[A-Ra-z]*;
_ZNSs[0-9][0-9]_[A-Ra-z]*;
_ZNSs12_S_empty_repEv;
_ZNSs20_S_empty_rep_storageE;
_ZNSbIwSt11char_traitsIwESaIwEE20_S_empty_rep_storageE;
_ZNSs12_S_constructE*;
_ZNSs13_S_copy_charsE*;
_ZNSbIwSt11char_traitsIwESaIwEE[A-Ra-z]*;
_ZNSbIwSt11char_traitsIwESaIwEE[0-9][A-Ra-z]*;
_ZNSbIwSt11char_traitsIwESaIwEE[0-9][0-9][A-Ra-z]*;
_ZNSbIwSt11char_traitsIwESaIwEE[0-9]_[A-Ra-z]*;
_ZNSbIwSt11char_traitsIwESaIwEE[0-9][0-9]_[A-Ra-z]*;
_ZNSbIwSt11char_traitsIwESaIwEE13_S_copy_chars*;
_ZNSbIwSt11char_traitsIwESaIwEE12_S_constructE[jm]wRKS1_;
_ZNSbIwSt11char_traitsIwESaIwEE12_S_empty_repEv;
_ZSt24__uninitialized_copy_auxIN9*;
_ZSt26__uninitialized_fill_n_aux*;
_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EPKS3_RKS6_;
_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_ES3_RKS6_;
_ZStplIwSt11char_traitsIwESaIwEESbIT_T0_T1_EPKS3_RKS6_;
_ZStplIwSt11char_traitsIwESaIwEESbIT_T0_T1_ES3_RKS6_;
# std::locale destructors
_ZNSt6localeD*;
# std::codecvt<char> members.
_ZNKSt7codecvtIcc11__mbstate_tE*;
# std::codecvt<char>::~codecvt
_ZNSt7codecvtIcc11__mbstate_tED*;
# std::codecvt<char>::codecvt(size_t), where size_t variable.
_ZNSt7codecvtIcc11__mbstate_tEC[12]E[jm];
# std::codecvt<char>::id
_ZNSt7codecvtIcc11__mbstate_tE2idE;
# std::codecvt<wchar_t> members.
_ZNKSt7codecvtIwc11__mbstate_tE*;
# std::codecvt<wchar_t>::~codecvt
_ZNSt7codecvtIwc11__mbstate_tED*;
# std::codecvt<wchar_t>::codecvt(size_t), where size_t variable.
_ZNSt7codecvtIwc11__mbstate_tEC[12]E[jm];
# std::codecvt<wchar_t>::id
_ZNSt7codecvtIwc11__mbstate_tE2idE;
# std::use_facet<codecvt>
_ZSt9use_facetISt7codecvtIcc11__mbstate_tEERKT_RKSt6locale;
_ZSt9use_facetISt7codecvtIwc11__mbstate_tEERKT_RKSt6locale;
# std::has_facet*
_ZSt9has_facet*; _ZSt9has_facet*;
# std::__default_alloc_template
_ZNSt24__default_alloc_templateILb1ELi0EE10deallocate*;
_ZNSt24__default_alloc_templateILb1ELi0EE8allocate*;
_ZNSt24__default_alloc_templateILb1ELi0EE12_S_free_listE;
_ZNSt24__default_alloc_templateILb1ELi0EE22_S_node_allocator_lockE;
_ZNSt24__default_alloc_templateILb1ELi0EE9_S_refillE*;
# std::__default_alloc_template to be removed in the future
_ZNSt24__default_alloc_templateILb1ELi0EE10reallocateEPv*;
_ZNSt24__default_alloc_templateILb1ELi0EE11_S_round_upE*;
_ZNSt24__default_alloc_templateILb1ELi0EE14_S_chunk_allocE*;
_ZNSt24__default_alloc_templateILb1ELi0EE17_S_freelist_indexE*;
_ZNSt24__default_alloc_templateILb1ELi0EE11_S_end_freeE;
_ZNSt24__default_alloc_templateILb1ELi0EE12_S_heap_sizeE;
_ZNSt24__default_alloc_templateILb1ELi0EE13_S_start_freeE;
_ZNSt24__default_alloc_templateILb1ELi0EE5_Lock*;
# operator new(unsigned) # operator new(unsigned)
_Znwj; _Znwj;
# operator new(unsigned, std::nothrow_t const&) # operator new(unsigned, std::nothrow_t const&)
@ -72,8 +170,8 @@ GLIBCPP_3.2 {
# operator delete[](void*, std::nothrow_t const&) # operator delete[](void*, std::nothrow_t const&)
_ZdaPvRKSt9nothrow_t; _ZdaPvRKSt9nothrow_t;
# vtable # vtable
_ZTV*; _ZTV*;
_ZTT*; _ZTT*;
# typeinfo # typeinfo
@ -95,6 +193,54 @@ GLIBCPP_3.2 {
*; *;
}; };
# Symbols added after GLIBCPP_3.2
GLIBCPP_3.2.1 {
_ZNSt7codecvtIcc11__mbstate_tEC1EP15__locale_structj;
_ZNSt7codecvtIcc11__mbstate_tEC2EP15__locale_structj;
_ZNSt7codecvtIwc11__mbstate_tEC1EP15__locale_structj;
_ZNSt7codecvtIwc11__mbstate_tEC2EP15__locale_structj;
_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_ERKS6_S8_;
_ZStplIwSt11char_traitsIwESaIwEESbIT_T0_T1_ERKS6_S8_;
_ZNSt24__default_alloc_templateILb1ELi0EE12_S_force_newE;
# stub functions from libmath
sinf;
sinl;
sinhf;
sinhl;
cosf;
cosl;
coshf;
coshl;
tanf;
tanl;
tanhf;
tanhl;
atan2f;
atan2l;
expf;
expl;
hypotf;
hypotl;
hypot;
logf;
logl;
log10f;
log10l;
powf;
powl;
sqrtf;
sqrtl;
copysignf;
nan;
__signbit;
__signbitf;
__signbitl;
} GLIBCPP_3.2;
# Symbols in the support library (libsupc++) have their own tag. # Symbols in the support library (libsupc++) have their own tag.
CXXABI_1.2 { CXXABI_1.2 {

View File

@ -223,4 +223,15 @@ namespace std
__c_locale __c_locale
locale::facet::_S_clone_c_locale(__c_locale&) locale::facet::_S_clone_c_locale(__c_locale&)
{ return __c_locale(); } { return __c_locale(); }
const char* locale::_S_categories[_S_categories_size
+ _S_extra_categories_size] =
{
"LC_CTYPE",
"LC_NUMERIC",
"LC_COLLATE",
"LC_TIME",
"LC_MONETARY",
"LC_MESSAGES"
};
} // namespace std } // namespace std

View File

@ -35,6 +35,8 @@
#include <clocale> #include <clocale>
#define _GLIBCPP_NUM_CATEGORIES 0
namespace std namespace std
{ {
typedef int* __c_locale; typedef int* __c_locale;

View File

@ -38,13 +38,6 @@
namespace std namespace std
{ {
template<>
__timepunct<char>::~__timepunct()
{
if (_M_c_locale_timepunct != _S_c_locale)
_S_destroy_c_locale(_M_c_locale_timepunct);
}
template<> template<>
void void
__timepunct<char>:: __timepunct<char>::
@ -121,13 +114,6 @@ namespace std
} }
#ifdef _GLIBCPP_USE_WCHAR_T #ifdef _GLIBCPP_USE_WCHAR_T
template<>
__timepunct<wchar_t>::~__timepunct()
{
if (_M_c_locale_timepunct != _S_c_locale)
_S_destroy_c_locale(_M_c_locale_timepunct);
}
template<> template<>
void void
__timepunct<wchar_t>:: __timepunct<wchar_t>::

View File

@ -178,9 +178,29 @@ namespace std
void void
locale::facet::_S_destroy_c_locale(__c_locale& __cloc) locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
{ __freelocale(__cloc); } {
if (_S_c_locale != __cloc)
__freelocale(__cloc);
}
__c_locale __c_locale
locale::facet::_S_clone_c_locale(__c_locale& __cloc) locale::facet::_S_clone_c_locale(__c_locale& __cloc)
{ return __duplocale(__cloc); } { return __duplocale(__cloc); }
const char* locale::_S_categories[_S_categories_size
+ _S_extra_categories_size] =
{
"LC_CTYPE",
"LC_NUMERIC",
"LC_COLLATE",
"LC_TIME",
"LC_MONETARY",
"LC_MESSAGES",
"LC_PAPER",
"LC_NAME",
"LC_ADDRESS",
"LC_TELEPHONE",
"LC_MEASUREMENT",
"LC_IDENTIFICATION"
};
} // namespace std } // namespace std

View File

@ -40,6 +40,8 @@
#define _GLIBCPP_C_LOCALE_GNU 1 #define _GLIBCPP_C_LOCALE_GNU 1
#define _GLIBCPP_NUM_CATEGORIES 6
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
namespace __gnu_cxx namespace __gnu_cxx
{ {

View File

@ -44,8 +44,7 @@ namespace std
ctype_byname<char>::ctype_byname(const char* __s, size_t __refs) ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
: ctype<char>(0, false, __refs) : ctype<char>(0, false, __refs)
{ {
if (_M_c_locale_ctype != _S_c_locale) _S_destroy_c_locale(_M_c_locale_ctype);
_S_destroy_c_locale(_M_c_locale_ctype);
_S_create_c_locale(_M_c_locale_ctype, __s); _S_create_c_locale(_M_c_locale_ctype, __s);
_M_toupper = _M_c_locale_ctype->__ctype_toupper; _M_toupper = _M_c_locale_ctype->__ctype_toupper;
_M_tolower = _M_c_locale_ctype->__ctype_tolower; _M_tolower = _M_c_locale_ctype->__ctype_tolower;

View File

@ -220,7 +220,7 @@ namespace std
moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc, moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
const char*) const char*)
{ {
if (__cloc == _S_c_locale) if (!__cloc)
{ {
// "C" locale // "C" locale
_M_decimal_point = '.'; _M_decimal_point = '.';
@ -265,7 +265,7 @@ namespace std
moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc, moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
const char*) const char*)
{ {
if (__cloc == _S_c_locale) if (!__cloc)
{ {
// "C" locale // "C" locale
_M_decimal_point = '.'; _M_decimal_point = '.';
@ -319,7 +319,7 @@ namespace std
moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc, moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
const char* __name) const char* __name)
{ {
if (__cloc == _S_c_locale) if (!__cloc)
{ {
// "C" locale // "C" locale
_M_decimal_point = L'.'; _M_decimal_point = L'.';
@ -348,14 +348,12 @@ namespace std
_M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w); _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w);
_M_grouping = __nl_langinfo_l(GROUPING, __cloc); _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
mbstate_t __state;
size_t __len;
const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
// NB: Should swich to __cloc's ctype info first. mbstate_t __state;
__len = strlen(__cpossign); size_t __len = strlen(__cpossign);
if (__len) if (__len)
{ {
++__len; ++__len;
@ -418,7 +416,7 @@ namespace std
moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc, moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
const char* __name) const char* __name)
{ {
if (__cloc == _S_c_locale) if (!__cloc)
{ {
// "C" locale // "C" locale
_M_decimal_point = L'.'; _M_decimal_point = L'.';
@ -446,13 +444,12 @@ namespace std
_M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w); _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w);
_M_grouping = __nl_langinfo_l(GROUPING, __cloc); _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
mbstate_t __state;
size_t __len;
const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
// NB: Should swich to __cloc's ctype info first. mbstate_t __state;
size_t __len;
__len = strlen(__cpossign); __len = strlen(__cpossign);
if (__len) if (__len)
{ {

View File

@ -42,7 +42,7 @@ namespace std
void void
numpunct<char>::_M_initialize_numpunct(__c_locale __cloc) numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
{ {
if (__cloc == _S_c_locale) if (!__cloc)
{ {
// "C" locale // "C" locale
_M_decimal_point = '.'; _M_decimal_point = '.';
@ -76,7 +76,7 @@ namespace std
void void
numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc) numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
{ {
if (__cloc == _S_c_locale) if (!__cloc)
{ {
// "C" locale // "C" locale
_M_decimal_point = L'.'; _M_decimal_point = L'.';

View File

@ -39,13 +39,6 @@
namespace std namespace std
{ {
template<>
__timepunct<char>::~__timepunct()
{
if (_M_c_locale_timepunct != _S_c_locale)
_S_destroy_c_locale(_M_c_locale_timepunct);
}
template<> template<>
void void
__timepunct<char>:: __timepunct<char>::
@ -67,11 +60,10 @@ namespace std
void void
__timepunct<char>::_M_initialize_timepunct(__c_locale __cloc) __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
{ {
if (__cloc == _S_c_locale) if (!__cloc)
{ {
// "C" locale // "C" locale
_M_c_locale_timepunct = _S_c_locale;
_M_c_locale_timepunct = _S_c_locale;
_M_date_format = "%m/%d/%y"; _M_date_format = "%m/%d/%y";
_M_date_era_format = "%m/%d/%y"; _M_date_era_format = "%m/%d/%y";
@ -192,13 +184,6 @@ namespace std
} }
#ifdef _GLIBCPP_USE_WCHAR_T #ifdef _GLIBCPP_USE_WCHAR_T
template<>
__timepunct<wchar_t>::~__timepunct()
{
if (_M_c_locale_timepunct != _S_c_locale)
_S_destroy_c_locale(_M_c_locale_timepunct);
}
template<> template<>
void void
__timepunct<wchar_t>:: __timepunct<wchar_t>::
@ -220,11 +205,10 @@ namespace std
void void
__timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc) __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
{ {
if (__cloc == _S_c_locale) if (!__cloc)
{ {
// "C" locale // "C" locale
_M_c_locale_timepunct = _S_c_locale;
_M_c_locale_timepunct = _S_c_locale;
_M_date_format = L"%m/%d/%y"; _M_date_format = L"%m/%d/%y";
_M_date_era_format = L"%m/%d/%y"; _M_date_era_format = L"%m/%d/%y";

View File

@ -38,8 +38,7 @@
const ctype_base::mask* const ctype_base::mask*
ctype<char>::classic_table() throw() ctype<char>::classic_table() throw()
{ {
if (!_S_c_locale) locale::classic();
_S_create_c_locale(_S_c_locale, "C");
return _S_c_locale->__ctype_b; return _S_c_locale->__ctype_b;
} }
#else #else
@ -96,7 +95,7 @@
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) :
__ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del) __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del)
{ {
_M_c_locale_ctype = _S_c_locale; _M_c_locale_ctype = _S_c_locale;
_M_toupper = _M_c_locale_ctype->__ctype_toupper; _M_toupper = _M_c_locale_ctype->__ctype_toupper;
_M_tolower = _M_c_locale_ctype->__ctype_tolower; _M_tolower = _M_c_locale_ctype->__ctype_tolower;
_M_table = __table ? __table : _M_c_locale_ctype->__ctype_b; _M_table = __table ? __table : _M_c_locale_ctype->__ctype_b;

View File

@ -830,7 +830,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes
for ac_prog in gawk mawk nawk awk for ac_prog in mawk gawk nawk awk
do do
# Extract the first word of "$ac_prog", so it can be a program name with args. # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2 set dummy $ac_prog; ac_word=$2
@ -1458,7 +1458,7 @@ else
if { (eval echo configure:1459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then if { (eval echo configure:1459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do for file in conftest.*; do
case $file in case $file in
*.c | *.o | *.obj) ;; *.$ac_ext | *.c | *.o | *.obj) ;;
*) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
esac esac
done done
@ -4080,7 +4080,7 @@ if test -n "$with_cross_host" || test x"$build" != x"$host"; then
# GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT # GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
# GLIBCPP_CHECK_MATH_SUPPORT # GLIBCPP_CHECK_MATH_SUPPORT
case "$target_alias" in case "$target" in
*-linux*) *-linux*)
# Check for available headers. # Check for available headers.
for ac_hdr in nan.h ieeefp.h endian.h sys/isa_defs.h \ for ac_hdr in nan.h ieeefp.h endian.h sys/isa_defs.h \
@ -8752,7 +8752,7 @@ EOF
;; ;;
esac esac
case "$target_alias" in case "$target" in
*-mingw32*) *-mingw32*)
;; ;;
*) *)
@ -21325,7 +21325,7 @@ else
fi fi
rm -f conftest* rm -f conftest*
for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h for ac_hdr in unistd.h
do do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@ -21457,24 +21457,11 @@ else
#include <fcntl.h> #include <fcntl.h>
#include <sys/mman.h> #include <sys/mman.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_STDLIB_H
# include <stdlib.h>
#endif
#if HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
/* This mess was copied from the GNU getpagesize.h. */ /* This mess was copied from the GNU getpagesize.h. */
#ifndef HAVE_GETPAGESIZE #ifndef HAVE_GETPAGESIZE
# ifdef HAVE_UNISTD_H
# include <unistd.h>
# endif
/* Assume that all systems that can run configure have sys/param.h. */ /* Assume that all systems that can run configure have sys/param.h. */
# ifndef HAVE_SYS_PARAM_H # ifndef HAVE_SYS_PARAM_H
@ -21582,7 +21569,7 @@ main()
} }
EOF EOF
if { (eval echo configure:21586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:21573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then then
ac_cv_func_mmap_fixed_mapped=yes ac_cv_func_mmap_fixed_mapped=yes
else else
@ -21613,17 +21600,17 @@ fi
do do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:21617: checking for $ac_hdr" >&5 echo "configure:21604: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 21622 "configure" #line 21609 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <$ac_hdr> #include <$ac_hdr>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:21627: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:21614: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
@ -21656,7 +21643,7 @@ done
# Can't do these in a loop, else the resulting syntax is wrong. # Can't do these in a loop, else the resulting syntax is wrong.
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 21660 "configure" #line 21647 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/resource.h> #include <sys/resource.h>
#include <unistd.h> #include <unistd.h>
@ -21665,7 +21652,7 @@ int main() {
int f = RLIMIT_DATA ; int f = RLIMIT_DATA ;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:21669: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:21656: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
glibcpp_mresult=1 glibcpp_mresult=1
else else
@ -21682,7 +21669,7 @@ EOF
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 21686 "configure" #line 21673 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/resource.h> #include <sys/resource.h>
#include <unistd.h> #include <unistd.h>
@ -21691,7 +21678,7 @@ int main() {
int f = RLIMIT_RSS ; int f = RLIMIT_RSS ;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:21695: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:21682: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
glibcpp_mresult=1 glibcpp_mresult=1
else else
@ -21708,7 +21695,7 @@ EOF
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 21712 "configure" #line 21699 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/resource.h> #include <sys/resource.h>
#include <unistd.h> #include <unistd.h>
@ -21717,7 +21704,7 @@ int main() {
int f = RLIMIT_VMEM ; int f = RLIMIT_VMEM ;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:21721: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:21708: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
glibcpp_mresult=1 glibcpp_mresult=1
else else
@ -21734,7 +21721,7 @@ EOF
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 21738 "configure" #line 21725 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/resource.h> #include <sys/resource.h>
#include <unistd.h> #include <unistd.h>
@ -21743,7 +21730,7 @@ int main() {
int f = RLIMIT_AS ; int f = RLIMIT_AS ;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:21747: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:21734: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
glibcpp_mresult=1 glibcpp_mresult=1
else else
@ -21765,7 +21752,7 @@ EOF
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 21769 "configure" #line 21756 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/resource.h> #include <sys/resource.h>
#include <unistd.h> #include <unistd.h>
@ -21774,7 +21761,7 @@ int main() {
struct rlimit r; setrlimit(0, &r); struct rlimit r; setrlimit(0, &r);
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:21778: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:21765: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
ac_setrlimit=yes ac_setrlimit=yes
else else
@ -21790,7 +21777,7 @@ fi
fi fi
echo $ac_n "checking for testsuite memory limit support""... $ac_c" 1>&6 echo $ac_n "checking for testsuite memory limit support""... $ac_c" 1>&6
echo "configure:21794: checking for testsuite memory limit support" >&5 echo "configure:21781: checking for testsuite memory limit support" >&5
if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then
ac_mem_limits=yes ac_mem_limits=yes
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
@ -21806,7 +21793,7 @@ EOF
# Look for setenv, so that extended locale tests can be performed. # Look for setenv, so that extended locale tests can be performed.
echo $ac_n "checking for setenv declaration""... $ac_c" 1>&6 echo $ac_n "checking for setenv declaration""... $ac_c" 1>&6
echo "configure:21810: checking for setenv declaration" >&5 echo "configure:21797: checking for setenv declaration" >&5
if test x${glibcpp_cv_func_setenv_use+set} != xset; then if test x${glibcpp_cv_func_setenv_use+set} != xset; then
if eval "test \"`echo '$''{'glibcpp_cv_func_setenv_use'+set}'`\" = set"; then if eval "test \"`echo '$''{'glibcpp_cv_func_setenv_use'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -21821,14 +21808,14 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 21825 "configure" #line 21812 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdlib.h> #include <stdlib.h>
int main() { int main() {
setenv(0, 0, 0); setenv(0, 0, 0);
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:21832: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:21819: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
glibcpp_cv_func_setenv_use=yes glibcpp_cv_func_setenv_use=yes
else else
@ -21854,12 +21841,12 @@ fi
for ac_func in setenv for ac_func in setenv
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:21858: checking for $ac_func" >&5 echo "configure:21845: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 21863 "configure" #line 21850 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */ which can conflict with char $ac_func(); below. */
@ -21882,7 +21869,7 @@ $ac_func();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:21886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:21873: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_$ac_func=yes" eval "ac_cv_func_$ac_func=yes"
else else
@ -21952,18 +21939,18 @@ fi
# Check to see if libgcc_s exists, indicating that shared libgcc is possible. # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
echo $ac_n "checking for shared libgcc""... $ac_c" 1>&6 echo $ac_n "checking for shared libgcc""... $ac_c" 1>&6
echo "configure:21956: checking for shared libgcc" >&5 echo "configure:21943: checking for shared libgcc" >&5
ac_save_CFLAGS="$CFLAGS" ac_save_CFLAGS="$CFLAGS"
CFLAGS=' -lgcc_s' CFLAGS=' -lgcc_s'
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 21960 "configure" #line 21947 "configure"
#include "confdefs.h" #include "confdefs.h"
int main() { int main() {
return 0 return 0
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:21967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:21954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
glibcpp_shared_libgcc=yes glibcpp_shared_libgcc=yes
else else
@ -21997,14 +21984,14 @@ if test $enable_symvers = yes ; then
echo 'FOO { global: f[a-z]o; local: *; };' > conftest.map echo 'FOO { global: f[a-z]o; local: *; };' > conftest.map
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 22001 "configure" #line 21988 "configure"
#include "confdefs.h" #include "confdefs.h"
int foo; int foo;
int main() { int main() {
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:22008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:21995: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
enable_symvers=gnu enable_symvers=gnu
else else
@ -22032,6 +22019,10 @@ case $enable_symvers in
;; ;;
gnu) gnu)
LINKER_MAP=config/linker-map.gnu LINKER_MAP=config/linker-map.gnu
cat >> confdefs.h <<\EOF
#define _GLIBCPP_SYMVER 1
EOF
;; ;;
esac esac
@ -22046,7 +22037,7 @@ else
GLIBCPP_BUILD_VERSIONED_SHLIB_FALSE= GLIBCPP_BUILD_VERSIONED_SHLIB_FALSE=
fi fi
echo $ac_n "checking versioning on shared library symbols""... $ac_c" 1>&6 echo $ac_n "checking versioning on shared library symbols""... $ac_c" 1>&6
echo "configure:22050: checking versioning on shared library symbols" >&5 echo "configure:22041: checking versioning on shared library symbols" >&5
echo "$ac_t""$enable_symvers" 1>&6 echo "$ac_t""$enable_symvers" 1>&6
@ -22134,7 +22125,7 @@ glibcpp_prefixdir=${prefix}
# Process the option --with-gxx-include-dir=<path to include-files directory> # Process the option --with-gxx-include-dir=<path to include-files directory>
echo $ac_n "checking for --with-gxx-include-dir""... $ac_c" 1>&6 echo $ac_n "checking for --with-gxx-include-dir""... $ac_c" 1>&6
echo "configure:22138: checking for --with-gxx-include-dir" >&5 echo "configure:22129: checking for --with-gxx-include-dir" >&5
# Check whether --with-gxx-include-dir or --without-gxx-include-dir was given. # Check whether --with-gxx-include-dir or --without-gxx-include-dir was given.
if test "${with_gxx_include_dir+set}" = set; then if test "${with_gxx_include_dir+set}" = set; then
withval="$with_gxx_include_dir" withval="$with_gxx_include_dir"
@ -22158,7 +22149,7 @@ echo "$ac_t""$gxx_include_dir" 1>&6
# Process the option "--enable-version-specific-runtime-libs" # Process the option "--enable-version-specific-runtime-libs"
echo $ac_n "checking for --enable-version-specific-runtime-libs""... $ac_c" 1>&6 echo $ac_n "checking for --enable-version-specific-runtime-libs""... $ac_c" 1>&6
echo "configure:22162: checking for --enable-version-specific-runtime-libs" >&5 echo "configure:22153: checking for --enable-version-specific-runtime-libs" >&5
# Check whether --enable-version-specific-runtime-libs or --disable-version-specific-runtime-libs was given. # Check whether --enable-version-specific-runtime-libs or --disable-version-specific-runtime-libs was given.
if test "${enable_version_specific_runtime_libs+set}" = set; then if test "${enable_version_specific_runtime_libs+set}" = set; then
enableval="$enable_version_specific_runtime_libs" enableval="$enable_version_specific_runtime_libs"
@ -22204,7 +22195,7 @@ if test x"$glibcpp_toolexecdir" = x"no"; then
fi fi
echo $ac_n "checking for install location""... $ac_c" 1>&6 echo $ac_n "checking for install location""... $ac_c" 1>&6
echo "configure:22208: checking for install location" >&5 echo "configure:22199: checking for install location" >&5
echo "$ac_t""$gxx_include_dir" 1>&6 echo "$ac_t""$gxx_include_dir" 1>&6

View File

@ -91,7 +91,7 @@ if test -n "$with_cross_host" || test x"$build" != x"$host"; then
# GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT # GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
# GLIBCPP_CHECK_MATH_SUPPORT # GLIBCPP_CHECK_MATH_SUPPORT
case "$target_alias" in case "$target" in
*-linux*) *-linux*)
# Check for available headers. # Check for available headers.
AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
@ -185,7 +185,7 @@ changequote([,])dnl
;; ;;
esac esac
case "$target_alias" in case "$target" in
*-mingw32*) *-mingw32*)
;; ;;
*) *)

View File

@ -187,7 +187,10 @@ namespace std
// which are defined via explicit instantiations elsewhere. // which are defined via explicit instantiations elsewhere.
// NB: This syntax is a GNU extension. // NB: This syntax is a GNU extension.
extern template class basic_ios<char>; extern template class basic_ios<char>;
#ifdef _GLIBCPP_USE_WCHAR_T
extern template class basic_ios<wchar_t>; extern template class basic_ios<wchar_t>;
#endif
} // namespace std } // namespace std
#endif #endif

View File

@ -139,13 +139,13 @@ namespace std
{ {
size_type __dnew = static_cast<size_type>(distance(__beg, __end)); size_type __dnew = static_cast<size_type>(distance(__beg, __end));
if (__beg == __end && __a == _Alloc())
return _S_empty_rep()._M_refcopy();
// NB: Not required, but considered best practice. // NB: Not required, but considered best practice.
if (__builtin_expect(__beg == _InIter(), 0)) if (__builtin_expect(__beg == _InIter(), 0))
__throw_logic_error("attempt to create string with null pointer"); __throw_logic_error("attempt to create string with null pointer");
if (__beg == __end && __a == _Alloc())
return _S_empty_rep()._M_refcopy();
// Check for out_of_range and length_error exceptions. // Check for out_of_range and length_error exceptions.
_Rep* __r = _Rep::_S_create(__dnew, __a); _Rep* __r = _Rep::_S_create(__dnew, __a);
try try
@ -223,8 +223,8 @@ namespace std
template<typename _CharT, typename _Traits, typename _Alloc> template<typename _CharT, typename _Traits, typename _Alloc>
basic_string<_CharT, _Traits, _Alloc>:: basic_string<_CharT, _Traits, _Alloc>::
basic_string(const _CharT* __s, const _Alloc& __a) basic_string(const _CharT* __s, const _Alloc& __a)
: _M_dataplus(_S_construct(__s, __s ? __s + traits_type::length(__s) : 0, : _M_dataplus(_S_construct(__s, __s ? __s + traits_type::length(__s) :
__a), __a) __s + npos, __a), __a)
{ } { }
template<typename _CharT, typename _Traits, typename _Alloc> template<typename _CharT, typename _Traits, typename _Alloc>
@ -497,7 +497,6 @@ namespace std
this->erase(__n); this->erase(__n);
// else nothing (in particular, avoid calling _M_mutate() unnecessarily.) // else nothing (in particular, avoid calling _M_mutate() unnecessarily.)
} }
// This is the general replace helper, which currently gets instantiated both // This is the general replace helper, which currently gets instantiated both
// for input iterators and reverse iterators. It buffers internally and then // for input iterators and reverse iterators. It buffers internally and then
@ -885,9 +884,11 @@ namespace std
compare(const _CharT* __s) const compare(const _CharT* __s) const
{ {
size_type __size = this->size(); size_type __size = this->size();
int __r = traits_type::compare(_M_data(), __s, __size); size_type __osize = traits_type::length(__s);
size_type __len = min(__size, __osize);
int __r = traits_type::compare(_M_data(), __s, __len);
if (!__r) if (!__r)
__r = __size - traits_type::length(__s); __r = __size - __osize;
return __r; return __r;
} }
@ -958,6 +959,7 @@ namespace std
basic_istream<char>& basic_istream<char>&
getline(basic_istream<char>&, string&); getline(basic_istream<char>&, string&);
#ifdef _GLIBCPP_USE_WCHAR_T
extern template class basic_string<wchar_t>; extern template class basic_string<wchar_t>;
extern template extern template
basic_istream<wchar_t>& basic_istream<wchar_t>&
@ -971,6 +973,7 @@ namespace std
extern template extern template
basic_istream<wchar_t>& basic_istream<wchar_t>&
getline(basic_istream<wchar_t>&, wstring&); getline(basic_istream<wchar_t>&, wstring&);
#endif
} // namespace std } // namespace std
#endif #endif

View File

@ -34,7 +34,7 @@
#include <bits/os_defines.h> #include <bits/os_defines.h>
// The current version of the C++ library in compressed ISO date format. // The current version of the C++ library in compressed ISO date format.
#define __GLIBCPP__ 20021009 #define __GLIBCPP__ 20021119
// This is necessary until GCC supports separate template // This is necessary until GCC supports separate template
// compilation. // compilation.
@ -55,6 +55,9 @@
// Use corrected code from the committee library group's issues list. // Use corrected code from the committee library group's issues list.
#define _GLIBCPP_RESOLVE_LIB_DEFECTS 1 #define _GLIBCPP_RESOLVE_LIB_DEFECTS 1
// Hopefully temporary workaround to autoconf/m4 issue with quoting '@'.
#define _GLIBCPP_AT_AT "@@"
// In those parts of the standard C++ library that use a mutex instead // In those parts of the standard C++ library that use a mutex instead
// of a spin-lock, we now unconditionally use GCC's gthr.h mutex // of a spin-lock, we now unconditionally use GCC's gthr.h mutex
// abstraction layer. All support to directly map to various // abstraction layer. All support to directly map to various

View File

@ -477,13 +477,16 @@ namespace std
// which are defined via explicit instantiations elsewhere. // which are defined via explicit instantiations elsewhere.
// NB: This syntax is a GNU extension. // NB: This syntax is a GNU extension.
extern template class basic_filebuf<char>; extern template class basic_filebuf<char>;
extern template class basic_filebuf<wchar_t>;
extern template class basic_ifstream<char>; extern template class basic_ifstream<char>;
extern template class basic_ifstream<wchar_t>;
extern template class basic_ofstream<char>; extern template class basic_ofstream<char>;
extern template class basic_ofstream<wchar_t>;
extern template class basic_fstream<char>; extern template class basic_fstream<char>;
#ifdef _GLIBCPP_USE_WCHAR_T
extern template class basic_filebuf<wchar_t>;
extern template class basic_ifstream<wchar_t>;
extern template class basic_ofstream<wchar_t>;
extern template class basic_fstream<wchar_t>; extern template class basic_fstream<wchar_t>;
#endif
} // namespace std } // namespace std
#endif #endif

View File

@ -220,6 +220,9 @@ namespace std
typedef int io_state; typedef int io_state;
typedef int open_mode; typedef int open_mode;
typedef int seek_dir; typedef int seek_dir;
typedef std::streampos streampos;
typedef std::streamoff streamoff;
#endif #endif
// Callbacks; // Callbacks;

View File

@ -811,8 +811,9 @@ namespace std
{ {
try try
{ {
// Cannot compare int_type with streamsize generically.
streamsize __num = this->rdbuf()->in_avail(); streamsize __num = this->rdbuf()->in_avail();
if (__num > 0) if (__num >= 0)
{ {
__num = min(__num, __n); __num = min(__num, __n);
if (__num) if (__num)
@ -935,23 +936,8 @@ namespace std
tellg(void) tellg(void)
{ {
pos_type __ret = pos_type(-1); pos_type __ret = pos_type(-1);
_M_gcount = 0; if (!this->fail())
sentry __cerb(*this, true); __ret = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
if (__cerb)
{
try
{
__ret = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
}
catch(exception& __fail)
{
// 27.6.1.3 paragraph 1
// Turn this on without causing an ios::failure to be thrown.
this->setstate(ios_base::badbit);
if ((this->exceptions() & ios_base::badbit) != 0)
__throw_exception_again;
}
}
return __ret; return __ret;
} }
@ -962,28 +948,16 @@ namespace std
seekg(pos_type __pos) seekg(pos_type __pos)
{ {
_M_gcount = 0; _M_gcount = 0;
sentry __cerb(*this, true); if (!this->fail())
if (__cerb)
{ {
try
{
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// 136. seekp, seekg setting wrong streams? // 136. seekp, seekg setting wrong streams?
pos_type __err = this->rdbuf()->pubseekpos(__pos, ios_base::in); pos_type __err = this->rdbuf()->pubseekpos(__pos, ios_base::in);
// 129. Need error indication from seekp() and seekg() // 129. Need error indication from seekp() and seekg()
if (__err == pos_type(off_type(-1))) if (__err == pos_type(off_type(-1)))
this->setstate(ios_base::failbit); this->setstate(ios_base::failbit);
#endif #endif
}
catch(exception& __fail)
{
// 27.6.1.3 paragraph 1
// Turn this on without causing an ios::failure to be thrown.
this->setstate(ios_base::badbit);
if ((this->exceptions() & ios_base::badbit) != 0)
__throw_exception_again;
}
} }
return *this; return *this;
} }
@ -994,29 +968,17 @@ namespace std
seekg(off_type __off, ios_base::seekdir __dir) seekg(off_type __off, ios_base::seekdir __dir)
{ {
_M_gcount = 0; _M_gcount = 0;
sentry __cerb(*this, true); if (!this->fail())
if (__cerb)
{ {
try
{
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// 136. seekp, seekg setting wrong streams? // 136. seekp, seekg setting wrong streams?
pos_type __err = this->rdbuf()->pubseekoff(__off, __dir, pos_type __err = this->rdbuf()->pubseekoff(__off, __dir,
ios_base::in); ios_base::in);
// 129. Need error indication from seekp() and seekg() // 129. Need error indication from seekp() and seekg()
if (__err == pos_type(off_type(-1))) if (__err == pos_type(off_type(-1)))
this->setstate(ios_base::failbit); this->setstate(ios_base::failbit);
#endif #endif
}
catch(exception& __fail)
{
// 27.6.1.3 paragraph 1
// Turn this on without causing an ios::failure to be thrown.
this->setstate(ios_base::badbit);
if ((this->exceptions() & ios_base::badbit) != 0)
__throw_exception_again;
}
} }
return *this; return *this;
} }
@ -1073,13 +1035,14 @@ namespace std
int_type __c = __sb->sgetc(); int_type __c = __sb->sgetc();
while (__extracted < __num - 1 while (__extracted < __num - 1
&& __c != __eof && !__ctype.is(ctype_base::space, __c)) && !_Traits::eq_int_type(__c, __eof)
&& !__ctype.is(ctype_base::space, __c))
{ {
*__s++ = __c; *__s++ = __c;
++__extracted; ++__extracted;
__c = __sb->snextc(); __c = __sb->snextc();
} }
if (__c == __eof) if (_Traits::eq_int_type(__c, __eof))
__in.setstate(ios_base::eofbit); __in.setstate(ios_base::eofbit);
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
@ -1117,9 +1080,11 @@ namespace std
__streambuf_type* __sb = __in.rdbuf(); __streambuf_type* __sb = __in.rdbuf();
__int_type __c = __sb->sgetc(); __int_type __c = __sb->sgetc();
while (__c != __eof && __ctype.is(ctype_base::space, __c)) while (!_Traits::eq_int_type(__c, __eof)
&& __ctype.is(ctype_base::space, __c))
__c = __sb->snextc(); __c = __sb->snextc();
if (__c == __eof)
if (_Traits::eq_int_type(__c, __eof))
__in.setstate(ios_base::eofbit); __in.setstate(ios_base::eofbit);
return __in; return __in;
@ -1153,13 +1118,14 @@ namespace std
__int_type __c = __sb->sgetc(); __int_type __c = __sb->sgetc();
while (__extracted < __n while (__extracted < __n
&& __c != __eof && !__ctype.is(ctype_base::space, __c)) && !_Traits::eq_int_type(__c, __eof)
&& !__ctype.is(ctype_base::space, __c))
{ {
__str += _Traits::to_char_type(__c); __str += _Traits::to_char_type(__c);
++__extracted; ++__extracted;
__c = __sb->snextc(); __c = __sb->snextc();
} }
if (__c == __eof) if (_Traits::eq_int_type(__c, __eof))
__in.setstate(ios_base::eofbit); __in.setstate(ios_base::eofbit);
__in.width(0); __in.width(0);
} }

View File

@ -525,7 +525,7 @@ namespace std
// For use at construction time only. // For use at construction time only.
void void
_M_initialize_numpunct(__c_locale __cloc = _S_c_locale); _M_initialize_numpunct(__c_locale __cloc = NULL);
}; };
template<typename _CharT> template<typename _CharT>
@ -875,10 +875,7 @@ namespace std
protected: protected:
virtual virtual
~collate() ~collate()
{ { _S_destroy_c_locale(_M_c_locale_collate); }
if (_M_c_locale_collate != _S_c_locale)
_S_destroy_c_locale(_M_c_locale_collate);
}
virtual int virtual int
do_compare(const _CharT* __lo1, const _CharT* __hi1, do_compare(const _CharT* __lo1, const _CharT* __hi1,
@ -924,8 +921,7 @@ namespace std
collate_byname(const char* __s, size_t __refs = 0) collate_byname(const char* __s, size_t __refs = 0)
: collate<_CharT>(__refs) : collate<_CharT>(__refs)
{ {
if (_M_c_locale_collate != _S_c_locale) _S_destroy_c_locale(_M_c_locale_collate);
_S_destroy_c_locale(_M_c_locale_collate);
_S_create_c_locale(_M_c_locale_collate, __s); _S_create_c_locale(_M_c_locale_collate, __s);
} }
@ -956,7 +952,7 @@ namespace std
protected: protected:
__c_locale _M_c_locale_timepunct; __c_locale _M_c_locale_timepunct;
const char* _M_name_timepunct; char* _M_name_timepunct;
const _CharT* _M_date_format; const _CharT* _M_date_format;
const _CharT* _M_date_era_format; const _CharT* _M_date_era_format;
const _CharT* _M_time_format; const _CharT* _M_time_format;
@ -1016,13 +1012,21 @@ namespace std
public: public:
explicit explicit
__timepunct(size_t __refs = 0) __timepunct(size_t __refs = 0)
: locale::facet(__refs), _M_name_timepunct("C") : locale::facet(__refs)
{ _M_initialize_timepunct(); } {
_M_name_timepunct = new char[2];
strcpy(_M_name_timepunct, "C");
_M_initialize_timepunct();
}
explicit explicit
__timepunct(__c_locale __cloc, const char* __s, size_t __refs = 0) __timepunct(__c_locale __cloc, const char* __s, size_t __refs = 0)
: locale::facet(__refs), _M_name_timepunct(__s) : locale::facet(__refs)
{ _M_initialize_timepunct(__cloc); } {
_M_name_timepunct = new char[strlen(__s) + 1];
strcpy(_M_name_timepunct, __s);
_M_initialize_timepunct(__cloc);
}
void void
_M_put(_CharT* __s, size_t __maxlen, const _CharT* __format, _M_put(_CharT* __s, size_t __maxlen, const _CharT* __format,
@ -1119,20 +1123,21 @@ namespace std
protected: protected:
virtual virtual
~__timepunct(); ~__timepunct()
{
delete [] _M_name_timepunct;
_S_destroy_c_locale(_M_c_locale_timepunct);
}
// For use at construction time only. // For use at construction time only.
void void
_M_initialize_timepunct(__c_locale __cloc = _S_c_locale); _M_initialize_timepunct(__c_locale __cloc = NULL);
}; };
template<typename _CharT> template<typename _CharT>
locale::id __timepunct<_CharT>::id; locale::id __timepunct<_CharT>::id;
// Specializations. // Specializations.
template<>
__timepunct<char>::~__timepunct();
template<> template<>
const char* const char*
__timepunct<char>::_S_timezones[14]; __timepunct<char>::_S_timezones[14];
@ -1146,9 +1151,6 @@ namespace std
__timepunct<char>::_M_put(char*, size_t, const char*, const tm*) const; __timepunct<char>::_M_put(char*, size_t, const char*, const tm*) const;
#ifdef _GLIBCPP_USE_WCHAR_T #ifdef _GLIBCPP_USE_WCHAR_T
template<>
__timepunct<wchar_t>::~__timepunct();
template<> template<>
const wchar_t* const wchar_t*
__timepunct<wchar_t>::_S_timezones[14]; __timepunct<wchar_t>::_S_timezones[14];
@ -1459,7 +1461,7 @@ namespace std
// For use at construction time only. // For use at construction time only.
void void
_M_initialize_moneypunct(__c_locale __cloc = _S_c_locale, _M_initialize_moneypunct(__c_locale __cloc = NULL,
const char* __name = NULL); const char* __name = NULL);
}; };
@ -1628,7 +1630,7 @@ namespace std
__c_locale _M_c_locale_messages; __c_locale _M_c_locale_messages;
#if 1 #if 1
// Only needed if glibc < 2.3 // Only needed if glibc < 2.3
const char* _M_name_messages; char* _M_name_messages;
#endif #endif
public: public:
@ -1636,15 +1638,20 @@ namespace std
explicit explicit
messages(size_t __refs = 0) messages(size_t __refs = 0)
: locale::facet(__refs), _M_name_messages("C") : locale::facet(__refs)
{ _M_c_locale_messages = _S_c_locale; } {
_M_name_messages = new char[2];
strcpy(_M_name_messages, "C");
_M_c_locale_messages = _S_c_locale;
}
// Non-standard. // Non-standard.
explicit explicit
messages(__c_locale __cloc, const char* __name, size_t __refs = 0) messages(__c_locale __cloc, const char* __s, size_t __refs = 0)
: locale::facet(__refs) : locale::facet(__refs)
{ {
_M_name_messages = __name; _M_name_messages = new char[strlen(__s) + 1];
strcpy(_M_name_messages, __s);
_M_c_locale_messages = _S_clone_c_locale(__cloc); _M_c_locale_messages = _S_clone_c_locale(__cloc);
} }
@ -1668,8 +1675,8 @@ namespace std
virtual virtual
~messages() ~messages()
{ {
if (_M_c_locale_messages != _S_c_locale) delete [] _M_name_messages;
_S_destroy_c_locale(_M_c_locale_messages); _S_destroy_c_locale(_M_c_locale_messages);
} }
virtual catalog virtual catalog
@ -1758,9 +1765,10 @@ namespace std
messages_byname(const char* __s, size_t __refs = 0) messages_byname(const char* __s, size_t __refs = 0)
: messages<_CharT>(__refs) : messages<_CharT>(__refs)
{ {
_M_name_messages = __s; delete [] _M_name_messages;
if (_M_c_locale_messages != _S_c_locale) _M_name_messages = new char[strlen(__s) + 1];
_S_destroy_c_locale(_M_c_locale_messages); strcpy(_M_name_messages, __s);
_S_destroy_c_locale(_M_c_locale_messages);
_S_create_c_locale(_M_c_locale_messages, __s); _S_create_c_locale(_M_c_locale_messages, __s);
} }

View File

@ -2140,42 +2140,21 @@ namespace std
extern template class moneypunct_byname<char, true>; extern template class moneypunct_byname<char, true>;
extern template class money_get<char>; extern template class money_get<char>;
extern template class money_put<char>; extern template class money_put<char>;
extern template class moneypunct<wchar_t, false>;
extern template class moneypunct<wchar_t, true>;
extern template class moneypunct_byname<wchar_t, false>;
extern template class moneypunct_byname<wchar_t, true>;
extern template class money_get<wchar_t>;
extern template class money_put<wchar_t>;
extern template class numpunct<char>; extern template class numpunct<char>;
extern template class numpunct_byname<char>; extern template class numpunct_byname<char>;
extern template class num_get<char>; extern template class num_get<char>;
extern template class num_put<char>; extern template class num_put<char>;
extern template class numpunct<wchar_t>;
extern template class numpunct_byname<wchar_t>;
extern template class num_get<wchar_t>;
extern template class num_put<wchar_t>;
extern template class __timepunct<char>; extern template class __timepunct<char>;
extern template class time_put<char>; extern template class time_put<char>;
extern template class time_put_byname<char>; extern template class time_put_byname<char>;
extern template class time_get<char>; extern template class time_get<char>;
extern template class time_get_byname<char>; extern template class time_get_byname<char>;
extern template class __timepunct<wchar_t>;
extern template class time_put<wchar_t>;
extern template class time_put_byname<wchar_t>;
extern template class time_get<wchar_t>;
extern template class time_get_byname<wchar_t>;
extern template class messages<char>; extern template class messages<char>;
extern template class messages_byname<char>; extern template class messages_byname<char>;
extern template class messages<wchar_t>;
extern template class messages_byname<wchar_t>;
extern template class ctype_byname<char>; extern template class ctype_byname<char>;
extern template class ctype_byname<wchar_t>;
extern template class codecvt_byname<char, char, mbstate_t>; extern template class codecvt_byname<char, char, mbstate_t>;
extern template class codecvt_byname<wchar_t, char, mbstate_t>;
extern template class collate<char>; extern template class collate<char>;
extern template class collate_byname<char>; extern template class collate_byname<char>;
extern template class collate<wchar_t>;
extern template class collate_byname<wchar_t>;
extern template extern template
const codecvt<char, char, mbstate_t>& const codecvt<char, char, mbstate_t>&
@ -2229,59 +2208,6 @@ namespace std
const messages<char>& const messages<char>&
use_facet<messages<char> >(const locale&); use_facet<messages<char> >(const locale&);
extern template
const codecvt<wchar_t, char, mbstate_t>&
use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const&);
extern template
const collate<wchar_t>&
use_facet<collate<wchar_t> >(const locale&);
extern template
const numpunct<wchar_t>&
use_facet<numpunct<wchar_t> >(const locale&);
extern template
const num_put<wchar_t>&
use_facet<num_put<wchar_t> >(const locale&);
extern template
const num_get<wchar_t>&
use_facet<num_get<wchar_t> >(const locale&);
extern template
const moneypunct<wchar_t, true>&
use_facet<moneypunct<wchar_t, true> >(const locale&);
extern template
const moneypunct<wchar_t, false>&
use_facet<moneypunct<wchar_t, false> >(const locale&);
extern template
const money_put<wchar_t>&
use_facet<money_put<wchar_t> >(const locale&);
extern template
const money_get<wchar_t>&
use_facet<money_get<wchar_t> >(const locale&);
extern template
const __timepunct<wchar_t>&
use_facet<__timepunct<wchar_t> >(const locale&);
extern template
const time_put<wchar_t>&
use_facet<time_put<wchar_t> >(const locale&);
extern template
const time_get<wchar_t>&
use_facet<time_get<wchar_t> >(const locale&);
extern template
const messages<wchar_t>&
use_facet<messages<wchar_t> >(const locale&);
extern template extern template
bool bool
has_facet<ctype<char> >(const locale&); has_facet<ctype<char> >(const locale&);
@ -2334,6 +2260,81 @@ namespace std
bool bool
has_facet<messages<char> >(const locale&); has_facet<messages<char> >(const locale&);
#ifdef _GLIBCPP_USE_WCHAR_T
extern template class moneypunct<wchar_t, false>;
extern template class moneypunct<wchar_t, true>;
extern template class moneypunct_byname<wchar_t, false>;
extern template class moneypunct_byname<wchar_t, true>;
extern template class money_get<wchar_t>;
extern template class money_put<wchar_t>;
extern template class numpunct<wchar_t>;
extern template class numpunct_byname<wchar_t>;
extern template class num_get<wchar_t>;
extern template class num_put<wchar_t>;
extern template class __timepunct<wchar_t>;
extern template class time_put<wchar_t>;
extern template class time_put_byname<wchar_t>;
extern template class time_get<wchar_t>;
extern template class time_get_byname<wchar_t>;
extern template class messages<wchar_t>;
extern template class messages_byname<wchar_t>;
extern template class ctype_byname<wchar_t>;
extern template class codecvt_byname<wchar_t, char, mbstate_t>;
extern template class collate<wchar_t>;
extern template class collate_byname<wchar_t>;
extern template
const codecvt<wchar_t, char, mbstate_t>&
use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const&);
extern template
const collate<wchar_t>&
use_facet<collate<wchar_t> >(const locale&);
extern template
const numpunct<wchar_t>&
use_facet<numpunct<wchar_t> >(const locale&);
extern template
const num_put<wchar_t>&
use_facet<num_put<wchar_t> >(const locale&);
extern template
const num_get<wchar_t>&
use_facet<num_get<wchar_t> >(const locale&);
extern template
const moneypunct<wchar_t, true>&
use_facet<moneypunct<wchar_t, true> >(const locale&);
extern template
const moneypunct<wchar_t, false>&
use_facet<moneypunct<wchar_t, false> >(const locale&);
extern template
const money_put<wchar_t>&
use_facet<money_put<wchar_t> >(const locale&);
extern template
const money_get<wchar_t>&
use_facet<money_get<wchar_t> >(const locale&);
extern template
const __timepunct<wchar_t>&
use_facet<__timepunct<wchar_t> >(const locale&);
extern template
const time_put<wchar_t>&
use_facet<time_put<wchar_t> >(const locale&);
extern template
const time_get<wchar_t>&
use_facet<time_get<wchar_t> >(const locale&);
extern template
const messages<wchar_t>&
use_facet<messages<wchar_t> >(const locale&);
extern template extern template
bool bool
has_facet<ctype<wchar_t> >(const locale&); has_facet<ctype<wchar_t> >(const locale&);
@ -2385,6 +2386,7 @@ namespace std
extern template extern template
bool bool
has_facet<messages<wchar_t> >(const locale&); has_facet<messages<wchar_t> >(const locale&);
#endif
} // namespace std } // namespace std
#endif #endif

View File

@ -207,8 +207,8 @@ namespace std
static const category time = 1L << 3; static const category time = 1L << 3;
static const category monetary = 1L << 4; static const category monetary = 1L << 4;
static const category messages = 1L << 5; static const category messages = 1L << 5;
static const category all = (collate | ctype | monetary | static const category all = (ctype | numeric | collate |
numeric | time | messages); time | monetary | messages);
// Construct/copy/destroy: // Construct/copy/destroy:
locale() throw(); locale() throw();
@ -267,7 +267,26 @@ namespace std
// Current global reference locale // Current global reference locale
static _Impl* _S_global; static _Impl* _S_global;
static const size_t _S_num_categories = 6; // Number of standard categories. For C++, these categories are
// collate, ctype, monetary, numeric, time, and messages. These
// directly correspond to ISO C99 macros LC_COLLATE, LC_CTYPE,
// LC_MONETARY, LC_NUMERIC, and LC_TIME. In addition, POSIX (IEEE
// 1003.1-2001) specifies LC_MESSAGES.
static const size_t _S_categories_size = 6;
// In addition to the standard categories, the underlying
// operating system is allowed to define extra LC_*
// macros. For GNU systems, the following are also valid:
// LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT,
// and LC_IDENTIFICATION.
static const size_t _S_extra_categories_size = _GLIBCPP_NUM_CATEGORIES;
// Names of underlying locale categories.
// NB: locale::global() has to know how to modify all the
// underlying categories, not just the ones required by the C++
// standard.
static const char* _S_categories[_S_categories_size
+ _S_extra_categories_size];
explicit explicit
locale(_Impl*) throw(); locale(_Impl*) throw();
@ -308,7 +327,9 @@ namespace std
_Atomic_word _M_references; _Atomic_word _M_references;
facet** _M_facets; facet** _M_facets;
size_t _M_facets_size; size_t _M_facets_size;
const char* _M_names[_S_num_categories];
char* _M_names[_S_categories_size
+ _S_extra_categories_size];
static const locale::id* const _S_id_ctype[]; static const locale::id* const _S_id_ctype[];
static const locale::id* const _S_id_numeric[]; static const locale::id* const _S_id_numeric[];
static const locale::id* const _S_id_collate[]; static const locale::id* const _S_id_collate[];
@ -348,8 +369,10 @@ namespace std
_M_check_same_name() _M_check_same_name()
{ {
bool __ret = true; bool __ret = true;
for (size_t i = 0; __ret && i < _S_num_categories - 1; ++i) for (size_t __i = 0;
__ret &= (strcmp(_M_names[i], _M_names[i + 1]) == 0); __ret && __i < _S_categories_size + _S_extra_categories_size - 1;
++__i)
__ret &= (strcmp(_M_names[__i], _M_names[__i + 1]) == 0);
return __ret; return __ret;
} }
@ -376,8 +399,14 @@ namespace std
{ {
_M_impl = new _Impl(*__other._M_impl, 1); _M_impl = new _Impl(*__other._M_impl, 1);
_M_impl->_M_install_facet(&_Facet::id, __f); _M_impl->_M_install_facet(&_Facet::id, __f);
for (size_t __i = 0; __i < _S_num_categories; ++__i) for (size_t __i = 0;
_M_impl->_M_names[__i] = "*"; __i < _S_categories_size + _S_extra_categories_size; ++__i)
{
delete [] _M_impl->_M_names[__i];
char* __new = new char[2];
strcpy(__new, "*");
_M_impl->_M_names[__i] = __new;
}
} }
// 22.1.1.1.2 Class locale::facet // 22.1.1.1.2 Class locale::facet

View File

@ -226,13 +226,16 @@ namespace std
// which are defined via explicit instantiations elsewhere. // which are defined via explicit instantiations elsewhere.
// NB: This syntax is a GNU extension. // NB: This syntax is a GNU extension.
extern template class basic_stringbuf<char>; extern template class basic_stringbuf<char>;
extern template class basic_stringbuf<wchar_t>;
extern template class basic_istringstream<char>; extern template class basic_istringstream<char>;
extern template class basic_istringstream<wchar_t>;
extern template class basic_ostringstream<char>; extern template class basic_ostringstream<char>;
extern template class basic_ostringstream<wchar_t>;
extern template class basic_stringstream<char>; extern template class basic_stringstream<char>;
#ifdef _GLIBCPP_USE_WCHAR_T
extern template class basic_stringbuf<wchar_t>;
extern template class basic_istringstream<wchar_t>;
extern template class basic_ostringstream<wchar_t>;
extern template class basic_stringstream<wchar_t>; extern template class basic_stringstream<wchar_t>;
#endif
} // namespace std } // namespace std
#endif #endif

View File

@ -208,19 +208,28 @@ namespace std
try try
{ {
while (__testput && __bufsize != -1) while (__testput && __bufsize != -1)
{ {
__xtrct = __sbout->sputn(__sbin->gptr(), __bufsize); if (__bufsize != 0 && __sbin->gptr() != NULL)
__ret += __xtrct;
__sbin->_M_in_cur_move(__xtrct);
if (__xtrct == __bufsize)
{ {
if (_Traits::eq_int_type(__sbin->sgetc(), _Traits::eof())) __xtrct = __sbout->sputn(__sbin->gptr(), __bufsize);
__ret += __xtrct;
__sbin->_M_in_cur_move(__xtrct);
if (__xtrct != __bufsize)
break; break;
__bufsize = __sbin->in_avail();
} }
else else
break; {
} _CharT __buf[256];
streamsize __charsread = __sbin->sgetn(__buf, sizeof(__buf));
__xtrct = __sbout->sputn(__buf, __charsread);
__ret += __xtrct;
if (__xtrct != __charsread)
break;
}
if (_Traits::eq_int_type(__sbin->sgetc(), _Traits::eof()))
break;
__bufsize = __sbin->in_avail();
}
} }
catch(exception& __fail) catch(exception& __fail)
{ {
@ -240,11 +249,13 @@ namespace std
__copy_streambufs(basic_ios<char>&, basic_streambuf<char>*, __copy_streambufs(basic_ios<char>&, basic_streambuf<char>*,
basic_streambuf<char>*); basic_streambuf<char>*);
#ifdef _GLIBCPP_USE_WCHAR_T
extern template class basic_streambuf<wchar_t>; extern template class basic_streambuf<wchar_t>;
extern template extern template
streamsize streamsize
__copy_streambufs(basic_ios<wchar_t>&, basic_streambuf<wchar_t>*, __copy_streambufs(basic_ios<wchar_t>&, basic_streambuf<wchar_t>*,
basic_streambuf<wchar_t>*); basic_streambuf<wchar_t>*);
#endif
} // namespace std } // namespace std
#endif #endif

View File

@ -45,23 +45,25 @@
namespace std namespace std
{ {
template<class _CharT>
struct char_traits;
template<> struct char_traits<char>;
#ifdef _GLIBCPP_USE_WCHAR_T
template<> struct char_traits<wchar_t>;
#endif
template<typename _Alloc> template<typename _Alloc>
class allocator; class allocator;
template<class _CharT>
struct char_traits;
template<typename _CharT, typename _Traits = char_traits<_CharT>, template<typename _CharT, typename _Traits = char_traits<_CharT>,
typename _Alloc = allocator<_CharT> > typename _Alloc = allocator<_CharT> >
class basic_string; class basic_string;
template<> struct char_traits<char>;
typedef basic_string<char> string; typedef basic_string<char> string;
#ifdef _GLIBCPP_USE_WCHAR_T
template<> struct char_traits<wchar_t>;
typedef basic_string<wchar_t> wstring; typedef basic_string<wchar_t> wstring;
#endif
} // namespace std } // namespace std
#endif // _CPP_BITS_STRINGFWD_H #endif // _CPP_BITS_STRINGFWD_H

View File

@ -225,25 +225,27 @@ namespace std
extern template ostream& operator<<(ostream&, _Setbase); extern template ostream& operator<<(ostream&, _Setbase);
extern template ostream& operator<<(ostream&, _Setprecision); extern template ostream& operator<<(ostream&, _Setprecision);
extern template ostream& operator<<(ostream&, _Setw); extern template ostream& operator<<(ostream&, _Setw);
extern template wostream& operator<<(wostream&, _Setfill<wchar_t>);
extern template wostream& operator<<(wostream&, _Setiosflags);
extern template wostream& operator<<(wostream&, _Resetiosflags);
extern template wostream& operator<<(wostream&, _Setbase);
extern template wostream& operator<<(wostream&, _Setprecision);
extern template wostream& operator<<(wostream&, _Setw);
extern template istream& operator>>(istream&, _Setfill<char>); extern template istream& operator>>(istream&, _Setfill<char>);
extern template istream& operator>>(istream&, _Setiosflags); extern template istream& operator>>(istream&, _Setiosflags);
extern template istream& operator>>(istream&, _Resetiosflags); extern template istream& operator>>(istream&, _Resetiosflags);
extern template istream& operator>>(istream&, _Setbase); extern template istream& operator>>(istream&, _Setbase);
extern template istream& operator>>(istream&, _Setprecision); extern template istream& operator>>(istream&, _Setprecision);
extern template istream& operator>>(istream&, _Setw); extern template istream& operator>>(istream&, _Setw);
#ifdef _GLIBCPP_USE_WCHAR_T
extern template wostream& operator<<(wostream&, _Setfill<wchar_t>);
extern template wostream& operator<<(wostream&, _Setiosflags);
extern template wostream& operator<<(wostream&, _Resetiosflags);
extern template wostream& operator<<(wostream&, _Setbase);
extern template wostream& operator<<(wostream&, _Setprecision);
extern template wostream& operator<<(wostream&, _Setw);
extern template wistream& operator>>(wistream&, _Setfill<wchar_t>); extern template wistream& operator>>(wistream&, _Setfill<wchar_t>);
extern template wistream& operator>>(wistream&, _Setiosflags); extern template wistream& operator>>(wistream&, _Setiosflags);
extern template wistream& operator>>(wistream&, _Resetiosflags); extern template wistream& operator>>(wistream&, _Resetiosflags);
extern template wistream& operator>>(wistream&, _Setbase); extern template wistream& operator>>(wistream&, _Setbase);
extern template wistream& operator>>(wistream&, _Setprecision); extern template wistream& operator>>(wistream&, _Setprecision);
extern template wistream& operator>>(wistream&, _Setw); extern template wistream& operator>>(wistream&, _Setw);
#endif
} // namespace std } // namespace std
#endif #endif

View File

@ -116,6 +116,7 @@ namespace std
typedef basic_ofstream<char> ofstream; typedef basic_ofstream<char> ofstream;
typedef basic_fstream<char> fstream; typedef basic_fstream<char> fstream;
#ifdef _GLIBCPP_USE_WCHAR_T
typedef basic_ios<wchar_t> wios; typedef basic_ios<wchar_t> wios;
typedef basic_streambuf<wchar_t> wstreambuf; typedef basic_streambuf<wchar_t> wstreambuf;
typedef basic_istream<wchar_t> wistream; typedef basic_istream<wchar_t> wistream;
@ -129,6 +130,7 @@ namespace std
typedef basic_ifstream<wchar_t> wifstream; typedef basic_ifstream<wchar_t> wifstream;
typedef basic_ofstream<wchar_t> wofstream; typedef basic_ofstream<wchar_t> wofstream;
typedef basic_fstream<wchar_t> wfstream; typedef basic_fstream<wchar_t> wfstream;
#endif
} // namespace std } // namespace std
#endif #endif

View File

@ -51,6 +51,7 @@ namespace std
extern ostream cout; extern ostream cout;
extern ostream cerr; extern ostream cerr;
extern ostream clog; extern ostream clog;
#ifdef _GLIBCPP_USE_WCHAR_T #ifdef _GLIBCPP_USE_WCHAR_T
extern wistream wcin; extern wistream wcin;
extern wostream wcout; extern wostream wcout;

View File

@ -292,12 +292,12 @@
#define __glibcpp_char_min (char)__glibcpp_signed_char_min #define __glibcpp_char_min (char)__glibcpp_signed_char_min
#define __glibcpp_char_max (char)__glibcpp_signed_char_max #define __glibcpp_char_max (char)__glibcpp_signed_char_max
#define __glibcpp_char_digits __glibcpp_signed_char_digits #define __glibcpp_char_digits __glibcpp_signed_char_digits
#define __glibcpp_char_digits10 __glibcpp_signed_char_digits #define __glibcpp_char_digits10 __glibcpp_signed_char_digits10
#else #else
#define __glibcpp_char_min (char)__glibcpp_unsigned_char_min #define __glibcpp_char_min (char)__glibcpp_unsigned_char_min
#define __glibcpp_char_max (char)__glibcpp_unsigned_char_max #define __glibcpp_char_max (char)__glibcpp_unsigned_char_max
#define __glibcpp_char_digits __glibcpp_unsigned_char_digits #define __glibcpp_char_digits __glibcpp_unsigned_char_digits
#define __glibcpp_char_digits10 __glibcpp_unsigned_char_digits #define __glibcpp_char_digits10 __glibcpp_unsigned_char_digits10
#endif #endif
// short // short

View File

@ -105,7 +105,8 @@ namespace std
void void
str(const __string_type& __s) str(const __string_type& __s)
{ {
_M_string = __s; // Cannot use _M_string = __s, since v3 strings are COW.
_M_string.assign(__s.data(), __s.size());
_M_stringbuf_init(_M_mode); _M_stringbuf_init(_M_mode);
} }

View File

@ -50,7 +50,7 @@ namespace std
codecvt<char, char, mbstate_t>:: codecvt<char, char, mbstate_t>::
~codecvt() ~codecvt()
{ } { }
codecvt_base::result codecvt_base::result
codecvt<char, char, mbstate_t>:: codecvt<char, char, mbstate_t>::

View File

@ -79,8 +79,7 @@ namespace std
ctype<char>::~ctype() ctype<char>::~ctype()
{ {
if (_M_c_locale_ctype != _S_c_locale) _S_destroy_c_locale(_M_c_locale_ctype);
_S_destroy_c_locale(_M_c_locale_ctype);
if (_M_del) if (_M_del)
delete[] this->table(); delete[] this->table();
} }
@ -135,17 +134,13 @@ namespace std
{ _M_c_locale_ctype = _S_clone_c_locale(__cloc); } { _M_c_locale_ctype = _S_clone_c_locale(__cloc); }
ctype<wchar_t>::~ctype() ctype<wchar_t>::~ctype()
{ { _S_destroy_c_locale(_M_c_locale_ctype); }
if (_M_c_locale_ctype != _S_c_locale)
_S_destroy_c_locale(_M_c_locale_ctype);
}
template<> template<>
ctype_byname<wchar_t>::ctype_byname(const char* __s, size_t __refs) ctype_byname<wchar_t>::ctype_byname(const char* __s, size_t __refs)
: ctype<wchar_t>(__refs) : ctype<wchar_t>(__refs)
{ {
if (_M_c_locale_ctype != _S_c_locale) _S_destroy_c_locale(_M_c_locale_ctype);
_S_destroy_c_locale(_M_c_locale_ctype);
_S_create_c_locale(_M_c_locale_ctype, __s); _S_create_c_locale(_M_c_locale_ctype, __s);
} }
#endif #endif

View File

@ -44,163 +44,209 @@
// Because <iostream> declares the standard streams to be [io]stream // Because <iostream> declares the standard streams to be [io]stream
// types instead of say [io]fstream types, it is also necessary to // types instead of say [io]fstream types, it is also necessary to
// allocate the actual file buffers in this file. // allocate the actual file buffers in this file.
namespace std namespace __gnu_cxx
{ {
// Standard "C" locale. using namespace std;
typedef char fake_locale[sizeof(locale)]
__attribute__ ((aligned(__alignof__(locale)))); typedef char fake_facet_name[sizeof(char*)]
fake_locale c_locale; __attribute__ ((aligned(__alignof__(char*))));
fake_facet_name facet_name[6 + _GLIBCPP_NUM_CATEGORIES];
typedef char fake_locale_Impl[sizeof(locale::_Impl)] typedef char fake_locale_Impl[sizeof(locale::_Impl)]
__attribute__ ((aligned(__alignof__(locale::_Impl)))); __attribute__ ((aligned(__alignof__(locale::_Impl))));
fake_locale_Impl c_locale_impl; fake_locale_Impl c_locale_impl;
// NB: The asm directives renames these non-exported, namespace
// __gnu_cxx symbols into the mistakenly exported, namespace std
// symbols in GLIBCPP_3.2.
// The rename syntax is
// asm (".symver currentname,oldname@@GLIBCPP_3.2")
// At the same time, these new __gnu_cxx symbols are not exported.
// In the future, GLIBCXX_ABI > 5 should remove all uses of
// _GLIBCPP_ASM_SYMVER in this file.
typedef char fake_locale[sizeof(locale)]
__attribute__ ((aligned(__alignof__(locale))));
fake_locale c_locale;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8c_localeE, _ZSt8c_locale, GLIBCPP_3.2)
// GLIBCXX_ABI > 5 will not need this symbol at all.
// It's here just as a placeholder, as the size of this exported
// object changed. The new symbol is not exported.
const int o = sizeof(locale::_Impl) - sizeof(char*[_GLIBCPP_NUM_CATEGORIES]);
typedef char fake_locale_Impl_compat[o]
__attribute__ ((aligned(__alignof__(o))));
fake_locale_Impl_compat c_locale_impl_compat;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx20c_locale_impl_compatE, _ZSt13c_locale_impl, GLIBCPP_3.2)
typedef char fake_facet_vec[sizeof(locale::facet*)] typedef char fake_facet_vec[sizeof(locale::facet*)]
__attribute__ ((aligned(__alignof__(locale::facet*)))); __attribute__ ((aligned(__alignof__(locale::facet*))));
fake_facet_vec facet_vec[_GLIBCPP_NUM_FACETS]; fake_facet_vec facet_vec[_GLIBCPP_NUM_FACETS];
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9facet_vecE, _ZSt9facet_vec, GLIBCPP_3.2)
typedef char fake_ctype_c[sizeof(std::ctype<char>)] typedef char fake_ctype_c[sizeof(std::ctype<char>)]
__attribute__ ((aligned(__alignof__(std::ctype<char>)))); __attribute__ ((aligned(__alignof__(std::ctype<char>))));
fake_ctype_c ctype_c; fake_ctype_c ctype_c;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx7ctype_cE, _ZSt7ctype_c, GLIBCPP_3.2)
typedef char fake_collate_c[sizeof(std::collate<char>)] typedef char fake_collate_c[sizeof(std::collate<char>)]
__attribute__ ((aligned(__alignof__(std::collate<char>)))); __attribute__ ((aligned(__alignof__(std::collate<char>))));
fake_collate_c collate_c; fake_collate_c collate_c;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9collate_cE, _ZSt9collate_c, GLIBCPP_3.2)
typedef char fake_numpunct_c[sizeof(numpunct<char>)] typedef char fake_numpunct_c[sizeof(numpunct<char>)]
__attribute__ ((aligned(__alignof__(numpunct<char>)))); __attribute__ ((aligned(__alignof__(numpunct<char>))));
fake_numpunct_c numpunct_c; fake_numpunct_c numpunct_c;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10numpunct_cE, _ZSt10numpunct_c, GLIBCPP_3.2)
typedef char fake_num_get_c[sizeof(num_get<char>)] typedef char fake_num_get_c[sizeof(num_get<char>)]
__attribute__ ((aligned(__alignof__(num_get<char>)))); __attribute__ ((aligned(__alignof__(num_get<char>))));
fake_num_get_c num_get_c; fake_num_get_c num_get_c;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9num_get_cE, _ZSt9num_get_c, GLIBCPP_3.2)
typedef char fake_num_put_c[sizeof(num_put<char>)] typedef char fake_num_put_c[sizeof(num_put<char>)]
__attribute__ ((aligned(__alignof__(num_put<char>)))); __attribute__ ((aligned(__alignof__(num_put<char>))));
fake_num_put_c num_put_c; fake_num_put_c num_put_c;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9num_put_cE, _ZSt9num_put_c, GLIBCPP_3.2)
typedef char fake_codecvt_c[sizeof(codecvt<char, char, mbstate_t>)] typedef char fake_codecvt_c[sizeof(codecvt<char, char, mbstate_t>)]
__attribute__ ((aligned(__alignof__(codecvt<char, char, mbstate_t>)))); __attribute__ ((aligned(__alignof__(codecvt<char, char, mbstate_t>))));
fake_codecvt_c codecvt_c; fake_codecvt_c codecvt_c;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9codecvt_cE, _ZSt9codecvt_c, GLIBCPP_3.2)
typedef char fake_moneypunct_c[sizeof(moneypunct<char, true>)] typedef char fake_moneypunct_c[sizeof(moneypunct<char, true>)]
__attribute__ ((aligned(__alignof__(moneypunct<char, true>)))); __attribute__ ((aligned(__alignof__(moneypunct<char, true>))));
fake_moneypunct_c moneypunct_tc; fake_moneypunct_c moneypunct_tc;
fake_moneypunct_c moneypunct_fc; fake_moneypunct_c moneypunct_fc;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx13moneypunct_tcE,\
_ZSt13moneypunct_tc, GLIBCPP_3.2)
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx13moneypunct_fcE,\
_ZSt13moneypunct_fc, GLIBCPP_3.2)
typedef char fake_money_get_c[sizeof(money_get<char>)] typedef char fake_money_get_c[sizeof(money_get<char>)]
__attribute__ ((aligned(__alignof__(money_get<char>)))); __attribute__ ((aligned(__alignof__(money_get<char>))));
fake_money_get_c money_get_c; fake_money_get_c money_get_c;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11money_get_cE, _ZSt11money_get_c, GLIBCPP_3.2)
typedef char fake_money_put_c[sizeof(money_put<char>)] typedef char fake_money_put_c[sizeof(money_put<char>)]
__attribute__ ((aligned(__alignof__(money_put<char>)))); __attribute__ ((aligned(__alignof__(money_put<char>))));
fake_money_put_c money_put_c; fake_money_put_c money_put_c;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11money_put_cE, _ZSt11money_put_c, GLIBCPP_3.2)
typedef char fake_timepunct_c[sizeof(__timepunct<char>)] typedef char fake_timepunct_c[sizeof(__timepunct<char>)]
__attribute__ ((aligned(__alignof__(__timepunct<char>)))); __attribute__ ((aligned(__alignof__(__timepunct<char>))));
fake_timepunct_c timepunct_c; fake_timepunct_c timepunct_c;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11timepunct_cE, _ZSt11timepunct_c, GLIBCPP_3.2)
typedef char fake_time_get_c[sizeof(time_get<char>)] typedef char fake_time_get_c[sizeof(time_get<char>)]
__attribute__ ((aligned(__alignof__(time_get<char>)))); __attribute__ ((aligned(__alignof__(time_get<char>))));
fake_time_get_c time_get_c; fake_time_get_c time_get_c;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10time_get_cE, _ZSt10time_get_c, GLIBCPP_3.2)
typedef char fake_time_put_c[sizeof(time_put<char>)] typedef char fake_time_put_c[sizeof(time_put<char>)]
__attribute__ ((aligned(__alignof__(time_put<char>)))); __attribute__ ((aligned(__alignof__(time_put<char>))));
fake_time_put_c time_put_c; fake_time_put_c time_put_c;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10time_put_cE, _ZSt10time_put_c, GLIBCPP_3.2)
typedef char fake_messages_c[sizeof(messages<char>)] typedef char fake_messages_c[sizeof(messages<char>)]
__attribute__ ((aligned(__alignof__(messages<char>)))); __attribute__ ((aligned(__alignof__(messages<char>))));
fake_messages_c messages_c; fake_messages_c messages_c;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10messages_cE, _ZSt10messages_c, GLIBCPP_3.2)
#ifdef _GLIBCPP_USE_WCHAR_T #ifdef _GLIBCPP_USE_WCHAR_T
typedef char fake_wtype_w[sizeof(std::ctype<wchar_t>)] typedef char fake_wtype_w[sizeof(std::ctype<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::ctype<wchar_t>)))); __attribute__ ((aligned(__alignof__(std::ctype<wchar_t>))));
fake_wtype_w ctype_w; fake_wtype_w ctype_w;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx7ctype_wE, _ZSt7ctype_w, GLIBCPP_3.2)
typedef char fake_wollate_w[sizeof(std::collate<wchar_t>)] typedef char fake_wollate_w[sizeof(std::collate<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::collate<wchar_t>)))); __attribute__ ((aligned(__alignof__(std::collate<wchar_t>))));
fake_wollate_w collate_w; fake_wollate_w collate_w;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9collate_wE, _ZSt9collate_w, GLIBCPP_3.2)
typedef char fake_numpunct_w[sizeof(numpunct<wchar_t>)] typedef char fake_numpunct_w[sizeof(numpunct<wchar_t>)]
__attribute__ ((aligned(__alignof__(numpunct<wchar_t>)))); __attribute__ ((aligned(__alignof__(numpunct<wchar_t>))));
fake_numpunct_w numpunct_w; fake_numpunct_w numpunct_w;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10numpunct_wE, _ZSt10numpunct_w, GLIBCPP_3.2)
typedef char fake_num_get_w[sizeof(num_get<wchar_t>)] typedef char fake_num_get_w[sizeof(num_get<wchar_t>)]
__attribute__ ((aligned(__alignof__(num_get<wchar_t>)))); __attribute__ ((aligned(__alignof__(num_get<wchar_t>))));
fake_num_get_w num_get_w; fake_num_get_w num_get_w;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9num_get_wE, _ZSt9num_get_w, GLIBCPP_3.2)
typedef char fake_num_put_w[sizeof(num_put<wchar_t>)] typedef char fake_num_put_w[sizeof(num_put<wchar_t>)]
__attribute__ ((aligned(__alignof__(num_put<wchar_t>)))); __attribute__ ((aligned(__alignof__(num_put<wchar_t>))));
fake_num_put_w num_put_w; fake_num_put_w num_put_w;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9num_put_wE, _ZSt9num_put_w, GLIBCPP_3.2)
typedef char fake_wodecvt_w[sizeof(codecvt<wchar_t, char, mbstate_t>)] typedef char fake_wodecvt_w[sizeof(codecvt<wchar_t, char, mbstate_t>)]
__attribute__ ((aligned(__alignof__(codecvt<wchar_t, char, mbstate_t>)))); __attribute__ ((aligned(__alignof__(codecvt<wchar_t, char, mbstate_t>))));
fake_wodecvt_w codecvt_w; fake_wodecvt_w codecvt_w;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9codecvt_wE, _ZSt9codecvt_w, GLIBCPP_3.2)
typedef char fake_moneypunct_w[sizeof(moneypunct<wchar_t, true>)] typedef char fake_moneypunct_w[sizeof(moneypunct<wchar_t, true>)]
__attribute__ ((aligned(__alignof__(moneypunct<wchar_t, true>)))); __attribute__ ((aligned(__alignof__(moneypunct<wchar_t, true>))));
fake_moneypunct_w moneypunct_tw; fake_moneypunct_w moneypunct_tw;
fake_moneypunct_w moneypunct_fw; fake_moneypunct_w moneypunct_fw;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx13moneypunct_twE,\
_ZSt13moneypunct_tw, GLIBCPP_3.2)
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx13moneypunct_fwE,\
_ZSt13moneypunct_fw, GLIBCPP_3.2)
typedef char fake_money_get_w[sizeof(money_get<wchar_t>)] typedef char fake_money_get_w[sizeof(money_get<wchar_t>)]
__attribute__ ((aligned(__alignof__(money_get<wchar_t>)))); __attribute__ ((aligned(__alignof__(money_get<wchar_t>))));
fake_money_get_w money_get_w; fake_money_get_w money_get_w;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11money_get_wE, _ZSt11money_get_w, GLIBCPP_3.2)
typedef char fake_money_put_w[sizeof(money_put<wchar_t>)] typedef char fake_money_put_w[sizeof(money_put<wchar_t>)]
__attribute__ ((aligned(__alignof__(money_put<wchar_t>)))); __attribute__ ((aligned(__alignof__(money_put<wchar_t>))));
fake_money_put_w money_put_w; fake_money_put_w money_put_w;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11money_put_wE, _ZSt11money_put_w, GLIBCPP_3.2)
typedef char fake_timepunct_w[sizeof(__timepunct<wchar_t>)] typedef char fake_timepunct_w[sizeof(__timepunct<wchar_t>)]
__attribute__ ((aligned(__alignof__(__timepunct<wchar_t>)))); __attribute__ ((aligned(__alignof__(__timepunct<wchar_t>))));
fake_timepunct_w timepunct_w; fake_timepunct_w timepunct_w;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11timepunct_wE, _ZSt11timepunct_w, GLIBCPP_3.2)
typedef char fake_time_get_w[sizeof(time_get<wchar_t>)] typedef char fake_time_get_w[sizeof(time_get<wchar_t>)]
__attribute__ ((aligned(__alignof__(time_get<wchar_t>)))); __attribute__ ((aligned(__alignof__(time_get<wchar_t>))));
fake_time_get_w time_get_w; fake_time_get_w time_get_w;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10time_get_wE, _ZSt10time_get_w, GLIBCPP_3.2)
typedef char fake_time_put_w[sizeof(time_put<wchar_t>)] typedef char fake_time_put_w[sizeof(time_put<wchar_t>)]
__attribute__ ((aligned(__alignof__(time_put<wchar_t>)))); __attribute__ ((aligned(__alignof__(time_put<wchar_t>))));
fake_time_put_w time_put_w; fake_time_put_w time_put_w;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10time_put_wE, _ZSt10time_put_w, GLIBCPP_3.2)
typedef char fake_messages_w[sizeof(messages<wchar_t>)] typedef char fake_messages_w[sizeof(messages<wchar_t>)]
__attribute__ ((aligned(__alignof__(messages<wchar_t>)))); __attribute__ ((aligned(__alignof__(messages<wchar_t>))));
fake_messages_w messages_w; fake_messages_w messages_w;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10messages_wE, _ZSt10messages_w, GLIBCPP_3.2)
#endif #endif
// Standard stream objects. typedef char fake_filebuf[sizeof(stdio_filebuf<char>)]
typedef char fake_istream[sizeof(istream)] __attribute__ ((aligned(__alignof__(stdio_filebuf<char>))));
__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;
typedef char fake_filebuf[sizeof(__gnu_cxx::stdio_filebuf<char>)]
__attribute__ ((aligned(__alignof__(__gnu_cxx::stdio_filebuf<char>))));
fake_filebuf buf_cout; fake_filebuf buf_cout;
fake_filebuf buf_cin; fake_filebuf buf_cin;
fake_filebuf buf_cerr; fake_filebuf buf_cerr;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8buf_coutE, _ZSt8buf_cout, GLIBCPP_3.2)
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx7buf_cinE, _ZSt7buf_cin, GLIBCPP_3.2)
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8buf_cerrE, _ZSt8buf_cerr, GLIBCPP_3.2)
#ifdef _GLIBCPP_USE_WCHAR_T #ifdef _GLIBCPP_USE_WCHAR_T
typedef char fake_wistream[sizeof(wistream)] typedef char fake_wfilebuf[sizeof(stdio_filebuf<wchar_t>)]
__attribute__ ((aligned(__alignof__(wistream)))); __attribute__ ((aligned(__alignof__(stdio_filebuf<wchar_t>))));
typedef char fake_wostream[sizeof(wostream)]
__attribute__ ((aligned(__alignof__(wostream))));
fake_wistream wcin;
fake_wostream wcout;
fake_wostream wcerr;
fake_wostream wclog;
typedef char fake_wfilebuf[sizeof(__gnu_cxx::stdio_filebuf<wchar_t>)]
__attribute__ ((aligned(__alignof__(__gnu_cxx::stdio_filebuf<wchar_t>))));
fake_wfilebuf buf_wcout; fake_wfilebuf buf_wcout;
fake_wfilebuf buf_wcin; fake_wfilebuf buf_wcin;
fake_wfilebuf buf_wcerr; fake_wfilebuf buf_wcerr;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9buf_wcoutE, _ZSt9buf_wcout, GLIBCPP_3.2)
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8buf_wcinE, _ZSt8buf_wcin, GLIBCPP_3.2)
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9buf_wcerrE, _ZSt9buf_wcerr, GLIBCPP_3.2)
#endif #endif
} // namespace __gnu_cxx
namespace std
{
// Globals for once-only runtime initialization of mutex objects. This // Globals for once-only runtime initialization of mutex objects. This
// allows static initialization of these objects on systems that need a // allows static initialization of these objects on systems that need a
// function call to initialize a mutex. For example, see stl_threads.h. // function call to initialize a mutex. For example, see stl_threads.h.
@ -223,4 +269,25 @@ namespace std
_GLIBCPP_mutex_address_init () _GLIBCPP_mutex_address_init ()
{ __GTHREAD_MUTEX_INIT_FUNCTION (_GLIBCPP_mutex_address); } { __GTHREAD_MUTEX_INIT_FUNCTION (_GLIBCPP_mutex_address); }
#endif #endif
}
// Standard stream objects.
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 _GLIBCPP_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
} // namespace std

View File

@ -39,28 +39,34 @@
#include <bits/atomicity.h> #include <bits/atomicity.h>
#include <ext/stdio_filebuf.h> #include <ext/stdio_filebuf.h>
namespace std namespace __gnu_cxx
{ {
// Extern declarations for global objects in src/globals.cc. // Extern declarations for global objects in src/globals.cc.
extern stdio_filebuf<char> buf_cout;
extern stdio_filebuf<char> buf_cin;
extern stdio_filebuf<char> buf_cerr;
#ifdef _GLIBCPP_USE_WCHAR_T
extern stdio_filebuf<wchar_t> buf_wcout;
extern stdio_filebuf<wchar_t> buf_wcin;
extern stdio_filebuf<wchar_t> buf_wcerr;
#endif
} // namespace __gnu_cxx
namespace std
{
using namespace __gnu_cxx;
extern istream cin; extern istream cin;
extern ostream cout; extern ostream cout;
extern ostream cerr; extern ostream cerr;
extern ostream clog; extern ostream clog;
using __gnu_cxx::stdio_filebuf;
extern stdio_filebuf<char> buf_cout;
extern stdio_filebuf<char> buf_cin;
extern stdio_filebuf<char> buf_cerr;
#ifdef _GLIBCPP_USE_WCHAR_T #ifdef _GLIBCPP_USE_WCHAR_T
extern wistream wcin; extern wistream wcin;
extern wostream wcout; extern wostream wcout;
extern wostream wcerr; extern wostream wcerr;
extern wostream wclog; extern wostream wclog;
extern stdio_filebuf<wchar_t> buf_wcout;
extern stdio_filebuf<wchar_t> buf_wcin;
extern stdio_filebuf<wchar_t> buf_wcerr;
#endif #endif
// Definitions for static const data members of __ios_flags. // Definitions for static const data members of __ios_flags.

View File

@ -35,11 +35,7 @@
#include <clocale> #include <clocale>
#include <cstring> #include <cstring>
#include <cassert> #include <cassert>
#include <limits>
#include <exception>
#include <locale> #include <locale>
#include <istream>
#include <ostream>
namespace std namespace std
{ {

View File

@ -31,19 +31,19 @@
#include <cassert> #include <cassert>
#include <cctype> #include <cctype>
#include <cwctype> // For towupper, etc. #include <cwctype> // For towupper, etc.
#include <limits>
#include <exception>
#include <locale> #include <locale>
#include <istream>
#include <ostream>
#include <bits/atomicity.h> #include <bits/atomicity.h>
namespace __gnu_cxx
{
// Defined in globals.cc.
extern std::locale c_locale;
extern std::locale::_Impl c_locale_impl;
} // namespace __gnu_cxx
namespace std namespace std
{ {
// Defined in globals.cc. using namespace __gnu_cxx;
extern locale c_locale;
extern locale::_Impl c_locale_impl;
extern locale::facet** facet_vec;
// Definitions for static const data members of locale. // Definitions for static const data members of locale.
const locale::category locale::none; const locale::category locale::none;
@ -55,9 +55,14 @@ namespace std
const locale::category locale::messages; const locale::category locale::messages;
const locale::category locale::all; const locale::category locale::all;
// In the future, GLIBCXX_ABI > 5 should remove all uses of
// _GLIBCPP_ASM_SYMVER in this file, and remove exports of any
// static data members of locale.
locale::_Impl* locale::_S_classic; locale::_Impl* locale::_S_classic;
locale::_Impl* locale::_S_global; locale::_Impl* locale::_S_global;
const size_t locale::_S_num_categories; const size_t locale::_S_categories_size;
_GLIBCPP_ASM_SYMVER(_ZNSt6locale18_S_categories_sizeE, _ZNSt6locale17_S_num_categoriesE, GLIBCPP_3.2)
const size_t locale::_S_extra_categories_size;
// Definitions for static const data members of locale::id // Definitions for static const data members of locale::id
_Atomic_word locale::id::_S_highwater; // init'd to 0 by linker _Atomic_word locale::id::_S_highwater; // init'd to 0 by linker
@ -146,31 +151,12 @@ namespace std
locale::_Impl::_S_id_ctype, locale::_Impl::_S_id_ctype,
locale::_Impl::_S_id_numeric, locale::_Impl::_S_id_numeric,
locale::_Impl::_S_id_collate, locale::_Impl::_S_id_collate,
locale::_Impl::_S_id_monetary,
locale::_Impl::_S_id_time, locale::_Impl::_S_id_time,
locale::_Impl::_S_id_monetary,
locale::_Impl::_S_id_messages, locale::_Impl::_S_id_messages,
0 0
}; };
locale::~locale() throw()
{ _M_impl->_M_remove_reference(); }
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;
}
}
locale::locale() throw() locale::locale() throw()
{ {
_S_initialize(); _S_initialize();
@ -182,6 +168,7 @@ namespace std
// This is used to initialize global and classic locales, and // This is used to initialize global and classic locales, and
// assumes that the _Impl objects are constructed correctly. // 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(_Impl* __ip) throw() : _M_impl(__ip)
{ } { }
@ -192,18 +179,110 @@ namespace std
_S_initialize(); _S_initialize();
if (strcmp(__s, "C") == 0 || strcmp(__s, "POSIX") == 0) if (strcmp(__s, "C") == 0 || strcmp(__s, "POSIX") == 0)
(_M_impl = _S_classic)->_M_add_reference(); (_M_impl = _S_classic)->_M_add_reference();
else if (strcmp(__s, "") == 0) else if (strcmp(__s, "") != 0)
{
char* __env = getenv("LC_ALL");
if (__env)
_M_impl = new _Impl(__env, 1);
else if ((__env = getenv("LANG")))
_M_impl = new _Impl(__env, 1);
else
(_M_impl = _S_classic)->_M_add_reference();
}
else
_M_impl = new _Impl(__s, 1); _M_impl = new _Impl(__s, 1);
else
{
// Get it from the environment.
char* __env = getenv("LC_ALL");
// If LC_ALL is set we are done.
if (__env && strcmp(__env, "") != 0)
{
if (strcmp(__env, "C") == 0 || strcmp(__env, "POSIX") == 0)
(_M_impl = _S_classic)->_M_add_reference();
else
_M_impl = new _Impl(__env, 1);
}
else
{
char* __res;
// LANG may set a default different from "C".
char* __env = getenv("LANG");
if (!__env || strcmp(__env, "") == 0 || strcmp(__env, "C") == 0
|| strcmp(__env, "POSIX") == 0)
__res = strdup("C");
else
__res = strdup(__env);
// Scan the categories looking for the first one
// different from LANG.
size_t __i = 0;
if (strcmp(__res, "C") == 0)
for (__i = 0;
__i < _S_categories_size + _S_extra_categories_size;
++__i)
{
__env = getenv(_S_categories[__i]);
if (__env && strcmp(__env, "") != 0
&& strcmp(__env, "C") != 0
&& strcmp(__env, "POSIX") != 0)
break;
}
else
for (__i = 0;
__i < _S_categories_size + _S_extra_categories_size;
++__i)
{
__env = getenv(_S_categories[__i]);
if (__env && strcmp(__env, "") != 0
&& strcmp(__env, __res) != 0)
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 + _S_extra_categories_size)
{
string __str;
for (size_t __j = 0; __j < __i; ++__j)
{
__str += _S_categories[__j];
__str += "=";
__str += __res;
__str += ";";
}
__str += _S_categories[__i];
__str += "=";
__str += __env;
__str += ";";
__i++;
for (; __i < _S_categories_size
+ _S_extra_categories_size; ++__i)
{
__env = getenv(_S_categories[__i]);
if (!__env || strcmp(__env, "") == 0)
{
__str += _S_categories[__i];
__str += '=';
__str += __res;
__str += ';';
}
else if (strcmp(__env, "C") == 0
|| strcmp(__env, "POSIX") == 0)
{
__str += _S_categories[__i];
__str += "=C;";
}
else
{
__str += _S_categories[__i];
__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 (strcmp(__res, "C") == 0)
(_M_impl = _S_classic)->_M_add_reference();
else
_M_impl = new _Impl(__res, 1);
free(__res);
}
}
} }
else else
__throw_runtime_error("attempt to create locale from NULL name"); __throw_runtime_error("attempt to create locale from NULL name");
@ -221,6 +300,9 @@ namespace std
locale::locale(const locale& __base, const locale& __add, category __cat) locale::locale(const locale& __base, const locale& __add, category __cat)
{ _M_coalesce(__base, __add, __cat); } { _M_coalesce(__base, __add, __cat); }
locale::~locale() throw()
{ _M_impl->_M_remove_reference(); }
bool bool
locale::operator==(const locale& __rhs) const throw() locale::operator==(const locale& __rhs) const throw()
{ {
@ -261,20 +343,22 @@ namespace std
string string
locale::name() const locale::name() const
{ {
// Need some kind of separator character. This one was pretty much
// arbitrarily chosen as to not conflict with glibc locales: the
// exact formatting is not set in stone.
const char __separator = '|';
string __ret; string __ret;
if (_M_impl->_M_check_same_name()) if (_M_impl->_M_check_same_name())
__ret = _M_impl->_M_names[0]; __ret = _M_impl->_M_names[0];
else else
{ {
for (size_t i = 0; i < _S_num_categories; ++i) __ret += _S_categories[0];
__ret += "=";
__ret += _M_impl->_M_names[0];
for (size_t __i = 1;
__i < _S_categories_size + _S_extra_categories_size;
++__i)
{ {
__ret += __separator; __ret += ";";
__ret += _M_impl->_M_names[i]; __ret += _S_categories[__i];
__ret += "=";
__ret += _M_impl->_M_names[__i];
} }
} }
return __ret; return __ret;
@ -291,12 +375,8 @@ namespace std
try try
{ {
// 26 Standard facets, 2 references. // 26 Standard facets, 2 references.
// One reference for _M_classic, one for _M_global // One reference for _S_classic, one for _S_global
facet** f = new(&facet_vec) facet*[_GLIBCPP_NUM_FACETS]; _S_classic = new (&c_locale_impl) _Impl(0, 2, true);
for (size_t __i = 0; __i < _GLIBCPP_NUM_FACETS; ++__i)
f[__i] = 0;
_S_classic = new (&c_locale_impl) _Impl(f, 2, true);
_S_global = _S_classic; _S_global = _S_classic;
new (&c_locale) locale(_S_classic); new (&c_locale) locale(_S_classic);
} }
@ -313,6 +393,22 @@ namespace std
return c_locale; return c_locale;
} }
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;
}
}
locale::category locale::category
locale::_S_normalize_category(category __cat) locale::_S_normalize_category(category __cat)
{ {
@ -361,11 +457,8 @@ namespace std
~facet() { } ~facet() { }
locale::facet:: locale::facet::
facet(size_t __refs) throw() : _M_references(__refs) facet(size_t __refs) throw() : _M_references(__refs ? 1 : 0)
{ { }
if (!_S_c_locale)
_S_create_c_locale(_S_c_locale, "C");
}
void void
locale::facet:: locale::facet::
@ -376,7 +469,7 @@ namespace std
locale::facet:: locale::facet::
_M_remove_reference() throw() _M_remove_reference() throw()
{ {
if (__exchange_and_add(&_M_references, -1) == 0) if (__exchange_and_add(&_M_references, -1) == 1)
{ {
try try
{ delete this; } { delete this; }

View File

@ -30,9 +30,14 @@
#include <cstring> #include <cstring>
#include <locale> #include <locale>
namespace std namespace __gnu_cxx
{ {
using namespace std;
// Defined in globals.cc. // Defined in globals.cc.
extern locale::facet** facet_vec;
extern char* facet_name[6 + _GLIBCPP_NUM_CATEGORIES];
extern std::ctype<char> ctype_c; extern std::ctype<char> ctype_c;
extern std::collate<char> collate_c; extern std::collate<char> collate_c;
extern numpunct<char> numpunct_c; extern numpunct<char> numpunct_c;
@ -63,6 +68,11 @@ namespace std
extern time_put<wchar_t> time_put_w; extern time_put<wchar_t> time_put_w;
extern std::messages<wchar_t> messages_w; extern std::messages<wchar_t> messages_w;
#endif #endif
} // namespace __gnu_cxx
namespace std
{
using namespace __gnu_cxx;
locale::_Impl:: locale::_Impl::
~_Impl() throw() ~_Impl() throw()
@ -71,6 +81,10 @@ namespace std
if (_M_facets[__i]) if (_M_facets[__i])
_M_facets[__i]->_M_remove_reference(); _M_facets[__i]->_M_remove_reference();
delete [] _M_facets; delete [] _M_facets;
for (size_t __i = 0;
__i < _S_categories_size + _S_extra_categories_size; ++__i)
delete [] _M_names[__i];
} }
// Clone existing _Impl object. // Clone existing _Impl object.
@ -95,14 +109,19 @@ namespace std
if (_M_facets[__i]) if (_M_facets[__i])
_M_facets[__i]->_M_add_reference(); _M_facets[__i]->_M_add_reference();
} }
for (size_t __i = 0; __i < _S_num_categories; ++__i) for (size_t __i = 0;
_M_names[__i] = __imp._M_names[__i]; __i < _S_categories_size + _S_extra_categories_size; ++__i)
{
char* __new = new char[strlen(__imp._M_names[__i]) + 1];
strcpy(__new, __imp._M_names[__i]);
_M_names[__i] = __new;
}
} }
// Construct named _Impl. // Construct named _Impl.
locale::_Impl:: locale::_Impl::
_Impl(const char* __s, size_t __refs) _Impl(const char* __s, size_t __refs)
: _M_references(__refs), _M_facets_size(_GLIBCPP_NUM_FACETS) // XXX : _M_references(__refs), _M_facets_size(_GLIBCPP_NUM_FACETS)
{ {
// Initialize the underlying locale model, which also checks // Initialize the underlying locale model, which also checks
// to see if the given name is valid. // to see if the given name is valid.
@ -122,11 +141,40 @@ namespace std
} }
// Name all the categories. // Name all the categories.
for (size_t i = 0; i < _S_num_categories; ++i) if (!strchr(__s, ';'))
_M_names[i] = __s; {
size_t __len = strlen(__s) + 1;
for (size_t __i = 0;
__i < _S_categories_size + _S_extra_categories_size; ++__i)
{
_M_names[__i] = new char[__len];
strcpy(_M_names[__i], __s);
}
}
else
{
char* __tmp = strdup(__s);
__tmp[strlen(__tmp)] = ';';
strtok(__tmp, "=;");
for (size_t __i = 0;
__i < _S_categories_size + _S_extra_categories_size - 1; ++__i)
{
char* __src = strtok(NULL, "=;");
char* __new = new char[strlen(__src) + 1];
strcpy(__new, __src);
_M_names[__i] = __new;
strtok(NULL, "=;");
}
char* __src = strtok(NULL, "=;");
char* __new = new char[strlen(__src) + 1];
strcpy(__new, __src);
_M_names[_S_categories_size + _S_extra_categories_size - 1] = __new;
// Construct all standard facets and add them to _M_facets. free(__tmp);
_M_init_facet(new std::ctype<char>(__cloc)); }
// 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>); _M_init_facet(new codecvt<char, char, mbstate_t>);
_M_init_facet(new numpunct<char>(__cloc)); _M_init_facet(new numpunct<char>(__cloc));
_M_init_facet(new num_get<char>); _M_init_facet(new num_get<char>);
@ -162,47 +210,61 @@ namespace std
// Construct "C" _Impl. // Construct "C" _Impl.
locale::_Impl:: locale::_Impl::
_Impl(facet** __f, size_t __refs, bool) _Impl(facet**, size_t __refs, bool)
: _M_references(__refs), _M_facets(__f), _M_facets_size(_GLIBCPP_NUM_FACETS) : _M_references(__refs), _M_facets_size(_GLIBCPP_NUM_FACETS)
{ {
// Initialize the underlying locale model.
locale::facet::_S_create_c_locale(locale::facet::_S_c_locale, "C");
_M_facets = new(&facet_vec) facet*[_M_facets_size];
for (size_t __i = 0; __i < _M_facets_size; ++__i)
_M_facets[__i] = 0;
// Name all the categories. // Name all the categories.
for (size_t i = 0; i < _S_num_categories; ++i) for (size_t __i = 0;
_M_names[i] = "C"; __i < _S_categories_size + _S_extra_categories_size; ++__i)
{
_M_names[__i] = new (&facet_name[__i]) char[2];
strcpy(_M_names[__i], "C");
}
// This is needed as presently the C++ version of "C" locales // This is needed as presently the C++ version of "C" locales
// != data in the underlying locale model for __timepunct, // != data in the underlying locale model for __timepunct,
// numpunct, and moneypunct. Also, the "C" locales must be // numpunct, and moneypunct. Also, the "C" locales must be
// constructed in a way such that they are pre-allocated. // constructed in a way such that they are pre-allocated.
_M_init_facet(new (&ctype_c) std::ctype<char>); // NB: Set locale::facets(ref) count to one so that each individual
_M_init_facet(new (&codecvt_c) codecvt<char, char, mbstate_t>); // facet is not destroyed when the locale (and thus locale::_Impl) is
_M_init_facet(new (&numpunct_c) numpunct<char>); // destroyed.
_M_init_facet(new (&num_get_c) num_get<char>); _M_init_facet(new (&ctype_c) std::ctype<char>(0, false, 1));
_M_init_facet(new (&num_put_c) num_put<char>); _M_init_facet(new (&codecvt_c) codecvt<char, char, mbstate_t>(1));
_M_init_facet(new (&collate_c) std::collate<char>); _M_init_facet(new (&numpunct_c) numpunct<char>(1));
_M_init_facet(new (&moneypunct_fc) moneypunct<char, false>); _M_init_facet(new (&num_get_c) num_get<char>(1));
_M_init_facet(new (&moneypunct_tc) moneypunct<char, true>); _M_init_facet(new (&num_put_c) num_put<char>(1));
_M_init_facet(new (&money_get_c) money_get<char>); _M_init_facet(new (&collate_c) std::collate<char>(1));
_M_init_facet(new (&money_put_c) money_put<char>); _M_init_facet(new (&moneypunct_fc) moneypunct<char, false>(1));
_M_init_facet(new (&timepunct_c) __timepunct<char>); _M_init_facet(new (&moneypunct_tc) moneypunct<char, true>(1));
_M_init_facet(new (&time_get_c) time_get<char>); _M_init_facet(new (&money_get_c) money_get<char>(1));
_M_init_facet(new (&time_put_c) time_put<char>); _M_init_facet(new (&money_put_c) money_put<char>(1));
_M_init_facet(new (&messages_c) std::messages<char>); _M_init_facet(new (&timepunct_c) __timepunct<char>(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 _GLIBCPP_USE_WCHAR_T #ifdef _GLIBCPP_USE_WCHAR_T
_M_init_facet(new (&ctype_w) std::ctype<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>); _M_init_facet(new (&codecvt_w) codecvt<wchar_t, char, mbstate_t>(1));
_M_init_facet(new (&numpunct_w) numpunct<wchar_t>); _M_init_facet(new (&numpunct_w) numpunct<wchar_t>(1));
_M_init_facet(new (&num_get_w) num_get<wchar_t>); _M_init_facet(new (&num_get_w) num_get<wchar_t>(1));
_M_init_facet(new (&num_put_w) num_put<wchar_t>); _M_init_facet(new (&num_put_w) num_put<wchar_t>(1));
_M_init_facet(new (&collate_w) std::collate<wchar_t>); _M_init_facet(new (&collate_w) std::collate<wchar_t>(1));
_M_init_facet(new (&moneypunct_fw) moneypunct<wchar_t, false>); _M_init_facet(new (&moneypunct_fw) moneypunct<wchar_t, false>(1));
_M_init_facet(new (&moneypunct_tw) moneypunct<wchar_t, true>); _M_init_facet(new (&moneypunct_tw) moneypunct<wchar_t, true>(1));
_M_init_facet(new (&money_get_w) money_get<wchar_t>); _M_init_facet(new (&money_get_w) money_get<wchar_t>(1));
_M_init_facet(new (&money_put_w) money_put<wchar_t>); _M_init_facet(new (&money_put_w) money_put<wchar_t>(1));
_M_init_facet(new (&timepunct_w) __timepunct<wchar_t>); _M_init_facet(new (&timepunct_w) __timepunct<wchar_t>(1));
_M_init_facet(new (&time_get_w) time_get<wchar_t>); _M_init_facet(new (&time_get_w) time_get<wchar_t>(1));
_M_init_facet(new (&time_put_w) time_put<wchar_t>); _M_init_facet(new (&time_put_w) time_put<wchar_t>(1));
_M_init_facet(new (&messages_w) std::messages<wchar_t>); _M_init_facet(new (&messages_w) std::messages<wchar_t>(1));
#endif #endif
} }
void void
@ -210,7 +272,7 @@ namespace std
_M_replace_categories(const _Impl* __imp, category __cat) _M_replace_categories(const _Impl* __imp, category __cat)
{ {
category __mask; category __mask;
for (unsigned int __ix = 0; __ix < _S_num_categories; ++__ix) for (size_t __ix = 0; __ix < _S_categories_size; ++__ix)
{ {
__mask = 1 << __ix; __mask = 1 << __ix;
if (__mask & __cat) if (__mask & __cat)
@ -220,7 +282,12 @@ namespace std
// If both have names, go ahead and mangle. // If both have names, go ahead and mangle.
if (strcmp(_M_names[__ix], "*") != 0 if (strcmp(_M_names[__ix], "*") != 0
&& strcmp(__imp->_M_names[__ix], "*") != 0) && strcmp(__imp->_M_names[__ix], "*") != 0)
_M_names[__ix] = __imp->_M_names[__ix]; {
delete [] _M_names[__ix];
char* __new = new char[strlen(__imp->_M_names[__ix]) + 1];
strcpy(__new, __imp->_M_names[__ix]);
_M_names[__ix] = __new;
}
} }
} }
} }
@ -250,6 +317,8 @@ namespace std
if (__fp) if (__fp)
{ {
size_t __index = __idp->_M_id(); size_t __index = __idp->_M_id();
// Check size of facet vector to ensure adequate room.
if (__index > _M_facets_size - 1) if (__index > _M_facets_size - 1)
{ {
facet** __old = _M_facets; facet** __old = _M_facets;
@ -266,11 +335,11 @@ namespace std
delete [] __old; delete [] __old;
} }
__fp->_M_add_reference();
facet*& __fpr = _M_facets[__index]; facet*& __fpr = _M_facets[__index];
if (__fpr) if (__fpr)
{ {
// Replacing an existing facet. Order matters. // Replacing an existing facet. Order matters.
__fp->_M_add_reference();
__fpr->_M_remove_reference(); __fpr->_M_remove_reference();
__fpr = __fp; __fpr = __fp;
} }

View File

@ -22,7 +22,8 @@
// As a special exception, you may use this file as part of a free software // As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate // library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile // templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this// file does not by itself cause the resulting executable to be covered by // this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however // the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by // invalidate any other reasons why the executable file might be covered by
// the GNU General Public License. // the GNU General Public License.
@ -48,6 +49,7 @@ namespace std
template class basic_string<C>; template class basic_string<C>;
template S operator+(const C*, const S&); template S operator+(const C*, const S&);
template S operator+(C, const S&); template S operator+(C, const S&);
template S operator+(const S&, const S&);
} // namespace std } // namespace std
namespace __gnu_cxx namespace __gnu_cxx