summaryrefslogtreecommitdiffstats
path: root/contrib/libstdc++/include
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2002-09-01 20:39:13 +0000
committerkan <kan@FreeBSD.org>2002-09-01 20:39:13 +0000
commitc31428d2117318fc5d72e9868d7d34eee52c4eba (patch)
treef69812e8f56ae46c848e604412b0729b776c7756 /contrib/libstdc++/include
parent2e25f3a6c57335cba50111faceb0ce2ab59e9bcb (diff)
downloadFreeBSD-src-c31428d2117318fc5d72e9868d7d34eee52c4eba.zip
FreeBSD-src-c31428d2117318fc5d72e9868d7d34eee52c4eba.tar.gz
Gcc 3.2.1-prerelease libf2c bits from the FSF anoncvs repo gcc-3_2-branch on 1-Sep-2002 00:00:01 EDT.
Diffstat (limited to 'contrib/libstdc++/include')
-rw-r--r--contrib/libstdc++/include/Makefile.am70
-rw-r--r--contrib/libstdc++/include/Makefile.in87
-rw-r--r--contrib/libstdc++/include/backward/strstream244
-rw-r--r--contrib/libstdc++/include/bits/basic_ios.tcc2
-rw-r--r--contrib/libstdc++/include/bits/basic_string.h31
-rw-r--r--contrib/libstdc++/include/bits/basic_string.tcc17
-rw-r--r--contrib/libstdc++/include/bits/c++config12
-rw-r--r--contrib/libstdc++/include/bits/char_traits.h62
-rw-r--r--contrib/libstdc++/include/bits/fpos.h2
-rw-r--r--contrib/libstdc++/include/bits/fstream.tcc112
-rw-r--r--contrib/libstdc++/include/bits/istream.tcc87
-rw-r--r--contrib/libstdc++/include/bits/locale_facets.h39
-rw-r--r--contrib/libstdc++/include/bits/locale_facets.tcc168
-rw-r--r--contrib/libstdc++/include/bits/ostream.tcc53
-rw-r--r--contrib/libstdc++/include/bits/sstream.tcc6
-rw-r--r--contrib/libstdc++/include/bits/stl_bvector.h4
-rw-r--r--contrib/libstdc++/include/bits/stl_deque.h132
-rw-r--r--contrib/libstdc++/include/bits/stl_iterator.h14
-rw-r--r--contrib/libstdc++/include/bits/stl_pair.h2
-rw-r--r--contrib/libstdc++/include/bits/streambuf.tcc8
-rw-r--r--contrib/libstdc++/include/bits/streambuf_iterator.h29
-rw-r--r--contrib/libstdc++/include/c/std_cerrno.h14
-rw-r--r--contrib/libstdc++/include/c/std_cmath.h83
-rw-r--r--contrib/libstdc++/include/c/std_csetjmp.h8
-rw-r--r--contrib/libstdc++/include/c/std_cstdarg.h1
-rw-r--r--contrib/libstdc++/include/c/std_cstddef.h4
-rw-r--r--contrib/libstdc++/include/c/std_cstdio.h43
-rw-r--r--contrib/libstdc++/include/c/std_cwchar.h21
-rw-r--r--contrib/libstdc++/include/c/std_cwctype.h4
-rw-r--r--contrib/libstdc++/include/c_compatibility/assert.h30
-rw-r--r--contrib/libstdc++/include/c_compatibility/ctype.h49
-rw-r--r--contrib/libstdc++/include/c_compatibility/errno.h35
-rw-r--r--contrib/libstdc++/include/c_compatibility/float.h35
-rw-r--r--contrib/libstdc++/include/c_compatibility/iso646.h35
-rw-r--r--contrib/libstdc++/include/c_compatibility/limits.h35
-rw-r--r--contrib/libstdc++/include/c_compatibility/locale.h39
-rw-r--r--contrib/libstdc++/include/c_compatibility/math.h74
-rw-r--r--contrib/libstdc++/include/c_compatibility/setjmp.h38
-rw-r--r--contrib/libstdc++/include/c_compatibility/signal.h40
-rw-r--r--contrib/libstdc++/include/c_compatibility/stdarg.h37
-rw-r--r--contrib/libstdc++/include/c_compatibility/stddef.h38
-rw-r--r--contrib/libstdc++/include/c_compatibility/stdio.h85
-rw-r--r--contrib/libstdc++/include/c_compatibility/stdlib.h67
-rw-r--r--contrib/libstdc++/include/c_compatibility/string.h58
-rw-r--r--contrib/libstdc++/include/c_compatibility/time.h60
-rw-r--r--contrib/libstdc++/include/c_compatibility/wchar.h106
-rw-r--r--contrib/libstdc++/include/c_compatibility/wctype.h55
-rw-r--r--contrib/libstdc++/include/c_std/std_cmath.h7
-rw-r--r--contrib/libstdc++/include/ext/algorithm40
-rw-r--r--contrib/libstdc++/include/ext/hash_map11
-rw-r--r--contrib/libstdc++/include/ext/hash_set10
-rw-r--r--contrib/libstdc++/include/ext/iterator5
-rw-r--r--contrib/libstdc++/include/ext/numeric15
-rw-r--r--contrib/libstdc++/include/ext/rb_tree5
-rw-r--r--contrib/libstdc++/include/ext/slist5
-rw-r--r--contrib/libstdc++/include/ext/stdio_filebuf.h71
-rw-r--r--contrib/libstdc++/include/ext/stl_hashtable.h19
-rw-r--r--contrib/libstdc++/include/ext/stl_rope.h5
-rw-r--r--contrib/libstdc++/include/std/std_bitset.h99
-rw-r--r--contrib/libstdc++/include/std/std_fstream.h11
-rw-r--r--contrib/libstdc++/include/std/std_istream.h10
-rw-r--r--contrib/libstdc++/include/std/std_memory.h373
-rw-r--r--contrib/libstdc++/include/std/std_streambuf.h39
63 files changed, 2332 insertions, 668 deletions
diff --git a/contrib/libstdc++/include/Makefile.am b/contrib/libstdc++/include/Makefile.am
index 38d1f7b..cb29b24 100644
--- a/contrib/libstdc++/include/Makefile.am
+++ b/contrib/libstdc++/include/Makefile.am
@@ -21,7 +21,7 @@
## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
## USA.
-AUTOMAKE_OPTIONS = 1.3 gnits
+AUTOMAKE_OPTIONS = 1.3 cygnus
MAINT_CHARSET = latin1
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
@@ -96,7 +96,7 @@ bits_headers = \
${bits_srcdir}/type_traits.h \
${bits_srcdir}/valarray_array.h \
${bits_srcdir}/valarray_array.tcc \
- ${bits_srcdir}/valarray_meta.h
+ ${bits_srcdir}/valarray_meta.h
backward_srcdir = ${glibcpp_srcdir}/include/backward
backward_builddir = ./backward
@@ -201,15 +201,45 @@ c_base_headers_rename = \
cwchar \
cwctype
+# "C" compatibility headers.
+c_compatibility_srcdir = ${glibcpp_srcdir}/include/c_compatibility
+c_compatibility_builddir = .
+c_compatibility_headers = \
+ ${c_compatibility_srcdir}/assert.h \
+ ${c_compatibility_srcdir}/ctype.h \
+ ${c_compatibility_srcdir}/errno.h \
+ ${c_compatibility_srcdir}/float.h \
+ ${c_compatibility_srcdir}/iso646.h \
+ ${c_compatibility_srcdir}/limits.h \
+ ${c_compatibility_srcdir}/locale.h \
+ ${c_compatibility_srcdir}/math.h \
+ ${c_compatibility_srcdir}/setjmp.h \
+ ${c_compatibility_srcdir}/signal.h \
+ ${c_compatibility_srcdir}/stdarg.h \
+ ${c_compatibility_srcdir}/stddef.h \
+ ${c_compatibility_srcdir}/stdio.h \
+ ${c_compatibility_srcdir}/stdlib.h \
+ ${c_compatibility_srcdir}/string.h \
+ ${c_compatibility_srcdir}/time.h \
+ ${c_compatibility_srcdir}/wchar.h \
+ ${c_compatibility_srcdir}/wctype.h
+
# Some of the different "C" header models need extra files.
+# Some "C" header schemes require the "C" compatibility headers.
# For --enable-cheaders=c_std
if GLIBCPP_C_HEADERS_C_STD
-c_base_headers_extra = \
- ${c_base_srcdir}/cmath.tcc
+c_base_headers_extra = ${c_base_srcdir}/cmath.tcc
else
c_base_headers_extra =
endif
+if GLIBCPP_C_HEADERS_COMPATIBILITY
+c_compatibility_headers_extra = ${c_compatibility_headers}
+else
+c_compatibility_headers_extra =
+endif
+
+
std_srcdir = ${glibcpp_srcdir}/include/std
std_builddir = .
std_headers = \
@@ -283,8 +313,8 @@ target_headers = \
${target_srcdir}/os_defines.h \
${glibcpp_srcdir}/@ATOMICITY_INC_SRCDIR@/atomicity.h \
${glibcpp_srcdir}/@CPU_LIMITS_INC_SRCDIR@/cpu_limits.h
-# These extra_target_headers files are all built with ad hoc naming rules.
-extra_target_headers = \
+# These target_headers_extra files are all built with ad hoc naming rules.
+target_headers_extra = \
${target_builddir}/basic_file.h \
${target_builddir}/c++config.h \
${target_builddir}/c++io.h \
@@ -300,7 +330,9 @@ thread_target_headers = \
# List of all timestamp files. By keeping only one copy of this list, both
# CLEANFILES and all-local are kept up-to-date.
-allstamps = stamp-std stamp-bits stamp-c_base stamp-backward stamp-ext \
+allstamps = \
+ stamp-std stamp-bits stamp-c_base stamp-c_compatibility \
+ stamp-backward stamp-ext \
${target_builddir}/stamp-target
@@ -339,6 +371,15 @@ stamp-c_base: ${c_base_headers} ${c_base_headers_extra}
fi ;\
echo `date` > stamp-c_base
+stamp-c_compatibility: ${c_compatibility_headers_extra}
+ @if [ ! -d "${c_compatibility_builddir}" ]; then \
+ mkdir -p ${c_compatibility_builddir} ;\
+ fi ;\
+ if [ ! -z "${c_compatibility_headers_extra}" ]; then \
+ (cd ${c_compatibility_builddir} && @LN_S@ $? . || true) ;\
+ fi ;\
+ echo `date` > stamp-c_compatibility
+
stamp-backward: ${backward_headers}
@if [ ! -d "${backward_builddir}" ]; then \
mkdir -p ${backward_builddir} ;\
@@ -420,7 +461,7 @@ ${target_builddir}/gthr-default.h: ${toplevel_srcdir}/gcc/${glibcpp_thread_h} \
# components. Yes, with minor differences, this is sheer duplication
# of the staging rules above using $(INSTALL_DATA) instead of LN_S and
# `$(mkinstalldirs)' instead of `mkdir -p'. In particular,
-# extra_target_headers are taken out of the build tree staging area;
+# target_headers_extra are taken out of the build tree staging area;
# the rest are taken from the original source tree.
gxx_include_dir = @gxx_include_dir@
install-data-local:
@@ -436,17 +477,18 @@ install-data-local:
$(INSTALL_DATA) $${file} ${gxx_include_dir}/${ext_builddir}; done
$(mkinstalldirs) ${gxx_include_dir}/${c_base_builddir}
for file in ${c_base_headers_rename}; do \
- $(INSTALL_DATA) ${c_base_builddir}/$${file} \
- ${gxx_include_dir}/${c_base_builddir}; done
- c_base_headers_extra_install=${c_base_headers_extra};\
+ $(INSTALL_DATA) ${c_base_builddir}/$${file} ${gxx_include_dir}; done
+ c_base_headers_extra_install='$(c_base_headers_extra)';\
for file in $$c_base_headers_extra_install; do \
$(INSTALL_DATA) $$file ${gxx_include_dir}/${bits_builddir}; done
+ c_compatibility_headers_install='$(c_compatibility_headers_extra)';\
+ for file in $$c_compatibility_headers_install; do \
+ $(INSTALL_DATA) $$file ${gxx_include_dir}; done
$(mkinstalldirs) ${gxx_include_dir}/${std_builddir}
for file in ${std_headers_rename}; do \
- $(INSTALL_DATA) ${std_builddir}/$${file} \
- ${gxx_include_dir}/${std_builddir}; done
+ $(INSTALL_DATA) ${std_builddir}/$${file} ${gxx_include_dir}; done
$(mkinstalldirs) ${gxx_include_dir}/${target_builddir}
- for file in ${target_headers} ${extra_target_headers} \
+ for file in ${target_headers} ${target_headers_extra} \
${thread_target_headers}; do \
$(INSTALL_DATA) $${file} ${gxx_include_dir}/${target_builddir}; done
diff --git a/contrib/libstdc++/include/Makefile.in b/contrib/libstdc++/include/Makefile.in
index 4a2cecd..d50f44c 100644
--- a/contrib/libstdc++/include/Makefile.in
+++ b/contrib/libstdc++/include/Makefile.in
@@ -68,9 +68,6 @@ AS = @AS@
ATOMICITY_INC_SRCDIR = @ATOMICITY_INC_SRCDIR@
AWK = @AWK@
BASIC_FILE_H = @BASIC_FILE_H@
-BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
-CATALOGS = @CATALOGS@
-CATOBJEXT = @CATOBJEXT@
CC = @CC@
CCODECVT_C = @CCODECVT_C@
CCODECVT_H = @CCODECVT_H@
@@ -78,29 +75,17 @@ CLOCALE_H = @CLOCALE_H@
CMESSAGES_H = @CMESSAGES_H@
CPP = @CPP@
CPU_LIMITS_INC_SRCDIR = @CPU_LIMITS_INC_SRCDIR@
-CSHADOW_FLAGS = @CSHADOW_FLAGS@
CSTDIO_H = @CSTDIO_H@
CXXCPP = @CXXCPP@
C_INCLUDE_DIR = @C_INCLUDE_DIR@
-DATADIRNAME = @DATADIRNAME@
DEBUG_FLAGS = @DEBUG_FLAGS@
DLLTOOL = @DLLTOOL@
EXEEXT = @EXEEXT@
EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
GCJ = @GCJ@
GCJFLAGS = @GCJFLAGS@
-GENCAT = @GENCAT@
-GLIBC21 = @GLIBC21@
GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
GLIBCPP_IS_CROSS_COMPILING = @GLIBCPP_IS_CROSS_COMPILING@
-GMOFILES = @GMOFILES@
-GMSGFMT = @GMSGFMT@
-INSTOBJEXT = @INSTOBJEXT@
-INTLBISON = @INTLBISON@
-INTLLIBS = @INTLLIBS@
-INTLOBJS = @INTLOBJS@
-INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
-LIBICONV = @LIBICONV@
LIBIO_INCLUDES = @LIBIO_INCLUDES@
LIBMATHOBJS = @LIBMATHOBJS@
LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
@@ -111,26 +96,22 @@ LIBUNWIND_FLAG = @LIBUNWIND_FLAG@
LN_S = @LN_S@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
-MKINSTALLDIRS = @MKINSTALLDIRS@
-MSGFMT = @MSGFMT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
OPT_LDFLAGS = @OPT_LDFLAGS@
OS_INC_SRCDIR = @OS_INC_SRCDIR@
PACKAGE = @PACKAGE@
-POFILES = @POFILES@
-POSUB = @POSUB@
RANLIB = @RANLIB@
SECTION_FLAGS = @SECTION_FLAGS@
SECTION_LDFLAGS = @SECTION_LDFLAGS@
STRIP = @STRIP@
TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
-USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_FLAGS = @WARN_FLAGS@
WERROR = @WERROR@
+baseline_file = @baseline_file@
check_msgfmt = @check_msgfmt@
enable_shared = @enable_shared@
enable_static = @enable_static@
@@ -145,10 +126,9 @@ glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
ifGNUmake = @ifGNUmake@
libio_la = @libio_la@
libtool_VERSION = @libtool_VERSION@
-release_VERSION = @release_VERSION@
toplevel_srcdir = @toplevel_srcdir@
-AUTOMAKE_OPTIONS = 1.3 gnits
+AUTOMAKE_OPTIONS = 1.3 cygnus
MAINT_CHARSET = latin1
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
@@ -223,7 +203,7 @@ bits_headers = \
${bits_srcdir}/type_traits.h \
${bits_srcdir}/valarray_array.h \
${bits_srcdir}/valarray_array.tcc \
- ${bits_srcdir}/valarray_meta.h
+ ${bits_srcdir}/valarray_meta.h
backward_srcdir = ${glibcpp_srcdir}/include/backward
@@ -332,9 +312,34 @@ c_base_headers_rename = \
cwchar \
cwctype
-@GLIBCPP_C_HEADERS_C_STD_TRUE@c_base_headers_extra = @GLIBCPP_C_HEADERS_C_STD_TRUE@\
-@GLIBCPP_C_HEADERS_C_STD_TRUE@ ${c_base_srcdir}/cmath.tcc
+
+# "C" compatibility headers.
+c_compatibility_srcdir = ${glibcpp_srcdir}/include/c_compatibility
+c_compatibility_builddir = .
+c_compatibility_headers = \
+ ${c_compatibility_srcdir}/assert.h \
+ ${c_compatibility_srcdir}/ctype.h \
+ ${c_compatibility_srcdir}/errno.h \
+ ${c_compatibility_srcdir}/float.h \
+ ${c_compatibility_srcdir}/iso646.h \
+ ${c_compatibility_srcdir}/limits.h \
+ ${c_compatibility_srcdir}/locale.h \
+ ${c_compatibility_srcdir}/math.h \
+ ${c_compatibility_srcdir}/setjmp.h \
+ ${c_compatibility_srcdir}/signal.h \
+ ${c_compatibility_srcdir}/stdarg.h \
+ ${c_compatibility_srcdir}/stddef.h \
+ ${c_compatibility_srcdir}/stdio.h \
+ ${c_compatibility_srcdir}/stdlib.h \
+ ${c_compatibility_srcdir}/string.h \
+ ${c_compatibility_srcdir}/time.h \
+ ${c_compatibility_srcdir}/wchar.h \
+ ${c_compatibility_srcdir}/wctype.h
+
+@GLIBCPP_C_HEADERS_C_STD_TRUE@c_base_headers_extra = @GLIBCPP_C_HEADERS_C_STD_TRUE@${c_base_srcdir}/cmath.tcc
@GLIBCPP_C_HEADERS_C_STD_FALSE@c_base_headers_extra =
+@GLIBCPP_C_HEADERS_COMPATIBILITY_TRUE@c_compatibility_headers_extra = @GLIBCPP_C_HEADERS_COMPATIBILITY_TRUE@${c_compatibility_headers}
+@GLIBCPP_C_HEADERS_COMPATIBILITY_FALSE@c_compatibility_headers_extra =
std_srcdir = ${glibcpp_srcdir}/include/std
std_builddir = .
@@ -412,8 +417,8 @@ target_headers = \
${glibcpp_srcdir}/@ATOMICITY_INC_SRCDIR@/atomicity.h \
${glibcpp_srcdir}/@CPU_LIMITS_INC_SRCDIR@/cpu_limits.h
-# These extra_target_headers files are all built with ad hoc naming rules.
-extra_target_headers = \
+# These target_headers_extra files are all built with ad hoc naming rules.
+target_headers_extra = \
${target_builddir}/basic_file.h \
${target_builddir}/c++config.h \
${target_builddir}/c++io.h \
@@ -431,7 +436,9 @@ thread_target_headers = \
# List of all timestamp files. By keeping only one copy of this list, both
# CLEANFILES and all-local are kept up-to-date.
-allstamps = stamp-std stamp-bits stamp-c_base stamp-backward stamp-ext \
+allstamps = \
+ stamp-std stamp-bits stamp-c_base stamp-c_compatibility \
+ stamp-backward stamp-ext \
${target_builddir}/stamp-target
@@ -445,7 +452,7 @@ uppercase = [ABCDEFGHIJKLMNOPQRSTUVWXYZ_]
# components. Yes, with minor differences, this is sheer duplication
# of the staging rules above using $(INSTALL_DATA) instead of LN_S and
# `$(mkinstalldirs)' instead of `mkdir -p'. In particular,
-# extra_target_headers are taken out of the build tree staging area;
+# target_headers_extra are taken out of the build tree staging area;
# the rest are taken from the original source tree.
gxx_include_dir = @gxx_include_dir@
CONFIG_HEADER = ../config.h
@@ -585,6 +592,15 @@ stamp-c_base: ${c_base_headers} ${c_base_headers_extra}
fi ;\
echo `date` > stamp-c_base
+stamp-c_compatibility: ${c_compatibility_headers_extra}
+ @if [ ! -d "${c_compatibility_builddir}" ]; then \
+ mkdir -p ${c_compatibility_builddir} ;\
+ fi ;\
+ if [ ! -z "${c_compatibility_headers_extra}" ]; then \
+ (cd ${c_compatibility_builddir} && @LN_S@ $? . || true) ;\
+ fi ;\
+ echo `date` > stamp-c_compatibility
+
stamp-backward: ${backward_headers}
@if [ ! -d "${backward_builddir}" ]; then \
mkdir -p ${backward_builddir} ;\
@@ -668,17 +684,18 @@ install-data-local:
$(INSTALL_DATA) $${file} ${gxx_include_dir}/${ext_builddir}; done
$(mkinstalldirs) ${gxx_include_dir}/${c_base_builddir}
for file in ${c_base_headers_rename}; do \
- $(INSTALL_DATA) ${c_base_builddir}/$${file} \
- ${gxx_include_dir}/${c_base_builddir}; done
- c_base_headers_extra_install=${c_base_headers_extra};\
+ $(INSTALL_DATA) ${c_base_builddir}/$${file} ${gxx_include_dir}; done
+ c_base_headers_extra_install='$(c_base_headers_extra)';\
for file in $$c_base_headers_extra_install; do \
$(INSTALL_DATA) $$file ${gxx_include_dir}/${bits_builddir}; done
+ c_compatibility_headers_install='$(c_compatibility_headers_extra)';\
+ for file in $$c_compatibility_headers_install; do \
+ $(INSTALL_DATA) $$file ${gxx_include_dir}; done
$(mkinstalldirs) ${gxx_include_dir}/${std_builddir}
for file in ${std_headers_rename}; do \
- $(INSTALL_DATA) ${std_builddir}/$${file} \
- ${gxx_include_dir}/${std_builddir}; done
+ $(INSTALL_DATA) ${std_builddir}/$${file} ${gxx_include_dir}; done
$(mkinstalldirs) ${gxx_include_dir}/${target_builddir}
- for file in ${target_headers} ${extra_target_headers} \
+ for file in ${target_headers} ${target_headers_extra} \
${thread_target_headers}; do \
$(INSTALL_DATA) $${file} ${gxx_include_dir}/${target_builddir}; done
diff --git a/contrib/libstdc++/include/backward/strstream b/contrib/libstdc++/include/backward/strstream
index 28308e3..165c6e7 100644
--- a/contrib/libstdc++/include/backward/strstream
+++ b/contrib/libstdc++/include/backward/strstream
@@ -1,6 +1,6 @@
// Backward-compat support -*- C++ -*-
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -57,132 +57,118 @@
namespace std
{
-
-//----------------------------------------------------------------------
-// Class strstreambuf, a streambuf class that manages an array of char.
-// Note that this class is not a template.
-
-class strstreambuf : public basic_streambuf<char, char_traits<char> >
-{
-public: // Types.
- typedef char_traits<char> _Traits;
- typedef basic_streambuf<char, _Traits> _Base;
-
-public: // Constructor, destructor
- explicit strstreambuf(streamsize __initial_capacity = 0);
- strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*));
-
- strstreambuf(char* __get, streamsize __n, char* __put = 0);
- strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0);
- strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0);
-
- strstreambuf(const char* __get, streamsize __n);
- strstreambuf(const signed char* __get, streamsize __n);
- strstreambuf(const unsigned char* __get, streamsize __n);
-
- virtual ~strstreambuf();
-
-public: // strstreambuf operations.
- void freeze(bool = true);
- char* str();
- int pcount() const;
-
-protected: // Overridden virtual member functions.
- virtual int_type overflow(int_type __c = _Traits::eof());
- virtual int_type pbackfail(int_type __c = _Traits::eof());
- virtual int_type underflow();
- virtual _Base* setbuf(char* __buf, streamsize __n);
- virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
- ios_base::openmode __mode
- = ios_base::in | ios_base::out);
- virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
- = ios_base::in | ios_base::out);
-
-private: // Helper functions.
- // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun.
- char* _M_alloc(size_t);
- void _M_free(char*);
-
- // Helper function used in constructors.
- void _M_setup(char* __get, char* __put, streamsize __n);
-
-private: // Data members.
- void* (*_M_alloc_fun)(size_t);
- void (*_M_free_fun)(void*);
-
- bool _M_dynamic : 1;
- bool _M_frozen : 1;
- bool _M_constant : 1;
-};
-
-//----------------------------------------------------------------------
-// Class istrstream, an istream that manages a strstreambuf.
-
-class istrstream : public basic_istream<char>
-{
-public:
- explicit istrstream(char*);
- explicit istrstream(const char*);
- istrstream(char* , streamsize);
- istrstream(const char*, streamsize);
- virtual ~istrstream();
-
- strstreambuf* rdbuf() const;
- char* str();
-
-private:
- strstreambuf _M_buf;
-};
-
-//----------------------------------------------------------------------
-// Class ostrstream
-
-class ostrstream : public basic_ostream<char>
-{
-public:
- ostrstream();
- ostrstream(char*, int, ios_base::openmode = ios_base::out);
- virtual ~ostrstream();
-
- strstreambuf* rdbuf() const;
- void freeze(bool = true);
- char* str();
- int pcount() const;
-
-private:
- strstreambuf _M_buf;
-};
-
-//----------------------------------------------------------------------
-// Class strstream
-
-class strstream : public basic_iostream<char>
-{
-public:
- typedef char char_type;
- typedef char_traits<char>::int_type int_type;
- typedef char_traits<char>::pos_type pos_type;
- typedef char_traits<char>::off_type off_type;
-
- strstream();
- strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out);
- virtual ~strstream();
-
- strstreambuf* rdbuf() const;
- void freeze(bool = true);
- int pcount() const;
- char* str();
-
-private:
- strstreambuf _M_buf;
-};
-
+ // Class strstreambuf, a streambuf class that manages an array of char.
+ // Note that this class is not a template.
+ class strstreambuf : public basic_streambuf<char, char_traits<char> >
+ {
+ public:
+ // Types.
+ typedef char_traits<char> _Traits;
+ typedef basic_streambuf<char, _Traits> _Base;
+
+ public:
+ // Constructor, destructor
+ explicit strstreambuf(streamsize __initial_capacity = 0);
+ strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*));
+
+ strstreambuf(char* __get, streamsize __n, char* __put = 0);
+ strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0);
+ strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0);
+
+ strstreambuf(const char* __get, streamsize __n);
+ strstreambuf(const signed char* __get, streamsize __n);
+ strstreambuf(const unsigned char* __get, streamsize __n);
+
+ virtual ~strstreambuf();
+
+ public:
+ void freeze(bool = true);
+ char* str();
+ int pcount() const;
+
+ protected:
+ virtual int_type overflow(int_type __c = _Traits::eof());
+ virtual int_type pbackfail(int_type __c = _Traits::eof());
+ virtual int_type underflow();
+ virtual _Base* setbuf(char* __buf, streamsize __n);
+ virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
+ ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+ virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+
+ private:
+ // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun.
+ char* _M_alloc(size_t);
+ void _M_free(char*);
+
+ // Helper function used in constructors.
+ void _M_setup(char* __get, char* __put, streamsize __n);
+
+ private:
+ // Data members.
+ void* (*_M_alloc_fun)(size_t);
+ void (*_M_free_fun)(void*);
+
+ bool _M_dynamic : 1;
+ bool _M_frozen : 1;
+ bool _M_constant : 1;
+ };
+
+ // Class istrstream, an istream that manages a strstreambuf.
+ class istrstream : public basic_istream<char>
+ {
+ public:
+ explicit istrstream(char*);
+ explicit istrstream(const char*);
+ istrstream(char* , streamsize);
+ istrstream(const char*, streamsize);
+ virtual ~istrstream();
+
+ strstreambuf* rdbuf() const;
+ char* str();
+
+ private:
+ strstreambuf _M_buf;
+ };
+
+ // Class ostrstream
+ class ostrstream : public basic_ostream<char>
+ {
+ public:
+ ostrstream();
+ ostrstream(char*, int, ios_base::openmode = ios_base::out);
+ virtual ~ostrstream();
+
+ strstreambuf* rdbuf() const;
+ void freeze(bool = true);
+ char* str();
+ int pcount() const;
+
+ private:
+ strstreambuf _M_buf;
+ };
+
+ // Class strstream
+ class strstream : public basic_iostream<char>
+ {
+ public:
+ typedef char char_type;
+ typedef char_traits<char>::int_type int_type;
+ typedef char_traits<char>::pos_type pos_type;
+ typedef char_traits<char>::off_type off_type;
+
+ strstream();
+ strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out);
+ virtual ~strstream();
+
+ strstreambuf* rdbuf() const;
+ void freeze(bool = true);
+ int pcount() const;
+ char* str();
+
+ private:
+ strstreambuf _M_buf;
+ };
} // namespace std
-
-#endif /* __SGI_STL_STRSTREAM */
-
-// Local Variables:
-// mode:C++
-// End:
-
-
+#endif
diff --git a/contrib/libstdc++/include/bits/basic_ios.tcc b/contrib/libstdc++/include/bits/basic_ios.tcc
index 1e345dc..a38a95b 100644
--- a/contrib/libstdc++/include/bits/basic_ios.tcc
+++ b/contrib/libstdc++/include/bits/basic_ios.tcc
@@ -156,7 +156,7 @@ namespace std
// unformatted input and output with non-required basic_ios
// instantiations is possible even without imbuing the expected
// ctype<char_type> facet.
- _M_fill = 0;
+ _M_fill = _CharT();
_M_fill_init = false;
_M_exception = goodbit;
diff --git a/contrib/libstdc++/include/bits/basic_string.h b/contrib/libstdc++/include/bits/basic_string.h
index e05a1c6..a9c02ce 100644
--- a/contrib/libstdc++/include/bits/basic_string.h
+++ b/contrib/libstdc++/include/bits/basic_string.h
@@ -650,8 +650,11 @@ namespace std
|| less<const _CharT*>()(_M_data() + __size, __s))
return _M_replace_safe(_M_ibegin() + __pos,
_M_ibegin() + __pos + __foldn1, __s, __s + __n2);
- else return this->replace(_M_check(__pos), _M_fold(__pos, __n1),
- __s, __s + __n2);
+ // Todo: optimized in-place replace.
+ else return
+ _M_replace(_M_ibegin() + __pos, _M_ibegin() + __pos + __foldn1,
+ __s, __s + __n2,
+ typename iterator_traits<const _CharT*>::iterator_category());
}
basic_string&
@@ -685,6 +688,30 @@ namespace std
{ return _M_replace(__i1, __i2, __k1, __k2,
typename iterator_traits<_InputIterator>::iterator_category()); }
+ // Specializations for the common case of pointer and iterator:
+ // useful to avoid the overhead of temporary buffering in _M_replace.
+ basic_string&
+ replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2)
+ { return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
+ __k1, __k2 - __k1); }
+
+ basic_string&
+ replace(iterator __i1, iterator __i2, const _CharT* __k1, const _CharT* __k2)
+ { return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
+ __k1, __k2 - __k1); }
+
+ basic_string&
+ replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)
+ { return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
+ __k1.base(), __k2 - __k1);
+ }
+
+ basic_string&
+ replace(iterator __i1, iterator __i2, const_iterator __k1, const_iterator __k2)
+ { return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
+ __k1.base(), __k2 - __k1);
+ }
+
private:
template<class _InputIterator>
basic_string&
diff --git a/contrib/libstdc++/include/bits/basic_string.tcc b/contrib/libstdc++/include/bits/basic_string.tcc
index 35a2f11..6d646ad 100644
--- a/contrib/libstdc++/include/bits/basic_string.tcc
+++ b/contrib/libstdc++/include/bits/basic_string.tcc
@@ -140,7 +140,7 @@ namespace std
size_type __dnew = static_cast<size_type>(distance(__beg, __end));
// NB: Not required, but considered best practice.
- if (__builtin_expect(__beg == _InIter(0), 0))
+ if (__builtin_expect(__beg == _InIter(), 0))
__throw_logic_error("attempt to create string with null pointer");
if (__beg == __end && __a == _Alloc())
@@ -498,13 +498,10 @@ namespace std
// else nothing (in particular, avoid calling _M_mutate() unnecessarily.)
}
- // This is the general replace helper, which gets instantiated both
- // for input-iterators and forward-iterators. It buffers internally and
- // then calls _M_replace_safe. For input-iterators this is almost the
- // best we can do, but for forward-iterators many optimizations could be
- // conceived: f.i., when source and destination ranges do not overlap
- // buffering is not really needed. In order to easily implement them, it
- // could become useful to add an _M_replace(forward_iterator_tag)
+
+ // This is the general replace helper, which currently gets instantiated both
+ // for input iterators and reverse iterators. It buffers internally and then
+ // calls _M_replace_safe.
template<typename _CharT, typename _Traits, typename _Alloc>
template<typename _InputIter>
basic_string<_CharT, _Traits, _Alloc>&
@@ -518,10 +515,8 @@ namespace std
}
// This is a special replace helper, which does not buffer internally
- // and can be used in the "safe" situations involving forward-iterators,
+ // and can be used in "safe" situations involving forward iterators,
// i.e., when source and destination ranges are known to not overlap.
- // Presently, is called by _M_replace, by the various append and by
- // the assigns.
template<typename _CharT, typename _Traits, typename _Alloc>
template<typename _ForwardIter>
basic_string<_CharT, _Traits, _Alloc>&
diff --git a/contrib/libstdc++/include/bits/c++config b/contrib/libstdc++/include/bits/c++config
index d5bf458..831d35e 100644
--- a/contrib/libstdc++/include/bits/c++config
+++ b/contrib/libstdc++/include/bits/c++config
@@ -34,7 +34,7 @@
#include <bits/os_defines.h>
// The current version of the C++ library in compressed ISO date format.
-#define __GLIBCPP__ 20020513
+#define __GLIBCPP__ 20020831
// This is necessary until GCC supports separate template
// compilation.
@@ -69,7 +69,15 @@
// that threads are properly configured on your platform before
// assigning blame to the STL container-memory allocator. After doing
// so, please report any possible issues to libstdc++@gcc.gnu.org .
-// Do not blindly #define __USE_MALLOC here or on the command line.
+// Do not define __USE_MALLOC on the command line. Enforce it here:
+#ifdef __USE_MALLOC
+#error __USE_MALLOC should only be defined within \
+libstdc++-v3/include/bits/c++config before full recompilation of the library.
+#endif
+// Define __USE_MALLOC after this point in the file in order to aid debugging
+// or globally change allocation policy. This breaks the ABI, thus
+// completely recompile the library. A patch to better support
+// changing the global allocator policy would be probably be accepted.
// The remainder of the prewritten config is mostly automatic; all the
// user hooks are listed above.
diff --git a/contrib/libstdc++/include/bits/char_traits.h b/contrib/libstdc++/include/bits/char_traits.h
index 7d14838..41f943d 100644
--- a/contrib/libstdc++/include/bits/char_traits.h
+++ b/contrib/libstdc++/include/bits/char_traits.h
@@ -1,6 +1,7 @@
// Character Traits for use by standard string and iostream -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -53,82 +54,53 @@ namespace std
struct char_traits
{
typedef _CharT char_type;
- // Unsigned as wint_t in unsigned.
+ // Unsigned as wint_t is unsigned.
typedef unsigned long int_type;
typedef streampos pos_type;
typedef streamoff off_type;
typedef mbstate_t state_type;
static void
- assign(char_type& __c1, const char_type& __c2)
- { __c1 = __c2; }
+ assign(char_type& __c1, const char_type& __c2);
static bool
- eq(const char_type& __c1, const char_type& __c2)
- { return __c1 == __c2; }
+ eq(const char_type& __c1, const char_type& __c2);
static bool
- lt(const char_type& __c1, const char_type& __c2)
- { return __c1 < __c2; }
+ lt(const char_type& __c1, const char_type& __c2);
static int
- compare(const char_type* __s1, const char_type* __s2, size_t __n)
- {
- for (size_t __i = 0; __i < __n; ++__i)
- if (!eq(__s1[__i], __s2[__i]))
- return lt(__s1[__i], __s2[__i]) ? -1 : 1;
- return 0;
- }
+ compare(const char_type* __s1, const char_type* __s2, size_t __n);
static size_t
- length(const char_type* __s)
- {
- const char_type* __p = __s;
- while (*__p) ++__p;
- return (__p - __s);
- }
+ length(const char_type* __s);
static const char_type*
- find(const char_type* __s, size_t __n, const char_type& __a)
- {
- for (const char_type* __p = __s; size_t(__p - __s) < __n; ++__p)
- if (*__p == __a) return __p;
- return 0;
- }
+ find(const char_type* __s, size_t __n, const char_type& __a);
static char_type*
- move(char_type* __s1, const char_type* __s2, size_t __n)
- { return (char_type*) memmove(__s1, __s2, __n * sizeof(char_type)); }
+ move(char_type* __s1, const char_type* __s2, size_t __n);
static char_type*
- copy(char_type* __s1, const char_type* __s2, size_t __n)
- { return (char_type*) memcpy(__s1, __s2, __n * sizeof(char_type)); }
+ copy(char_type* __s1, const char_type* __s2, size_t __n);
static char_type*
- assign(char_type* __s, size_t __n, char_type __a)
- {
- for (char_type* __p = __s; __p < __s + __n; ++__p)
- assign(*__p, __a);
- return __s;
- }
+ assign(char_type* __s, size_t __n, char_type __a);
static char_type
- to_char_type(const int_type& __c)
- { return char_type(__c); }
+ to_char_type(const int_type& __c);
static int_type
- to_int_type(const char_type& __c) { return int_type(__c); }
+ to_int_type(const char_type& __c);
static bool
- eq_int_type(const int_type& __c1, const int_type& __c2)
- { return __c1 == __c2; }
+ eq_int_type(const int_type& __c1, const int_type& __c2);
static int_type
- eof() { return static_cast<int_type>(-1); }
+ eof();
static int_type
- not_eof(const int_type& __c)
- { return eq_int_type(__c, eof()) ? int_type(0) : __c; }
+ not_eof(const int_type& __c);
};
diff --git a/contrib/libstdc++/include/bits/fpos.h b/contrib/libstdc++/include/bits/fpos.h
index 3cb3e4b..279e0ab 100644
--- a/contrib/libstdc++/include/bits/fpos.h
+++ b/contrib/libstdc++/include/bits/fpos.h
@@ -105,7 +105,7 @@ namespace std
bool
operator!=(const fpos& __pos) const
{ return _M_off != __pos._M_off; }
-
+
streamoff
_M_position() const { return _M_off; }
diff --git a/contrib/libstdc++/include/bits/fstream.tcc b/contrib/libstdc++/include/bits/fstream.tcc
index 90850f5..18dbaf1 100644
--- a/contrib/libstdc++/include/bits/fstream.tcc
+++ b/contrib/libstdc++/include/bits/fstream.tcc
@@ -49,12 +49,7 @@ namespace std
_M_buf_size = _M_buf_size_opt;
// Allocate internal buffer.
- try { _M_buf = new char_type[_M_buf_size]; }
- catch(...)
- {
- delete [] _M_buf;
- __throw_exception_again;
- }
+ _M_buf = new char_type[_M_buf_size];
_M_buf_allocated = true;
}
}
@@ -95,9 +90,8 @@ namespace std
{
_M_allocate_internal_buffer();
_M_mode = __mode;
-
- // For time being, set both (in/out) sets of pointers.
_M_set_indeterminate();
+
if ((__mode & ios_base::ate)
&& this->seekoff(0, ios_base::end, __mode) < 0)
this->close();
@@ -117,7 +111,8 @@ namespace std
{
const int_type __eof = traits_type::eof();
bool __testput = _M_out_cur && _M_out_beg < _M_out_end;
- if (__testput && _M_really_overflow(__eof) == __eof)
+ if (__testput
+ && traits_type::eq_int_type(_M_really_overflow(__eof), __eof))
return __ret;
// NB: Do this here so that re-opened filebufs will be cool...
@@ -151,102 +146,7 @@ namespace std
bool __testin = _M_mode & ios_base::in;
if (__testin && this->is_open())
- {
- if (_M_in_cur < _M_in_end)
- __ret = _M_in_end - _M_in_cur;
- else
- __ret = 0;
- }
- _M_last_overflowed = false;
- return __ret;
- }
-
- template<typename _CharT, typename _Traits>
- typename basic_filebuf<_CharT, _Traits>::int_type
- basic_filebuf<_CharT, _Traits>::
- _M_underflow_common(bool __bump)
- {
- int_type __ret = traits_type::eof();
- bool __testin = _M_mode & ios_base::in;
- bool __testout = _M_mode & ios_base::out;
-
- if (__testin)
- {
- // Check for pback madness, and if so swich back to the
- // normal buffers and jet outta here before expensive
- // fileops happen...
- if (_M_pback_init)
- {
- _M_pback_destroy();
- if (_M_in_cur < _M_in_end)
- return traits_type::to_int_type(*_M_in_cur);
- }
-
- // Sync internal and external buffers.
- // NB: __testget -> __testput as _M_buf_unified here.
- bool __testget = _M_in_cur && _M_in_beg < _M_in_cur;
- bool __testinit = _M_is_indeterminate();
- if (__testget)
- {
- if (__testout)
- _M_really_overflow();
- else if (_M_in_cur != _M_filepos)
- _M_file.seekoff(_M_in_cur - _M_filepos,
- ios_base::cur, ios_base::in);
- }
-
- if (__testinit || __testget)
- {
- const locale __loc = this->getloc();
- const __codecvt_type& __cvt = use_facet<__codecvt_type>(__loc);
-
- streamsize __elen = 0;
- streamsize __ilen = 0;
- if (__cvt.always_noconv())
- {
- __elen = _M_file.xsgetn(reinterpret_cast<char*>(_M_in_beg),
- _M_buf_size);
- __ilen = __elen;
- }
- else
- {
- char* __buf = static_cast<char*>(__builtin_alloca(_M_buf_size));
- __elen = _M_file.xsgetn(__buf, _M_buf_size);
-
- const char* __eend;
- char_type* __iend;
- __res_type __r = __cvt.in(_M_state_cur, __buf,
- __buf + __elen, __eend, _M_in_beg,
- _M_in_beg + _M_buf_size, __iend);
- if (__r == codecvt_base::ok)
- __ilen = __iend - _M_in_beg;
- else
- {
- // Unwind.
- __ilen = 0;
- _M_file.seekoff(-__elen, ios_base::cur, ios_base::in);
- }
- }
-
- if (0 < __ilen)
- {
- _M_set_determinate(__ilen);
- if (__testout)
- _M_out_cur = _M_in_cur;
- __ret = traits_type::to_int_type(*_M_in_cur);
- if (__bump)
- _M_in_cur_move(1);
- else if (_M_buf_size == 1)
- {
- // If we are synced with stdio, we have to unget the
- // character we just read so that the file pointer
- // doesn't move.
- _M_file.sys_ungetc(*_M_in_cur);
- _M_set_indeterminate();
- }
- }
- }
- }
+ __ret = _M_in_end - _M_in_cur;
_M_last_overflowed = false;
return __ret;
}
@@ -410,7 +310,7 @@ namespace std
{
int_type __ret = traits_type::eof();
bool __testput = _M_out_cur && _M_out_beg < _M_out_end;
- bool __testunbuffered = _M_file.is_open() && !_M_buf_size;
+ bool __testunbuffered = _M_file.is_open() && !_M_buf_size_opt;
if (__testput || __testunbuffered)
{
diff --git a/contrib/libstdc++/include/bits/istream.tcc b/contrib/libstdc++/include/bits/istream.tcc
index 636a738..58e2caf 100644
--- a/contrib/libstdc++/include/bits/istream.tcc
+++ b/contrib/libstdc++/include/bits/istream.tcc
@@ -54,13 +54,14 @@ namespace std
__int_type __c = __sb->sgetc();
if (__in._M_check_facet(__in._M_fctype))
- while (__c != __eof
- && __in._M_fctype->is(ctype_base::space, __c))
+ while (!traits_type::eq_int_type(__c, __eof)
+ && __in._M_fctype->is(ctype_base::space,
+ traits_type::to_char_type(__c)))
__c = __sb->snextc();
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
//195. Should basic_istream::sentry's constructor ever set eofbit?
- if (__c == __eof)
+ if (traits_type::eq_int_type(__c, __eof))
__in.setstate(ios_base::eofbit);
#endif
}
@@ -521,7 +522,7 @@ namespace std
{
__c = this->rdbuf()->sbumpc();
// 27.6.1.1 paragraph 3
- if (__c != __eof)
+ if (!traits_type::eq_int_type(__c, __eof))
_M_gcount = 1;
else
this->setstate(ios_base::eofbit | ios_base::failbit);
@@ -552,7 +553,7 @@ namespace std
const int_type __eof = traits_type::eof();
int_type __bufval = this->rdbuf()->sbumpc();
// 27.6.1.1 paragraph 3
- if (__bufval != __eof)
+ if (!traits_type::eq_int_type(__bufval, __eof))
{
_M_gcount = 1;
__c = traits_type::to_char_type(__bufval);
@@ -588,13 +589,15 @@ namespace std
__streambuf_type* __sb = this->rdbuf();
int_type __c = __sb->sgetc();
- while (_M_gcount + 1 < __n && __c != __eof && __c != __idelim)
+ while (_M_gcount + 1 < __n
+ && !traits_type::eq_int_type(__c, __eof)
+ && !traits_type::eq_int_type(__c, __idelim))
{
*__s++ = traits_type::to_char_type(__c);
__c = __sb->snextc();
++_M_gcount;
}
- if (__c == __eof)
+ if (traits_type::eq_int_type(__c, __eof))
this->setstate(ios_base::eofbit);
}
catch(exception& __fail)
@@ -627,14 +630,17 @@ namespace std
const int_type __eof = traits_type::eof();
__streambuf_type* __this_sb = this->rdbuf();
int_type __c = __this_sb->sgetc();
+ char_type __c2 = traits_type::to_char_type(__c);
- while (__c != __eof && __c != __idelim
- && (__sb.sputc(traits_type::to_char_type(__c)) != __eof))
+ while (!traits_type::eq_int_type(__c, __eof)
+ && !traits_type::eq_int_type(__c, __idelim)
+ && !traits_type::eq_int_type(__sb.sputc(__c2), __eof))
{
++_M_gcount;
__c = __this_sb->snextc();
+ __c2 = traits_type::to_char_type(__c);
}
- if (__c == __eof)
+ if (traits_type::eq_int_type(__c, __eof))
this->setstate(ios_base::eofbit);
}
catch(exception& __fail)
@@ -667,19 +673,21 @@ namespace std
__streambuf_type* __sb = this->rdbuf();
int_type __c = __sb->sgetc();
- while (_M_gcount + 1 < __n && __c != __eof && __c != __idelim)
+ while (_M_gcount + 1 < __n
+ && !traits_type::eq_int_type(__c, __eof)
+ && !traits_type::eq_int_type(__c, __idelim))
{
*__s++ = traits_type::to_char_type(__c);
__c = __sb->snextc();
++_M_gcount;
}
- if (__c == __eof)
+ if (traits_type::eq_int_type(__c, __eof))
this->setstate(ios_base::eofbit);
else
{
- if (__c == __idelim)
+ if (traits_type::eq_int_type(__c, __idelim))
{
- __sb->snextc();
+ __sb->sbumpc();
++_M_gcount;
}
else
@@ -708,27 +716,24 @@ namespace std
{
_M_gcount = 0;
sentry __cerb(*this, true);
- if (__cerb)
+ if (__cerb && __n > 0)
{
try
{
const int_type __eof = traits_type::eof();
__streambuf_type* __sb = this->rdbuf();
- int_type __c = __sb->sgetc();
+ int_type __c;
__n = min(__n, numeric_limits<streamsize>::max());
- while (_M_gcount < __n && __c !=__eof && __c != __delim)
+ while (_M_gcount < __n
+ && !traits_type::eq_int_type(__c = __sb->sbumpc(), __eof))
{
- __c = __sb->snextc();
++_M_gcount;
+ if (traits_type::eq_int_type(__c, __delim))
+ break;
}
- if (__c == __eof)
+ if (traits_type::eq_int_type(__c, __eof))
this->setstate(ios_base::eofbit);
- else if (__c == __delim)
- {
- __sb->snextc();
- ++_M_gcount;
- }
}
catch(exception& __fail)
{
@@ -806,9 +811,8 @@ namespace std
{
try
{
- const int_type __eof = traits_type::eof();
streamsize __num = this->rdbuf()->in_avail();
- if (__num != static_cast<streamsize>(__eof))
+ if (__num > 0)
{
__num = min(__num, __n);
if (__num)
@@ -843,7 +847,8 @@ namespace std
{
const int_type __eof = traits_type::eof();
__streambuf_type* __sb = this->rdbuf();
- if (!__sb || __sb->sputbackc(__c) == __eof)
+ if (!__sb
+ || traits_type::eq_int_type(__sb->sputbackc(__c), __eof))
this->setstate(ios_base::badbit);
}
catch(exception& __fail)
@@ -873,7 +878,8 @@ namespace std
{
const int_type __eof = traits_type::eof();
__streambuf_type* __sb = this->rdbuf();
- if (!__sb || __eof == __sb->sungetc())
+ if (!__sb
+ || traits_type::eq_int_type(__sb->sungetc(), __eof))
this->setstate(ios_base::badbit);
}
catch(exception& __fail)
@@ -895,7 +901,7 @@ namespace std
basic_istream<_CharT, _Traits>::
sync(void)
{
- int __ret = traits_type::eof();
+ int __ret = -1;
_M_gcount = 0;
sentry __cerb(*this, true);
if (__cerb)
@@ -903,10 +909,13 @@ namespace std
try
{
__streambuf_type* __sb = this->rdbuf();
- if (!__sb || __ret == __sb->pubsync())
- this->setstate(ios_base::badbit);
- else
- __ret = 0;
+ if (__sb)
+ {
+ if (__sb->pubsync() == -1)
+ this->setstate(ios_base::badbit);
+ else
+ __ret = 0;
+ }
}
catch(exception& __fail)
{
@@ -1186,16 +1195,18 @@ namespace std
__streambuf_type* __sb = __in.rdbuf();
__int_type __c = __sb->sbumpc();
const __int_type __eof = _Traits::eof();
- __testdelim = __c == __idelim;
+ __testdelim = _Traits::eq_int_type(__c, __idelim);
- while (__extracted <= __n && __c != __eof && !__testdelim)
+ while (__extracted <= __n
+ && !_Traits::eq_int_type(__c, __eof)
+ && !__testdelim)
{
__str += _Traits::to_char_type(__c);
++__extracted;
__c = __sb->sbumpc();
- __testdelim = __c == __idelim;
+ __testdelim = _Traits::eq_int_type(__c, __idelim);
}
- if (__c == __eof)
+ if (_Traits::eq_int_type(__c, __eof))
__in.setstate(ios_base::eofbit);
}
if (!__extracted && !__testdelim)
@@ -1221,8 +1232,10 @@ namespace std
extern template istream& operator>>(istream&, unsigned char*);
extern template istream& operator>>(istream&, signed char*);
+#ifdef _GLIBCPP_USE_WCHAR_T
extern template class basic_istream<wchar_t>;
extern template wistream& ws(wistream&);
extern template wistream& operator>>(wistream&, wchar_t&);
extern template wistream& operator>>(wistream&, wchar_t*);
+#endif
} // namespace std
diff --git a/contrib/libstdc++/include/bits/locale_facets.h b/contrib/libstdc++/include/bits/locale_facets.h
index d63eb5d..159cecc 100644
--- a/contrib/libstdc++/include/bits/locale_facets.h
+++ b/contrib/libstdc++/include/bits/locale_facets.h
@@ -55,6 +55,9 @@ namespace std
# define _GLIBCPP_NUM_FACETS 14
#endif
+ template<typename _CharT, typename _Traits>
+ struct __pad;
+
// 22.2.1.1 Template class ctype
// Include host and configuration specific ctype enums for ctype_base.
#include <bits/ctype_base.h>
@@ -652,6 +655,7 @@ namespace std
virtual iter_type
do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const;
+
virtual iter_type
do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, long&) const;
@@ -697,6 +701,23 @@ namespace std
template<typename _CharT, typename _InIter>
locale::id num_get<_CharT, _InIter>::id;
+#if 0
+ // Partial specialization for istreambuf_iterator, so can use traits_type.
+ template<typename _CharT>
+ class num_get<_CharT, istreambuf_iterator<_CharT> >;
+
+ iter_type
+ _M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&,
+ string& __xtrc) const;
+
+ iter_type
+ _M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&,
+ string& __xtrc, int& __base) const;
+
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const;
+#endif
+
template<typename _CharT, typename _OutIter>
class num_put : public locale::facet, public __num_base
{
@@ -1357,8 +1378,9 @@ namespace std
{ _M_initialize_moneypunct(); }
explicit
- moneypunct(__c_locale __cloc, size_t __refs = 0) : locale::facet(__refs)
- { _M_initialize_moneypunct(__cloc); }
+ moneypunct(__c_locale __cloc, const char* __s, size_t __refs = 0)
+ : locale::facet(__refs)
+ { _M_initialize_moneypunct(__cloc, __s); }
char_type
decimal_point() const
@@ -1438,7 +1460,8 @@ namespace std
// For use at construction time only.
void
- _M_initialize_moneypunct(__c_locale __cloc = _S_c_locale);
+ _M_initialize_moneypunct(__c_locale __cloc = _S_c_locale,
+ const char* __name = NULL);
};
template<typename _CharT, bool _Intl>
@@ -1455,11 +1478,11 @@ namespace std
template<>
void
- moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc);
+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*);
template<>
void
- moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc);
+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*);
#ifdef _GLIBCPP_USE_WCHAR_T
template<>
@@ -1470,11 +1493,13 @@ namespace std
template<>
void
- moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc);
+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale,
+ const char*);
template<>
void
- moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc);
+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale,
+ const char*);
#endif
template<typename _CharT, bool _Intl>
diff --git a/contrib/libstdc++/include/bits/locale_facets.tcc b/contrib/libstdc++/include/bits/locale_facets.tcc
index d362c33..63e52c0 100644
--- a/contrib/libstdc++/include/bits/locale_facets.tcc
+++ b/contrib/libstdc++/include/bits/locale_facets.tcc
@@ -94,6 +94,7 @@ namespace std
_M_extract_float(_InIter __beg, _InIter __end, ios_base& __io,
ios_base::iostate& __err, string& __xtrc) const
{
+ typedef char_traits<_CharT> __traits_type;
const locale __loc = __io.getloc();
const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
@@ -103,7 +104,8 @@ namespace std
const char_type __minus = __ctype.widen('-');
int __pos = 0;
char_type __c = *__beg;
- if ((__c == __plus || __c == __minus) && __beg != __end)
+ if ((__traits_type::eq(__c, __plus) || __traits_type::eq(__c, __minus))
+ && __beg != __end)
{
__xtrc += __ctype.narrow(__c, char());
++__pos;
@@ -113,7 +115,7 @@ namespace std
// Next, strip leading zeros.
const char_type __zero = __ctype.widen(_S_atoms[_M_zero]);
bool __found_zero = false;
- while (__c == __zero && __beg != __end)
+ while (__traits_type::eq(__c, __zero) && __beg != __end)
{
__c = *(++__beg);
__found_zero = true;
@@ -141,11 +143,10 @@ namespace std
while (__beg != __end)
{
// Only look in digits.
- typedef char_traits<_CharT> __traits_type;
const char_type* __p = __traits_type::find(__watoms, 10, __c);
// NB: strchr returns true for __c == 0x0
- if (__p && __c)
+ if (__p && !__traits_type::eq(__c, char_type()))
{
// Try first for acceptable digit; record it if found.
++__pos;
@@ -153,7 +154,8 @@ namespace std
++__sep_pos;
__c = *(++__beg);
}
- else if (__c == __sep && __check_grouping && !__found_dec)
+ else if (__traits_type::eq(__c, __sep)
+ && __check_grouping && !__found_dec)
{
// NB: Thousands separator at the beginning of a string
// is a no-no, as is two consecutive thousands separators.
@@ -169,7 +171,7 @@ namespace std
break;
}
}
- else if (__c == __dec && !__found_dec)
+ else if (__traits_type::eq(__c, __dec) && !__found_dec)
{
// According to the standard, if no grouping chars are seen,
// no grouping check is applied. Therefore __found_grouping
@@ -181,7 +183,8 @@ namespace std
__c = *(++__beg);
__found_dec = true;
}
- else if ((__c == __watoms[_M_e] || __c == __watoms[_M_E])
+ else if ((__traits_type::eq(__c, __watoms[_M_e])
+ || __traits_type::eq(__c, __watoms[_M_E]))
&& !__found_sci && __pos)
{
// Scientific notation.
@@ -190,7 +193,8 @@ namespace std
__c = *(++__beg);
// Remove optional plus or minus sign, if they exist.
- if (__c == __plus || __c == __minus)
+ if (__traits_type::eq(__c, __plus)
+ || __traits_type::eq(__c, __minus))
{
++__pos;
__xtrc += __ctype.narrow(__c, char());
@@ -228,6 +232,7 @@ namespace std
_M_extract_int(_InIter __beg, _InIter __end, ios_base& __io,
ios_base::iostate& __err, string& __xtrc, int& __base) const
{
+ typedef char_traits<_CharT> __traits_type;
const locale __loc = __io.getloc();
const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
@@ -241,10 +246,13 @@ namespace std
else
__base = 10;
- // First check for sign.
+ // First check for sign.
int __pos = 0;
char_type __c = *__beg;
- if ((__c == __ctype.widen('+') || __c == __ctype.widen('-'))
+ const char_type __plus = __ctype.widen('+');
+ const char_type __minus = __ctype.widen('-');
+
+ if ((__traits_type::eq(__c, __plus) || __traits_type::eq(__c, __minus))
&& __beg != __end)
{
__xtrc += __ctype.narrow(__c, char());
@@ -259,7 +267,7 @@ namespace std
if (__base == 10)
{
bool __found_zero = false;
- while (__c == __zero && __beg != __end)
+ while (__traits_type::eq(__c, __zero) && __beg != __end)
{
__c = *(++__beg);
__found_zero = true;
@@ -270,7 +278,9 @@ namespace std
++__pos;
if (__basefield == 0)
{
- if ((__c == __x || __c == __X) && __beg != __end)
+ if ((__traits_type::eq(__c, __x)
+ || __traits_type::eq(__c, __X))
+ && __beg != __end)
{
__xtrc += __ctype.narrow(__c, char());
++__pos;
@@ -284,12 +294,13 @@ namespace std
}
else if (__base == 16)
{
- if (__c == __zero && __beg != __end)
+ if (__traits_type::eq(__c, __zero) && __beg != __end)
{
__xtrc += _S_atoms[_M_zero];
++__pos;
__c = *(++__beg);
- if ((__c == __x || __c == __X) && __beg != __end)
+ if ((__traits_type::eq(__c, __x) || __traits_type::eq(__c, __X))
+ && __beg != __end)
{
__xtrc += __ctype.narrow(__c, char());
++__pos;
@@ -316,11 +327,10 @@ namespace std
const char_type __sep = __np.thousands_sep();
while (__beg != __end)
{
- typedef char_traits<_CharT> __traits_type;
const char_type* __p = __traits_type::find(__watoms, __len, __c);
// NB: strchr returns true for __c == 0x0
- if (__p && __c)
+ if (__p && !__traits_type::eq(__c, char_type()))
{
// Try first for acceptable digit; record it if found.
__xtrc += _S_atoms[__p - __watoms];
@@ -328,7 +338,7 @@ namespace std
++__sep_pos;
__c = *(++__beg);
}
- else if (__c == __sep && __check_grouping)
+ else if (__traits_type::eq(__c, __sep) && __check_grouping)
{
// NB: Thousands separator at the beginning of a string
// is a no-no, as is two consecutive thousands separators.
@@ -394,7 +404,9 @@ namespace std
// Parse bool values as alphanumeric
else
{
- typedef basic_string<_CharT> __string_type;
+ typedef char_traits<_CharT> __traits_type;
+ typedef basic_string<_CharT> __string_type;
+
locale __loc = __io.getloc();
const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
const __string_type __true = __np.truename();
@@ -407,8 +419,10 @@ namespace std
for (size_t __n = 0; __beg != __end; ++__n)
{
char_type __c = *__beg++;
- bool __testf = __n <= __falsen ? __c == __falses[__n] : false;
- bool __testt = __n <= __truen ? __c == __trues[__n] : false;
+ bool __testf = __n <= __falsen
+ ? __traits_type::eq(__c, __falses[__n]) : false;
+ bool __testt = __n <= __truen
+ ? __traits_type::eq(__c, __trues[__n]) : false;
if (!(__testf || __testt))
{
__err |= ios_base::failbit;
@@ -708,6 +722,7 @@ namespace std
_M_widen_float(_OutIter __s, ios_base& __io, _CharT __fill, char* __cs,
int __len) const
{
+ typedef char_traits<_CharT> __traits_type;
// [22.2.2.2.2] Stage 2, convert to char_type, using correct
// numpunct.decimal_point() values for '.' and adding grouping.
const locale __loc = __io.getloc();
@@ -723,7 +738,7 @@ namespace std
// Replace decimal point.
const _CharT* __p;
const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
- if (__p = char_traits<_CharT>::find(__ws, __len, __ctype.widen('.')))
+ if (__p = __traits_type::find(__ws, __len, __ctype.widen('.')))
__ws[__p - __ws] = __np.decimal_point();
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
@@ -744,7 +759,7 @@ namespace std
// Tack on decimal part.
if (__p)
{
- char_traits<_CharT>::copy(__p2, __p, __len - __declen);
+ __traits_type::copy(__p2, __p, __len - __declen);
__newlen += __len - __declen;
}
@@ -816,13 +831,15 @@ namespace std
_M_insert(_OutIter __s, ios_base& __io, _CharT __fill, const _CharT* __ws,
int __len) const
{
+ typedef char_traits<_CharT> __traits_type;
// [22.2.2.2.2] Stage 3.
streamsize __w = __io.width();
_CharT* __ws2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
* __w));
if (__w > static_cast<streamsize>(__len))
{
- __pad(__io, __fill, __ws2, __ws, __w, __len, true);
+ __pad<_CharT, __traits_type>::_S_pad(__io, __fill, __ws2, __ws,
+ __w, __len, true);
__len = static_cast<int>(__w);
// Switch strings.
__ws = __ws2;
@@ -845,7 +862,7 @@ namespace std
if ((__flags & ios_base::boolalpha) == 0)
{
unsigned long __uv = __v;
- __s = _M_convert_int(__s, __io, __fill, 'u', char_type(), __uv);
+ __s = _M_convert_int(__s, __io, __fill, 'u', char(), __uv);
}
else
{
@@ -866,14 +883,14 @@ namespace std
_OutIter
num_put<_CharT, _OutIter>::
do_put(iter_type __s, ios_base& __io, char_type __fill, long __v) const
- { return _M_convert_int(__s, __io, __fill, 'd', char_type(), __v); }
+ { return _M_convert_int(__s, __io, __fill, 'd', char(), __v); }
template<typename _CharT, typename _OutIter>
_OutIter
num_put<_CharT, _OutIter>::
do_put(iter_type __s, ios_base& __io, char_type __fill,
unsigned long __v) const
- { return _M_convert_int(__s, __io, __fill, 'u', char_type(), __v); }
+ { return _M_convert_int(__s, __io, __fill, 'u', char(), __v); }
#ifdef _GLIBCPP_USE_LONG_LONG
template<typename _CharT, typename _OutIter>
@@ -894,7 +911,7 @@ namespace std
_OutIter
num_put<_CharT, _OutIter>::
do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const
- { return _M_convert_float(__s, __io, __fill, char_type(), __v); }
+ { return _M_convert_float(__s, __io, __fill, char(), __v); }
template<typename _CharT, typename _OutIter>
_OutIter
@@ -915,7 +932,7 @@ namespace std
__io.flags(__flags & __fmt | (ios_base::hex | ios_base::showbase));
try
{
- __s = _M_convert_int(__s, __io, __fill, 'u', char_type(),
+ __s = _M_convert_int(__s, __io, __fill, 'u', char(),
reinterpret_cast<unsigned long>(__v));
__io.flags(__flags);
}
@@ -1591,7 +1608,7 @@ namespace std
const _CharT** __names, size_t __indexlen,
ios_base::iostate& __err) const
{
- typedef char_traits<char_type> __traits_type;
+ typedef char_traits<_CharT> __traits_type;
int* __matches = static_cast<int*>(__builtin_alloca(sizeof(int) * __indexlen));
size_t __nmatches = 0;
size_t __pos = 0;
@@ -1686,7 +1703,7 @@ namespace std
do_get_weekday(iter_type __beg, iter_type __end, ios_base& __io,
ios_base::iostate& __err, tm* __tm) const
{
- typedef char_traits<char_type> __traits_type;
+ typedef char_traits<_CharT> __traits_type;
locale __loc = __io.getloc();
__timepunct<_CharT> const& __tp = use_facet<__timepunct<_CharT> >(__loc);
const char_type* __days[7];
@@ -1729,7 +1746,7 @@ namespace std
do_get_monthname(iter_type __beg, iter_type __end,
ios_base& __io, ios_base::iostate& __err, tm* __tm) const
{
- typedef char_traits<char_type> __traits_type;
+ typedef char_traits<_CharT> __traits_type;
locale __loc = __io.getloc();
__timepunct<_CharT> const& __tp = use_facet<__timepunct<_CharT> >(__loc);
const char_type* __months[12];
@@ -1959,12 +1976,14 @@ namespace std
_Tv __v, const __c_locale&, int __prec = -1)
{
int __ret;
- const char* __old = setlocale(LC_ALL, "C");
+ char* __old = strdup(setlocale(LC_ALL, NULL));
+ setlocale(LC_ALL, "C");
if (__prec >= 0)
__ret = snprintf(__out, __size, __fmt, __prec, __v);
else
__ret = snprintf(__out, __size, __fmt, __v);
setlocale(LC_ALL, __old);
+ free(__old);
return __ret;
}
#else
@@ -1974,12 +1993,14 @@ namespace std
const __c_locale&, int __prec = -1)
{
int __ret;
- const char* __old = setlocale(LC_ALL, "C");
+ char* __old = strdup(setlocale(LC_ALL, NULL));
+ setlocale(LC_ALL, "C");
if (__prec >= 0)
__ret = sprintf(__out, __fmt, __prec, __v);
else
__ret = sprintf(__out, __fmt, __v);
setlocale(LC_ALL, __old);
+ free(__old);
return __ret;
}
#endif
@@ -1992,22 +2013,31 @@ namespace std
// internal-adjusted objects are padded according to the rules below
// concerning 0[xX] and +-, otherwise, exactly as right-adjusted
// ones are.
+
+ // NB: Of the two parameters, _CharT can be deduced from the
+ // function arguments. The other (_Traits) has to be explicitly specified.
template<typename _CharT, typename _Traits>
- void
- __pad(ios_base& __io, _CharT __fill, _CharT* __news, const _CharT* __olds,
- const streamsize __newlen, const streamsize __oldlen,
- const bool __num)
+ struct __pad
{
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
-
- int_type __plen = static_cast<size_t>(__newlen - __oldlen);
- char_type* __pads = static_cast<char_type*>(__builtin_alloca(sizeof(char_type) * __plen));
- traits_type::assign(__pads, __plen, __fill);
+ static void
+ _S_pad(ios_base& __io, _CharT __fill, _CharT* __news,
+ const _CharT* __olds, const streamsize __newlen,
+ const streamsize __oldlen, const bool __num);
+ };
- char_type* __beg;
- char_type* __end;
+ template<typename _CharT, typename _Traits>
+ void
+ __pad<_CharT, _Traits>::_S_pad(ios_base& __io, _CharT __fill,
+ _CharT* __news, const _CharT* __olds,
+ const streamsize __newlen,
+ const streamsize __oldlen, const bool __num)
+ {
+ size_t __plen = static_cast<size_t>(__newlen - __oldlen);
+ _CharT* __pads = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __plen));
+ _Traits::assign(__pads, __plen, __fill);
+
+ _CharT* __beg;
+ _CharT* __end;
size_t __mod = 0;
size_t __beglen; //either __plen or __oldlen
ios_base::fmtflags __adjust = __io.flags() & ios_base::adjustfield;
@@ -2015,7 +2045,7 @@ namespace std
if (__adjust == ios_base::left)
{
// Padding last.
- __beg = const_cast<char_type*>(__olds);
+ __beg = const_cast<_CharT*>(__olds);
__beglen = __oldlen;
__end = __pads;
}
@@ -2026,12 +2056,14 @@ namespace std
// Who came up with these rules, anyway? Jeeze.
locale __loc = __io.getloc();
const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
- const char_type __minus = __ctype.widen('-');
- const char_type __plus = __ctype.widen('+');
- bool __testsign = __olds[0] == __minus || __olds[0] == __plus;
- bool __testhex = __ctype.widen('0') == __olds[0]
- && (__ctype.widen('x') == __olds[1]
- || __ctype.widen('X') == __olds[1]);
+ const _CharT __minus = __ctype.widen('-');
+ const _CharT __plus = __ctype.widen('+');
+ bool __testsign = _Traits::eq(__olds[0], __minus)
+ || _Traits::eq(__olds[0], __plus);
+
+ bool __testhex = _Traits::eq(__ctype.widen('0'), __olds[0])
+ && (_Traits::eq(__ctype.widen('x'), __olds[1])
+ || _Traits::eq(__ctype.widen('X'), __olds[1]));
if (__testhex)
{
__news[0] = __olds[0];
@@ -2040,23 +2072,23 @@ namespace std
__news += 2;
__beg = __pads;
__beglen = __plen;
- __end = const_cast<char_type*>(__olds + __mod);
+ __end = const_cast<_CharT*>(__olds + __mod);
}
else if (__testsign)
{
- __news[0] = __olds[0] == __plus ? __plus : __minus;
+ _Traits::eq((__news[0] = __olds[0]), __plus) ? __plus : __minus;
++__mod;
++__news;
__beg = __pads;
__beglen = __plen;
- __end = const_cast<char_type*>(__olds + __mod);
+ __end = const_cast<_CharT*>(__olds + __mod);
}
else
{
// Padding first.
__beg = __pads;
__beglen = __plen;
- __end = const_cast<char_type*>(__olds);
+ __end = const_cast<_CharT*>(__olds);
}
}
else
@@ -2064,23 +2096,11 @@ namespace std
// Padding first.
__beg = __pads;
__beglen = __plen;
- __end = const_cast<char_type*>(__olds);
+ __end = const_cast<_CharT*>(__olds);
}
- traits_type::copy(__news, __beg, __beglen);
- traits_type::copy(__news + __beglen, __end, __newlen - __beglen - __mod);
- }
-
- // NB: Can't have default argument on non-member template, and
- // num_put doesn't have a _Traits template parameter, so this
- // forwarding template adds in the default template argument.
- template<typename _CharT>
- void
- __pad(ios_base& __io, _CharT __fill, _CharT* __news, const _CharT* __olds,
- const streamsize __newlen, const streamsize __oldlen,
- const bool __num)
- {
- return __pad<_CharT, char_traits<_CharT> >(__io, __fill, __news, __olds,
- __newlen, __oldlen, __num);
+ _Traits::copy(__news, __beg, __beglen);
+ _Traits::copy(__news + __beglen, __end,
+ __newlen - __beglen - __mod);
}
// Used by both numeric and monetary facets.
@@ -2397,5 +2417,3 @@ namespace std
} // namespace std
#endif
-
-
diff --git a/contrib/libstdc++/include/bits/ostream.tcc b/contrib/libstdc++/include/bits/ostream.tcc
index d15b9f2..e42eca2 100644
--- a/contrib/libstdc++/include/bits/ostream.tcc
+++ b/contrib/libstdc++/include/bits/ostream.tcc
@@ -119,19 +119,11 @@ namespace std
basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type* __sbin)
{
sentry __cerb(*this);
- if (__cerb)
+ if (__cerb && __sbin)
{
try
{
- streamsize __xtrct = 0;
- if (__sbin)
- {
- __streambuf_type* __sbout = this->rdbuf();
- __xtrct = __copy_streambufs(*this, __sbin, __sbout);
- }
- else
- this->setstate(ios_base::badbit);
- if (!__xtrct)
+ if (!__copy_streambufs(*this, __sbin, this->rdbuf()))
this->setstate(ios_base::failbit);
}
catch(exception& __fail)
@@ -143,6 +135,8 @@ namespace std
__throw_exception_again;
}
}
+ else if (!__sbin)
+ this->setstate(ios_base::badbit);
return *this;
}
@@ -480,7 +474,8 @@ namespace std
streamsize __len = 1;
if (__w > __len)
{
- __pad(__out, __out.fill(), __pads, &__c, __w, __len, false);
+ __pad<_CharT, _Traits>::_S_pad(__out, __out.fill(), __pads,
+ &__c, __w, __len, false);
__len = __w;
}
__out.write(__pads, __len);
@@ -515,7 +510,8 @@ namespace std
streamsize __len = 1;
if (__w > __len)
{
- __pad(__out, __out.fill(), __pads, &__c, __w, __len, false);
+ __pad<char, _Traits>::_S_pad(__out, __out.fill(), __pads,
+ &__c, __w, __len, false);
__len = __w;
}
__out.write(__pads, __len);
@@ -539,7 +535,7 @@ namespace std
{
typedef basic_ostream<_CharT, _Traits> __ostream_type;
typename __ostream_type::sentry __cerb(__out);
- if (__cerb)
+ if (__cerb && __s)
{
try
{
@@ -548,7 +544,8 @@ namespace std
streamsize __len = static_cast<streamsize>(_Traits::length(__s));
if (__w > __len)
{
- __pad(__out, __out.fill(), __pads, __s, __w, __len, false);
+ __pad<_CharT, _Traits>::_S_pad(__out, __out.fill(), __pads,
+ __s, __w, __len, false);
__s = __pads;
__len = __w;
}
@@ -564,6 +561,8 @@ namespace std
__throw_exception_again;
}
}
+ else if (!__s)
+ __out.setstate(ios_base::badbit);
return __out;
}
@@ -575,14 +574,14 @@ namespace std
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// 167. Improper use of traits_type::length()
// Note that this is only in 'Review' status.
- typedef char_traits<char> __ctraits_type;
+ typedef char_traits<char> __traits_type;
#endif
typename __ostream_type::sentry __cerb(__out);
- if (__cerb)
+ if (__cerb && __s)
{
- size_t __clen = __ctraits_type::length(__s);
+ size_t __clen = __traits_type::length(__s);
_CharT* __ws = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * (__clen + 1)));
- for (size_t __i = 0; __i <= __clen; ++__i)
+ for (size_t __i = 0; __i < __clen; ++__i)
__ws[__i] = __out.widen(__s[__i]);
_CharT* __str = __ws;
@@ -594,7 +593,8 @@ namespace std
if (__w > __len)
{
- __pad(__out, __out.fill(), __pads, __ws, __w, __len, false);
+ __pad<_CharT, _Traits>::_S_pad(__out, __out.fill(), __pads,
+ __ws, __w, __len, false);
__str = __pads;
__len = __w;
}
@@ -610,6 +610,8 @@ namespace std
__throw_exception_again;
}
}
+ else if (!__s)
+ __out.setstate(ios_base::badbit);
return __out;
}
@@ -620,16 +622,18 @@ namespace std
{
typedef basic_ostream<char, _Traits> __ostream_type;
typename __ostream_type::sentry __cerb(__out);
- if (__cerb)
+ if (__cerb && __s)
{
try
{
streamsize __w = __out.width();
char* __pads = static_cast<char*>(__builtin_alloca(__w));
streamsize __len = static_cast<streamsize>(_Traits::length(__s));
+
if (__w > __len)
{
- __pad(__out, __out.fill(), __pads, __s, __w, __len, false);
+ __pad<char, _Traits>::_S_pad(__out, __out.fill(), __pads,
+ __s, __w, __len, false);
__s = __pads;
__len = __w;
}
@@ -645,6 +649,8 @@ namespace std
__throw_exception_again;
}
}
+ else if (!__s)
+ __out.setstate(ios_base::badbit);
return __out;
}
@@ -667,7 +673,8 @@ namespace std
#endif
if (__w > __len)
{
- __pad(__out, __out.fill(), __pads, __s, __w, __len, false);
+ __pad<_CharT, _Traits>::_S_pad(__out, __out.fill(), __pads, __s,
+ __w, __len, false);
__s = __pads;
__len = __w;
}
@@ -693,6 +700,7 @@ namespace std
extern template ostream& operator<<(ostream&, const unsigned char*);
extern template ostream& operator<<(ostream&, const signed char*);
+#ifdef _GLIBCPP_USE_WCHAR_T
extern template class basic_ostream<wchar_t>;
extern template wostream& endl(wostream&);
extern template wostream& ends(wostream&);
@@ -701,4 +709,5 @@ namespace std
extern template wostream& operator<<(wostream&, char);
extern template wostream& operator<<(wostream&, const wchar_t*);
extern template wostream& operator<<(wostream&, const char*);
+#endif
} // namespace std
diff --git a/contrib/libstdc++/include/bits/sstream.tcc b/contrib/libstdc++/include/bits/sstream.tcc
index e741950..99eb6af 100644
--- a/contrib/libstdc++/include/bits/sstream.tcc
+++ b/contrib/libstdc++/include/bits/sstream.tcc
@@ -95,13 +95,13 @@ namespace std
__len *= 2;
if (__testwrite)
- __ret = this->sputc(__c);
+ __ret = this->sputc(traits_type::to_char_type(__c));
else if (__len <= _M_string.max_size())
{
// Force-allocate, re-sync.
_M_string = this->str();
_M_string.reserve(__len);
- _M_buf_size = static_cast<int_type>(__len);
+ _M_buf_size = __len;
_M_really_sync(_M_in_cur - _M_in_beg,
_M_out_cur - _M_out_beg);
*_M_out_cur = traits_type::to_char_type(__c);
@@ -184,7 +184,7 @@ namespace std
if (_M_buf_size)
{
- off_type __pos = __sp._M_position();
+ off_type __pos = __sp; // Use streamoff operator to do conversion.
char_type* __beg = NULL;
char_type* __end = NULL;
bool __testin = (ios_base::in & _M_mode & __mode) != 0;
diff --git a/contrib/libstdc++/include/bits/stl_bvector.h b/contrib/libstdc++/include/bits/stl_bvector.h
index 6cb6d9c..e48ad7d 100644
--- a/contrib/libstdc++/include/bits/stl_bvector.h
+++ b/contrib/libstdc++/include/bits/stl_bvector.h
@@ -166,7 +166,7 @@ struct _Bit_iterator : public _Bit_iterator_base
_Bit_iterator(_Bit_type * __x, unsigned int __y)
: _Bit_iterator_base(__x, __y) {}
- reference operator*() const { return reference(_M_p, 1U << _M_offset); }
+ reference operator*() const { return reference(_M_p, 1UL << _M_offset); }
iterator& operator++() {
_M_bump_up();
return *this;
@@ -223,7 +223,7 @@ struct _Bit_const_iterator : public _Bit_iterator_base
: _Bit_iterator_base(__x._M_p, __x._M_offset) {}
const_reference operator*() const {
- return _Bit_reference(_M_p, 1U << _M_offset);
+ return _Bit_reference(_M_p, 1UL << _M_offset);
}
const_iterator& operator++() {
_M_bump_up();
diff --git a/contrib/libstdc++/include/bits/stl_deque.h b/contrib/libstdc++/include/bits/stl_deque.h
index 5fa8d12..ce6be7e 100644
--- a/contrib/libstdc++/include/bits/stl_deque.h
+++ b/contrib/libstdc++/include/bits/stl_deque.h
@@ -130,11 +130,6 @@ struct _Deque_iterator
reference operator*() const { return *_M_cur; }
pointer operator->() const { return _M_cur; }
- difference_type operator-(const _Self& __x) const {
- return difference_type(_S_buffer_size()) * (_M_node - __x._M_node - 1) +
- (_M_cur - _M_first) + (__x._M_last - __x._M_cur);
- }
-
_Self& operator++() {
++_M_cur;
if (_M_cur == _M_last) {
@@ -194,16 +189,6 @@ struct _Deque_iterator
reference operator[](difference_type __n) const { return *(*this + __n); }
- bool operator==(const _Self& __x) const { return _M_cur == __x._M_cur; }
- bool operator!=(const _Self& __x) const { return !(*this == __x); }
- bool operator<(const _Self& __x) const {
- return (_M_node == __x._M_node) ?
- (_M_cur < __x._M_cur) : (_M_node < __x._M_node);
- }
- bool operator>(const _Self& __x) const { return __x < *this; }
- bool operator<=(const _Self& __x) const { return !(__x < *this); }
- bool operator>=(const _Self& __x) const { return !(*this < __x); }
-
/** @if maint
* Prepares to traverse new_node. Sets everything except _M_cur, which
* should therefore be set by the caller immediately afterwards, based on
@@ -217,6 +202,123 @@ struct _Deque_iterator
}
};
+// Note: we also provide overloads whose operands are of the same type in
+// order to avoid ambiguos overload resolution when std::rel_ops operators
+// are in scope (for additional details, see libstdc++/3628)
+template <class _Tp, class _Ref, class _Ptr>
+inline bool
+operator==(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+{
+ return __x._M_cur == __y._M_cur;
+}
+
+template <class _Tp, class _RefL, class _PtrL, class _RefR, class _PtrR>
+inline bool
+operator==(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+{
+ return __x._M_cur == __y._M_cur;
+}
+
+template <class _Tp, class _Ref, class _Ptr>
+inline bool
+operator!=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+{
+ return !(__x == __y);
+}
+
+template <class _Tp, class _RefL, class _PtrL, class _RefR, class _PtrR>
+inline bool
+operator!=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+{
+ return !(__x == __y);
+}
+
+template <class _Tp, class _Ref, class _Ptr>
+inline bool
+operator<(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+{
+ return (__x._M_node == __y._M_node) ?
+ (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node);
+}
+
+template <class _Tp, class _RefL, class _PtrL, class _RefR, class _PtrR>
+inline bool
+operator<(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+{
+ return (__x._M_node == __y._M_node) ?
+ (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node);
+}
+
+template <class _Tp, class _Ref, class _Ptr>
+inline bool
+operator>(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+{
+ return __y < __x;
+}
+
+template <class _Tp, class _RefL, class _PtrL, class _RefR, class _PtrR>
+inline bool
+operator>(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+{
+ return __y < __x;
+}
+
+template <class _Tp, class _Ref, class _Ptr>
+inline bool
+operator<=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+{
+ return !(__y < __x);
+}
+
+template <class _Tp, class _RefL, class _PtrL, class _RefR, class _PtrR>
+inline bool
+operator<=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+{
+ return !(__y < __x);
+}
+
+template <class _Tp, class _Ref, class _Ptr>
+inline bool
+operator>=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+{
+ return !(__x < __y);
+}
+
+template <class _Tp, class _RefL, class _PtrL, class _RefR, class _PtrR>
+inline bool
+operator>=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+{
+ return !(__x < __y);
+}
+
+// _GLIBCPP_RESOLVE_LIB_DEFECTS
+// According to the resolution of DR179 not only the various comparison
+// operators but also operator- must accept mixed iterator/const_iterator
+// parameters.
+template <typename _Tp, typename _RefL, typename _PtrL,
+ typename _RefR, typename _PtrR>
+inline typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type
+operator-(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+{
+ return _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type
+ (_Deque_iterator<_Tp, _RefL, _PtrL>::_S_buffer_size()) *
+ (__x._M_node - __y._M_node - 1) + (__x._M_cur - __x._M_first) +
+ (__y._M_last - __y._M_cur);
+}
+
template <class _Tp, class _Ref, class _Ptr>
inline _Deque_iterator<_Tp, _Ref, _Ptr>
operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x)
diff --git a/contrib/libstdc++/include/bits/stl_iterator.h b/contrib/libstdc++/include/bits/stl_iterator.h
index d8a6d8c..6fb0d81 100644
--- a/contrib/libstdc++/include/bits/stl_iterator.h
+++ b/contrib/libstdc++/include/bits/stl_iterator.h
@@ -629,10 +629,6 @@ namespace __gnu_cxx
operator-(const difference_type& __n) const
{ return __normal_iterator(_M_current - __n); }
- difference_type
- operator-(const __normal_iterator& __i) const
- { return _M_current - __i._M_current; }
-
const _Iterator&
base() const { return _M_current; }
};
@@ -719,6 +715,16 @@ namespace __gnu_cxx
const __normal_iterator<_Iterator, _Container>& __rhs)
{ return __lhs.base() >= __rhs.base(); }
+ // _GLIBCPP_RESOLVE_LIB_DEFECTS
+ // According to the resolution of DR179 not only the various comparison
+ // operators but also operator- must accept mixed iterator/const_iterator
+ // parameters.
+ template<typename _IteratorL, typename _IteratorR, typename _Container>
+ inline typename __normal_iterator<_IteratorL, _Container>::difference_type
+ operator-(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ const __normal_iterator<_IteratorR, _Container>& __rhs)
+ { return __lhs.base() - __rhs.base(); }
+
template<typename _Iterator, typename _Container>
inline __normal_iterator<_Iterator, _Container>
operator+(typename __normal_iterator<_Iterator, _Container>::difference_type __n,
diff --git a/contrib/libstdc++/include/bits/stl_pair.h b/contrib/libstdc++/include/bits/stl_pair.h
index d689ccc..b0411b2 100644
--- a/contrib/libstdc++/include/bits/stl_pair.h
+++ b/contrib/libstdc++/include/bits/stl_pair.h
@@ -95,7 +95,7 @@ inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
return __x.first == __y.first && __x.second == __y.second;
}
-/// http://gcc.gnu.org/onlinedocs/libstdc++/20_util/howto.html#pairlt
+/// <http://gcc.gnu.org/onlinedocs/libstdc++/20_util/howto.html#pairlt>
template <class _T1, class _T2>
inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
{
diff --git a/contrib/libstdc++/include/bits/streambuf.tcc b/contrib/libstdc++/include/bits/streambuf.tcc
index 292999c..2f790e9 100644
--- a/contrib/libstdc++/include/bits/streambuf.tcc
+++ b/contrib/libstdc++/include/bits/streambuf.tcc
@@ -40,7 +40,7 @@
namespace std
{
template<typename _CharT, typename _Traits>
- const typename basic_streambuf<_CharT, _Traits>::int_type
+ const size_t
basic_streambuf<_CharT, _Traits>::_S_pback_size;
template<typename _CharT, typename _Traits>
@@ -138,7 +138,7 @@ namespace std
if (__ret < __n)
{
int_type __c = this->uflow();
- if (__c != traits_type::eof())
+ if (!traits_type::eq_int_type(__c, traits_type::eof()))
{
traits_type::assign(*__s++, traits_type::to_char_type(__c));
++__ret;
@@ -177,7 +177,7 @@ namespace std
if (__ret < __n)
{
int_type __c = this->overflow(traits_type::to_int_type(*__s));
- if (__c != traits_type::eof())
+ if (!traits_type::eq_int_type(__c, traits_type::eof()))
{
++__ret;
++__s;
@@ -214,7 +214,7 @@ namespace std
__sbin->_M_in_cur_move(__xtrct);
if (__xtrct == __bufsize)
{
- if (__sbin->sgetc() == _Traits::eof())
+ if (_Traits::eq_int_type(__sbin->sgetc(), _Traits::eof()))
break;
__bufsize = __sbin->in_avail();
}
diff --git a/contrib/libstdc++/include/bits/streambuf_iterator.h b/contrib/libstdc++/include/bits/streambuf_iterator.h
index 659caec..152df9c 100644
--- a/contrib/libstdc++/include/bits/streambuf_iterator.h
+++ b/contrib/libstdc++/include/bits/streambuf_iterator.h
@@ -69,13 +69,13 @@ namespace std
public:
istreambuf_iterator() throw()
- : _M_sbuf(0), _M_c(-2) { }
+ : _M_sbuf(0), _M_c(traits_type::eof()) { }
istreambuf_iterator(istream_type& __s) throw()
- : _M_sbuf(__s.rdbuf()), _M_c(-2) { }
+ : _M_sbuf(__s.rdbuf()), _M_c(traits_type::eof()) { }
istreambuf_iterator(streambuf_type* __s) throw()
- : _M_sbuf(__s), _M_c(-2) { }
+ : _M_sbuf(__s), _M_c(traits_type::eof()) { }
// NB: The result of operator*() on an end of stream is undefined.
char_type
@@ -85,21 +85,25 @@ namespace std
istreambuf_iterator&
operator++()
{
- if (_M_sbuf && _M_sbuf->sbumpc() == traits_type::eof())
+ const int_type __eof = traits_type::eof();
+ if (_M_sbuf && traits_type::eq_int_type(_M_sbuf->sbumpc(), __eof))
_M_sbuf = 0;
else
- _M_c = -2;
+ _M_c = __eof;
return *this;
}
istreambuf_iterator
operator++(int)
{
+ const int_type __eof = traits_type::eof();
istreambuf_iterator __old = *this;
- if (_M_sbuf && (__old._M_c = _M_sbuf->sbumpc()) == traits_type::eof())
+ if (_M_sbuf
+ && traits_type::eq_int_type((__old._M_c = _M_sbuf->sbumpc()),
+ __eof))
_M_sbuf = 0;
else
- _M_c = -2;
+ _M_c = __eof;
return __old;
}
@@ -110,8 +114,8 @@ namespace std
equal(const istreambuf_iterator& __b) const
{
const int_type __eof = traits_type::eof();
- bool __thiseof = _M_get() == __eof;
- bool __beof = __b._M_get() == __eof;
+ bool __thiseof = traits_type::eq_int_type(_M_get(), __eof);
+ bool __beof = traits_type::eq_int_type(__b._M_get(), __eof);
return (__thiseof && __beof || (!__thiseof && !__beof));
}
#endif
@@ -120,13 +124,14 @@ namespace std
int_type
_M_get() const
{
- int_type __ret = traits_type::eof();
+ const int_type __eof = traits_type::eof();
+ int_type __ret = __eof;
if (_M_sbuf)
{
- if (_M_c != static_cast<int_type>(-2))
+ if (!traits_type::eq_int_type(_M_c, __eof))
__ret = _M_c;
else
- if ((__ret = _M_sbuf->sgetc()) == traits_type::eof())
+ if (traits_type::eq_int_type((__ret = _M_sbuf->sgetc()), __eof))
_M_sbuf = 0;
}
return __ret;
diff --git a/contrib/libstdc++/include/c/std_cerrno.h b/contrib/libstdc++/include/c/std_cerrno.h
index 93ba868..646d609 100644
--- a/contrib/libstdc++/include/c/std_cerrno.h
+++ b/contrib/libstdc++/include/c/std_cerrno.h
@@ -31,6 +31,15 @@
// ISO C++ 14882: 19.3 Error numbers
//
+/** @file cerrno
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c errno.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std.
+ */
+
#ifndef _CPP_CERRNO
#define _CPP_CERRNO 1
@@ -38,4 +47,9 @@
#include_next <errno.h>
+// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
+#ifndef errno
+#define errno errno
+#endif
+
#endif
diff --git a/contrib/libstdc++/include/c/std_cmath.h b/contrib/libstdc++/include/c/std_cmath.h
index 33ac50b..beb7141 100644
--- a/contrib/libstdc++/include/c/std_cmath.h
+++ b/contrib/libstdc++/include/c/std_cmath.h
@@ -36,6 +36,89 @@
#pragma GCC system_header
+#include <bits/c++config.h>
+
#include_next <math.h>
+// Get rid of those macros defined in <math.h> in lieu of real functions.
+#undef abs
+#undef div
+#undef acos
+#undef asin
+#undef atan
+#undef atan2
+#undef ceil
+#undef cos
+#undef cosh
+#undef exp
+#undef fabs
+#undef floor
+#undef fmod
+#undef frexp
+#undef ldexp
+#undef log
+#undef log10
+#undef modf
+#undef pow
+#undef sin
+#undef sinh
+#undef sqrt
+#undef tan
+#undef tanh
+
+#undef fpclassify
+#undef isfinite
+#undef isinf
+#undef isnan
+#undef isnormal
+#undef signbit
+#undef isgreater
+#undef isgreaterequal
+#undef isless
+#undef islessequal
+#undef islessgreater
+#undef isunordered
+
+namespace std
+{
+ inline double
+ abs(double __x)
+ { return __builtin_fabs(__x); }
+
+ inline float
+ abs(float __x)
+ { return __builtin_fabsf(__x); }
+
+ inline long double
+ abs(long double __x)
+ { return __builtin_fabsl(__x); }
+
+#if _GLIBCPP_HAVE_MODFF
+ inline float
+ modf(float __x, float* __iptr) { return modff(__x, __iptr); }
+#else
+ inline float
+ modf(float __x, float* __iptr)
+ {
+ double __tmp;
+ double __res = modf(static_cast<double>(__x), &__tmp);
+ *__iptr = static_cast<float>(__tmp);
+ return __res;
+ }
+#endif
+
+#if _GLIBCPP_HAVE_MODFL
+ inline long double
+ modf(long double __x, long double* __iptr) { return modfl(__x, __iptr); }
+#else
+ inline long double
+ modf(long double __x, long double* __iptr)
+ {
+ double __tmp;
+ double __res = modf(static_cast<double>(__x), &__tmp);
+ * __iptr = static_cast<long double>(__tmp);
+ return __res;
+ }
+#endif
+}
#endif
diff --git a/contrib/libstdc++/include/c/std_csetjmp.h b/contrib/libstdc++/include/c/std_csetjmp.h
index 011907b..fe3f9c7 100644
--- a/contrib/libstdc++/include/c/std_csetjmp.h
+++ b/contrib/libstdc++/include/c/std_csetjmp.h
@@ -38,4 +38,12 @@
#include_next <setjmp.h>
+// Get rid of those macros defined in <setjmp.h> in lieu of real functions.
+#undef longjmp
+
+// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
+#ifndef setjmp
+#define setjmp(env) std::setjmp (env)
+#endif
+
#endif
diff --git a/contrib/libstdc++/include/c/std_cstdarg.h b/contrib/libstdc++/include/c/std_cstdarg.h
index d2cb544..39d019b 100644
--- a/contrib/libstdc++/include/c/std_cstdarg.h
+++ b/contrib/libstdc++/include/c/std_cstdarg.h
@@ -36,6 +36,7 @@
#pragma GCC system_header
+#undef __need___va_list
#include_next <stdarg.h>
#endif
diff --git a/contrib/libstdc++/include/c/std_cstddef.h b/contrib/libstdc++/include/c/std_cstddef.h
index da41736..82561cd 100644
--- a/contrib/libstdc++/include/c/std_cstddef.h
+++ b/contrib/libstdc++/include/c/std_cstddef.h
@@ -36,6 +36,10 @@
#pragma GCC system_header
+#define __need_size_t
+#define __need_ptrdiff_t
+#define __need_NULL
+#define __need_offsetof
#include_next <stddef.h>
#endif
diff --git a/contrib/libstdc++/include/c/std_cstdio.h b/contrib/libstdc++/include/c/std_cstdio.h
index 542b924..3d6272a 100644
--- a/contrib/libstdc++/include/c/std_cstdio.h
+++ b/contrib/libstdc++/include/c/std_cstdio.h
@@ -38,4 +38,47 @@
#include_next <stdio.h>
+// Get rid of those macros defined in <stdio.h> in lieu of real functions.
+#undef clearerr
+#undef fclose
+#undef feof
+#undef ferror
+#undef fflush
+#undef fgetc
+#undef fgetpos
+#undef fgets
+#undef fopen
+#undef fprintf
+#undef fputc
+#undef fputs
+#undef fread
+#undef freopen
+#undef fscanf
+#undef fseek
+#undef fsetpos
+#undef ftell
+#undef fwrite
+#undef getc
+#undef getchar
+#undef gets
+#undef perror
+#undef printf
+#undef putc
+#undef putchar
+#undef puts
+#undef remove
+#undef rename
+#undef rewind
+#undef scanf
+#undef setbuf
+#undef setvbuf
+#undef sprintf
+#undef sscanf
+#undef tmpfile
+#undef tmpnam
+#undef ungetc
+#undef vfprintf
+#undef vprintf
+#undef vsprintf
+
#endif
diff --git a/contrib/libstdc++/include/c/std_cwchar.h b/contrib/libstdc++/include/c/std_cwchar.h
index f9dfbadb..d06f5e4 100644
--- a/contrib/libstdc++/include/c/std_cwchar.h
+++ b/contrib/libstdc++/include/c/std_cwchar.h
@@ -36,6 +36,27 @@
#pragma GCC system_header
+#include <bits/c++config.h>
+#include <cstddef>
+#include <ctime>
+
+#if _GLIBCPP_HAVE_WCHAR_H
#include_next <wchar.h>
+#endif
+
+// Need to do a bit of trickery here with mbstate_t as char_traits
+// assumes it is in wchar.h, regardless of wchar_t specializations.
+#ifndef _GLIBCPP_HAVE_MBSTATE_T
+namespace std
+{
+ extern "C"
+ {
+ typedef struct
+ {
+ int __fill[6];
+ } mbstate_t;
+ }
+}
+#endif
#endif
diff --git a/contrib/libstdc++/include/c/std_cwctype.h b/contrib/libstdc++/include/c/std_cwctype.h
index ef6b44b..d515698 100644
--- a/contrib/libstdc++/include/c/std_cwctype.h
+++ b/contrib/libstdc++/include/c/std_cwctype.h
@@ -36,6 +36,10 @@
#pragma GCC system_header
+#include <bits/c++config.h>
+
+#if _GLIBCPP_HAVE_WCTYPE_H
#include_next <wctype.h>
+#endif
#endif
diff --git a/contrib/libstdc++/include/c_compatibility/assert.h b/contrib/libstdc++/include/c_compatibility/assert.h
new file mode 100644
index 0000000..cb5313f
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/assert.h
@@ -0,0 +1,30 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cassert>
diff --git a/contrib/libstdc++/include/c_compatibility/ctype.h b/contrib/libstdc++/include/c_compatibility/ctype.h
new file mode 100644
index 0000000..1989347
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/ctype.h
@@ -0,0 +1,49 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_CTYPE_H_
+#define _CPP_CTYPE_H_ 1
+
+#include <cctype>
+
+using std::isalnum;
+using std::isalpha;
+using std::iscntrl;
+using std::isdigit;
+using std::isgraph;
+using std::islower;
+using std::isprint;
+using std::ispunct;
+using std::isspace;
+using std::isupper;
+using std::isxdigit;
+using std::tolower;
+using std::toupper;
+
+#endif
diff --git a/contrib/libstdc++/include/c_compatibility/errno.h b/contrib/libstdc++/include/c_compatibility/errno.h
new file mode 100644
index 0000000..f890b53
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/errno.h
@@ -0,0 +1,35 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_ERRNO_H_
+#define _CPP_ERRNO_H_ 1
+
+#include <cerrno>
+
+#endif
diff --git a/contrib/libstdc++/include/c_compatibility/float.h b/contrib/libstdc++/include/c_compatibility/float.h
new file mode 100644
index 0000000..7d7b9d44
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/float.h
@@ -0,0 +1,35 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_FLOAT_H_
+#define _CPP_FLOAT_H_ 1
+
+#include <cfloat>
+
+#endif
diff --git a/contrib/libstdc++/include/c_compatibility/iso646.h b/contrib/libstdc++/include/c_compatibility/iso646.h
new file mode 100644
index 0000000..25b6140
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/iso646.h
@@ -0,0 +1,35 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_ISO646_H_
+#define _CPP_ISO646_H_ 1
+
+#include <ciso646>
+
+#endif
diff --git a/contrib/libstdc++/include/c_compatibility/limits.h b/contrib/libstdc++/include/c_compatibility/limits.h
new file mode 100644
index 0000000..9ddbce8
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/limits.h
@@ -0,0 +1,35 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_LIMITS_H_
+#define _CPP_LIMITS_H_ 1
+
+#include <climits>
+
+#endif
diff --git a/contrib/libstdc++/include/c_compatibility/locale.h b/contrib/libstdc++/include/c_compatibility/locale.h
new file mode 100644
index 0000000..4d7d72d
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/locale.h
@@ -0,0 +1,39 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_LOCALE_H_
+#define _CPP_LOCALE_H_ 1
+
+#include <clocale>
+
+using std::lconv;
+using std::setlocale;
+using std::localeconv;
+
+#endif
diff --git a/contrib/libstdc++/include/c_compatibility/math.h b/contrib/libstdc++/include/c_compatibility/math.h
new file mode 100644
index 0000000..4c4fd0a
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/math.h
@@ -0,0 +1,74 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_MATH_H_
+#define _CPP_MATH_H_ 1
+
+#include <cmath>
+
+using std::abs;
+using std::acos;
+using std::asin;
+using std::atan;
+using std::atan2;
+using std::cos;
+using std::sin;
+using std::tan;
+using std::cosh;
+using std::sinh;
+using std::tanh;
+using std::exp;
+using std::frexp;
+using std::ldexp;
+using std::log;
+using std::log10;
+using std::modf;
+using std::pow;
+using std::sqrt;
+using std::ceil;
+using std::fabs;
+using std::floor;
+using std::fmod;
+
+#if _GLIBCPP_USE_C99
+using std::fpclassify;
+using std::isfinite;
+using std::isinf;
+using std::isnan;
+using std::isnormal;
+using std::signbit;
+using std::isgreater;
+using std::isgreaterequal;
+using std::isless;
+using std::islessequal;
+using std::islessgreater;
+using std::isunordered;
+#endif
+
+#endif
diff --git a/contrib/libstdc++/include/c_compatibility/setjmp.h b/contrib/libstdc++/include/c_compatibility/setjmp.h
new file mode 100644
index 0000000..f194253
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/setjmp.h
@@ -0,0 +1,38 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_SETJMP_H_
+#define _CPP_SETJMP_H_ 1
+
+#include <csetjmp>
+
+using std::jmp_buf;
+using std::longjmp;
+
+#endif
diff --git a/contrib/libstdc++/include/c_compatibility/signal.h b/contrib/libstdc++/include/c_compatibility/signal.h
new file mode 100644
index 0000000..724ac8a
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/signal.h
@@ -0,0 +1,40 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_SIGNAL_H_
+#define _CPP_SIGNAL_H_ 1
+
+#include <csignal>
+
+using std::sig_atomic_t;
+
+using std::raise;
+using std::signal;
+
+#endif
diff --git a/contrib/libstdc++/include/c_compatibility/stdarg.h b/contrib/libstdc++/include/c_compatibility/stdarg.h
new file mode 100644
index 0000000..a1a62b1
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/stdarg.h
@@ -0,0 +1,37 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_STDARG_H_
+#define _CPP_STDARG_H_ 1
+
+#include <cstdarg>
+
+using std::va_list;
+
+#endif
diff --git a/contrib/libstdc++/include/c_compatibility/stddef.h b/contrib/libstdc++/include/c_compatibility/stddef.h
new file mode 100644
index 0000000..094c380
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/stddef.h
@@ -0,0 +1,38 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_STDDEF_H_
+#define _CPP_STDDEF_H_ 1
+
+#include <cstddef>
+
+using std::size_t;
+using std::ptrdiff_t;
+
+#endif
diff --git a/contrib/libstdc++/include/c_compatibility/stdio.h b/contrib/libstdc++/include/c_compatibility/stdio.h
new file mode 100644
index 0000000..930ffd4
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/stdio.h
@@ -0,0 +1,85 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_STDIO_H_
+#define _CPP_STDIO_H_ 1
+
+#include <cstdio>
+
+using std::FILE;
+using std::fpos_t;
+
+using std::remove;
+using std::rename;
+using std::tmpfile;
+using std::tmpnam;
+using std::fclose;
+using std::fflush;
+using std::fopen;
+using std::freopen;
+using std::setbuf;
+using std::setvbuf;
+using std::fprintf;
+using std::fscanf;
+using std::printf;
+using std::scanf;
+using std::snprintf;
+using std::sprintf;
+using std::sscanf;
+using std::vfprintf;
+using std::vfscanf;
+using std::vprintf;
+using std::vscanf;
+using std::vsnprintf;
+using std::vsprintf;
+using std::vsscanf;
+using std::fgetc;
+using std::fgets;
+using std::fputc;
+using std::fputs;
+using std::getc;
+using std::getchar;
+using std::gets;
+using std::putc;
+using std::putchar;
+using std::puts;
+using std::ungetc;
+using std::fread;
+using std::fwrite;
+using std::fgetpos;
+using std::fseek;
+using std::fsetpos;
+using std::ftell;
+using std::rewind;
+using std::clearerr;
+using std::feof;
+using std::ferror;
+using std::perror;
+
+#endif
diff --git a/contrib/libstdc++/include/c_compatibility/stdlib.h b/contrib/libstdc++/include/c_compatibility/stdlib.h
new file mode 100644
index 0000000..d516034
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/stdlib.h
@@ -0,0 +1,67 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_STDLIB_H_
+#define _CPP_STDLIB_H_ 1
+
+#include <cstdlib>
+
+using std::div_t;
+using std::ldiv_t;
+
+using std::abort;
+using std::abs;
+using std::atexit;
+using std::atof;
+using std::atoi;
+using std::atol;
+using std::bsearch;
+using std::calloc;
+using std::div;
+using std::exit;
+using std::free;
+using std::getenv;
+using std::labs;
+using std::ldiv;
+using std::malloc;
+using std::mblen;
+using std::mbstowcs;
+using std::mbtowc;
+using std::qsort;
+using std::rand;
+using std::realloc;
+using std::srand;
+using std::strtod;
+using std::strtol;
+using std::strtoul;
+using std::system;
+using std::wcstombs;
+using std::wctomb;
+
+#endif
diff --git a/contrib/libstdc++/include/c_compatibility/string.h b/contrib/libstdc++/include/c_compatibility/string.h
new file mode 100644
index 0000000..b639157
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/string.h
@@ -0,0 +1,58 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_STRING_H_
+#define _CPP_STRING_H_ 1
+
+#include <cstring>
+
+using std::memcpy;
+using std::memmove;
+using std::strcpy;
+using std::strncpy;
+using std::strcat;
+using std::strncat;
+using std::memcmp;
+using std::strcmp;
+using std::strcoll;
+using std::strncmp;
+using std::strxfrm;
+using std::memchr;
+using std::strchr;
+using std::strcspn;
+using std::strpbrk;
+using std::strrchr;
+using std::strspn;
+using std::strstr;
+using std::strtok;
+using std::memset;
+using std::strerror;
+using std::strlen;
+
+#endif
diff --git a/contrib/libstdc++/include/c_compatibility/time.h b/contrib/libstdc++/include/c_compatibility/time.h
new file mode 100644
index 0000000..6d07aa1
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/time.h
@@ -0,0 +1,60 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_TIME_H_
+#define _CPP_TIME_H_ 1
+
+#include <ctime>
+
+// Get rid of those macros defined in <time.h> in lieu of real functions.
+#undef clock
+#undef difftime
+#undef mktime
+#undef time
+#undef asctime
+#undef ctime
+#undef gmtime
+#undef localtime
+#undef strftime
+
+using std::clock_t;
+using std::time_t;
+using std::tm;
+
+using std::clock;
+using std::difftime;
+using std::mktime;
+using std::time;
+using std::asctime;
+using std::ctime;
+using std::gmtime;
+using std::localtime;
+using std::strftime;
+
+#endif
diff --git a/contrib/libstdc++/include/c_compatibility/wchar.h b/contrib/libstdc++/include/c_compatibility/wchar.h
new file mode 100644
index 0000000..e9485a5
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/wchar.h
@@ -0,0 +1,106 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_WCHAR_H_
+#define _CPP_WCHAR_H_ 1
+
+#include <cwchar>
+
+using std::mbstate_t;
+
+#if _GLIBCPP_USE_WCHAR_T
+using std::wint_t;
+
+using std::btowc;
+using std::wctob;
+using std::fgetwc;
+using std::fgetwc;
+using std::fgetws;
+using std::fputwc;
+using std::fputws;
+using std::fwide;
+using std::fwprintf;
+using std::fwscanf;
+using std::swprintf;
+using std::swscanf;
+using std::vfwprintf;
+using std::vfwscanf;
+using std::vswprintf;
+using std::vswscanf;
+using std::vwprintf;
+using std::vwscanf;
+using std::wprintf;
+using std::wscanf;
+using std::getwc;
+using std::getwchar;
+using std::mbsinit;
+using std::mbrlen;
+using std::mbrtowc;
+using std::mbsrtowcs;
+using std::wcsrtombs;
+using std::putwc;
+using std::putwchar;
+using std::ungetwc;
+using std::wcrtomb;
+using std::wcstod;
+using std::wcstof;
+using std::wcstol;
+using std::wcstoul;
+using std::wcscpy;
+using std::wcsncpy;
+using std::wcscat;
+using std::wcsncat;
+using std::wcscmp;
+using std::wcscoll;
+using std::wcsncmmp;
+using std::wcsxfrm;
+using std::wcschr;
+using std::wcscspn;
+using std::wcslen;
+using std::wcspbrk;
+using std::wcsrchr;
+using std::wcsspn;
+using std::wcsstr;
+using std::wcstok;
+using std::wmemchr;
+using std::wmemcmp;
+using std::wmemcpy;
+using std::wmemmove;
+using std::wmemset;
+using std::wcsftime;
+
+#if _GLIBCPP_USE_C99
+using std::wcstold;
+using std::wcstoll;
+using std::wcstoull;
+#endif
+
+#endif //_GLIBCPP_USE_WCHAR_T
+
+#endif
diff --git a/contrib/libstdc++/include/c_compatibility/wctype.h b/contrib/libstdc++/include/c_compatibility/wctype.h
new file mode 100644
index 0000000..2c75ec8
--- /dev/null
+++ b/contrib/libstdc++/include/c_compatibility/wctype.h
@@ -0,0 +1,55 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_CWCTYPE_H_
+#define _CPP_CWCTYPE_H_ 1
+
+#include <cwctype>
+
+using std::wctype_t;
+using std::wctrans_t;
+using std::iswalpha;
+using std::iswupper;
+using std::iswlower;
+using std::iswdigit;
+using std::iswxdigit;
+using std::iswalnum;
+using std::iswspace;
+using std::iswpunct;
+using std::iswprint;
+using std::iswgraph;
+using std::iswcntrl;
+using std::iswctype;
+using std::towctrans;
+using std::towlower;
+using std::towupper;
+using std::wctrans;
+using std::wctype;
+
+#endif
diff --git a/contrib/libstdc++/include/c_std/std_cmath.h b/contrib/libstdc++/include/c_std/std_cmath.h
index 9e05900..b2f65c8 100644
--- a/contrib/libstdc++/include/c_std/std_cmath.h
+++ b/contrib/libstdc++/include/c_std/std_cmath.h
@@ -82,13 +82,6 @@ namespace std
// an `exported' forward declaration.
template<typename _Tp> _Tp __cmath_power(_Tp, unsigned int);
- template<typename _Tp>
- inline _Tp
- __cmath_abs(_Tp __x)
- {
- return __x < _Tp() ? -__x : __x;
- }
-
inline double
abs(double __x)
{ return __builtin_fabs(__x); }
diff --git a/contrib/libstdc++/include/ext/algorithm b/contrib/libstdc++/include/ext/algorithm
index bf72765..b35d36f 100644
--- a/contrib/libstdc++/include/ext/algorithm
+++ b/contrib/libstdc++/include/ext/algorithm
@@ -247,6 +247,11 @@ namespace __gnu_cxx
// random_sample and random_sample_n (extensions, not part of the standard).
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
template<typename _ForwardIter, typename _OutputIter, typename _Distance>
_OutputIter
random_sample_n(_ForwardIter __first, _ForwardIter __last,
@@ -273,6 +278,11 @@ namespace __gnu_cxx
return __out;
}
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
template<typename _ForwardIter, typename _OutputIter, typename _Distance,
typename _RandomNumberGenerator>
_OutputIter
@@ -353,6 +363,11 @@ namespace __gnu_cxx
return __out + __m;
}
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
template<typename _InputIter, typename _RandomAccessIter>
inline _RandomAccessIter
random_sample(_InputIter __first, _InputIter __last,
@@ -367,6 +382,11 @@ namespace __gnu_cxx
__out_first, __out_last - __out_first);
}
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
template<typename _InputIter, typename _RandomAccessIter,
typename _RandomNumberGenerator>
inline _RandomAccessIter
@@ -418,6 +438,11 @@ namespace __gnu_cxx
return true;
}
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
template<typename _RandomAccessIter>
inline bool
is_heap(_RandomAccessIter __first, _RandomAccessIter __last)
@@ -430,6 +455,11 @@ namespace __gnu_cxx
return __is_heap(__first, __last - __first);
}
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
template<typename _RandomAccessIter, typename _StrictWeakOrdering>
inline bool
is_heap(_RandomAccessIter __first, _RandomAccessIter __last,
@@ -448,6 +478,11 @@ namespace __gnu_cxx
// nondescending order. This is an extension, not part of the C++
// standard.
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
template<typename _ForwardIter>
bool
is_sorted(_ForwardIter __first, _ForwardIter __last)
@@ -469,6 +504,11 @@ namespace __gnu_cxx
return true;
}
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
template<typename _ForwardIter, typename _StrictWeakOrdering>
bool
is_sorted(_ForwardIter __first, _ForwardIter __last, _StrictWeakOrdering __comp)
diff --git a/contrib/libstdc++/include/ext/hash_map b/contrib/libstdc++/include/ext/hash_map
index 08ed87b..b66758d 100644
--- a/contrib/libstdc++/include/ext/hash_map
+++ b/contrib/libstdc++/include/ext/hash_map
@@ -83,7 +83,11 @@ class hash_map;
template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
inline bool operator==(const hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>&,
const hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>&);
-
+/**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+*/
template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
class _Alloc>
class hash_map
@@ -235,6 +239,11 @@ inline bool
operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2);
+/**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+*/
template <class _Key, class _Tp, class _HashFcn, class _EqualKey, class _Alloc>
class hash_multimap
{
diff --git a/contrib/libstdc++/include/ext/hash_set b/contrib/libstdc++/include/ext/hash_set
index eaeed7c..0f420e2 100644
--- a/contrib/libstdc++/include/ext/hash_set
+++ b/contrib/libstdc++/include/ext/hash_set
@@ -85,6 +85,11 @@ inline bool
operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2);
+/**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+*/
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
class hash_set
{
@@ -236,6 +241,11 @@ operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2);
+/**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+*/
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
class hash_multiset
{
diff --git a/contrib/libstdc++/include/ext/iterator b/contrib/libstdc++/include/ext/iterator
index 3892eb6..f23212f 100644
--- a/contrib/libstdc++/include/ext/iterator
+++ b/contrib/libstdc++/include/ext/iterator
@@ -93,6 +93,11 @@ namespace __gnu_cxx
__n += __last - __first;
}
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
template<typename _InputIterator, typename _Distance>
inline void
distance(_InputIterator __first, _InputIterator __last,
diff --git a/contrib/libstdc++/include/ext/numeric b/contrib/libstdc++/include/ext/numeric
index 601cb82..6770461 100644
--- a/contrib/libstdc++/include/ext/numeric
+++ b/contrib/libstdc++/include/ext/numeric
@@ -105,11 +105,21 @@ namespace __gnu_cxx
// Alias for the internal name __power. Note that power is an extension,
// not part of the C++ standard.
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
template<typename _Tp, typename _Integer, typename _MonoidOperation>
inline _Tp
power(_Tp __x, _Integer __n, _MonoidOperation __monoid_op)
{ return __power(__x, __n, __monoid_op); }
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
template<typename _Tp, typename _Integer>
inline _Tp
power(_Tp __x, _Integer __n)
@@ -117,6 +127,11 @@ namespace __gnu_cxx
// iota is not part of the C++ standard. It is an extension.
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
template<typename _ForwardIter, typename _Tp>
void
iota(_ForwardIter __first, _ForwardIter __last, _Tp __value)
diff --git a/contrib/libstdc++/include/ext/rb_tree b/contrib/libstdc++/include/ext/rb_tree
index f4b24b6..3941243 100644
--- a/contrib/libstdc++/include/ext/rb_tree
+++ b/contrib/libstdc++/include/ext/rb_tree
@@ -73,6 +73,11 @@ using std::allocator;
// Class rb_tree is not part of the C++ standard. It is provided for
// compatibility with the HP STL.
+/**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+*/
template <class _Key, class _Value, class _KeyOfValue, class _Compare,
class _Alloc = allocator<_Value> >
struct rb_tree : public _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc>
diff --git a/contrib/libstdc++/include/ext/slist b/contrib/libstdc++/include/ext/slist
index df2e97b..35e089a 100644
--- a/contrib/libstdc++/include/ext/slist
+++ b/contrib/libstdc++/include/ext/slist
@@ -295,6 +295,11 @@ _Slist_base<_Tp,_Alloc>::_M_erase_after(_Slist_node_base* __before_first,
return __last_node;
}
+/**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+*/
template <class _Tp, class _Alloc = allocator<_Tp> >
class slist : private _Slist_base<_Tp,_Alloc>
{
diff --git a/contrib/libstdc++/include/ext/stdio_filebuf.h b/contrib/libstdc++/include/ext/stdio_filebuf.h
index 1b0d5ae..59ab41a 100644
--- a/contrib/libstdc++/include/ext/stdio_filebuf.h
+++ b/contrib/libstdc++/include/ext/stdio_filebuf.h
@@ -27,10 +27,27 @@
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
+/** @file ext/stdio_filebuf.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _EXT_STDIO_FILEBUF
+#define _EXT_STDIO_FILEBUF
+
+#pragma GCC system_header
#include <fstream>
namespace __gnu_cxx
{
+ /**
+ * @class stdio_filebuf ext/stdio_filebuf.h <ext/stdio_filebuf.h>
+ * @brief Provides a layer of compatibility for C/POSIX.
+ *
+ * This GNU extension provides extensions for working with standard C
+ * FILE*'s and POSIX file descriptors. It must be instantiated by the
+ * user with the type of character used in the file stream, e.g.,
+ * stdio_filebuf<char>.
+ */
template<typename _CharT, typename _Traits = std::char_traits<_CharT> >
class stdio_filebuf : public std::basic_filebuf<_CharT, _Traits>
{
@@ -47,15 +64,47 @@ namespace __gnu_cxx
char_type _M_unbuf[4];
public:
+ /**
+ * @param fd An open file descriptor.
+ * @param mode Same meaning as in a standard filebuf.
+ * @param del Whether to close the file on destruction.
+ * @param size Optimal or preferred size of internal buffer, in bytes.
+ *
+ * This constructor associates a file stream buffer with an open
+ * POSIX file descriptor. Iff @a del is true, then the associated
+ * file will be closed when the stdio_filebuf is closed/destroyed.
+ */
stdio_filebuf(int __fd, std::ios_base::openmode __mode, bool __del,
int_type __size);
+ /**
+ * @param f An open @c FILE*.
+ * @param mode Same meaning as in a standard filebuf.
+ * @param size Optimal or preferred size of internal buffer, in bytes.
+ * Defaults to system's @c BUFSIZ.
+ *
+ * This constructor associates a file stream buffer with an open
+ * C @c FILE*. The @c FILE* will not be automatically closed when the
+ * stdio_filebuf is closed/destroyed.
+ */
stdio_filebuf(std::__c_file* __f, std::ios_base::openmode __mode,
int_type __size = static_cast<int_type>(BUFSIZ));
+ /**
+ * Possibly closes the external data stream, in the case of the file
+ * descriptor constructor and @c del @c == @c true.
+ */
virtual
~stdio_filebuf();
+ /**
+ * @return The underlying file descriptor.
+ *
+ * Once associated with an external data stream, this function can be
+ * used to access the underlying POSIX file descriptor. Note that
+ * there is no way for the library to track what you do with the
+ * descriptor, so be careful.
+ */
int
fd()
{ return _M_file.fd(); }
@@ -74,16 +123,18 @@ namespace __gnu_cxx
if (this->is_open())
{
_M_mode = __mode;
- _M_buf_size_opt = __size;
-
if (__size > 0 && __size < 4)
{
+ // Specify unbuffered.
_M_buf = _M_unbuf;
_M_buf_size = __size;
+ _M_buf_size_opt = 0;
}
else
- _M_allocate_internal_buffer();
-
+ {
+ _M_buf_size_opt = __size;
+ _M_allocate_internal_buffer();
+ }
_M_set_indeterminate();
}
}
@@ -97,17 +148,21 @@ namespace __gnu_cxx
if (this->is_open())
{
_M_mode = __mode;
- _M_buf_size_opt = __size;
-
if (__size > 0 && __size < 4)
{
+ // Specify unbuffered.
_M_buf = _M_unbuf;
_M_buf_size = __size;
+ _M_buf_size_opt = 0;
}
else
- _M_allocate_internal_buffer();
-
+ {
+ _M_buf_size_opt = __size;
+ _M_allocate_internal_buffer();
+ }
_M_set_indeterminate();
}
}
} // namespace __gnu_cxx
+
+#endif /* _EXT_STDIO_FILEBUF */
diff --git a/contrib/libstdc++/include/ext/stl_hashtable.h b/contrib/libstdc++/include/ext/stl_hashtable.h
index 5ee49d8..2bc8a2f 100644
--- a/contrib/libstdc++/include/ext/stl_hashtable.h
+++ b/contrib/libstdc++/include/ext/stl_hashtable.h
@@ -610,11 +610,28 @@ bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
for (size_t __n = 0; __n < __ht1._M_buckets.size(); ++__n) {
_Node* __cur1 = __ht1._M_buckets[__n];
_Node* __cur2 = __ht2._M_buckets[__n];
- for ( ; __cur1 && __cur2 && __cur1->_M_val == __cur2->_M_val;
+ // Check same length of lists
+ for ( ; __cur1 && __cur2;
__cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next)
{}
if (__cur1 || __cur2)
return false;
+ // Now check one's elements are in the other
+ for (__cur1 = __ht1._M_buckets[__n] ; __cur1; __cur1 = __cur1->_M_next)
+ {
+ bool _found__cur1 = false;
+ for (_Node* __cur2 = __ht2._M_buckets[__n];
+ __cur2; __cur2 = __cur2->_M_next)
+ {
+ if (__cur1->_M_val == __cur2->_M_val)
+ {
+ _found__cur1 = true;
+ break;
+ }
+ }
+ if (!_found__cur1)
+ return false;
+ }
}
return true;
}
diff --git a/contrib/libstdc++/include/ext/stl_rope.h b/contrib/libstdc++/include/ext/stl_rope.h
index 188fc40..bb9bb47 100644
--- a/contrib/libstdc++/include/ext/stl_rope.h
+++ b/contrib/libstdc++/include/ext/stl_rope.h
@@ -1238,6 +1238,11 @@ struct _Rope_base
};
+/**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+*/
template <class _CharT, class _Alloc>
class rope : public _Rope_base<_CharT,_Alloc> {
public:
diff --git a/contrib/libstdc++/include/std/std_bitset.h b/contrib/libstdc++/include/std/std_bitset.h
index 0945c90..fe60b01 100644
--- a/contrib/libstdc++/include/std/std_bitset.h
+++ b/contrib/libstdc++/include/std/std_bitset.h
@@ -61,7 +61,7 @@
#define _GLIBCPP_BITSET_BITS_PER_WORD (CHAR_BIT*sizeof(unsigned long))
#define _GLIBCPP_BITSET_WORDS(__n) \
- ((__n) < 1 ? 1 : ((__n) + _GLIBCPP_BITSET_BITS_PER_WORD - 1)/_GLIBCPP_BITSET_BITS_PER_WORD)
+ ((__n) < 1 ? 0 : ((__n) + _GLIBCPP_BITSET_BITS_PER_WORD - 1)/_GLIBCPP_BITSET_BITS_PER_WORD)
namespace std
{
@@ -463,6 +463,101 @@ namespace std
_M_do_find_next(size_t __prev, size_t __not_found) const;
};
+
+ /**
+ * @if maint
+ * Base class, specialization for no storage (zero-length %bitset).
+ *
+ * See documentation for bitset.
+ * @endif
+ */
+ template<>
+ struct _Base_bitset<0>
+ {
+ typedef unsigned long _WordT;
+
+ _Base_bitset() {}
+ _Base_bitset(unsigned long) {}
+
+ static size_t
+ _S_whichword(size_t __pos )
+ { return __pos / _GLIBCPP_BITSET_BITS_PER_WORD; }
+
+ static size_t
+ _S_whichbyte(size_t __pos )
+ { return (__pos % _GLIBCPP_BITSET_BITS_PER_WORD) / CHAR_BIT; }
+
+ static size_t
+ _S_whichbit(size_t __pos )
+ { return __pos % _GLIBCPP_BITSET_BITS_PER_WORD; }
+
+ static _WordT
+ _S_maskbit(size_t __pos )
+ { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
+
+ // This would normally give access to the data. The bounds-checking
+ // in the bitset class will prevent the user from getting this far,
+ // but (1) it must still return an lvalue to compile, and (2) the
+ // user might call _Unchecked_set directly, in which case this /needs/
+ // to fail. Let's not penalize zero-length users unless they actually
+ // make an unchecked call; all the memory ugliness is therefore
+ // localized to this single should-never-get-this-far function.
+ _WordT&
+ _M_getword(size_t) const
+ { __throw_out_of_range("bitset -- zero-length"); return *new _WordT; }
+
+ _WordT
+ _M_hiword() const { return 0; }
+
+ void
+ _M_do_and(const _Base_bitset<0>&) { }
+
+ void
+ _M_do_or(const _Base_bitset<0>&) { }
+
+ void
+ _M_do_xor(const _Base_bitset<0>&) { }
+
+ void
+ _M_do_left_shift(size_t) { }
+
+ void
+ _M_do_right_shift(size_t) { }
+
+ void
+ _M_do_flip() { }
+
+ void
+ _M_do_set() { }
+
+ void
+ _M_do_reset() { }
+
+ // Are all empty bitsets equal to each other? Are they equal to
+ // themselves? How to compare a thing which has no state? What is
+ // the sound of one zero-length bitset clapping?
+ bool
+ _M_is_equal(const _Base_bitset<0>&) const { return true; }
+
+ bool
+ _M_is_any() const { return false; }
+
+ size_t
+ _M_do_count() const { return 0; }
+
+ unsigned long
+ _M_do_to_ulong() const { return 0; }
+
+ // Normally "not found" is the size, but that could also be
+ // misinterpreted as an index in this corner case. Oh well.
+ size_t
+ _M_do_find_first(size_t) const { return 0; }
+
+ size_t
+ _M_do_find_next(size_t, size_t) const { return 0; }
+ };
+
+
// Helper class to zero out the unused high-order bits in the highest word.
template<size_t _Extrabits>
struct _Sanitize
@@ -1115,7 +1210,7 @@ namespace std
}
}
- if (__tmp.empty())
+ if (__tmp.empty() && !_Nb)
__is.setstate(ios_base::failbit);
else
__x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb);
diff --git a/contrib/libstdc++/include/std/std_fstream.h b/contrib/libstdc++/include/std/std_fstream.h
index fb95965..c386105 100644
--- a/contrib/libstdc++/include/std/std_fstream.h
+++ b/contrib/libstdc++/include/std/std_fstream.h
@@ -286,7 +286,16 @@ namespace std
}
};
-
+ // Explicit specializations.
+ template<>
+ basic_filebuf<char>::int_type
+ basic_filebuf<char>::_M_underflow_common(bool __bump);
+
+ #ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ basic_filebuf<wchar_t>::int_type
+ basic_filebuf<wchar_t>::_M_underflow_common(bool __bump);
+ #endif
// 27.8.1.5 Template class basic_ifstream
/**
diff --git a/contrib/libstdc++/include/std/std_istream.h b/contrib/libstdc++/include/std/std_istream.h
index 40f4b67..8aa9123 100644
--- a/contrib/libstdc++/include/std/std_istream.h
+++ b/contrib/libstdc++/include/std/std_istream.h
@@ -261,6 +261,16 @@ namespace std
public basic_ostream<_CharT, _Traits>
{
public:
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+// 271. basic_iostream missing typedefs
+ // Types (inherited):
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+#endif
+
// Non-standard Types:
typedef basic_istream<_CharT, _Traits> __istream_type;
typedef basic_ostream<_CharT, _Traits> __ostream_type;
diff --git a/contrib/libstdc++/include/std/std_memory.h b/contrib/libstdc++/include/std/std_memory.h
index b7feb37..5850eb2 100644
--- a/contrib/libstdc++/include/std/std_memory.h
+++ b/contrib/libstdc++/include/std/std_memory.h
@@ -58,147 +58,314 @@
#include <bits/stl_uninitialized.h>
#include <bits/stl_raw_storage_iter.h>
+// Since this entire file is within namespace std, there's no reason to
+// waste two spaces along the left column. Thus the leading indentation is
+// slightly violated from here on.
namespace std
{
+/**
+ * @if maint
+ * This is a helper function. The unused second parameter exists to
+ * permit the real get_temporary_buffer to use template parameter deduction.
+ *
+ * XXX This should perhaps use the pool.
+ * @endif
+*/
+template <typename _Tp>
+pair<_Tp*, ptrdiff_t>
+__get_temporary_buffer(ptrdiff_t __len, _Tp*)
+{
+ if (__len > ptrdiff_t(INT_MAX / sizeof(_Tp)))
+ __len = INT_MAX / sizeof(_Tp);
- /**
- * @if maint
- * This is a helper function. The unused second parameter exists to
- * permit the real get_temporary_buffer to use template parameter deduction.
- * @endif
- */
- template <class _Tp>
- pair<_Tp*, ptrdiff_t>
- __get_temporary_buffer(ptrdiff_t __len, _Tp*)
- {
- if (__len > ptrdiff_t(INT_MAX / sizeof(_Tp)))
- __len = INT_MAX / sizeof(_Tp);
-
- while (__len > 0) {
- _Tp* __tmp = (_Tp*) std::malloc((std::size_t)__len * sizeof(_Tp));
- if (__tmp != 0)
- return pair<_Tp*, ptrdiff_t>(__tmp, __len);
- __len /= 2;
- }
-
- return pair<_Tp*, ptrdiff_t>((_Tp*)0, 0);
+ while (__len > 0) {
+ _Tp* __tmp = (_Tp*) std::malloc((std::size_t)__len * sizeof(_Tp));
+ if (__tmp != 0)
+ return pair<_Tp*, ptrdiff_t>(__tmp, __len);
+ __len /= 2;
}
- /**
- * @brief This is a mostly-useless wrapper around malloc().
- * @param len The number of objects of type Tp.
- * @return See full description.
- *
- * Reinventing the wheel, but this time with prettier spokes!
- *
- * This function tries to obtain storage for @c len adjacent Tp objects.
- * The objects themselves are not constructed, of course. A pair<> is
- * returned containing "the buffer s address and capacity (in the units of
- * sizeof(Tp)), or a pair of 0 values if no storage can be obtained."
- * Note that the capacity obtained may be less than that requested if the
- * memory is unavailable; you should compare len with the .second return
- * value.
- */
- template <class _Tp>
- inline pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __len) {
+ return pair<_Tp*, ptrdiff_t>((_Tp*)0, 0);
+}
+
+/**
+ * @brief This is a mostly-useless wrapper around malloc().
+ * @param len The number of objects of type Tp.
+ * @return See full description.
+ *
+ * Reinventing the wheel, but this time with prettier spokes!
+ *
+ * This function tries to obtain storage for @c len adjacent Tp objects.
+ * The objects themselves are not constructed, of course. A pair<> is
+ * returned containing "the buffer s address and capacity (in the units of
+ * sizeof(Tp)), or a pair of 0 values if no storage can be obtained."
+ * Note that the capacity obtained may be less than that requested if the
+ * memory is unavailable; you should compare len with the .second return
+ * value.
+*/
+template<typename _Tp>
+ inline pair<_Tp*,ptrdiff_t>
+ get_temporary_buffer(ptrdiff_t __len)
+ {
return __get_temporary_buffer(__len, (_Tp*) 0);
}
- /**
- * @brief The companion to get_temporary_buffer().
- * @param p A buffer previously allocated by get_temporary_buffer.
- * @return None.
- *
- * Frees the memory pointed to by p.
- */
- template <class _Tp>
- void return_temporary_buffer(_Tp* __p) {
+/**
+ * @brief The companion to get_temporary_buffer().
+ * @param p A buffer previously allocated by get_temporary_buffer.
+ * @return None.
+ *
+ * Frees the memory pointed to by p.
+ */
+template<typename _Tp>
+ void
+ return_temporary_buffer(_Tp* __p)
+ {
std::free(__p);
}
-template <class _Tp1>
+/**
+ * A wrapper class to provide auto_ptr with reference semantics. For
+ * example, an auto_ptr can be assigned (or constructed from) the result of
+ * a function which returns an auto_ptr by value.
+ *
+ * All the auto_ptr_ref stuff should happen behind the scenes.
+*/
+template<typename _Tp1>
struct auto_ptr_ref
{
_Tp1* _M_ptr;
- auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {}
+
+ explicit
+ auto_ptr_ref(_Tp1* __p)
+ : _M_ptr(__p) {}
};
+
/**
- * A simple smart pointer providing strict ownership semantics. (More later.)
+ * @brief A simple smart pointer providing strict ownership semantics.
+ *
+ * The Standard says:
+ * <pre>
+ * An @c auto_ptr owns the object it holds a pointer to. Copying an
+ * @c auto_ptr copies the pointer and transfers ownership to the destination.
+ * If more than one @c auto_ptr owns the same object at the same time the
+ * behavior of the program is undefined.
+ *
+ * The uses of @c auto_ptr include providing temporary exception-safety for
+ * dynamically allocated memory, passing ownership of dynamically allocated
+ * memory to a function, and returning dynamically allocated memory from a
+ * function. @c auto_ptr does not meet the CopyConstructible and Assignable
+ * requirements for Standard Library <a href="tables.html#65">container</a>
+ * elements and thus instantiating a Standard Library container with an
+ * @c auto_ptr results in undefined behavior.
+ * </pre>
+ * Quoted from [20.4.5]/3.
+ *
+ * Good examples of what can and cannot be done with auto_ptr can be found
+ * in the libstdc++ testsuite.
+ *
+ * @if maint
+ * _GLIBCPP_RESOLVE_LIB_DEFECTS
+ * 127. auto_ptr<> conversion issues
+ * These resolutions have all been incorporated.
+ * @endif
*/
-template <class _Tp>
+template<typename _Tp>
class auto_ptr
{
private:
_Tp* _M_ptr;
public:
+ /// The pointed-to type.
typedef _Tp element_type;
- explicit auto_ptr(_Tp* __p = 0) throw() : _M_ptr(__p) {}
- auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) {}
+ /**
+ * @brief An %auto_ptr is usually constructed from a raw pointer.
+ * @param p A pointer (defaults to NULL).
+ *
+ * This object now @e owns the object pointed to by @a p.
+ */
+ explicit
+ auto_ptr(element_type* __p = 0) throw()
+ : _M_ptr(__p) { }
- template <class _Tp1> auto_ptr(auto_ptr<_Tp1>& __a) throw()
- : _M_ptr(__a.release()) {}
+ /**
+ * @brief An %auto_ptr can be constructed from another %auto_ptr.
+ * @param a Another %auto_ptr of the same type.
+ *
+ * This object now @e owns the object previously owned by @a a, which has
+ * given up ownsership.
+ */
+ auto_ptr(auto_ptr& __a) throw()
+ : _M_ptr(__a.release()) { }
- auto_ptr& operator=(auto_ptr& __a) throw() {
- reset(__a.release());
- return *this;
- }
+ /**
+ * @brief An %auto_ptr can be constructed from another %auto_ptr.
+ * @param a Another %auto_ptr of a different but related type.
+ *
+ * A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type.
+ *
+ * This object now @e owns the object previously owned by @a a, which has
+ * given up ownsership.
+ */
+ template<typename _Tp1>
+ auto_ptr(auto_ptr<_Tp1>& __a) throw()
+ : _M_ptr(__a.release()) { }
- template <class _Tp1>
- auto_ptr& operator=(auto_ptr<_Tp1>& __a) throw() {
- reset(__a.release());
- return *this;
- }
-
- // Note: The C++ standard says there is supposed to be an empty throw
- // specification here, but omitting it is standard conforming. Its
- // presence can be detected only if _Tp::~_Tp() throws, but (17.4.3.6/2)
- // this is prohibited.
+ /**
+ * @brief %auto_ptr assignment operator.
+ * @param a Another %auto_ptr of the same type.
+ *
+ * This object now @e owns the object previously owned by @a a, which has
+ * given up ownsership. The object that this one @e used to own and
+ * track has been deleted.
+ */
+ auto_ptr&
+ operator=(auto_ptr& __a) throw()
+ {
+ reset(__a.release());
+ return *this;
+ }
+
+ /**
+ * @brief %auto_ptr assignment operator.
+ * @param a Another %auto_ptr of a different but related type.
+ *
+ * A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type.
+ *
+ * This object now @e owns the object previously owned by @a a, which has
+ * given up ownsership. The object that this one @e used to own and
+ * track has been deleted.
+ */
+ template <typename _Tp1>
+ auto_ptr&
+ operator=(auto_ptr<_Tp1>& __a) throw()
+ {
+ reset(__a.release());
+ return *this;
+ }
+
+ /**
+ * When the %auto_ptr goes out of scope, the object it owns is deleted.
+ * If it no longer owns anything (i.e., @c get() is @c NULL), then this
+ * has no effect.
+ *
+ * @if maint
+ * The C++ standard says there is supposed to be an empty throw
+ * specification here, but omitting it is standard conforming. Its
+ * presence can be detected only if _Tp::~_Tp() throws, but this is
+ * prohibited. [17.4.3.6]/2
+ * @end maint
+ */
~auto_ptr() { delete _M_ptr; }
-
- _Tp& operator*() const throw() {
- return *_M_ptr;
- }
- _Tp* operator->() const throw() {
- return _M_ptr;
- }
- _Tp* get() const throw() {
- return _M_ptr;
- }
- _Tp* release() throw() {
- _Tp* __tmp = _M_ptr;
- _M_ptr = 0;
- return __tmp;
- }
- void reset(_Tp* __p = 0) throw() {
- if (__p != _M_ptr) {
- delete _M_ptr;
- _M_ptr = __p;
- }
- }
-public:
- auto_ptr(auto_ptr_ref<_Tp> __ref) throw()
+ /**
+ * @brief Smart pointer dereferencing.
+ *
+ * If this %auto_ptr no longer owns anything, then this operation will
+ * crash. (For a smart pointer, "no longer owns anything" is the same as
+ * being a null pointer, and you know what happens when you dereference
+ * one of those...)
+ */
+ element_type&
+ operator*() const throw() { return *_M_ptr; }
+
+ /**
+ * @brief Smart pointer dereferencing.
+ *
+ * This returns the pointer itself, which the language then will
+ * automatically cause to be dereferenced.
+ */
+ element_type*
+ operator->() const throw() { return _M_ptr; }
+
+ /**
+ * @brief Bypassing the smart pointer.
+ * @return The raw pointer being managed.
+ *
+ * You can get a copy of the pointer that this object owns, for
+ * situations such as passing to a function which only accepts a raw
+ * pointer.
+ *
+ * @note This %auto_ptr still owns the memory.
+ */
+ element_type*
+ get() const throw() { return _M_ptr; }
+
+ /**
+ * @brief Bypassing the smart pointer.
+ * @return The raw pointer being managed.
+ *
+ * You can get a copy of the pointer that this object owns, for
+ * situations such as passing to a function which only accepts a raw
+ * pointer.
+ *
+ * @note This %auto_ptr no longer owns the memory. When this object
+ * goes out of scope, nothing will happen.
+ */
+ element_type*
+ release() throw()
+ {
+ element_type* __tmp = _M_ptr;
+ _M_ptr = 0;
+ return __tmp;
+ }
+
+ /**
+ * @brief Forcibly deletes the managed object.
+ * @param p A pointer (defaults to NULL).
+ *
+ * This object now @e owns the object pointed to by @a p. The previous
+ * object has been deleted.
+ */
+ void
+ reset(element_type* __p = 0) throw()
+ {
+ if (__p != _M_ptr)
+ {
+ delete _M_ptr;
+ _M_ptr = __p;
+ }
+ }
+
+ /** @{
+ * @brief Automatic conversions
+ *
+ * These operations convert an %auto_ptr into and from an auto_ptr_ref
+ * automatically as needed. This allows constructs such as
+ * @code
+ * auto_ptr<Derived> func_returning_auto_ptr(.....);
+ * ...
+ * auto_ptr<Base> ptr = func_returning_auto_ptr(.....);
+ * @endcode
+ */
+ auto_ptr(auto_ptr_ref<element_type> __ref) throw()
: _M_ptr(__ref._M_ptr) {}
- auto_ptr& operator=(auto_ptr_ref<_Tp> __ref) throw() {
- if (__ref._M_ptr != this->get()) {
- delete _M_ptr;
- _M_ptr = __ref._M_ptr;
+ auto_ptr&
+ operator=(auto_ptr_ref<element_type> __ref) throw()
+ {
+ if (__ref._M_ptr != this->get())
+ {
+ delete _M_ptr;
+ _M_ptr = __ref._M_ptr;
+ }
+ return *this;
}
- return *this;
- }
- template <class _Tp1> operator auto_ptr_ref<_Tp1>() throw()
- { return auto_ptr_ref<_Tp>(this->release()); }
- template <class _Tp1> operator auto_ptr<_Tp1>() throw()
- { return auto_ptr<_Tp1>(this->release()); }
+ template<typename _Tp1>
+ operator auto_ptr_ref<_Tp1>() throw()
+ { return auto_ptr_ref<_Tp1>(this->release()); }
+
+ template<typename _Tp1>
+ operator auto_ptr<_Tp1>() throw()
+ { return auto_ptr<_Tp1>(this->release()); }
+ /** @} */
};
} // namespace std
#endif /* _CPP_MEMORY */
-
diff --git a/contrib/libstdc++/include/std/std_streambuf.h b/contrib/libstdc++/include/std/std_streambuf.h
index 012bf4e..491570e 100644
--- a/contrib/libstdc++/include/std/std_streambuf.h
+++ b/contrib/libstdc++/include/std/std_streambuf.h
@@ -71,6 +71,7 @@ namespace std
// Non-standard Types:
typedef ctype<char_type> __ctype_type;
typedef basic_streambuf<char_type, traits_type> __streambuf_type;
+ typedef typename traits_type::state_type __state_type;
friend class basic_ios<char_type, traits_type>;
friend class basic_istream<char_type, traits_type>;
@@ -91,10 +92,10 @@ namespace std
char_type* _M_buf;
// Actual size of allocated internal buffer, in bytes.
- int_type _M_buf_size;
+ size_t _M_buf_size;
// Optimal or preferred size of internal buffer, in bytes.
- int_type _M_buf_size_opt;
+ size_t _M_buf_size_opt;
// True iff _M_in_* and _M_out_* buffers should always point to
// the same place. True for fstreams, false for sstreams.
@@ -126,12 +127,15 @@ namespace std
// requirements. The only basic_streambuf member function that
// needs access to these data members is in_avail...
// NB: pbacks of over one character are not currently supported.
- static const int_type _S_pback_size = 1;
+ static const size_t _S_pback_size = 1;
char_type _M_pback[_S_pback_size];
char_type* _M_pback_cur_save;
char_type* _M_pback_end_save;
bool _M_pback_init;
+ // Yet unused.
+ fpos<__state_type> _M_pos;
+
// Initializes pback buffers, and moves normal buffers to safety.
// Assumptions:
// _M_in_cur has already been moved back
@@ -140,8 +144,8 @@ namespace std
{
if (!_M_pback_init)
{
- int_type __dist = _M_in_end - _M_in_cur;
- int_type __len = min(_S_pback_size, __dist);
+ size_t __dist = _M_in_end - _M_in_cur;
+ size_t __len = min(_S_pback_size, __dist);
traits_type::copy(_M_pback, _M_in_cur, __len);
_M_pback_cur_save = _M_in_cur;
_M_pback_end_save = _M_in_end;
@@ -159,12 +163,12 @@ namespace std
if (_M_pback_init)
{
// Length _M_in_cur moved in the pback buffer.
- int_type __off_cur = _M_in_cur - _M_pback;
+ size_t __off_cur = _M_in_cur - _M_pback;
// For in | out buffers, the end can be pushed back...
- int_type __off_end = 0;
- int_type __pback_len = _M_in_end - _M_pback;
- int_type __save_len = _M_pback_end_save - _M_buf;
+ size_t __off_end = 0;
+ size_t __pback_len = _M_in_end - _M_pback;
+ size_t __save_len = _M_pback_end_save - _M_buf;
if (__pback_len > __save_len)
__off_end = __pback_len - __save_len;
@@ -288,8 +292,8 @@ namespace std
{
if (_M_pback_init)
{
- int_type __save_len = _M_pback_end_save - _M_pback_cur_save;
- int_type __pback_len = _M_in_cur - _M_pback;
+ size_t __save_len = _M_pback_end_save - _M_pback_cur_save;
+ size_t __pback_len = _M_in_cur - _M_pback;
__ret = __save_len - __pback_len;
}
else
@@ -304,7 +308,8 @@ namespace std
snextc()
{
int_type __eof = traits_type::eof();
- return (this->sbumpc() == __eof ? __eof : this->sgetc());
+ return (traits_type::eq_int_type(this->sbumpc(), __eof)
+ ? __eof : this->sgetc());
}
int_type
@@ -342,10 +347,10 @@ namespace std
protected:
basic_streambuf()
- : _M_buf(NULL), _M_buf_size(0),
- _M_buf_size_opt(static_cast<int_type>(BUFSIZ)), _M_buf_unified(false),
- _M_in_beg(0), _M_in_cur(0), _M_in_end(0), _M_out_beg(0), _M_out_cur(0),
- _M_out_end(0), _M_mode(ios_base::openmode(0)), _M_buf_locale(locale()),
+ : _M_buf(NULL), _M_buf_size(0), _M_buf_size_opt(BUFSIZ),
+ _M_buf_unified(false), _M_in_beg(0), _M_in_cur(0), _M_in_end(0),
+ _M_out_beg(0), _M_out_cur(0), _M_out_end(0),
+ _M_mode(ios_base::openmode(0)), _M_buf_locale(locale()),
_M_buf_locale_init(false), _M_pback_cur_save(0), _M_pback_end_save(0),
_M_pback_init(false)
{ }
@@ -438,7 +443,7 @@ namespace std
uflow()
{
int_type __ret = traits_type::eof();
- bool __testeof = this->underflow() == __ret;
+ bool __testeof = traits_type::eq_int_type(this->underflow(), __ret);
bool __testpending = _M_in_cur && _M_in_cur < _M_in_end;
if (!__testeof && __testpending)
{
OpenPOWER on IntegriCloud