summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-06 20:36:03 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-06 20:36:03 +0000
commite4ab123c32e6ee2064f01f5bb477bfaca438c20f (patch)
tree45c6c5ff8fa819ab554de69d49403a43f8de5ecb /libstdc++-v3
parent692323c3112b3b579a1634758842ede7c416f94c (diff)
downloadgcc-e4ab123c32e6ee2064f01f5bb477bfaca438c20f.tar.gz
2011-03-06 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 170715 using svnmerge git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@170721 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog82
-rw-r--r--libstdc++-v3/acinclude.m419
-rw-r--r--libstdc++-v3/config/abi/pre/gnu.ver3
-rwxr-xr-xlibstdc++-v3/configure57
-rw-r--r--libstdc++-v3/configure.ac1
-rw-r--r--libstdc++-v3/doc/xml/manual/configure.xml58
-rw-r--r--libstdc++-v3/include/Makefile.am13
-rw-r--r--libstdc++-v3/include/Makefile.in10
-rw-r--r--libstdc++-v3/include/bits/allocator.h7
-rw-r--r--libstdc++-v3/include/bits/basic_ios.tcc5
-rw-r--r--libstdc++-v3/include/bits/basic_string.tcc3
-rw-r--r--libstdc++-v3/include/bits/c++config4
-rw-r--r--libstdc++-v3/include/bits/codecvt.h5
-rw-r--r--libstdc++-v3/include/bits/fstream.tcc15
-rw-r--r--libstdc++-v3/include/bits/istream.tcc3
-rw-r--r--libstdc++-v3/include/bits/locale_classes.tcc5
-rw-r--r--libstdc++-v3/include/bits/locale_facets.tcc3
-rw-r--r--libstdc++-v3/include/bits/locale_facets_nonio.tcc5
-rw-r--r--libstdc++-v3/include/bits/ostream.tcc3
-rw-r--r--libstdc++-v3/include/bits/ostream_insert.h3
-rw-r--r--libstdc++-v3/include/bits/sstream.tcc32
-rw-r--r--libstdc++-v3/include/bits/streambuf.tcc9
-rw-r--r--libstdc++-v3/include/bits/streambuf_iterator.h6
-rw-r--r--libstdc++-v3/include/std/ratio64
-rw-r--r--libstdc++-v3/include/std/sstream5
-rw-r--r--libstdc++-v3/include/std/streambuf7
-rw-r--r--libstdc++-v3/src/Makefile.am65
-rw-r--r--libstdc++-v3/src/Makefile.in92
-rw-r--r--libstdc++-v3/src/compatibility.cc4
-rw-r--r--libstdc++-v3/src/istream.cc16
-rw-r--r--libstdc++-v3/src/streambuf.cc7
-rw-r--r--libstdc++-v3/src/strstream.cc9
-rw-r--r--libstdc++-v3/src/valarray.cc (renamed from libstdc++-v3/src/valarray-inst.cc)0
-rw-r--r--libstdc++-v3/testsuite/20_util/hash/chi2_quality.cc7
-rw-r--r--libstdc++-v3/testsuite/20_util/hash/quality.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/comparisons/comp2.cc5
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/comparisons/comp3.cc75
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/operations/47913.cc42
-rw-r--r--libstdc++-v3/testsuite/Makefile.am4
-rw-r--r--libstdc++-v3/testsuite/Makefile.in4
-rw-r--r--libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc2
41 files changed, 569 insertions, 194 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 4b9b197a0da..9e1fc0aa52c 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,85 @@
+2011-03-04 Benjamin Kosnik <bkoz@chula>
+
+ * src/Makefile.am (inst_sources): Make source instantion files
+ conditional.
+ (XTEMPLATE_FLAGS): Make -fno-implicit-templates conditional.
+ * src/Makefile.in: Regenerate.
+ * src/valarray-inst.cc: Move to..
+ * src/valarray.cc: ...this.
+ * acinclude.m4 (GLIBCXX_ENABLE_EXTERN_TEMPLATE]): Define.
+ * configure.ac (GLIBCXX_ENABLE_EXTERN_TEMPLATE): Use it.
+ * configure: Regenerate.
+ * include/Makefile.am (stamp-extern-template): Add.
+ * include/Makefile.in: Regenerate.
+
+ * doc/xml/manual/configure.xml: Document --enable-extern-template.
+
+ * include/bits/locale_classes.tcc: Adjust comment.
+ * include/bits/locale_facets.tcc: Same.
+ * include/bits/basic_ios.tcc: Same.
+ * include/bits/istream.tcc: Same.
+ * include/bits/codecvt.h: Same.
+ * include/bits/ostream.tcc: Same.
+ * include/bits/sstream.tcc: Same.
+ * include/bits/c++config: Same.
+ * include/bits/basic_string.tcc: Same.
+ * include/bits/ostream_insert.h: Same.
+ * include/bits/locale_facets_nonio.tcc: Same.
+ * include/bits/streambuf.tcc: Same.
+ * include/bits/allocator.h: Same.
+ * include/bits/fstream.tcc: Same.
+
+ * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers.
+
+2011-03-02 Benjamin Kosnik <bkoz@redhat.com>
+
+ * testsuite/Makefile.am: Make clean fixups.
+ * testsuite/Makefile.in: Regenerate.
+
+2011-03-02 Marc Glisse <marc.glisse@normalesup.org>
+
+ * include/std/ratio (ratio_less): Add comments.
+
+2011-03-02 Marc Glisse <marc.glisse@normalesup.org>
+
+ PR libstdc++/47913
+ * include/std/ratio (ratio_add): Avoid denominator overflow.
+ * testsuite/20_util/ratio/operations/47913.cc: New.
+
+2011-02-28 Benjamin Kosnik <bkoz@redhat.com>
+
+ * testsuite/20_util/hash/chi2_quality.cc: Use C++0x mode on simulators.
+ * testsuite/20_util/hash/quality.cc: Same.
+
+2011-02-28 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/47921
+ * include/std/streambuf (basic_streambuf<>::__safe_gbump,
+ __safe_pbump): Add.
+ * include/bits/streambuf.tcc (basic_streambuf<>::xgetn,
+ xputn): Use the latter.
+ * include/bits/streambuf_iterator.h: Likewise.
+ * src/strstream.cc: Likewise.
+ * src/streambuf.cc: Likewise.
+ * src/compatibility.cc: Likewise.
+ * src/istream.cc: Likewise.
+ * include/bits/fstream.tcc (basic_filebuf<>::xsgetn): Use setg
+ instead of gbump.
+ * include/std/sstream (basic_stringbuf<>::_M_pbump): Add.
+ * include/bits/sstream.tcc (basic_stringbuf<>::seekoff,
+ seekpos, _M_sync): Use setg, setp, and _M_pbump.
+ * config/abi/pre/gnu.ver: Tweak.
+
+2011-02-28 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * testsuite/20_util/ratio/comparisons/comp3.cc: New.
+
+2011-02-28 Marc Glisse <marc.glisse@normalesup.org>
+
+ PR libstdc++/42622
+ * include/std/ratio (ratio_less): Reimplement to never overflow.
+ * testsuite/20_util/ratio/comparisons/comp2.cc: Extend.
+
2011-02-24 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/18_support/type_info/fundamental.cc: New.
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index f8db04e9afb..3b9cdcb45c3 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -1993,6 +1993,25 @@ AC_DEFUN([GLIBCXX_ENABLE_CONCEPT_CHECKS], [
])
dnl
+dnl Use extern templates.
+dnl
+dnl --enable-extern-template defines _GLIBCXX_EXTERN_TEMPLATE to 1
+dnl --disable-extern-template defines _GLIBCXX_EXTERN_TEMPLATE to 0
+
+dnl + Usage: GLIBCXX_ENABLE_TEMPLATE[(DEFAULT)]
+dnl Where DEFAULT is `yes' or `no'.
+dnl
+AC_DEFUN([GLIBCXX_ENABLE_EXTERN_TEMPLATE], [
+
+ GLIBCXX_ENABLE(extern-template,$1,,[enable extern template])
+
+ AC_MSG_CHECKING([for extern template support])
+ AC_MSG_RESULT([$enable_extern_template])
+
+ GLIBCXX_CONDITIONAL(ENABLE_EXTERN_TEMPLATE, test $enable_extern_template = yes)
+])
+
+dnl
dnl Check for parallel mode pre-requisites, including OpenMP support.
dnl
dnl + Usage: GLIBCXX_ENABLE_PARALLEL
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index aa4031afade..b3e5380f76d 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -322,7 +322,8 @@ GLIBCXX_3.4 {
_ZNSt15basic_stringbufIcSt11char_traitsIcESaIcEE3strERKSs;
_ZNSt15basic_stringbufIwSt11char_traitsIwESaIwEE3strERKSbIwS1_S2_E;
_ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9][t-z]*;
- _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9]_M_[a-z]*;
+ _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9]_M_[a-o]*;
+ _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9]_M_[q-z]*;
_ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9][0-9]_M_[a-z]*;
# std::basic_iostream constructors, destructors
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 53129c67332..c2288b308e9 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -663,6 +663,8 @@ LIBICONV
OPT_LDFLAGS
SECTION_LDFLAGS
GLIBCXX_LIBS
+ENABLE_EXTERN_TEMPLATE_FALSE
+ENABLE_EXTERN_TEMPLATE_TRUE
EXTRA_CXX_FLAGS
ENABLE_PARALLEL_FALSE
ENABLE_PARALLEL_TRUE
@@ -853,6 +855,7 @@ enable_libstdcxx_debug_flags
enable_libstdcxx_debug
enable_cxx_flags
enable_fully_dynamic_string
+enable_extern_template
enable_libstdcxx_time
enable_tls
enable_rpath
@@ -1539,6 +1542,8 @@ Optional Features:
--enable-fully-dynamic-string
do not put empty strings in per-process static
memory [default=no]
+ --enable-extern-template
+ enable extern template [default=yes]
--enable-libstdcxx-time[=KIND]
use KIND for check type [default=no]
--enable-tls Use thread-local storage [default=yes]
@@ -11482,7 +11487,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11485 "configure"
+#line 11490 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11588,7 +11593,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11591 "configure"
+#line 11596 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14946,7 +14951,7 @@ fi
#
# Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style.
cat > conftest.$ac_ext << EOF
-#line 14949 "configure"
+#line 14954 "configure"
struct S { ~S(); };
void bar();
void foo()
@@ -15314,7 +15319,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 15317 "configure"
+#line 15322 "configure"
int main()
{
typedef bool atomic_type;
@@ -15351,7 +15356,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15354 "configure"
+#line 15359 "configure"
int main()
{
typedef short atomic_type;
@@ -15388,7 +15393,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15391 "configure"
+#line 15396 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@@ -15426,7 +15431,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15429 "configure"
+#line 15434 "configure"
int main()
{
typedef long long atomic_type;
@@ -15502,7 +15507,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 15505 "configure"
+#line 15510 "configure"
int main()
{
_Decimal32 d1;
@@ -17134,6 +17139,29 @@ $as_echo "#define _GLIBCXX_FULLY_DYNAMIC_STRING 1" >>confdefs.h
fi
+
+ # Check whether --enable-extern-template was given.
+if test "${enable_extern_template+set}" = set; then :
+ enableval=$enable_extern_template;
+ case "$enableval" in
+ yes|no) ;;
+ *) as_fn_error "Argument to enable/disable extern-template must be yes or no" "$LINENO" 5 ;;
+ esac
+
+else
+ enable_extern_template=yes
+fi
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for extern template support" >&5
+$as_echo_n "checking for extern template support... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_extern_template" >&5
+$as_echo "$enable_extern_template" >&6; }
+
+
+
+
# Checks for operating systems support that doesn't require linking.
@@ -65345,6 +65373,15 @@ else
fi
+ if test $enable_extern_template = yes; then
+ ENABLE_EXTERN_TEMPLATE_TRUE=
+ ENABLE_EXTERN_TEMPLATE_FALSE='#'
+else
+ ENABLE_EXTERN_TEMPLATE_TRUE='#'
+ ENABLE_EXTERN_TEMPLATE_FALSE=
+fi
+
+
if test $enable_symvers != no; then
ENABLE_SYMVERS_TRUE=
ENABLE_SYMVERS_FALSE='#'
@@ -65794,6 +65831,10 @@ if test -z "${ENABLE_PARALLEL_TRUE}" && test -z "${ENABLE_PARALLEL_FALSE}"; then
as_fn_error "conditional \"ENABLE_PARALLEL\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_EXTERN_TEMPLATE_TRUE}" && test -z "${ENABLE_EXTERN_TEMPLATE_FALSE}"; then
+ as_fn_error "conditional \"ENABLE_EXTERN_TEMPLATE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${ENABLE_SYMVERS_TRUE}" && test -z "${ENABLE_SYMVERS_FALSE}"; then
as_fn_error "conditional \"ENABLE_SYMVERS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 94f63bb6432..8ac9cadf643 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -132,6 +132,7 @@ GLIBCXX_ENABLE_DEBUG([no])
GLIBCXX_ENABLE_PARALLEL([yes])
GLIBCXX_ENABLE_CXX_FLAGS
GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no])
+GLIBCXX_ENABLE_EXTERN_TEMPLATE([yes])
# Checks for operating systems support that doesn't require linking.
GLIBCXX_CHECK_SYSTEM_ERROR
diff --git a/libstdc++-v3/doc/xml/manual/configure.xml b/libstdc++-v3/doc/xml/manual/configure.xml
index 4c983a4fd2d..6b1efa8006e 100644
--- a/libstdc++-v3/doc/xml/manual/configure.xml
+++ b/libstdc++-v3/doc/xml/manual/configure.xml
@@ -161,6 +161,29 @@
</para>
</listitem></varlistentry>
+
+ <varlistentry><term><code>--enable-libstdcxx-time</code></term>
+ <listitem><para>This is an abbreviated form of
+ <code>'--enable-libstdcxx-time=yes'</code>(described next).
+ </para>
+ </listitem></varlistentry>
+
+ <varlistentry><term><code>--enable-libstdcxx-time=OPTION</code></term>
+ <listitem><para>Enables link-type checks for the availability of the
+ clock_gettime clocks, used in the implementation of [time.clock],
+ and of the nanosleep and sched_yield functions, used in the
+ implementation of [thread.thread.this] of the current C++0x draft.
+ The choice OPTION=yes checks for the availability of the facilities
+ in libc and libposix4. In case of need the latter is also linked
+ to libstdc++ as part of the build process. OPTION=rt also searches
+ (and, in case, links) librt. Note that the latter is not always
+ desirable because, in glibc, for example, in turn it triggers the
+ linking of libpthread too, which activates locking, a large overhead
+ for single-thread programs. OPTION=no skips the tests completely.
+ The default is OPTION=no.
+ </para>
+ </listitem></varlistentry>
+
<varlistentry><term><code>--enable-libstdcxx-debug</code></term>
<listitem><para>Build separate debug libraries in addition to what is normally built.
By default, the debug libraries are compiled with
@@ -313,6 +336,19 @@
</para>
</listitem></varlistentry>
+
+ <varlistentry><term><code>--enable-extern-template</code>[default]</term>
+ <listitem><para>Use extern template to pre-instantiate all required
+ specializations for certain types defined in the standard libraries.
+ These types include <classname>string</classname> and dependents like
+ <classname>char_traits</classname>, the templateized io classes,
+ <classname>allocator</classname>, and others.
+ Disabling means that implicit
+ template generation will be used when compiling these types. By
+ default, this option is on. This option can change the library ABI.
+ </para>
+ </listitem></varlistentry>
+
<varlistentry><term><code>--disable-hosted-libstdcxx</code></term>
<listitem>
<para>
@@ -324,28 +360,6 @@
</para>
</listitem></varlistentry>
- <varlistentry><term><code>--enable-libstdcxx-time</code></term>
- <listitem><para>This is an abbreviated form of
- <code>'--enable-libstdcxx-time=yes'</code>(described next).
- </para>
- </listitem></varlistentry>
-
- <varlistentry><term><code>--enable-libstdcxx-time=OPTION</code></term>
- <listitem><para>Enables link-type checks for the availability of the
- clock_gettime clocks, used in the implementation of [time.clock],
- and of the nanosleep and sched_yield functions, used in the
- implementation of [thread.thread.this] of the current C++0x draft.
- The choice OPTION=yes checks for the availability of the facilities
- in libc and libposix4. In case of need the latter is also linked
- to libstdc++ as part of the build process. OPTION=rt also searches
- (and, in case, links) librt. Note that the latter is not always
- desirable because, in glibc, for example, in turn it triggers the
- linking of libpthread too, which activates locking, a large overhead
- for single-thread programs. OPTION=no skips the tests completely.
- The default is OPTION=no.
- </para>
- </listitem></varlistentry>
-
</variablelist>
</section>
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 5b6352e33b8..165adc1574d 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -1067,6 +1067,14 @@ stamp-namespace-version:
echo 0 > stamp-namespace-version
endif
+if ENABLE_EXTERN_TEMPLATE
+stamp-extern-template:
+ echo 1 > stamp-extern-template
+else
+stamp-extern-template:
+ echo 0 > stamp-extern-template
+endif
+
if ENABLE_VISIBILITY
stamp-visibility:
echo 1 > stamp-visibility
@@ -1082,10 +1090,12 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
stamp-${host_alias} \
${toplevel_srcdir}/gcc/DATESTAMP \
stamp-namespace-version \
- stamp-visibility
+ stamp-visibility \
+ stamp-extern-template
@date=`cat ${toplevel_srcdir}/gcc/DATESTAMP` ;\
ns_version=`cat stamp-namespace-version` ;\
visibility=`cat stamp-visibility` ;\
+ externtemplate=`cat stamp-extern-template` ;\
ldbl_compat='s,g,g,' ;\
grep "^[ ]*#[ ]*define[ ][ ]*_GLIBCXX_LONG_DOUBLE_COMPAT[ ][ ]*1[ ]*$$" \
${CONFIG_HEADER} > /dev/null 2>&1 \
@@ -1093,6 +1103,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
sed -e "s,define __GLIBCXX__,define __GLIBCXX__ $$date," \
-e "s,define _GLIBCXX_INLINE_VERSION, define _GLIBCXX_INLINE_VERSION $$ns_version," \
-e "s,define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY, define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY $$visibility," \
+ -e "s,define _GLIBCXX_EXTERN_TEMPLATE, define _GLIBCXX_EXTERN_TEMPLATE $$externtemplate," \
-e "$$ldbl_compat" \
< ${glibcxx_srcdir}/include/bits/c++config > $@ ;\
sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index d78315885cc..4f0bb723d16 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -1462,6 +1462,11 @@ stamp-host: ${host_headers} ${host_headers_noinst} stamp-${host_alias}
@ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@stamp-namespace-version:
@ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@ echo 0 > stamp-namespace-version
+@ENABLE_EXTERN_TEMPLATE_TRUE@stamp-extern-template:
+@ENABLE_EXTERN_TEMPLATE_TRUE@ echo 1 > stamp-extern-template
+@ENABLE_EXTERN_TEMPLATE_FALSE@stamp-extern-template:
+@ENABLE_EXTERN_TEMPLATE_FALSE@ echo 0 > stamp-extern-template
+
@ENABLE_VISIBILITY_TRUE@stamp-visibility:
@ENABLE_VISIBILITY_TRUE@ echo 1 > stamp-visibility
@ENABLE_VISIBILITY_FALSE@stamp-visibility:
@@ -1474,10 +1479,12 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
stamp-${host_alias} \
${toplevel_srcdir}/gcc/DATESTAMP \
stamp-namespace-version \
- stamp-visibility
+ stamp-visibility \
+ stamp-extern-template
@date=`cat ${toplevel_srcdir}/gcc/DATESTAMP` ;\
ns_version=`cat stamp-namespace-version` ;\
visibility=`cat stamp-visibility` ;\
+ externtemplate=`cat stamp-extern-template` ;\
ldbl_compat='s,g,g,' ;\
grep "^[ ]*#[ ]*define[ ][ ]*_GLIBCXX_LONG_DOUBLE_COMPAT[ ][ ]*1[ ]*$$" \
${CONFIG_HEADER} > /dev/null 2>&1 \
@@ -1485,6 +1492,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
sed -e "s,define __GLIBCXX__,define __GLIBCXX__ $$date," \
-e "s,define _GLIBCXX_INLINE_VERSION, define _GLIBCXX_INLINE_VERSION $$ns_version," \
-e "s,define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY, define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY $$visibility," \
+ -e "s,define _GLIBCXX_EXTERN_TEMPLATE, define _GLIBCXX_EXTERN_TEMPLATE $$externtemplate," \
-e "$$ldbl_compat" \
< ${glibcxx_srcdir}/include/bits/c++config > $@ ;\
sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h
index 9018b5aa59a..9d01a602dae 100644
--- a/libstdc++-v3/include/bits/allocator.h
+++ b/libstdc++-v3/include/bits/allocator.h
@@ -1,7 +1,7 @@
// Allocators -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+// 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -139,7 +139,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
- // NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE
extern template class allocator<char>;
extern template class allocator<wchar_t>;
@@ -235,6 +234,6 @@ _GLIBCXX_HAS_NESTED_TYPE(allocator_type)
#endif
_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+} // namespace std
#endif
diff --git a/libstdc++-v3/include/bits/basic_ios.tcc b/libstdc++-v3/include/bits/basic_ios.tcc
index 98b227fb95a..8ac6bfdbe1e 100644
--- a/libstdc++-v3/include/bits/basic_ios.tcc
+++ b/libstdc++-v3/include/bits/basic_ios.tcc
@@ -1,7 +1,7 @@
// basic_ios member functions -*- C++ -*-
// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-// 2009, 2010 Free Software Foundation, Inc.
+// 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -175,7 +175,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
- // NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE
extern template class basic_ios<char>;
@@ -185,6 +184,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+} // namespace std
#endif
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index 880fc6b3494..d988334274e 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -1130,7 +1130,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
- // NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE > 0
extern template class basic_string<char>;
extern template
@@ -1164,6 +1163,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+} // namespace std
#endif
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index bab2b87ac81..e334f94d3dd 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -109,9 +109,7 @@
// Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern
// templates only in basic_string, thus activating its debug-mode
// checks even at -O0.
-#ifndef _GLIBCXX_EXTERN_TEMPLATE
-# define _GLIBCXX_EXTERN_TEMPLATE 1
-#endif
+#define _GLIBCXX_EXTERN_TEMPLATE
/*
Outline of libstdc++ namespaces.
diff --git a/libstdc++-v3/include/bits/codecvt.h b/libstdc++-v3/include/bits/codecvt.h
index 42cc471d9cd..6ae9bbe26de 100644
--- a/libstdc++-v3/include/bits/codecvt.h
+++ b/libstdc++-v3/include/bits/codecvt.h
@@ -1,7 +1,7 @@
// Locale support (codecvt) -*- C++ -*-
// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-// 2009, 2010 Free Software Foundation, Inc.
+// 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -476,7 +476,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
- // NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE
extern template class codecvt_byname<char, char, mbstate_t>;
@@ -502,6 +501,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+} // namespace std
#endif // _CODECVT_H
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc
index edaff970374..3d5ca62ad9c 100644
--- a/libstdc++-v3/include/bits/fstream.tcc
+++ b/libstdc++-v3/include/bits/fstream.tcc
@@ -584,14 +584,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const streamsize __avail = this->egptr() - this->gptr();
if (__avail != 0)
{
- if (__avail == 1)
- *__s = *this->gptr();
- else
- traits_type::copy(__s, this->gptr(), __avail);
+ traits_type::copy(__s, this->gptr(), __avail);
__s += __avail;
- this->gbump(__avail);
- __ret += __avail;
- __n -= __avail;
+ this->setg(this->eback(), this->gptr() + __avail,
+ this->egptr());
+ __ret += __avail;
+ __n -= __avail;
}
// Need to loop in case of short reads (relatively common
@@ -966,7 +964,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
- // NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE
extern template class basic_filebuf<char>;
extern template class basic_ifstream<char>;
@@ -982,6 +979,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+} // namespace std
#endif
diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc
index 5666b11be3d..9055c31ce12 100644
--- a/libstdc++-v3/include/bits/istream.tcc
+++ b/libstdc++-v3/include/bits/istream.tcc
@@ -1038,7 +1038,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
- // NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE
extern template class basic_istream<char>;
extern template istream& ws(istream&);
@@ -1090,6 +1089,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+} // namespace std
#endif
diff --git a/libstdc++-v3/include/bits/locale_classes.tcc b/libstdc++-v3/include/bits/locale_classes.tcc
index e60401343e0..5b2901aea9e 100644
--- a/libstdc++-v3/include/bits/locale_classes.tcc
+++ b/libstdc++-v3/include/bits/locale_classes.tcc
@@ -1,6 +1,6 @@
// Locale support -*- C++ -*-
-// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -241,7 +241,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
- // NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE
extern template class collate<char>;
extern template class collate_byname<char>;
@@ -269,6 +268,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+} // namespace std
#endif
diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc
index 114d852e2ae..80bda15ac2a 100644
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -1,7 +1,7 @@
// Locale support -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2008, 2009, 2010
+// 2006, 2007, 2008, 2009, 2010, 2011
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -1276,7 +1276,6 @@ _GLIBCXX_END_NAMESPACE_LDBL
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
- // NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE
extern template class numpunct<char>;
extern template class numpunct_byname<char>;
diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.tcc b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
index 3039907d750..fbf70053549 100644
--- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
@@ -1,6 +1,6 @@
// Locale support -*- C++ -*-
-// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -1215,7 +1215,6 @@ _GLIBCXX_END_NAMESPACE_LDBL
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
- // NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE
extern template class moneypunct<char, false>;
extern template class moneypunct<char, true>;
@@ -1369,6 +1368,6 @@ _GLIBCXX_END_NAMESPACE_LDBL
#endif
_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+} // namespace std
#endif
diff --git a/libstdc++-v3/include/bits/ostream.tcc b/libstdc++-v3/include/bits/ostream.tcc
index 6c59e3e4162..c0dce6a232b 100644
--- a/libstdc++-v3/include/bits/ostream.tcc
+++ b/libstdc++-v3/include/bits/ostream.tcc
@@ -357,7 +357,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
- // NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE
extern template class basic_ostream<char>;
extern template ostream& endl(ostream&);
@@ -405,6 +404,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+} // namespace std
#endif
diff --git a/libstdc++-v3/include/bits/ostream_insert.h b/libstdc++-v3/include/bits/ostream_insert.h
index 97608a00d06..f4228657d1b 100644
--- a/libstdc++-v3/include/bits/ostream_insert.h
+++ b/libstdc++-v3/include/bits/ostream_insert.h
@@ -114,7 +114,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
- // NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE
extern template ostream& __ostream_insert(ostream&, const char*, streamsize);
@@ -125,6 +124,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+} // namespace std
#endif /* _OSTREAM_INSERT_H */
diff --git a/libstdc++-v3/include/bits/sstream.tcc b/libstdc++-v3/include/bits/sstream.tcc
index 8956e9ee758..89b9a547c25 100644
--- a/libstdc++-v3/include/bits/sstream.tcc
+++ b/libstdc++-v3/include/bits/sstream.tcc
@@ -1,7 +1,7 @@
// String based streams -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2009, 2010
+// 2006, 2007, 2008, 2009, 2010, 2011
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -178,14 +178,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
&& __newoffi >= 0
&& this->egptr() - __beg >= __newoffi)
{
- this->gbump((__beg + __newoffi) - this->gptr());
+ this->setg(this->eback(), this->eback() + __newoffi,
+ this->egptr());
__ret = pos_type(__newoffi);
}
if ((__testout || __testboth)
&& __newoffo >= 0
&& this->egptr() - __beg >= __newoffo)
{
- this->pbump((__beg + __newoffo) - this->pptr());
+ _M_pbump(this->pbase(), this->epptr(), __newoffo);
__ret = pos_type(__newoffo);
}
}
@@ -212,9 +213,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__testpos)
{
if (__testin)
- this->gbump((__beg + __pos) - this->gptr());
+ this->setg(this->eback(), this->eback() + __pos,
+ this->egptr());
if (__testout)
- this->pbump((__beg + __pos) - this->pptr());
+ _M_pbump(this->pbase(), this->epptr(), __pos);
__ret = __sp;
}
}
@@ -243,8 +245,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
this->setg(__base, __base + __i, __endg);
if (__testout)
{
- this->setp(__base, __endp);
- this->pbump(__o);
+ _M_pbump(__base, __endp, __o);
// egptr() always tracks the string end. When !__testin,
// for the correct functioning of the streambuf inlines
// the other get area pointers are identical.
@@ -253,9 +254,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
}
+ template <class _CharT, class _Traits, class _Alloc>
+ void
+ basic_stringbuf<_CharT, _Traits, _Alloc>::
+ _M_pbump(char_type* __pbeg, char_type* __pend, off_type __off)
+ {
+ this->setp(__pbeg, __pend);
+ while (__off > __gnu_cxx::__numeric_traits<int>::__max)
+ {
+ this->pbump(__gnu_cxx::__numeric_traits<int>::__max);
+ __off -= __gnu_cxx::__numeric_traits<int>::__max;
+ }
+ this->pbump(__off);
+ }
+
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
- // NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE
extern template class basic_stringbuf<char>;
extern template class basic_istringstream<char>;
@@ -271,6 +285,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+} // namespace std
#endif
diff --git a/libstdc++-v3/include/bits/streambuf.tcc b/libstdc++-v3/include/bits/streambuf.tcc
index 253f308dc88..6cb85fc1818 100644
--- a/libstdc++-v3/include/bits/streambuf.tcc
+++ b/libstdc++-v3/include/bits/streambuf.tcc
@@ -1,7 +1,7 @@
// Stream buffer classes -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2009, 2010 Free Software Foundation, Inc.
+// 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -57,7 +57,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
traits_type::copy(__s, this->gptr(), __len);
__ret += __len;
__s += __len;
- this->gbump(__len);
+ this->__safe_gbump(__len);
}
if (__ret < __n)
@@ -91,7 +91,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
traits_type::copy(this->pptr(), __s, __len);
__ret += __len;
__s += __len;
- this->pbump(__len);
+ this->__safe_pbump(__len);
}
if (__ret < __n)
@@ -146,7 +146,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
- // NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE
extern template class basic_streambuf<char>;
extern template
@@ -172,6 +171,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+} // namespace std
#endif
diff --git a/libstdc++-v3/include/bits/streambuf_iterator.h b/libstdc++-v3/include/bits/streambuf_iterator.h
index 6032a29e6f8..83ae6785c2d 100644
--- a/libstdc++-v3/include/bits/streambuf_iterator.h
+++ b/libstdc++-v3/include/bits/streambuf_iterator.h
@@ -1,7 +1,7 @@
// Streambuf iterators
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2009, 2010
+// 2006, 2007, 2009, 2010, 2011
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -339,7 +339,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__n > 1)
{
traits_type::copy(__result, __sb->gptr(), __n);
- __sb->gbump(__n);
+ __sb->__safe_gbump(__n);
__result += __n;
__c = __sb->underflow();
}
@@ -379,7 +379,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__n, __val);
if (__p)
__n = __p - __sb->gptr();
- __sb->gbump(__n);
+ __sb->__safe_gbump(__n);
__c = __sb->sgetc();
}
else
diff --git a/libstdc++-v3/include/std/ratio b/libstdc++-v3/include/std/ratio
index 69c0b6e14bb..17d28a10f46 100644
--- a/libstdc++-v3/include/std/ratio
+++ b/libstdc++-v3/include/std/ratio
@@ -1,6 +1,6 @@
// ratio -*- C++ -*-
-// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -177,15 +177,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct ratio_add
{
private:
- static const intmax_t __gcd =
+ static constexpr intmax_t __gcd =
__static_gcd<_R1::den, _R2::den>::value;
+ static constexpr intmax_t __n = __safe_add<
+ __safe_multiply<_R1::num, (_R2::den / __gcd)>::value,
+ __safe_multiply<_R2::num, (_R1::den / __gcd)>::value>::value;
+
+ // The new numerator may have common factors with the denominator,
+ // but they have to also be factors of __gcd.
+ static constexpr intmax_t __gcd2 = __static_gcd<__n, __gcd>::value;
public:
- typedef ratio<
- __safe_add<
- __safe_multiply<_R1::num, (_R2::den / __gcd)>::value,
- __safe_multiply<_R2::num, (_R1::den / __gcd)>::value>::value,
- __safe_multiply<_R1::den, (_R2::den / __gcd)>::value> type;
+ typedef ratio<__n / __gcd2,
+ __safe_multiply<_R1::den / __gcd2, _R2::den / __gcd>::value> type;
static constexpr intmax_t num = type::num;
static constexpr intmax_t den = type::den;
@@ -274,9 +278,45 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: integral_constant<bool, !ratio_equal<_R1, _R2>::value>
{ };
- template<typename _R1>
+ // 0 <= _Ri < 1
+ // If one is 0, conclude
+ // Otherwise, x < y iff 1/y < 1/x
+ template<typename _R1, typename _R2>
+ struct __ratio_less_impl_2;
+
+ // _Ri > 0
+ // Compare the integral parts, and remove them if they are equal
+ template<typename _R1, typename _R2, intmax_t __q1 = _R1::num / _R1::den,
+ intmax_t __q2 = _R2::num / _R2::den, bool __eq = (__q1 == __q2)>
struct __ratio_less_impl_1
- : integral_constant<bool, _R1::num < _R1::den>
+ : __ratio_less_impl_2<ratio<_R1::num % _R1::den, _R1::den>,
+ ratio<_R2::num % _R2::den, _R2::den> >::type
+ { };
+
+ template<typename _R1, typename _R2, intmax_t __q1, intmax_t __q2>
+ struct __ratio_less_impl_1<_R1, _R2, __q1, __q2, false>
+ : integral_constant<bool, (__q1 < __q2) >
+ { };
+
+ template<typename _R1, typename _R2>
+ struct __ratio_less_impl_2
+ : __ratio_less_impl_1<ratio<_R2::den, _R2::num>,
+ ratio<_R1::den, _R1::num> >::type
+ { };
+
+ template<intmax_t __d1, typename _R2>
+ struct __ratio_less_impl_2<ratio<0, __d1>, _R2>
+ : integral_constant<bool, true>
+ { };
+
+ template<typename _R1, intmax_t __d2>
+ struct __ratio_less_impl_2<_R1, ratio<0, __d2> >
+ : integral_constant<bool, false>
+ { };
+
+ template<intmax_t __d1, intmax_t __d2>
+ struct __ratio_less_impl_2<ratio<0, __d1>, ratio<0, __d2> >
+ : integral_constant<bool, false>
{ };
template<typename _R1, typename _R2,
@@ -286,7 +326,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool = (__static_sign<_R1::num>::value == -1
&& __static_sign<_R2::num>::value == -1)>
struct __ratio_less_impl
- : __ratio_less_impl_1<typename ratio_divide<_R1, _R2>::type>::type
+ : __ratio_less_impl_1<_R1, _R2>::type
{ };
template<typename _R1, typename _R2>
@@ -296,10 +336,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _R1, typename _R2>
struct __ratio_less_impl<_R1, _R2, false, true>
- : __ratio_less_impl_1<typename ratio_divide<_R2, _R1>::type>::type
+ : __ratio_less_impl_1<ratio<-_R2::num, _R2::den>,
+ ratio<-_R1::num, _R1::den> >::type
{ };
/// ratio_less
+ // using a continued fraction expansion
template<typename _R1, typename _R2>
struct ratio_less
: __ratio_less_impl<_R1, _R2>::type
diff --git a/libstdc++-v3/include/std/sstream b/libstdc++-v3/include/std/sstream
index 6dd0a3d8f56..bf2862add30 100644
--- a/libstdc++-v3/include/std/sstream
+++ b/libstdc++-v3/include/std/sstream
@@ -241,6 +241,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
this->setg(this->pptr(), this->pptr(), this->pptr());
}
}
+
+ // Works around the issue with pbump, part of the protected
+ // interface of basic_streambuf, taking just an int.
+ void
+ _M_pbump(char_type* __pbeg, char_type* __pend, off_type __off);
};
diff --git a/libstdc++-v3/include/std/streambuf b/libstdc++-v3/include/std/streambuf
index 0121ac2de98..b46efec4601 100644
--- a/libstdc++-v3/include/std/streambuf
+++ b/libstdc++-v3/include/std/streambuf
@@ -769,6 +769,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
#endif
+ // Also used by specializations for char and wchar_t in src.
+ void
+ __safe_gbump(streamsize __n) { _M_in_cur += __n; }
+
+ void
+ __safe_pbump(streamsize __n) { _M_out_cur += __n; }
+
private:
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// Side effect of DR 50.
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 5524a774e31..f52993b54cb 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -1,7 +1,7 @@
## Makefile for the src subdirectory of the GNU C++ Standard library.
##
## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-## 2006, 2007, 2008, 2009, 2010
+## 2006, 2007, 2008, 2009, 2010, 2011
## Free Software Foundation, Inc.
##
## This file is part of the libstdc++ version 3 distribution.
@@ -108,7 +108,7 @@ host_sources = \
messages_members.cc \
monetary_members.cc \
numeric_members.cc \
- time_members.cc
+ time_members.cc
codecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC)
$(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true
@@ -138,7 +138,8 @@ atomicity.cc: ${atomicity_file}
# Source files linked in via configuration/make substitution for a
# particular host, but with ad hoc naming rules.
host_sources_extra = \
- basic_file.cc c++locale.cc ${ldbl_compat_sources} ${parallel_sources}
+ basic_file.cc c++locale.cc \
+ ${inst_sources} ${ldbl_compat_sources} ${parallel_sources}
c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC)
$(LN_S) ${glibcxx_srcdir}/$(CLOCALE_CC) ./$@ || true
@@ -148,8 +149,8 @@ basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
if ENABLE_PARALLEL
parallel_sources = parallel_settings.cc \
- compatibility-parallel_list.cc \
- compatibility-parallel_list-2.cc
+ compatibility-parallel_list.cc \
+ compatibility-parallel_list-2.cc
else
parallel_sources =
endif
@@ -160,7 +161,30 @@ else
ldbl_compat_sources =
endif
-# Sources present in the src directory.
+if ENABLE_EXTERN_TEMPLATE
+XTEMPLATE_FLAGS = -fno-implicit-templates
+inst_sources = \
+ allocator-inst.cc \
+ concept-inst.cc \
+ ext-inst.cc \
+ fstream-inst.cc \
+ ios-inst.cc \
+ iostream-inst.cc \
+ istream-inst.cc \
+ locale-inst.cc \
+ misc-inst.cc \
+ ostream-inst.cc \
+ sstream-inst.cc \
+ streambuf-inst.cc \
+ string-inst.cc \
+ wlocale-inst.cc \
+ wstring-inst.cc
+else
+XTEMPLATE_FLAGS =
+inst_sources =
+endif
+
+# Sources present in the src directory, always present.
sources = \
atomic.cc \
bitmap_allocator.cc \
@@ -198,33 +222,18 @@ sources = \
strstream.cc \
system_error.cc \
tree.cc \
- allocator-inst.cc \
- concept-inst.cc \
- fstream-inst.cc \
- ext-inst.cc \
- ios-inst.cc \
- iostream-inst.cc \
- istream-inst.cc \
istream.cc \
- locale-inst.cc \
- misc-inst.cc \
- ostream-inst.cc \
placeholders.cc \
regex.cc \
- sstream-inst.cc \
- streambuf-inst.cc \
streambuf.cc \
- string-inst.cc \
- valarray-inst.cc \
- wlocale-inst.cc \
- wstring-inst.cc \
mutex.cc \
condition_variable.cc \
chrono.cc \
thread.cc \
future.cc \
+ valarray.cc \
${host_sources} \
- ${host_sources_extra}
+ ${host_sources_extra}
vpath % $(top_srcdir)/src
vpath % $(top_srcdir)
@@ -240,7 +249,7 @@ libstdc___la_DEPENDENCIES = \
$(top_builddir)/libsupc++/libsupc++convenience.la
libstdc___la_LDFLAGS = \
- -version-info $(libtool_VERSION) ${version_arg} -lm
+ -version-info $(libtool_VERSION) ${version_arg} -lm
libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS)
@@ -383,7 +392,7 @@ endif
# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
# as the occasion calls for it.
AM_CXXFLAGS = \
- -fno-implicit-templates \
+ $(XTEMPLATE_FLAGS) \
$(WARN_CXXFLAGS) \
$(OPTIMIZE_CXXFLAGS) \
$(CONFIG_CXXFLAGS)
@@ -407,8 +416,10 @@ AM_CXXFLAGS = \
# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
# attempt to infer which configuration to use
-LTCXXCOMPILE = $(LIBTOOL) --tag CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \
- $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag CXX \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \
+ $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index 956cbb9e4ad..9b65811f2c4 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -91,13 +91,21 @@ am__DEPENDENCIES_1 =
am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \
ctype_members.lo messages_members.lo monetary_members.lo \
numeric_members.lo time_members.lo
-@GLIBCXX_LDBL_COMPAT_TRUE@am__objects_2 = compatibility-ldbl.lo
-@ENABLE_PARALLEL_TRUE@am__objects_3 = parallel_settings.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_2 = allocator-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ concept-inst.lo ext-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ fstream-inst.lo ios-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ iostream-inst.lo istream-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ locale-inst.lo misc-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ ostream-inst.lo sstream-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ streambuf-inst.lo string-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ wlocale-inst.lo wstring-inst.lo
+@GLIBCXX_LDBL_COMPAT_TRUE@am__objects_3 = compatibility-ldbl.lo
+@ENABLE_PARALLEL_TRUE@am__objects_4 = parallel_settings.lo \
@ENABLE_PARALLEL_TRUE@ compatibility-parallel_list.lo \
@ENABLE_PARALLEL_TRUE@ compatibility-parallel_list-2.lo
-am__objects_4 = basic_file.lo c++locale.lo $(am__objects_2) \
- $(am__objects_3)
-am__objects_5 = atomic.lo bitmap_allocator.lo pool_allocator.lo \
+am__objects_5 = basic_file.lo c++locale.lo $(am__objects_2) \
+ $(am__objects_3) $(am__objects_4)
+am__objects_6 = atomic.lo bitmap_allocator.lo pool_allocator.lo \
mt_allocator.lo codecvt.lo compatibility.lo \
compatibility-c++0x.lo compatibility-debug_list.lo \
compatibility-debug_list-2.lo compatibility-list.lo \
@@ -107,15 +115,11 @@ am__objects_5 = atomic.lo bitmap_allocator.lo pool_allocator.lo \
ios_init.lo ios_locale.lo limits.lo list.lo locale.lo \
locale_init.lo locale_facets.lo localename.lo \
math_stubs_float.lo math_stubs_long_double.lo stdexcept.lo \
- strstream.lo system_error.lo tree.lo allocator-inst.lo \
- concept-inst.lo fstream-inst.lo ext-inst.lo ios-inst.lo \
- iostream-inst.lo istream-inst.lo istream.lo locale-inst.lo \
- misc-inst.lo ostream-inst.lo placeholders.lo regex.lo \
- sstream-inst.lo streambuf-inst.lo streambuf.lo string-inst.lo \
- valarray-inst.lo wlocale-inst.lo wstring-inst.lo mutex.lo \
+ strstream.lo system_error.lo tree.lo istream.lo \
+ placeholders.lo regex.lo streambuf.lo mutex.lo \
condition_variable.lo chrono.lo thread.lo future.lo \
- $(am__objects_1) $(am__objects_4)
-am_libstdc___la_OBJECTS = $(am__objects_5)
+ valarray.lo $(am__objects_1) $(am__objects_5)
+am_libstdc___la_OBJECTS = $(am__objects_6)
libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp =
@@ -360,24 +364,45 @@ host_sources = \
messages_members.cc \
monetary_members.cc \
numeric_members.cc \
- time_members.cc
+ time_members.cc
atomicity_file = ${glibcxx_srcdir}/$(ATOMICITY_SRCDIR)/atomicity.h
# Source files linked in via configuration/make substitution for a
# particular host, but with ad hoc naming rules.
host_sources_extra = \
- basic_file.cc c++locale.cc ${ldbl_compat_sources} ${parallel_sources}
+ basic_file.cc c++locale.cc \
+ ${inst_sources} ${ldbl_compat_sources} ${parallel_sources}
@ENABLE_PARALLEL_FALSE@parallel_sources =
@ENABLE_PARALLEL_TRUE@parallel_sources = parallel_settings.cc \
-@ENABLE_PARALLEL_TRUE@ compatibility-parallel_list.cc \
-@ENABLE_PARALLEL_TRUE@ compatibility-parallel_list-2.cc
+@ENABLE_PARALLEL_TRUE@ compatibility-parallel_list.cc \
+@ENABLE_PARALLEL_TRUE@ compatibility-parallel_list-2.cc
@GLIBCXX_LDBL_COMPAT_FALSE@ldbl_compat_sources =
@GLIBCXX_LDBL_COMPAT_TRUE@ldbl_compat_sources = compatibility-ldbl.cc
-
-# Sources present in the src directory.
+@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS =
+@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates
+@ENABLE_EXTERN_TEMPLATE_FALSE@inst_sources =
+@ENABLE_EXTERN_TEMPLATE_TRUE@inst_sources = \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ allocator-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ concept-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ ext-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ fstream-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ ios-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ iostream-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ istream-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ locale-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ misc-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ ostream-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ sstream-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ streambuf-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ string-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ wlocale-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ wstring-inst.cc
+
+
+# Sources present in the src directory, always present.
sources = \
atomic.cc \
bitmap_allocator.cc \
@@ -415,33 +440,18 @@ sources = \
strstream.cc \
system_error.cc \
tree.cc \
- allocator-inst.cc \
- concept-inst.cc \
- fstream-inst.cc \
- ext-inst.cc \
- ios-inst.cc \
- iostream-inst.cc \
- istream-inst.cc \
istream.cc \
- locale-inst.cc \
- misc-inst.cc \
- ostream-inst.cc \
placeholders.cc \
regex.cc \
- sstream-inst.cc \
- streambuf-inst.cc \
streambuf.cc \
- string-inst.cc \
- valarray-inst.cc \
- wlocale-inst.cc \
- wstring-inst.cc \
mutex.cc \
condition_variable.cc \
chrono.cc \
thread.cc \
future.cc \
+ valarray.cc \
${host_sources} \
- ${host_sources_extra}
+ ${host_sources_extra}
libstdc___la_SOURCES = $(sources)
libstdc___la_LIBADD = \
@@ -453,7 +463,7 @@ libstdc___la_DEPENDENCIES = \
$(top_builddir)/libsupc++/libsupc++convenience.la
libstdc___la_LDFLAGS = \
- -version-info $(libtool_VERSION) ${version_arg} -lm
+ -version-info $(libtool_VERSION) ${version_arg} -lm
libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS)
@@ -470,7 +480,7 @@ PARALLEL_FLAGS = -fopenmp -D_GLIBCXX_PARALLEL -I$(glibcxx_builddir)/../libgomp
# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
# as the occasion calls for it.
AM_CXXFLAGS = \
- -fno-implicit-templates \
+ $(XTEMPLATE_FLAGS) \
$(WARN_CXXFLAGS) \
$(OPTIMIZE_CXXFLAGS) \
$(CONFIG_CXXFLAGS)
@@ -494,8 +504,10 @@ AM_CXXFLAGS = \
# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
# attempt to infer which configuration to use
-LTCXXCOMPILE = $(LIBTOOL) --tag CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \
- $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag CXX \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \
+ $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
diff --git a/libstdc++-v3/src/compatibility.cc b/libstdc++-v3/src/compatibility.cc
index d5d39b3317a..d4cf5d7c122 100644
--- a/libstdc++-v3/src/compatibility.cc
+++ b/libstdc++-v3/src/compatibility.cc
@@ -86,7 +86,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
streamsize(__n - _M_gcount));
if (__size > 1)
{
- __sb->gbump(__size);
+ __sb->__safe_gbump(__size);
_M_gcount += __size;
__c = __sb->sgetc();
}
@@ -157,7 +157,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
streamsize(__n - _M_gcount));
if (__size > 1)
{
- __sb->gbump(__size);
+ __sb->__safe_gbump(__size);
_M_gcount += __size;
__c = __sb->sgetc();
}
diff --git a/libstdc++-v3/src/istream.cc b/libstdc++-v3/src/istream.cc
index e550306a0e6..f161016cf3d 100644
--- a/libstdc++-v3/src/istream.cc
+++ b/libstdc++-v3/src/istream.cc
@@ -67,7 +67,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__size = __p - __sb->gptr();
traits_type::copy(__s, __sb->gptr(), __size);
__s += __size;
- __sb->gbump(__size);
+ __sb->__safe_gbump(__size);
_M_gcount += __size;
__c = __sb->sgetc();
}
@@ -145,7 +145,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__cdelim);
if (__p)
__size = __p - __sb->gptr();
- __sb->gbump(__size);
+ __sb->__safe_gbump(__size);
_M_gcount += __size;
__c = __sb->sgetc();
}
@@ -239,7 +239,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
- __sb->gptr());
__traits_type::copy(__s, __sb->gptr(), __size);
__s += __size;
- __sb->gbump(__size);
+ __sb->__safe_gbump(__size);
__extracted += __size;
__c = __sb->sgetc();
}
@@ -318,7 +318,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__sb->gptr() + __size)
- __sb->gptr());
__str.append(__sb->gptr(), __size);
- __sb->gbump(__size);
+ __sb->__safe_gbump(__size);
__extracted += __size;
__c = __sb->sgetc();
}
@@ -397,7 +397,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__p)
__size = __p - __sb->gptr();
__str.append(__sb->gptr(), __size);
- __sb->gbump(__size);
+ __sb->__safe_gbump(__size);
__extracted += __size;
__c = __sb->sgetc();
}
@@ -474,7 +474,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__size = __p - __sb->gptr();
traits_type::copy(__s, __sb->gptr(), __size);
__s += __size;
- __sb->gbump(__size);
+ __sb->__safe_gbump(__size);
_M_gcount += __size;
__c = __sb->sgetc();
}
@@ -552,7 +552,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__cdelim);
if (__p)
__size = __p - __sb->gptr();
- __sb->gbump(__size);
+ __sb->__safe_gbump(__size);
_M_gcount += __size;
__c = __sb->sgetc();
}
@@ -643,7 +643,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__p)
__size = __p - __sb->gptr();
__str.append(__sb->gptr(), __size);
- __sb->gbump(__size);
+ __sb->__safe_gbump(__size);
__extracted += __size;
__c = __sb->sgetc();
}
diff --git a/libstdc++-v3/src/streambuf.cc b/libstdc++-v3/src/streambuf.cc
index 2e72559d827..5bcd0ea8d58 100644
--- a/libstdc++-v3/src/streambuf.cc
+++ b/libstdc++-v3/src/streambuf.cc
@@ -1,6 +1,7 @@
// Stream buffer classes -*- C++ -*-
-// Copyright (C) 2004, 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -47,7 +48,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__n > 1)
{
const streamsize __wrote = __sbout->sputn(__sbin->gptr(), __n);
- __sbin->gbump(__wrote);
+ __sbin->__safe_gbump(__wrote);
__ret += __wrote;
if (__wrote < __n)
{
@@ -87,7 +88,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__n > 1)
{
const streamsize __wrote = __sbout->sputn(__sbin->gptr(), __n);
- __sbin->gbump(__wrote);
+ __sbin->__safe_gbump(__wrote);
__ret += __wrote;
if (__wrote < __n)
{
diff --git a/libstdc++-v3/src/strstream.cc b/libstdc++-v3/src/strstream.cc
index d6c936e5f9d..c76fc60e0ac 100644
--- a/libstdc++-v3/src/strstream.cc
+++ b/libstdc++-v3/src/strstream.cc
@@ -1,6 +1,7 @@
// strstream definitions -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003, 2005, 2009, 2010, 2011
+// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -161,7 +162,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
setp(buf, buf + new_size);
- pbump(old_size);
+ __safe_pbump(old_size);
if (reposition_get)
setg(buf, buf + old_get_offset, buf +
@@ -271,12 +272,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (seeklow + off < pbase())
{
setp(seeklow, epptr());
- pbump(off);
+ __safe_pbump(off);
}
else
{
setp(pbase(), epptr());
- pbump(off - (pbase() - seeklow));
+ __safe_pbump(off - (pbase() - seeklow));
}
}
if (do_get)
diff --git a/libstdc++-v3/src/valarray-inst.cc b/libstdc++-v3/src/valarray.cc
index 4d21ab171ba..4d21ab171ba 100644
--- a/libstdc++-v3/src/valarray-inst.cc
+++ b/libstdc++-v3/src/valarray.cc
diff --git a/libstdc++-v3/testsuite/20_util/hash/chi2_quality.cc b/libstdc++-v3/testsuite/20_util/hash/chi2_quality.cc
index a105f4b45d0..d626d829888 100644
--- a/libstdc++-v3/testsuite/20_util/hash/chi2_quality.cc
+++ b/libstdc++-v3/testsuite/20_util/hash/chi2_quality.cc
@@ -1,6 +1,9 @@
// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2010 Free Software Foundation, Inc.
+// Use smaller statistics when running on simulators, so it takes less time.
+// { dg-options "-std=gnu++0x -DSAMPLES=10000" { target simulator } }
+
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -48,8 +51,6 @@
#include <vector>
#include <testsuite_hooks.h>
-// Use smaller statistics when running on simulators, so it takes less time.
-// { dg-options "-DSAMPLES=10000" { target simulator } }
#ifndef SAMPLES
#define SAMPLES 300000
#endif
diff --git a/libstdc++-v3/testsuite/20_util/hash/quality.cc b/libstdc++-v3/testsuite/20_util/hash/quality.cc
index 8a6edac1687..0bc2637241f 100644
--- a/libstdc++-v3/testsuite/20_util/hash/quality.cc
+++ b/libstdc++-v3/testsuite/20_util/hash/quality.cc
@@ -1,6 +1,7 @@
// { dg-options "-std=gnu++0x" }
+// { dg-options "-DNTESTS=1 -DNSTRINGS=100 -DSTRSIZE=21 -std=gnu++0x" { target simulator } }
-// Copyright (C) 2010 Free Software Foundation, Inc.
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -26,7 +27,6 @@
using namespace std;
-// { dg-options "-DNTESTS=1 -DNSTRINGS=100 -DSTRSIZE=21" { target simulator } }
#ifndef NTESTS
#define NTESTS 5
#endif
diff --git a/libstdc++-v3/testsuite/20_util/ratio/comparisons/comp2.cc b/libstdc++-v3/testsuite/20_util/ratio/comparisons/comp2.cc
index 151dc64450e..20da30cbe25 100644
--- a/libstdc++-v3/testsuite/20_util/ratio/comparisons/comp2.cc
+++ b/libstdc++-v3/testsuite/20_util/ratio/comparisons/comp2.cc
@@ -1,7 +1,7 @@
// { dg-options "-std=gnu++0x" }
// { dg-require-cstdint "" }
-// Copyright (C) 2008, 2009, 2010 Free Software Foundation
+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -48,6 +48,9 @@ test01()
VERIFY( (std::ratio_less<std::ratio<-M, M - 1>,
std::ratio<-M, M - 2>>::value == 0) );
+
+ VERIFY( (std::ratio_less<std::ratio<M - 2, M - 1>,
+ std::ratio<M - 1, M>>::value == 1) );
}
int main()
diff --git a/libstdc++-v3/testsuite/20_util/ratio/comparisons/comp3.cc b/libstdc++-v3/testsuite/20_util/ratio/comparisons/comp3.cc
new file mode 100644
index 00000000000..f8c0c486b4a
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/ratio/comparisons/comp3.cc
@@ -0,0 +1,75 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// 2011-02-28 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2011 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <ratio>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ VERIFY( (std::ratio_less<std::ratio<59, 29131>,
+ std::ratio<59, 29129>>::value == 1) );
+ VERIFY( (std::ratio_less<std::ratio<4733, 13>,
+ std::ratio<4751, 13>>::value == 1) );
+ VERIFY( (std::ratio_less<std::ratio<25703, 25717>,
+ std::ratio<25733, 25741>>::value == 1) );
+ VERIFY( (std::ratio_less<std::ratio<631, 769>,
+ std::ratio<673, 773>>::value == 1) );
+ VERIFY( (std::ratio_less<std::ratio<8353, 16903>,
+ std::ratio<17891, 32099>>::value == 1) );
+ VERIFY( (std::ratio_less<std::ratio<2311, 18701>,
+ std::ratio<18457, 19571>>::value == 1) );
+
+ VERIFY( (std::ratio_less<std::ratio<60, 29132>,
+ std::ratio<60, 29130>>::value == 1) );
+ VERIFY( (std::ratio_less<std::ratio<4734, 14>,
+ std::ratio<4752, 14>>::value == 1) );
+ VERIFY( (std::ratio_less<std::ratio<25704, 25718>,
+ std::ratio<25732, 25742>>::value == 1) );
+ VERIFY( (std::ratio_less<std::ratio<632, 770>,
+ std::ratio<674, 774>>::value == 1) );
+ VERIFY( (std::ratio_less<std::ratio<8352, 16904>,
+ std::ratio<17892, 32100>>::value == 1) );
+ VERIFY( (std::ratio_less<std::ratio<2312, 18702>,
+ std::ratio<18458, 19572>>::value == 1) );
+
+ VERIFY( (std::ratio_less<std::ratio<58, 29130>,
+ std::ratio<58, 29128>>::value == 1) );
+ VERIFY( (std::ratio_less<std::ratio<4732, 12>,
+ std::ratio<4750, 12>>::value == 1) );
+ VERIFY( (std::ratio_less<std::ratio<25702, 25716>,
+ std::ratio<25734, 25740>>::value == 1) );
+ VERIFY( (std::ratio_less<std::ratio<630, 768>,
+ std::ratio<672, 772>>::value == 1) );
+ VERIFY( (std::ratio_less<std::ratio<8354, 16902>,
+ std::ratio<17890, 32102>>::value == 1) );
+ VERIFY( (std::ratio_less<std::ratio<2310, 18700>,
+ std::ratio<18456, 19570>>::value == 1) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/ratio/operations/47913.cc b/libstdc++-v3/testsuite/20_util/ratio/operations/47913.cc
new file mode 100644
index 00000000000..4105a710d91
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/ratio/operations/47913.cc
@@ -0,0 +1,42 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2011 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <ratio>
+#include <testsuite_hooks.h>
+
+// libstdc++/47913
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ const intmax_t m = (intmax_t)1 << (4 * sizeof(intmax_t) - 1);
+ typedef ratio_add<ratio<1, (m - 1) * (m - 2)>,
+ ratio<1, (m - 3) * (m - 2)> > ra_type;
+
+ VERIFY( ra_type::num == 2 );
+ VERIFY( ra_type::den == (m - 1) * (m - 3) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/Makefile.am b/libstdc++-v3/testsuite/Makefile.am
index 34d1ee7e904..4e297e0f669 100644
--- a/libstdc++-v3/testsuite/Makefile.am
+++ b/libstdc++-v3/testsuite/Makefile.am
@@ -247,8 +247,8 @@ check-profile: site.exp
# By adding these files here, automake will remove them for 'make clean'
CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \
testsuite_* site.exp abi_check baseline_symbols *TEST* *.dat \
- *.ii *.s *.o *.cc *.x *.a *.so *.xml
+ *.ii *.s *.o *.cc *.x *.a *.so *.xml *.raw *.out
# To remove directories.
clean-local:
- rm -rf de fr debug parallel profile binaries
+ rm -rf de fr debug parallel profile binaries normal*
diff --git a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in
index d0967a5a6bc..460db8df89d 100644
--- a/libstdc++-v3/testsuite/Makefile.in
+++ b/libstdc++-v3/testsuite/Makefile.in
@@ -319,7 +319,7 @@ profile_flags = "unix/-D_GLIBCXX_PROFILE"
# By adding these files here, automake will remove them for 'make clean'
CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \
testsuite_* site.exp abi_check baseline_symbols *TEST* *.dat \
- *.ii *.s *.o *.cc *.x *.a *.so *.xml
+ *.ii *.s *.o *.cc *.x *.a *.so *.xml *.raw *.out
all: all-am
@@ -652,7 +652,7 @@ check-profile: site.exp
# To remove directories.
clean-local:
- rm -rf de fr debug parallel profile binaries
+ rm -rf de fr debug parallel profile binaries normal*
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc b/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc
index b81418f7293..174a8af556c 100644
--- a/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc
+++ b/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc
@@ -22,4 +22,4 @@
#include <vector>
-// { dg-error "multiple inlined namespaces" "" { target *-*-* } 243 }
+// { dg-error "multiple inlined namespaces" "" { target *-*-* } 241 }