summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-31 05:47:39 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-31 05:47:39 +0000
commit630d47b9fe9db6b61d4f372fc305a4569da984d3 (patch)
treeca6e2960bcc231a9c0e87ab14828e7e1ee7968e2 /libstdc++-v3
parentfc41dd820f53334fd95a07641cbbd733b7b9259b (diff)
downloadgcc-630d47b9fe9db6b61d4f372fc305a4569da984d3.tar.gz
2011-05-31 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 174464 using svnmerge git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@174466 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog151
-rw-r--r--libstdc++-v3/acinclude.m455
-rw-r--r--libstdc++-v3/config.h.in9
-rw-r--r--libstdc++-v3/config/abi/pre/gnu.ver7
-rwxr-xr-xlibstdc++-v3/configure184
-rw-r--r--libstdc++-v3/configure.ac8
-rw-r--r--libstdc++-v3/include/Makefile.am2
-rw-r--r--libstdc++-v3/include/Makefile.in2
-rw-r--r--libstdc++-v3/include/bits/allocator.h420
-rw-r--r--libstdc++-v3/include/bits/ptr_traits.h222
-rw-r--r--libstdc++-v3/include/bits/stl_pair.h44
-rw-r--r--libstdc++-v3/include/bits/uses_allocator.h109
-rw-r--r--libstdc++-v3/include/ext/array_allocator.h18
-rw-r--r--libstdc++-v3/include/ext/bitmap_allocator.h19
-rw-r--r--libstdc++-v3/include/ext/extptr_allocator.h19
-rw-r--r--libstdc++-v3/include/ext/malloc_allocator.h18
-rw-r--r--libstdc++-v3/include/ext/mt_allocator.h18
-rw-r--r--libstdc++-v3/include/ext/new_allocator.h18
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pool_allocator.h18
-rw-r--r--libstdc++-v3/include/ext/throw_allocator.h19
-rw-r--r--libstdc++-v3/include/parallel/algo.h10
-rw-r--r--libstdc++-v3/include/parallel/algobase.h5
-rw-r--r--libstdc++-v3/include/parallel/losertree.h8
-rw-r--r--libstdc++-v3/include/parallel/multiseq_selection.h4
-rw-r--r--libstdc++-v3/include/parallel/multiway_merge.h7
-rw-r--r--libstdc++-v3/include/std/future207
-rw-r--r--libstdc++-v3/include/std/thread15
-rw-r--r--libstdc++-v3/include/std/tuple318
-rw-r--r--libstdc++-v3/include/std/type_traits14
-rw-r--r--libstdc++-v3/src/future.cc14
-rw-r--r--libstdc++-v3/src/thread.cc19
-rw-r--r--libstdc++-v3/testsuite/20_util/allocator_traits/members/allocate_hint.cc90
-rw-r--r--libstdc++-v3/testsuite/20_util/allocator_traits/members/construct.cc79
-rw-r--r--libstdc++-v3/testsuite/20_util/allocator_traits/members/destroy.cc84
-rw-r--r--libstdc++-v3/testsuite/20_util/allocator_traits/members/max_size.cc67
-rw-r--r--libstdc++-v3/testsuite/20_util/allocator_traits/members/select.cc68
-rw-r--r--libstdc++-v3/testsuite/20_util/allocator_traits/requirements/explicit_instantiation.cc29
-rw-r--r--libstdc++-v3/testsuite/20_util/allocator_traits/requirements/typedefs.cc52
-rw-r--r--libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/pointer_traits/pointer_to.cc52
-rw-r--r--libstdc++-v3/testsuite/20_util/pointer_traits/requirements/explicit_instantiation.cc31
-rw-r--r--libstdc++-v3/testsuite/20_util/pointer_traits/requirements/typedefs.cc45
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/tuple/cons/allocators.cc169
-rw-r--r--libstdc++-v3/testsuite/20_util/tuple/moveable2.cc8
-rw-r--r--libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc48
-rw-r--r--libstdc++-v3/testsuite/20_util/uses_allocator/construction.cc108
-rw-r--r--libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/30_threads/async/any.cc4
-rw-r--r--libstdc++-v3/testsuite/30_threads/async/launch.cc94
-rw-r--r--libstdc++-v3/testsuite/30_threads/async/sync.cc4
-rw-r--r--libstdc++-v3/testsuite/30_threads/thread/members/hardware_concurrency.cc6
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand_debug.cc4
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand_debug.cc4
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand_debug.cc2
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand_debug.cc2
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand_debug.cc4
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand_debug.cc4
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc4
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand_debug.cc4
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand_debug.cc4
-rw-r--r--libstdc++-v3/testsuite/lib/dg-options.exp9
-rw-r--r--libstdc++-v3/testsuite/lib/libstdc++.exp63
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_abi.cc1
67 files changed, 2862 insertions, 284 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index af0453b45ca..ba7bd9cbc46 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,154 @@
+2011-05-30 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/std/type_traits (__or_, __and_): Add trivial definitions
+ for a single element.
+ * include/bits/stl_pair.h: Use __and_ in noexcept specs and
+ constraints.
+ (pair<>::pair(pair&&)): Define.
+ (pair<>::pair(const pair<>&)): Constrain with is_convertible.
+ (pair<>::pair(pair<>&&)): Likewise, remove noexcept.
+ * include/std/tuple: Use __and_ in noexcept specs and constraints.
+ (_Tuple_impl<>::_Tuple_impl(allocator_arg_t, const _Alloc&,
+ _Tuple_impl&&)): Remove noexcept.
+ (tuple<>::tuple(_UElements&&...), tuple(const tuple<_UElements...>&),
+ tuple(tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&),
+ tuple(pair<_U1, _U2>&&)): Constrain with is_convertible.
+ * testsuite/20_util/tuple/moveable2.cc: Use = delete.
+ * testsuite/20_util/make_signed/requirements/typedefs_neg.cc:
+ Adjust dg-error line numbers.
+ * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
+ Likewise.
+ * testsuite/20_util/declval/requirements/1_neg.cc: Likewise.
+ * testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Likewise.
+ * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Likewise.
+
+2011-05-31 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/std/tuple: Restore is_convertible constraint.
+ * testsuite/20_util/tuple/cons/allocate_noncopyable.cc: Remove.
+
+2011-05-30 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/49236
+ * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust dg-warning
+ line number.
+
+2011-05-30 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/std/tuple: Implement uses-allocator construction.
+ * include/bits/allocator.h (uses_allocator): Move to ...
+ * include/bits/uses_allocator.h: New file.
+ * include/Makefile.am: Add new header.
+ * include/Makefile.in: Regenerate.
+ * testsuite/20_util/uses_allocator/cons_neg.cc: New.
+ * testsuite/20_util/uses_allocator/construction.cc: New.
+ * testsuite/20_util/tuple/cons/allocate_noncopyable.cc: New.
+ * testsuite/20_util/tuple/cons/allocators.cc: New.
+
+2011-05-28 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * testsuite/20_util/pointer_traits/pointer_to.cc: Fix.
+
+2011-05-28 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * acinclude.m4: Define GLIBCXX_CHECK_GET_NPROCS and
+ GLIBCXX_CHECK_SC_NPROCESSORS_ONLN.
+ * configure.ac: Use them. Increase minor version.
+ * configure: Regenerate.
+ * config.h.in: Regenerate.
+ * include/std/thread (thread::hardware_concurrency): Remove inline
+ definition.
+ * src/thread.cc (thread::hardware_concurrency): Define.
+ * config/abi/pre/gnu.ver: Export new symbol @3.4.17
+ * testsuite/util/testsuite_abi.cc: Add new version.
+ * testsuite/lib/libstdc++.exp (check_v3_target_nprocs): Add.
+ * testsuite/lib/dg-options.exp (dg-require-nprocs): Add.
+ * testsuite/30_threads/thread/members/hardware_concurrency.cc: Use
+ dg-require-nprocs and verify hardware_concurrency returns non-zero.
+
+2011-05-28 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * testsuite/20_util/pointer_traits/pointer_to.cc: New.
+
+2011-05-28 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/Makefile.am: Add new ptr_traits.h header.
+ * include/Makefile.in: Regenerate.
+ * include/bits/ptr_traits.h (pointer_traits): New.
+ * include/bits/allocator.h (allocator_traits): Add.
+ * include/ext/array_allocator.h (construct, destroy): Update C++0x
+ versions.
+ * include/ext/bitmap_allocator.h (construct, destroy): Likewise.
+ * include/ext/extptr_allocator.h (construct, destroy): Likewise.
+ * include/ext/malloc_allocator.h (construct, destroy): Likewise.
+ * include/ext/mt_allocator.h (construct, destroy): Likewise.
+ * include/ext/new_allocator.h (construct, destroy): Likewise.
+ * include/ext/pool_allocator.h (construct, destroy): Likewise.
+ * include/ext/throw_allocator.h (construct, destroy): Likewise.
+ * testsuite/20_util/allocator_traits/requirements/typedefs.cc: New.
+ * testsuite/20_util/allocator_traits/requirements/
+ explicit_instantiation.cc: New.
+ * testsuite/20_util/allocator_traits/members/max_size.cc: New.
+ * testsuite/20_util/allocator_traits/members/select.cc: New.
+ * testsuite/20_util/allocator_traits/members/construct.cc: New.
+ * testsuite/20_util/allocator_traits/members/allocate_hint.cc: New.
+ * testsuite/20_util/allocator_traits/members/destroy.cc: New.
+ * testsuite/20_util/pointer_traits/requirements/typedefs.cc: New.
+ * testsuite/20_util/pointer_traits/requirements/
+ explicit_instantiation.cc: New.
+
+2011-05-28 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/std/future (launch): Update enumerators and define
+ operators required for bitmask type. Remove trailing whitespace.
+ * src/future.cc: Remove trailing whitespace.
+ * testsuite/30_threads/async/any.cc: Adjust.
+ * testsuite/30_threads/async/sync.cc: Adjust.
+ * testsuite/30_threads/async/launch.cc: New.
+
+2011-05-28 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/std/future: Use noexcept.
+ * src/future.cc: Likewise.
+
+2011-05-27 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/std/thread (this_thread::sleep_until): Move after sleep_for.
+
+2011-05-27 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/49187
+ * include/parallel/losertree.h: Add missing using declarations
+ of _Base::_M_comp.
+ * include/parallel/algobase.h: Include <parallel/algorithmfwd.h>.
+ * include/parallel/multiway_merge.h: Include <parallel/
+ multiseq_selection.h>, forward declare __merge_advance.
+ * include/parallel/multiseq_selection.h: Don't include <parallel/
+ sort.h> here.
+ * include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp: Fix
+ qualification of upper_bound.
+
+ * testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc:
+ Use dg-require-debug-mode.
+ * testsuite/ext/pb_ds/regression/tree_data_map_rand_debug.cc:
+ Likewise.
+ * testsuite/ext/pb_ds/regression/priority_queue_rand_debug.cc:
+ Likewise.
+ * testsuite/ext/pb_ds/regression/trie_no_data_map_rand_debug.cc:
+ Likewise.
+ * testsuite/ext/pb_ds/regression/trie_data_map_rand_debug.cc:
+ Likewise.
+ * testsuite/ext/pb_ds/regression/list_update_no_data_map_rand_debug.cc:
+ Likewise.
+ * testsuite/ext/pb_ds/regression/list_update_data_map_rand_debug.cc:
+ Likewise.
+ * testsuite/ext/pb_ds/regression/hash_no_data_map_rand_debug.cc:
+ Likewise.
+ * testsuite/ext/pb_ds/regression/hash_data_map_rand_debug.cc:
+ Likewise.
+
+ * include/parallel/algo.h: Minor uglification fixes.
+
2011-05-26 Paolo Carlini <paolo.carlini@oracle.com>
* src/list.cc: Use noexcept per the FDIS.
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index ed8b129c29f..bedb585f13f 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3204,6 +3204,61 @@ AC_DEFUN([AC_LC_MESSAGES], [
])
])
+dnl
+dnl Check whether get_nprocs is available in <sys/sysinfo.h>, and define _GLIBCXX_USE_GET_NPROCS.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_GET_NPROCS], [
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
+ AC_MSG_CHECKING([for get_nprocs])
+ AC_CACHE_VAL(glibcxx_cv_GET_NPROCS, [
+ GCC_TRY_COMPILE_OR_LINK(
+ [#include <sys/sysinfo.h>],
+ [int n = get_nprocs();],
+ [glibcxx_cv_GET_NPROCS=yes],
+ [glibcxx_cv_GET_NPROCS=no])
+ ])
+ if test $glibcxx_cv_GET_NPROCS = yes; then
+ AC_DEFINE(_GLIBCXX_USE_GET_NPROCS, 1, [Define if get_nprocs is available in <sys/sysinfo.h>.])
+ fi
+ AC_MSG_RESULT($glibcxx_cv_GET_NPROCS)
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+])
+
+dnl
+dnl Check whether sysconf(_SC_NPROCESSORS_ONLN) is available in <unistd.h>, and define _GLIBCXX_USE_SC_NPROCESSORS_ONLN.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_SC_NPROCESSORS_ONLN], [
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
+ AC_MSG_CHECKING([for _SC_NPROCESSORS_ONLN])
+ AC_CACHE_VAL(glibcxx_cv_SC_NPROCESSORS_ONLN, [
+ GCC_TRY_COMPILE_OR_LINK(
+ [#include <unistd.h>],
+ [int n = sysconf(_SC_NPROCESSORS_ONLN);],
+ [glibcxx_cv_SC_NPROCESSORS_ONLN=yes],
+ [glibcxx_cv_SC_NPROCESSORS_ONLN=no])
+ ])
+ if test $glibcxx_cv_SC_NPROCESSORS_ONLN = yes; then
+ AC_DEFINE(_GLIBCXX_USE_SC_NPROCESSORS_ONLN, 1, [Define if _SC_NPROCESSORS_ONLN is available in <unistd.h>.])
+ fi
+ AC_MSG_RESULT($glibcxx_cv_SC_NPROCESSORS_ONLN)
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+])
+
+
# Macros from the top-level gcc directory.
m4_include([../config/gc++filt.m4])
m4_include([../config/tls.m4])
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index 6ab257fa344..6137ba02827 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -380,6 +380,9 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
+/* Define to 1 if you have the <sys/sysinfo.h> header file. */
+#undef HAVE_SYS_SYSINFO_H
+
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
@@ -792,6 +795,9 @@
/* Defined if gettimeofday is available. */
#undef _GLIBCXX_USE_GETTIMEOFDAY
+/* Define if get_nprocs is available in <sys/sysinfo.h>. */
+#undef _GLIBCXX_USE_GET_NPROCS
+
/* Define if LFS support is available. */
#undef _GLIBCXX_USE_LFS
@@ -811,6 +817,9 @@
/* Defined if sched_yield is available. */
#undef _GLIBCXX_USE_SCHED_YIELD
+/* Define if _SC_NPROCESSORS_ONLN is available in <unistd.h>. */
+#undef _GLIBCXX_USE_SC_NPROCESSORS_ONLN
+
/* Define if code specialized for wchar_t should be used. */
#undef _GLIBCXX_USE_WCHAR_T
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 57744a410e5..427189c063d 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1279,6 +1279,13 @@ GLIBCXX_3.4.16 {
} GLIBCXX_3.4.15;
+GLIBCXX_3.4.17 {
+
+ # std::thread::hardware_concurrency
+ _ZNSt6thread20hardware_concurrencyEv;
+
+} GLIBCXX_3.4.16;
+
# Symbols in the support library (libsupc++) have their own tag.
CXXABI_1.3 {
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index c3cd3a68f81..8f871114b67 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -2825,7 +2825,7 @@ ac_config_headers="$ac_config_headers config.h"
### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD
# For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=6:16:0
+libtool_VERSION=6:17:0
# Find the rest of the source tree framework.
@@ -19521,6 +19521,188 @@ fi
+# For hardware_concurrency
+for ac_header in sys/sysinfo.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/sysinfo.h" "ac_cv_header_sys_sysinfo_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_sysinfo_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_SYSINFO_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for get_nprocs" >&5
+$as_echo_n "checking for get_nprocs... " >&6; }
+ if test "${glibcxx_cv_GET_NPROCS+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ if test x$gcc_no_link = xyes; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/sysinfo.h>
+int
+main ()
+{
+int n = get_nprocs();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ glibcxx_cv_GET_NPROCS=yes
+else
+ glibcxx_cv_GET_NPROCS=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/sysinfo.h>
+int
+main ()
+{
+int n = get_nprocs();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ glibcxx_cv_GET_NPROCS=yes
+else
+ glibcxx_cv_GET_NPROCS=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+
+fi
+
+ if test $glibcxx_cv_GET_NPROCS = yes; then
+
+$as_echo "#define _GLIBCXX_USE_GET_NPROCS 1" >>confdefs.h
+
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_GET_NPROCS" >&5
+$as_echo "$glibcxx_cv_GET_NPROCS" >&6; }
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+for ac_header in unistd.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
+if test "x$ac_cv_header_unistd_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_UNISTD_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _SC_NPROCESSORS_ONLN" >&5
+$as_echo_n "checking for _SC_NPROCESSORS_ONLN... " >&6; }
+ if test "${glibcxx_cv_SC_NPROCESSORS_ONLN+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ if test x$gcc_no_link = xyes; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <unistd.h>
+int
+main ()
+{
+int n = sysconf(_SC_NPROCESSORS_ONLN);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ glibcxx_cv_SC_NPROCESSORS_ONLN=yes
+else
+ glibcxx_cv_SC_NPROCESSORS_ONLN=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <unistd.h>
+int
+main ()
+{
+int n = sysconf(_SC_NPROCESSORS_ONLN);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ glibcxx_cv_SC_NPROCESSORS_ONLN=yes
+else
+ glibcxx_cv_SC_NPROCESSORS_ONLN=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+
+fi
+
+ if test $glibcxx_cv_SC_NPROCESSORS_ONLN = yes; then
+
+$as_echo "#define _GLIBCXX_USE_SC_NPROCESSORS_ONLN 1" >>confdefs.h
+
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_SC_NPROCESSORS_ONLN" >&5
+$as_echo "$glibcxx_cv_SC_NPROCESSORS_ONLN" >&6; }
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
# Check for available headers.
for ac_header in endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 35c54fd4e9a..416c0d72d68 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -12,7 +12,7 @@ AC_CONFIG_HEADER(config.h)
### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD
# For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=6:16:0
+libtool_VERSION=6:17:0
AC_SUBST(libtool_VERSION)
# Find the rest of the source tree framework.
@@ -170,6 +170,12 @@ GLIBCXX_CHECK_GTHREADS
AC_LC_MESSAGES
+# For hardware_concurrency
+AC_CHECK_HEADERS(sys/sysinfo.h)
+GLIBCXX_CHECK_GET_NPROCS
+AC_CHECK_HEADERS(unistd.h)
+GLIBCXX_CHECK_SC_NPROCESSORS_ONLN
+
# Check for available headers.
AC_CHECK_HEADERS([endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 73b858993d0..a4b7f27aaa4 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -119,6 +119,7 @@ bits_headers = \
${bits_srcdir}/ostream.tcc \
${bits_srcdir}/ostream_insert.h \
${bits_srcdir}/postypes.h \
+ ${bits_srcdir}/ptr_traits.h \
${bits_srcdir}/random.h \
${bits_srcdir}/random.tcc \
${bits_srcdir}/range_access.h \
@@ -167,6 +168,7 @@ bits_headers = \
${bits_srcdir}/unique_ptr.h \
${bits_srcdir}/unordered_map.h \
${bits_srcdir}/unordered_set.h \
+ ${bits_srcdir}/uses_allocator.h \
${bits_srcdir}/valarray_array.h \
${bits_srcdir}/valarray_array.tcc \
${bits_srcdir}/valarray_before.h \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index aa908133092..3cbe0e4500e 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -370,6 +370,7 @@ bits_headers = \
${bits_srcdir}/ostream.tcc \
${bits_srcdir}/ostream_insert.h \
${bits_srcdir}/postypes.h \
+ ${bits_srcdir}/ptr_traits.h \
${bits_srcdir}/random.h \
${bits_srcdir}/random.tcc \
${bits_srcdir}/range_access.h \
@@ -418,6 +419,7 @@ bits_headers = \
${bits_srcdir}/unique_ptr.h \
${bits_srcdir}/unordered_map.h \
${bits_srcdir}/unordered_set.h \
+ ${bits_srcdir}/uses_allocator.h \
${bits_srcdir}/valarray_array.h \
${bits_srcdir}/valarray_array.tcc \
${bits_srcdir}/valarray_before.h \
diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h
index 9d01a602dae..6fccba51bb1 100644
--- a/libstdc++-v3/include/bits/allocator.h
+++ b/libstdc++-v3/include/bits/allocator.h
@@ -48,7 +48,9 @@
#include <bits/c++allocator.h>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-#include <type_traits> // For _GLIBCXX_HAS_NESTED_TYPE
+#include <bits/ptr_traits.h>
+#include <bits/uses_allocator.h>
+#include <limits>
#endif
namespace std _GLIBCXX_VISIBILITY(default)
@@ -85,8 +87,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @brief The @a standard allocator, as per [20.4].
* @ingroup allocators
*
- * Further details:
- * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt04ch11.html
+ * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt04ch11.html
+ * for further details.
*/
template<typename _Tp>
class allocator: public __glibcxx_base_allocator<_Tp>
@@ -185,7 +187,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// A very basic implementation for now. In general we have to wait for
// the availability of the infrastructure described in N2983: we should
// try when either T has a move constructor which cannot throw or T is
- // CopyContructible.
+ // CopyConstructible.
// NB: This code doesn't properly belong here, we should find a more
// suited place common to std::vector and std::deque.
template<typename _Tp,
@@ -205,31 +207,403 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
};
+ template<typename _Alloc, typename _Tp>
+ class __alloctr_rebind_helper
+ {
+ template<typename _Alloc2, typename _Tp2>
+ static constexpr bool
+ _S_chk(typename _Alloc2::template rebind<_Tp2>::other*)
+ { return true; }
- /// [allocator.tag]
- struct allocator_arg_t { };
+ template<typename, typename>
+ static constexpr bool
+ _S_chk(...)
+ { return false; }
- constexpr allocator_arg_t allocator_arg = allocator_arg_t();
+ public:
+ static const bool __value = _S_chk<_Alloc, _Tp>(nullptr);
+ };
-_GLIBCXX_HAS_NESTED_TYPE(allocator_type)
+ template<typename _Alloc, typename _Tp,
+ bool = __alloctr_rebind_helper<_Alloc, _Tp>::__value>
+ struct __alloctr_rebind;
- template<typename _Tp, typename _Alloc,
- bool = __has_allocator_type<_Tp>::value>
- struct __uses_allocator_helper
- : public false_type { };
+ template<typename _Alloc, typename _Tp>
+ struct __alloctr_rebind<_Alloc, _Tp, true>
+ {
+ typedef typename _Alloc::template rebind<_Tp>::other __type;
+ };
- template<typename _Tp, typename _Alloc>
- struct __uses_allocator_helper<_Tp, _Alloc, true>
- : public integral_constant<bool, is_convertible<_Alloc,
- typename _Tp::allocator_type>::value>
- { };
+ template<template<typename, typename...> class _Alloc, typename _Tp,
+ typename _Up, typename... _Args>
+ struct __alloctr_rebind<_Alloc<_Up, _Args...>, _Tp, false>
+ {
+ typedef _Alloc<_Tp, _Args...> __type;
+ };
- /// [allocator.uses.trait]
- template<typename _Tp, typename _Alloc>
- struct uses_allocator
- : public integral_constant<bool,
- __uses_allocator_helper<_Tp, _Alloc>::value>
- { };
+ /**
+ * @brief Uniform interface to all allocator types.
+ * @ingroup allocators
+ */
+ template<typename _Alloc>
+ struct allocator_traits
+ {
+ /// The allocator type
+ typedef _Alloc allocator_type;
+ /// The allocated type
+ typedef typename _Alloc::value_type value_type;
+
+#define _GLIBCXX_ALLOC_TR_NESTED_TYPE(_NTYPE, _ALT) \
+ private: \
+ template<typename _Tp> \
+ static typename _Tp::_NTYPE _S_##_NTYPE##_helper(_Tp*); \
+ static _ALT _S_##_NTYPE##_helper(...); \
+ typedef decltype(_S_##_NTYPE##_helper((_Alloc*)0)) __##_NTYPE; \
+ public:
+
+_GLIBCXX_ALLOC_TR_NESTED_TYPE(pointer, value_type*)
+
+ /**
+ * @brief The allocator's pointer type.
+ *
+ * @c Alloc::pointer if that type exists, otherwise @c value_type*
+ */
+ typedef __pointer pointer;
+
+// TODO: Use pointer_traits::rebind alias template.
+
+_GLIBCXX_ALLOC_TR_NESTED_TYPE(const_pointer,
+ typename pointer_traits<pointer>::template __rebind<const value_type>::__type)
+
+ /**
+ * @brief The allocator's const pointer type.
+ *
+ * @c Alloc::const_pointer if that type exists, otherwise
+ * <tt> pointer_traits<pointer>::rebind<const value_type> </tt>
+ */
+ typedef __const_pointer const_pointer;
+
+_GLIBCXX_ALLOC_TR_NESTED_TYPE(void_pointer,
+ typename pointer_traits<pointer>::template __rebind<void>::__type)
+
+ /**
+ * @brief The allocator's void pointer type.
+ *
+ * @c Alloc::void_pointer if that type exists, otherwise
+ * <tt> pointer_traits<pointer>::rebind<void> </tt>
+ */
+ typedef __void_pointer void_pointer;
+
+_GLIBCXX_ALLOC_TR_NESTED_TYPE(const_void_pointer,
+ typename pointer_traits<pointer>::template __rebind<const void>::__type)
+
+ /**
+ * @brief The allocator's const void pointer type.
+ *
+ * @c Alloc::const_void_pointer if that type exists, otherwise
+ * <tt> pointer_traits<pointer>::rebind<const void> </tt>
+ */
+ typedef __const_void_pointer const_void_pointer;
+
+_GLIBCXX_ALLOC_TR_NESTED_TYPE(difference_type,
+ typename pointer_traits<pointer>::difference_type)
+
+ /**
+ * @brief The allocator's difference type
+ *
+ * @c Alloc::difference_type if that type exists, otherwise
+ * <tt> pointer_traits<pointer>::difference_type </tt>
+ */
+ typedef __difference_type difference_type;
+
+_GLIBCXX_ALLOC_TR_NESTED_TYPE(size_type,
+ typename make_unsigned<difference_type>::type)
+
+ /**
+ * @brief The allocator's size type
+ *
+ * @c Alloc::size_type if that type exists, otherwise
+ * <tt> make_unsigned<difference_type>::type </tt>
+ */
+ typedef __size_type size_type;
+
+_GLIBCXX_ALLOC_TR_NESTED_TYPE(propagate_on_container_copy_assignment,
+ false_type)
+
+ /**
+ * @brief How the allocator is propagated on copy assignment
+ *
+ * @c Alloc::propagate_on_container_copy_assignment if that type exists,
+ * otherwise @c false_type
+ */
+ typedef __propagate_on_container_copy_assignment
+ propagate_on_container_copy_assignment;
+
+_GLIBCXX_ALLOC_TR_NESTED_TYPE(propagate_on_container_move_assignment,
+ false_type)
+
+ /**
+ * @brief How the allocator is propagated on move assignment
+ *
+ * @c Alloc::propagate_on_container_move_assignment if that type exists,
+ * otherwise @c false_type
+ */
+ typedef __propagate_on_container_move_assignment
+ propagate_on_container_move_assignment;
+
+_GLIBCXX_ALLOC_TR_NESTED_TYPE(propagate_on_container_swap,
+ false_type)
+
+ /**
+ * @brief How the allocator is propagated on swap
+ *
+ * @c Alloc::propagate_on_container_swap if that type exists,
+ * otherwise @c false_type
+ */
+ typedef __propagate_on_container_swap propagate_on_container_swap;
+
+#undef _GLIBCXX_ALLOC_TR_NESTED_TYPE
+
+ /* TODO: use template alias
+ template<typename _Tp>
+ using rebind_alloc = __alloctr_rebind<_Alloc, _Tp>::__type;
+ template<typename _Tp>
+ using rebind_traits = allocator_traits<rebind_alloc<_Tp>>;
+ */
+ template<typename _Tp>
+ struct __rebind_alloc
+ {
+ typedef typename __alloctr_rebind<_Alloc, _Tp>::__type __type;
+ };
+
+ template<typename _Tp>
+ struct __rebind_traits
+ {
+ typedef allocator_traits<typename __rebind_alloc<_Tp>::__type> __type;
+ };
+
+ private:
+ template<typename _Alloc2>
+ struct __allocate_helper
+ {
+ template<typename _Alloc3,
+ typename = decltype(std::declval<_Alloc3*>()->allocate(
+ std::declval<size_type>(),
+ std::declval<const_void_pointer>()))>
+ static true_type __test(int);
+
+ template<typename>
+ static false_type __test(...);
+
+ typedef decltype(__test<_Alloc>(0)) type;
+ static const bool value = type::value;
+ };
+
+ template<typename _Alloc2>
+ static typename
+ enable_if<__allocate_helper<_Alloc2>::value, pointer>::type
+ _S_allocate(_Alloc2& __a, size_type __n, const_void_pointer __hint)
+ { return __a.allocate(__n, __hint); }
+
+ template<typename _Alloc2>
+ static typename
+ enable_if<!__allocate_helper<_Alloc2>::value, pointer>::type
+ _S_allocate(_Alloc2& __a, size_type __n, ...)
+ { return __a.allocate(__n); }
+
+ template<typename _Tp, typename... _Args>
+ struct __construct_helper
+ {
+ template<typename _Alloc2,
+ typename = decltype(std::declval<_Alloc2*>()->construct(
+ std::declval<_Tp*>(), std::declval<_Args>()...))>
+ static true_type __test(int);
+
+ template<typename>
+ static false_type __test(...);
+
+ typedef decltype(__test<_Alloc>(0)) type;
+ static const bool value = type::value;
+ };
+
+ template<typename _Tp, typename... _Args>
+ static typename
+ enable_if<__construct_helper<_Tp, _Args...>::value, void>::type
+ _S_construct(_Alloc& __a, _Tp* __p, _Args&&... __args)
+ { __a.construct(__p, std::forward<_Args>(__args)...); }
+
+ template<typename _Tp, typename... _Args>
+ static typename
+ enable_if<!__construct_helper<_Tp, _Args...>::value, void>::type
+ _S_construct(_Alloc&, _Tp* __p, _Args&&... __args)
+ { ::new((void*)__p) _Tp(std::forward<_Args>(__args)...); }
+
+ template<typename _Tp>
+ struct __destroy_helper
+ {
+ template<typename _Alloc2,
+ typename = decltype(std::declval<_Alloc2*>()->destroy(
+ std::declval<_Tp*>()))>
+ static true_type __test(int);
+
+ template<typename>
+ static false_type __test(...);
+
+ typedef decltype(__test<_Alloc>(0)) type;
+ static const bool value = type::value;
+ };
+
+ template<typename _Tp>
+ static typename enable_if<__destroy_helper<_Tp>::value, void>::type
+ _S_destroy(_Alloc& __a, _Tp* __p)
+ { __a.destroy(__p); }
+
+ template<typename _Tp>
+ static typename enable_if<!__destroy_helper<_Tp>::value, void>::type
+ _S_destroy(_Alloc&, _Tp* __p)
+ { __p->~_Tp(); }
+
+ template<typename _Alloc2>
+ struct __maxsize_helper
+ {
+ template<typename _Alloc3,
+ typename = decltype(std::declval<_Alloc3*>()->max_size())>
+ static true_type __test(int);
+
+ template<typename>
+ static false_type __test(...);
+
+ typedef decltype(__test<_Alloc2>(0)) type;
+ static const bool value = type::value;
+ };
+
+ template<typename _Alloc2>
+ static typename
+ enable_if<__maxsize_helper<_Alloc2>::value, size_type>::type
+ _S_max_size(_Alloc2& __a)
+ { return __a.max_size(); }
+
+ template<typename _Alloc2>
+ static typename
+ enable_if<!__maxsize_helper<_Alloc2>::value, size_type>::type
+ _S_max_size(_Alloc2&)
+ { return numeric_limits<size_type>::max(); }
+
+ template<typename _Alloc2>
+ struct __select_helper
+ {
+ template<typename _Alloc3, typename
+ = decltype(std::declval<_Alloc3*>()
+ ->select_on_container_copy_construction())>
+ static true_type __test(int);
+
+ template<typename>
+ static false_type __test(...);
+
+ typedef decltype(__test<_Alloc2>(0)) type;
+ static const bool value = type::value;
+ };
+ template<typename _Alloc2>
+ static typename
+ enable_if<__select_helper<_Alloc2>::value, _Alloc2>::type
+ _S_select(_Alloc2& __a)
+ { return __a.select_on_container_copy_construction(); }
+
+ template<typename _Alloc2>
+ static typename
+ enable_if<!__select_helper<_Alloc2>::value, _Alloc2>::type
+ _S_select(_Alloc2& __a)
+ { return __a; }
+
+ public:
+
+ /**
+ * @brief Allocate memory.
+ * @param a An allocator.
+ * @param n The number of objects to allocate space for.
+ *
+ * Calls @c a.allocate(n)
+ */
+ static pointer
+ allocate(_Alloc& __a, size_type __n)
+ { return __a.allocate(__n); }
+
+ /**
+ * @brief Allocate memory.
+ * @param a An allocator.
+ * @param n The number of objects to allocate space for.
+ * @param hint Aid to locality.
+ * @return Memory of suitable size and alignment for @a n objects
+ * of type @c value_type
+ *
+ * Returns <tt> a.allocate(n, hint) </tt> if that expression is
+ * well-formed, otherwise returns @c a.allocate(n)
+ */
+ static pointer
+ allocate(_Alloc& __a, size_type __n, const_void_pointer __hint)
+ { return _S_allocate(__a, __n, __hint); }
+
+ /**
+ * @brief Deallocate memory.
+ * @param a An allocator.
+ * @param p Pointer to the memory to deallocate.
+ * @param n The number of objects space was allocated for.
+ *
+ * Calls <tt> a.deallocate(p, n) </tt>
+ */
+ static void deallocate(_Alloc& __a, pointer __p, size_type __n)
+ { __a.deallocate(__p, __n); }
+
+ /**
+ * @brief Construct an object of type @a Tp
+ * @param a An allocator.
+ * @param p Pointer to memory of suitable size and alignment for Tp
+ * @param args Constructor arguments.
+ *
+ * Calls <tt> a.construct(p, std::forward<Args>(args)...) </tt>
+ * if that expression is well-formed, otherwise uses placement-new
+ * to construct an object of type @a Tp at location @a p from the
+ * arguments @a args...
+ */
+ template<typename _Tp, typename... _Args>
+ static void construct(_Alloc& __a, _Tp* __p, _Args&&... __args)
+ { _S_construct(__a, __p, std::forward<_Args>(__args)...); }
+
+ /**
+ * @brief Destroy an object of type @a Tp
+ * @param a An allocator.
+ * @param p Pointer to the object to destroy
+ *
+ * Calls @c a.destroy(p) if that expression is well-formed,
+ * otherwise calls @c p->~Tp()
+ */
+ template <class _Tp>
+ static void destroy(_Alloc& __a, _Tp* __p)
+ { _S_destroy(__a, __p); }
+
+ /**
+ * @brief The maximum supported allocation size
+ * @param a An allocator.
+ * @return @c a.max_size() or @c %numeric_limits<size_type>::max()
+ *
+ * Returns @c a.max_size() if that expression is well-formed,
+ * otherwise returns @c %numeric_limits<size_type>::max()
+ */
+ static size_type max_size(const _Alloc& __a)
+ { return _S_max_size(__a); }
+
+ /**
+ * @brief Obtain an allocator to use when copying a container.
+ * @param rhs An allocator.
+ * @return @c rhs.select_on_container_copy_construction() or @a rhs
+ *
+ * Returns @c rhs.select_on_container_copy_construction() if that
+ * expression is well-formed, otherwise returns @a rhs
+ */
+ static _Alloc
+ select_on_container_copy_construction(const _Alloc& __rhs)
+ { return _S_select(__rhs); }
+ };
#endif
diff --git a/libstdc++-v3/include/bits/ptr_traits.h b/libstdc++-v3/include/bits/ptr_traits.h
new file mode 100644
index 00000000000..342db12aff8
--- /dev/null
+++ b/libstdc++-v3/include/bits/ptr_traits.h
@@ -0,0 +1,222 @@
+// Pointer Traits -*- C++ -*-
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/ptr_traits.h
+ * This is an internal header file, included by other library headers.
+ * Do not attempt to use it directly. @headername{memory}
+ */
+
+#ifndef _PTR_TRAITS_H
+#define _PTR_TRAITS_H 1
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+#include <type_traits> // For _GLIBCXX_HAS_NESTED_TYPE
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+_GLIBCXX_HAS_NESTED_TYPE(element_type)
+_GLIBCXX_HAS_NESTED_TYPE(difference_type)
+
+ template<typename _Tp, bool = __has_element_type<_Tp>::value>
+ struct __ptrtr_elt_type;
+
+ template<typename _Tp>
+ struct __ptrtr_elt_type<_Tp, true>
+ {
+ typedef typename _Tp::element_type __type;
+ };
+
+ template<template<typename, typename...> class _SomePtr, typename _Tp,
+ typename... _Args>
+ struct __ptrtr_elt_type<_SomePtr<_Tp, _Args...>, false>
+ {
+ typedef _Tp __type;
+ };
+
+ template<typename _Tp, bool = __has_difference_type<_Tp>::value>
+ struct __ptrtr_diff_type
+ {
+ typedef typename _Tp::difference_type __type;
+ };
+
+ template<typename _Tp>
+ struct __ptrtr_diff_type<_Tp, false>
+ {
+ typedef ptrdiff_t __type;
+ };
+
+ template<typename _Ptr, typename _Up>
+ class __ptrtr_rebind_helper
+ {
+ template<typename _Ptr2, typename _Up2>
+ static constexpr bool
+ _S_chk(typename _Ptr2::template rebind<_Up2>*)
+ { return true; }
+
+ template<typename, typename>
+ static constexpr bool
+ _S_chk(...)
+ { return false; }
+
+ public:
+ static const bool __value = _S_chk<_Ptr, _Up>(nullptr);
+ };
+
+ // hack to use _Tp::__rebind<_Up>::__type instead if that exists
+ template<typename _Ptr, typename _Up>
+ class __ptrtr_rebind_helper2
+ {
+ template<typename _Ptr2, typename _Up2>
+ static constexpr bool
+ _S_chk(typename _Ptr2::template __rebind<_Up2>::__type*)
+ { return true; }
+
+ template<typename, typename>
+ static constexpr bool
+ _S_chk(...)
+ { return false; }
+
+ public:
+ static const bool __value = _S_chk<_Ptr, _Up>(nullptr);
+ };
+
+ /* TODO: remove second bool when alias templates are supported */
+ template<typename _Tp, typename _Up,
+ bool = __ptrtr_rebind_helper<_Tp, _Up>::value,
+ bool = __ptrtr_rebind_helper2<_Tp, _Up>::value>
+ struct __ptrtr_rebind;
+
+ template<typename _Tp, typename _Up, bool _B2>
+ struct __ptrtr_rebind<_Tp, _Up, true, _B2>
+ {
+ typedef typename _Tp::template rebind<_Up> __type;
+ };
+
+ /* TODO: remove this when alias templates are supported */
+ template<typename _Tp, typename _Up>
+ struct __ptrtr_rebind<_Tp, _Up, false, true>
+ {
+ typedef typename _Tp::template __rebind<_Up>::__type __type;
+ };
+
+ template<template<typename, typename...> class _SomePtr, typename _Up,
+ typename _Tp, typename... _Args>
+ struct __ptrtr_rebind<_SomePtr<_Tp, _Args...>, _Up, false, false>
+ {
+ typedef _SomePtr<_Up, _Args...> __type;
+ };
+
+ template<typename _Tp, typename = typename remove_cv<_Tp>::type>
+ struct __ptrtr_not_void
+ {
+ typedef _Tp __type;
+ };
+
+ template<typename _Tp>
+ struct __ptrtr_not_void<_Tp, void>
+ {
+ struct __type { };
+ };
+
+ template<typename _Ptr>
+ class __ptrtr_pointer_to
+ {
+ typedef typename __ptrtr_elt_type<_Ptr>::__type __orig_type;
+ typedef typename __ptrtr_not_void<__orig_type>::__type __element_type;
+
+ public:
+ static _Ptr pointer_to(__element_type& __e)
+ { return _Ptr::pointer_to(__e); }
+ };
+
+ /**
+ * @brief Uniform interface to all pointer-like types
+ * @ingroup pointer_abstractions
+ */
+ template<typename _Ptr>
+ struct pointer_traits : __ptrtr_pointer_to<_Ptr>
+ {
+ /// The pointer type
+ typedef _Ptr pointer;
+ /// The type pointed to
+ typedef typename __ptrtr_elt_type<_Ptr>::__type element_type;
+ /// Type used to represent the difference between two pointers
+ typedef typename __ptrtr_diff_type<_Ptr>::__type difference_type;
+
+ private:
+ /* TODO: replace __rebind<U> with alias template rebind<U> */
+ /*
+ template<typename _Up>
+ using rebind<_Up> = typename __ptrtr_rebind<_Ptr, _Up>::__type;
+ */
+ template<typename _Up>
+ struct __rebind
+ { typedef typename __ptrtr_rebind<_Ptr, _Up>::__type __type; };
+
+ // allocator_traits needs to use __rebind
+ template<typename> struct allocator_traits;
+ template<typename, typename> class __ptrtr_rebind_helper2;
+ };
+
+ /**
+ * @brief Partial specialization for built-in pointers.
+ * @ingroup pointer_abstractions
+ */
+ template<typename _Tp>
+ struct pointer_traits<_Tp*>
+ {
+ /// The pointer type
+ typedef _Tp* pointer;
+ /// The type pointed to
+ typedef _Tp element_type;
+ /// Type used to represent the difference between two pointers
+ typedef ptrdiff_t difference_type;
+
+ /* TODO: replace __rebind<U> with alias template rebind<U> */
+ /*
+ template<typename _Up>
+ using rebind<_Up> = U*;
+ */
+ template<typename U>
+ struct __rebind { typedef U* __type; };
+
+ /**
+ * @brief Obtain a pointer to an object
+ * @param r A reference to an object of type @c element_type
+ * @return @c addressof(r)
+ */
+ static pointer
+ pointer_to(typename __ptrtr_not_void<element_type>::__type& __r)
+ { return std::addressof(__r); }
+ };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif
+
+#endif
diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h
index fbb475b5132..61ebc719040 100644
--- a/libstdc++-v3/include/bits/stl_pair.h
+++ b/libstdc++-v3/include/bits/stl_pair.h
@@ -105,37 +105,47 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: first(__a), second(__b) { }
/** There is also a templated copy ctor for the @c pair class itself. */
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
template<class _U1, class _U2>
- _GLIBCXX_CONSTEXPR pair(const pair<_U1, _U2>& __p)
+ pair(const pair<_U1, _U2>& __p)
+ : first(__p.first), second(__p.second) { }
+#else
+ template<class _U1, class _U2, class = typename
+ enable_if<__and_<is_convertible<const _U1&, _T1>,
+ is_convertible<const _U2&, _T2>>::value>::type>
+ constexpr pair(const pair<_U1, _U2>& __p)
: first(__p.first), second(__p.second) { }
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
constexpr pair(const pair&) = default;
- // Implicit?!? Breaks containers!!!
- // pair(pair&&) = default;
+ // XXX Defaulted?!? Breaks std::map!!!
+ pair(pair&& __p)
+ noexcept(__and_<is_nothrow_move_constructible<_T1>,
+ is_nothrow_move_constructible<_T2>>::value)
+ : first(std::forward<first_type>(__p.first)),
+ second(std::forward<second_type>(__p.second)) { }
// DR 811.
template<class _U1, class = typename
- std::enable_if<std::is_convertible<_U1, _T1>::value>::type>
+ enable_if<is_convertible<_U1, _T1>::value>::type>
pair(_U1&& __x, const _T2& __y)
: first(std::forward<_U1>(__x)), second(__y) { }
template<class _U2, class = typename
- std::enable_if<std::is_convertible<_U2, _T2>::value>::type>
+ enable_if<is_convertible<_U2, _T2>::value>::type>
pair(const _T1& __x, _U2&& __y)
: first(__x), second(std::forward<_U2>(__y)) { }
template<class _U1, class _U2, class = typename
- std::enable_if<std::is_convertible<_U1, _T1>::value
- && std::is_convertible<_U2, _T2>::value>::type>
+ enable_if<__and_<is_convertible<_U1, _T1>,
+ is_convertible<_U2, _T2>>::value>::type>
pair(_U1&& __x, _U2&& __y)
: first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
- template<class _U1, class _U2>
+ template<class _U1, class _U2, class = typename
+ enable_if<__and_<is_convertible<_U1, _T1>,
+ is_convertible<_U2, _T2>>::value>::type>
pair(pair<_U1, _U2>&& __p)
- noexcept(std::is_nothrow_constructible<_T1, _U1&&>::value
- && std::is_nothrow_constructible<_T2, _U2&&>::value)
: first(std::forward<_U1>(__p.first)),
second(std::forward<_U2>(__p.second)) { }
@@ -155,11 +165,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
pair&
operator=(pair&& __p)
- noexcept(std::is_nothrow_move_assignable<_T1>::value
- && std::is_nothrow_move_assignable<_T2>::value)
+ noexcept(__and_<is_nothrow_move_assignable<_T1>,
+ is_nothrow_move_assignable<_T2>>::value)
{
- first = std::move(__p.first);
- second = std::move(__p.second);
+ first = std::forward<first_type>(__p.first);
+ second = std::forward<second_type>(__p.second);
return *this;
}
@@ -176,8 +186,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
pair&
operator=(pair<_U1, _U2>&& __p)
{
- first = std::move(__p.first);
- second = std::move(__p.second);
+ first = std::forward<_U1>(__p.first);
+ second = std::forward<_U2>(__p.second);
return *this;
}
diff --git a/libstdc++-v3/include/bits/uses_allocator.h b/libstdc++-v3/include/bits/uses_allocator.h
new file mode 100644
index 00000000000..49b5409c15a
--- /dev/null
+++ b/libstdc++-v3/include/bits/uses_allocator.h
@@ -0,0 +1,109 @@
+// Uses-allocator Construction -*- C++ -*-
+
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#ifndef _USES_ALLOCATOR_H
+#define _USES_ALLOCATOR_H 1
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <bits/c++0x_warning.h>
+#else
+
+#include <type_traits>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ /// [allocator.tag]
+ struct allocator_arg_t { };
+
+ constexpr allocator_arg_t allocator_arg = allocator_arg_t();
+
+_GLIBCXX_HAS_NESTED_TYPE(allocator_type)
+
+ template<typename _Tp, typename _Alloc,
+ bool = __has_allocator_type<_Tp>::value>
+ struct __uses_allocator_helper
+ : public false_type { };
+
+ template<typename _Tp, typename _Alloc>
+ struct __uses_allocator_helper<_Tp, _Alloc, true>
+ : public integral_constant<bool, is_convertible<_Alloc,
+ typename _Tp::allocator_type>::value>
+ { };
+
+ /// [allocator.uses.trait]
+ template<typename _Tp, typename _Alloc>
+ struct uses_allocator
+ : public integral_constant<bool,
+ __uses_allocator_helper<_Tp, _Alloc>::value>
+ { };
+
+ template<typename _Tp, typename _Alloc, typename... _Args>
+ struct __uses_allocator_arg
+ : is_constructible<_Tp, _Alloc, _Args...>
+ { static_assert( uses_allocator<_Tp, _Alloc>::value, "uses allocator" ); };
+
+ struct __uses_alloc_base { };
+ struct __uses_alloc0 : __uses_alloc_base
+ { struct _Anything { _Anything(...) { } } _M_a; };
+ template<typename _Alloc>
+ struct __uses_alloc1 : __uses_alloc_base { const _Alloc* _M_a; };
+ template<typename _Alloc>
+ struct __uses_alloc2 : __uses_alloc_base { const _Alloc* _M_a; };
+
+ template<bool, typename _Alloc, typename... _Args>
+ struct __uses_alloc;
+
+ template<typename _Tp, typename _Alloc, typename... _Args>
+ struct __uses_alloc<true, _Tp, _Alloc, _Args...>
+ : conditional<
+ is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value,
+ __uses_alloc1<_Alloc>,
+ __uses_alloc2<_Alloc>>::type
+ { };
+
+ template<typename _Tp, typename _Alloc, typename... _Args>
+ struct __uses_alloc<false, _Tp, _Alloc, _Args...>
+ : __uses_alloc0 { };
+
+ template<typename _Tp, typename _Alloc, typename... _Args>
+ struct __uses_alloc_impl
+ : __uses_alloc<uses_allocator<_Tp, _Alloc>::value, _Tp, _Alloc, _Args...>
+ { };
+
+ template<typename _Tp, typename _Alloc, typename... _Args>
+ __uses_alloc_impl<_Tp, _Alloc, _Args...>
+ __use_alloc(const _Alloc& __a)
+ {
+ __uses_alloc_impl<_Tp, _Alloc, _Args...> __ret;
+ __ret._M_a = &__a;
+ return __ret;
+ }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif
+#endif
diff --git a/libstdc++-v3/include/ext/array_allocator.h b/libstdc++-v3/include/ext/array_allocator.h
index 9c61d7431b1..cee53f59182 100644
--- a/libstdc++-v3/include/ext/array_allocator.h
+++ b/libstdc++-v3/include/ext/array_allocator.h
@@ -72,21 +72,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
max_size() const throw()
{ return size_t(-1) / sizeof(_Tp); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Up, typename... _Args>
+ void
+ construct(_Up* __p, _Args&&... __args)
+ { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
+
+ template<typename _Up>
+ void
+ destroy(_Up* __p) { __p->~_Up(); }
+#else
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 402. wrong new expression in [some_] allocator::construct
void
construct(pointer __p, const _Tp& __val)
{ ::new((void *)__p) value_type(__val); }
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- template<typename... _Args>
- void
- construct(pointer __p, _Args&&... __args)
- { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
-#endif
-
void
destroy(pointer __p) { __p->~_Tp(); }
+#endif
};
/**
diff --git a/libstdc++-v3/include/ext/bitmap_allocator.h b/libstdc++-v3/include/ext/bitmap_allocator.h
index 4993c2c5780..b03dc6a8e03 100644
--- a/libstdc++-v3/include/ext/bitmap_allocator.h
+++ b/libstdc++-v3/include/ext/bitmap_allocator.h
@@ -1053,20 +1053,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
max_size() const throw()
{ return size_type(-1) / sizeof(value_type); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Up, typename... _Args>
+ void
+ construct(_Up* __p, _Args&&... __args)
+ { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
+
+ template<typename _Up>
+ void
+ destroy(_Up* __p)
+ { __p->~_Up(); }
+#else
void
construct(pointer __p, const_reference __data)
{ ::new((void *)__p) value_type(__data); }
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- template<typename... _Args>
- void
- construct(pointer __p, _Args&&... __args)
- { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
-#endif
-
void
destroy(pointer __p)
{ __p->~value_type(); }
+#endif
};
template<typename _Tp1, typename _Tp2>
diff --git a/libstdc++-v3/include/ext/extptr_allocator.h b/libstdc++-v3/include/ext/extptr_allocator.h
index dfb76ac0959..c93a7280df6 100644
--- a/libstdc++-v3/include/ext/extptr_allocator.h
+++ b/libstdc++-v3/include/ext/extptr_allocator.h
@@ -100,18 +100,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
size_type max_size() const throw()
{ return std::numeric_limits<size_type>::max() / sizeof(_Tp); }
- void construct(pointer __p, const _Tp& __val)
- { ::new(__p.get()) _Tp(__val); }
-
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- template<typename... _Args>
+ template<typename _Up, typename... _Args>
void
- construct(pointer __p, _Args&&... __args)
- { ::new(__p.get()) _Tp(std::forward<_Args>(__args)...); }
-#endif
+ construct(_Up* __p, _Args&&... __args)
+ { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
+
+ template<typename _Up>
+ void
+ destroy(_Up* __p)
+ { __p->~_Up(); }
+#else
+ void construct(pointer __p, const _Tp& __val)
+ { ::new(__p.get()) _Tp(__val); }
void destroy(pointer __p)
{ __p->~_Tp(); }
+#endif
template<typename _Up>
inline bool
diff --git a/libstdc++-v3/include/ext/malloc_allocator.h b/libstdc++-v3/include/ext/malloc_allocator.h
index 3aa994d9f70..e1794f7a0d7 100644
--- a/libstdc++-v3/include/ext/malloc_allocator.h
+++ b/libstdc++-v3/include/ext/malloc_allocator.h
@@ -104,21 +104,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
max_size() const throw()
{ return size_t(-1) / sizeof(_Tp); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Up, typename... _Args>
+ void
+ construct(_Up* __p, _Args&&... __args)
+ { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
+
+ template<typename _Up>
+ void
+ destroy(_Up* __p) { __p->~_Up(); }
+#else
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 402. wrong new expression in [some_] allocator::construct
void
construct(pointer __p, const _Tp& __val)
{ ::new((void *)__p) value_type(__val); }
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- template<typename... _Args>
- void
- construct(pointer __p, _Args&&... __args)
- { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
-#endif
-
void
destroy(pointer __p) { __p->~_Tp(); }
+#endif
};
template<typename _Tp>
diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h
index 91eac24f223..9281494e186 100644
--- a/libstdc++-v3/include/ext/mt_allocator.h
+++ b/libstdc++-v3/include/ext/mt_allocator.h
@@ -588,21 +588,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
max_size() const throw()
{ return size_t(-1) / sizeof(_Tp); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Up, typename... _Args>
+ void
+ construct(_Up* __p, _Args&&... __args)
+ { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
+
+ template<typename _Up>
+ void
+ destroy(_Up* __p) { __p->~_Up(); }
+#else
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 402. wrong new expression in [some_] allocator::construct
void
construct(pointer __p, const _Tp& __val)
{ ::new((void *)__p) _Tp(__val); }
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- template<typename... _Args>
- void
- construct(pointer __p, _Args&&... __args)
- { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
-#endif
-
void
destroy(pointer __p) { __p->~_Tp(); }
+#endif
};
#ifdef __GTHREADS
diff --git a/libstdc++-v3/include/ext/new_allocator.h b/libstdc++-v3/include/ext/new_allocator.h
index 35d5cdccd58..4dd2ca2c3d2 100644
--- a/libstdc++-v3/include/ext/new_allocator.h
+++ b/libstdc++-v3/include/ext/new_allocator.h
@@ -101,21 +101,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
max_size() const throw()
{ return size_t(-1) / sizeof(_Tp); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Up, typename... _Args>
+ void
+ construct(_Up* __p, _Args&&... __args)
+ { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
+
+ template<typename _Up>
+ void
+ destroy(_Up* __p) { __p->~_Up(); }
+#else
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 402. wrong new expression in [some_] allocator::construct
void
construct(pointer __p, const _Tp& __val)
{ ::new((void *)__p) _Tp(__val); }
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- template<typename... _Args>
- void
- construct(pointer __p, _Args&&... __args)
- { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
-#endif
-
void
destroy(pointer __p) { __p->~_Tp(); }
+#endif
};
template<typename _Tp>
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
index 11b7d773f9b..c52e2dcc417 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
@@ -244,9 +244,9 @@ rank_bound()
{
using namespace std;
const size_t* const p_upper =
- _GLIBCXX_STD_A::upper_bound(g_a_rank_bounds,
- g_a_rank_bounds + num_distinct_rank_bounds,
- base_type::m_size);
+ std::upper_bound(g_a_rank_bounds,
+ g_a_rank_bounds + num_distinct_rank_bounds,
+ base_type::m_size);
if (p_upper == g_a_rank_bounds + num_distinct_rank_bounds)
return max_rank;
diff --git a/libstdc++-v3/include/ext/pool_allocator.h b/libstdc++-v3/include/ext/pool_allocator.h
index 66ddced8054..9a47b191fc6 100644
--- a/libstdc++-v3/include/ext/pool_allocator.h
+++ b/libstdc++-v3/include/ext/pool_allocator.h
@@ -158,21 +158,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
max_size() const throw()
{ return size_t(-1) / sizeof(_Tp); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Up, typename... _Args>
+ void
+ construct(_Up* __p, _Args&&... __args)
+ { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
+
+ template<typename _Up>
+ void
+ destroy(_Up* __p) { __p->~_Up(); }
+#else
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 402. wrong new expression in [some_] allocator::construct
void
construct(pointer __p, const _Tp& __val)
{ ::new((void *)__p) _Tp(__val); }
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- template<typename... _Args>
- void
- construct(pointer __p, _Args&&... __args)
- { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
-#endif
-
void
destroy(pointer __p) { __p->~_Tp(); }
+#endif
pointer
allocate(size_type __n, const void* = 0);
diff --git a/libstdc++-v3/include/ext/throw_allocator.h b/libstdc++-v3/include/ext/throw_allocator.h
index 778b8dec165..aa01b257ae2 100644
--- a/libstdc++-v3/include/ext/throw_allocator.h
+++ b/libstdc++-v3/include/ext/throw_allocator.h
@@ -639,20 +639,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return a;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Up, typename... _Args>
+ void
+ construct(_Up* __p, _Args&&... __args)
+ { return _M_allocator.construct(__p, std::forward<_Args>(__args)...); }
+
+ template<typename _Up>
+ void
+ destroy(_Up* __p)
+ { _M_allocator.destroy(__p); }
+#else
void
construct(pointer __p, const value_type& val)
{ return _M_allocator.construct(__p, val); }
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- template<typename... _Args>
- void
- construct(pointer __p, _Args&&... __args)
- { return _M_allocator.construct(__p, std::forward<_Args>(__args)...); }
-#endif
-
void
destroy(pointer __p)
{ _M_allocator.destroy(__p); }
+#endif
void
deallocate(pointer __p, size_type __n)
diff --git a/libstdc++-v3/include/parallel/algo.h b/libstdc++-v3/include/parallel/algo.h
index 89b7f6d827f..26d9e4c63f4 100644
--- a/libstdc++-v3/include/parallel/algo.h
+++ b/libstdc++-v3/include/parallel/algo.h
@@ -273,12 +273,12 @@ namespace __parallel
_BinaryPredicate __comp)
{
typedef std::iterator_traits<_IIter> _IIterTraits;
- typedef std::iterator_traits<_FIterator> iteratorf_traits;
+ typedef std::iterator_traits<_FIterator> _FIterTraits;
typedef typename _IIterTraits::iterator_category _IIteratorCategory;
- typedef typename iteratorf_traits::iterator_category iteratorf_category;
+ typedef typename _FIterTraits::iterator_category _FIteratorCategory;
return __find_first_of_switch(__begin1, __end1, __begin2, __end2, __comp,
- _IIteratorCategory(), iteratorf_category());
+ _IIteratorCategory(), _FIteratorCategory());
}
// Public interface, insert default comparator
@@ -288,9 +288,9 @@ namespace __parallel
_FIterator __begin2, _FIterator __end2)
{
typedef std::iterator_traits<_IIter> _IIterTraits;
- typedef std::iterator_traits<_FIterator> iteratorf_traits;
+ typedef std::iterator_traits<_FIterator> _FIterTraits;
typedef typename _IIterTraits::value_type _IValueType;
- typedef typename iteratorf_traits::value_type _FValueType;
+ typedef typename _FIterTraits::value_type _FValueType;
return __gnu_parallel::find_first_of(__begin1, __end1, __begin2, __end2,
__gnu_parallel::_EqualTo<_IValueType, _FValueType>());
diff --git a/libstdc++-v3/include/parallel/algobase.h b/libstdc++-v3/include/parallel/algobase.h
index 20456b57b2f..8d6ec191d13 100644
--- a/libstdc++-v3/include/parallel/algobase.h
+++ b/libstdc++-v3/include/parallel/algobase.h
@@ -1,6 +1,6 @@
// -*- 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 terms
@@ -38,8 +38,7 @@
#include <bits/stl_algobase.h>
#include <parallel/base.h>
-#include <parallel/tags.h>
-#include <parallel/settings.h>
+#include <parallel/algorithmfwd.h>
#include <parallel/find.h>
#include <parallel/find_selectors.h>
diff --git a/libstdc++-v3/include/parallel/losertree.h b/libstdc++-v3/include/parallel/losertree.h
index cb24f7f6771..577497e787d 100644
--- a/libstdc++-v3/include/parallel/losertree.h
+++ b/libstdc++-v3/include/parallel/losertree.h
@@ -171,6 +171,7 @@ namespace __gnu_parallel
{
typedef _LoserTreeBase<_Tp, _Compare> _Base;
using _Base::_M_k;
+ using _Base::_M_comp;
using _Base::_M_losers;
using _Base::_M_first_insert;
@@ -263,6 +264,7 @@ namespace __gnu_parallel
typedef _LoserTreeBase<_Tp, _Compare> _Base;
using _Base::_M_log_k;
using _Base::_M_k;
+ using _Base::_M_comp;
using _Base::_M_losers;
using _Base::_M_first_insert;
@@ -409,6 +411,7 @@ namespace __gnu_parallel
{
typedef _LoserTreePointerBase<_Tp, _Compare> _Base;
using _Base::_M_k;
+ using _Base::_M_comp;
using _Base::_M_losers;
public:
@@ -490,6 +493,7 @@ namespace __gnu_parallel
{
typedef _LoserTreePointerBase<_Tp, _Compare> _Base;
using _Base::_M_k;
+ using _Base::_M_comp;
using _Base::_M_losers;
public:
@@ -644,6 +648,7 @@ namespace __gnu_parallel
{
typedef _LoserTreeUnguardedBase<_Tp, _Compare> _Base;
using _Base::_M_k;
+ using _Base::_M_comp;
using _Base::_M_losers;
public:
@@ -731,6 +736,7 @@ namespace __gnu_parallel
{
typedef _LoserTreeUnguardedBase<_Tp, _Compare> _Base;
using _Base::_M_k;
+ using _Base::_M_comp;
using _Base::_M_losers;
public:
@@ -887,6 +893,7 @@ namespace __gnu_parallel
{
typedef _LoserTreePointerUnguardedBase<_Tp, _Compare> _Base;
using _Base::_M_k;
+ using _Base::_M_comp;
using _Base::_M_losers;
public:
@@ -972,6 +979,7 @@ namespace __gnu_parallel
{
typedef _LoserTreePointerUnguardedBase<_Tp, _Compare> _Base;
using _Base::_M_k;
+ using _Base::_M_comp;
using _Base::_M_losers;
public:
diff --git a/libstdc++-v3/include/parallel/multiseq_selection.h b/libstdc++-v3/include/parallel/multiseq_selection.h
index e77653aeefa..cfba9c4366e 100644
--- a/libstdc++-v3/include/parallel/multiseq_selection.h
+++ b/libstdc++-v3/include/parallel/multiseq_selection.h
@@ -1,6 +1,6 @@
// -*- 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 terms
@@ -46,8 +46,6 @@
#include <bits/stl_algo.h>
-#include <parallel/sort.h>
-
namespace __gnu_parallel
{
/** @brief Compare __a pair of types lexicographically, ascending. */
diff --git a/libstdc++-v3/include/parallel/multiway_merge.h b/libstdc++-v3/include/parallel/multiway_merge.h
index 1c73ad0042d..bae6a5cd611 100644
--- a/libstdc++-v3/include/parallel/multiway_merge.h
+++ b/libstdc++-v3/include/parallel/multiway_merge.h
@@ -45,6 +45,7 @@
#include <parallel/features.h>
#include <parallel/parallel.h>
#include <parallel/losertree.h>
+#include <parallel/multiseq_selection.h>
#if _GLIBCXX_ASSERTIONS
#include <parallel/checkers.h>
#endif
@@ -54,6 +55,12 @@
namespace __gnu_parallel
{
+ template<typename _RAIter1, typename _RAIter2, typename _OutputIterator,
+ typename _DifferenceTp, typename _Compare>
+ _OutputIterator
+ __merge_advance(_RAIter1&, _RAIter1, _RAIter2&, _RAIter2,
+ _OutputIterator, _DifferenceTp, _Compare);
+
/** @brief _Iterator wrapper supporting an implicit supremum at the end
* of the sequence, dominating all comparisons.
*
diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
index f7035a9109a..2b3e982200d 100644
--- a/libstdc++-v3/include/std/future
+++ b/libstdc++-v3/include/std/future
@@ -72,16 +72,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// Points to a statically-allocated object derived from error_category.
const error_category&
- future_category();
+ future_category() noexcept;
/// Overload for make_error_code.
- inline error_code
- make_error_code(future_errc __errc)
+ inline error_code
+ make_error_code(future_errc __errc) noexcept
{ return error_code(static_cast<int>(__errc), future_category()); }
/// Overload for make_error_condition.
- inline error_condition
- make_error_condition(future_errc __errc)
+ inline error_condition
+ make_error_condition(future_errc __errc) noexcept
{ return error_condition(static_cast<int>(__errc), future_category()); }
/**
@@ -97,13 +97,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: logic_error("std::future_error"), _M_code(__ec)
{ }
- virtual ~future_error() throw();
+ virtual ~future_error() noexcept;
- virtual const char*
- what() const throw();
+ virtual const char*
+ what() const noexcept;
- const error_code&
- code() const throw() { return _M_code; }
+ const error_code&
+ code() const noexcept { return _M_code; }
};
// Forward declarations.
@@ -116,22 +116,51 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Res>
class atomic_future;
- template<typename _Signature>
+ template<typename _Signature>
class packaged_task;
template<typename _Res>
class promise;
/// Launch code for futures
- enum class launch
- {
- any,
- async,
- sync
+ enum class launch
+ {
+ async = 1,
+ deferred = 2
};
+ inline constexpr launch operator&(launch __x, launch __y)
+ {
+ return static_cast<launch>(
+ static_cast<int>(__x) & static_cast<int>(__y));
+ }
+
+ inline constexpr launch operator|(launch __x, launch __y)
+ {
+ return static_cast<launch>(
+ static_cast<int>(__x) | static_cast<int>(__y));
+ }
+
+ inline constexpr launch operator^(launch __x, launch __y)
+ {
+ return static_cast<launch>(
+ static_cast<int>(__x) ^ static_cast<int>(__y));
+ }
+
+ inline constexpr launch operator~(launch __x)
+ { return static_cast<launch>(~static_cast<int>(__x)); }
+
+ inline launch& operator&=(launch& __x, launch __y)
+ { return __x = __x & __y; }
+
+ inline launch& operator|=(launch& __x, launch __y)
+ { return __x = __x | __y; }
+
+ inline launch& operator^=(launch& __x, launch __y)
+ { return __x = __x ^ __y; }
+
/// Status code for futures
- enum class future_status
+ enum class future_status
{
ready,
timeout,
@@ -197,7 +226,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool _M_initialized;
public:
- _Result() : _M_initialized() { }
+ _Result() noexcept : _M_initialized() { }
~_Result()
{
@@ -206,8 +235,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
// Return lvalue, future will add const or rvalue-reference
- _Res&
- _M_value() { return *static_cast<_Res*>(_M_addr()); }
+ _Res&
+ _M_value() noexcept { return *static_cast<_Res*>(_M_addr()); }
void
_M_set(const _Res& __res)
@@ -226,7 +255,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
private:
void _M_destroy() { delete this; }
- void* _M_addr() { return static_cast<void*>(&_M_storage); }
+ void* _M_addr() noexcept { return static_cast<void*>(&_M_storage); }
};
// TODO: use template alias when available
@@ -294,7 +323,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
once_flag _M_once;
public:
- _State_base() : _M_result(), _M_retrieved(ATOMIC_FLAG_INIT) { }
+ _State_base() noexcept : _M_result(), _M_retrieved(ATOMIC_FLAG_INIT) { }
_State_base(const _State_base&) = delete;
_State_base& operator=(const _State_base&) = delete;
virtual ~_State_base();
@@ -454,7 +483,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__set = true;
}
- bool _M_ready() const { return static_cast<bool>(_M_result); }
+ bool _M_ready() const noexcept { return static_cast<bool>(_M_result); }
virtual void _M_run_deferred() { }
};
@@ -476,15 +505,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Res>
struct __future_base::_Result<_Res&> : __future_base::_Result_base
{
- _Result() : _M_value_ptr() { }
+ _Result() noexcept : _M_value_ptr() { }
- void _M_set(_Res& __res) { _M_value_ptr = &__res; }
+ void _M_set(_Res& __res) noexcept { _M_value_ptr = &__res; }
- _Res& _M_get() { return *_M_value_ptr; }
+ _Res& _M_get() noexcept { return *_M_value_ptr; }
private:
_Res* _M_value_ptr;
-
+
void _M_destroy() { delete this; }
};
@@ -513,10 +542,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__basic_future(const __basic_future&) = delete;
__basic_future& operator=(const __basic_future&) = delete;
- bool
- valid() const { return static_cast<bool>(_M_state); }
+ bool
+ valid() const noexcept { return static_cast<bool>(_M_state); }
- void
+ void
wait() const
{
_State_base::_S_check(_M_state);
@@ -551,7 +580,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return static_cast<__result_type>(__res);
}
- void _M_swap(__basic_future& __that)
+ void _M_swap(__basic_future& __that) noexcept
{
_M_state.swap(__that._M_state);
}
@@ -566,21 +595,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Copy construction from a shared_future
explicit
- __basic_future(const shared_future<_Res>&);
+ __basic_future(const shared_future<_Res>&) noexcept;
// Move construction from a shared_future
explicit
- __basic_future(shared_future<_Res>&&);
+ __basic_future(shared_future<_Res>&&) noexcept;
// Move construction from a future
explicit
- __basic_future(future<_Res>&&);
+ __basic_future(future<_Res>&&) noexcept;
- constexpr __basic_future() : _M_state() { }
+ constexpr __basic_future() noexcept : _M_state() { }
struct _Reset
{
- explicit _Reset(__basic_future& __fut) : _M_fut(__fut) { }
+ explicit _Reset(__basic_future& __fut) noexcept : _M_fut(__fut) { }
~_Reset() { _M_fut._M_state.reset(); }
__basic_future& _M_fut;
};
@@ -604,16 +633,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
future(const __state_type& __state) : _Base_type(__state) { }
public:
- constexpr future() : _Base_type() { }
+ constexpr future() noexcept : _Base_type() { }
/// Move constructor
- future(future&& __uf) : _Base_type(std::move(__uf)) { }
+ future(future&& __uf) noexcept : _Base_type(std::move(__uf)) { }
// Disable copying
future(const future&) = delete;
future& operator=(const future&) = delete;
- future& operator=(future&& __fut)
+ future& operator=(future&& __fut) noexcept
{
future(std::move(__fut))._M_swap(*this);
return *this;
@@ -629,7 +658,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
shared_future<_Res> share();
};
-
+
/// Partial specialization for future<R&>
template<typename _Res>
class future<_Res&> : public __basic_future<_Res&>
@@ -647,23 +676,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
future(const __state_type& __state) : _Base_type(__state) { }
public:
- constexpr future() : _Base_type() { }
+ constexpr future() noexcept : _Base_type() { }
/// Move constructor
- future(future&& __uf) : _Base_type(std::move(__uf)) { }
+ future(future&& __uf) noexcept : _Base_type(std::move(__uf)) { }
// Disable copying
future(const future&) = delete;
future& operator=(const future&) = delete;
- future& operator=(future&& __fut)
+ future& operator=(future&& __fut) noexcept
{
future(std::move(__fut))._M_swap(*this);
return *this;
}
/// Retrieving the value
- _Res&
+ _Res&
get()
{
typename _Base_type::_Reset __reset(*this);
@@ -690,23 +719,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
future(const __state_type& __state) : _Base_type(__state) { }
public:
- constexpr future() : _Base_type() { }
+ constexpr future() noexcept : _Base_type() { }
/// Move constructor
- future(future&& __uf) : _Base_type(std::move(__uf)) { }
+ future(future&& __uf) noexcept : _Base_type(std::move(__uf)) { }
// Disable copying
future(const future&) = delete;
future& operator=(const future&) = delete;
- future& operator=(future&& __fut)
+ future& operator=(future&& __fut) noexcept
{
future(std::move(__fut))._M_swap(*this);
return *this;
}
/// Retrieving the value
- void
+ void
get()
{
typename _Base_type::_Reset __reset(*this);
@@ -724,18 +753,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef __basic_future<_Res> _Base_type;
public:
- constexpr shared_future() : _Base_type() { }
+ constexpr shared_future() noexcept : _Base_type() { }
/// Copy constructor
shared_future(const shared_future& __sf) : _Base_type(__sf) { }
/// Construct from a future rvalue
- shared_future(future<_Res>&& __uf)
+ shared_future(future<_Res>&& __uf) noexcept
: _Base_type(std::move(__uf))
{ }
/// Construct from a shared_future rvalue
- shared_future(shared_future&& __sf)
+ shared_future(shared_future&& __sf) noexcept
: _Base_type(std::move(__sf))
{ }
@@ -745,7 +774,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return *this;
}
- shared_future& operator=(shared_future&& __sf)
+ shared_future& operator=(shared_future&& __sf) noexcept
{
shared_future(std::move(__sf))._M_swap(*this);
return *this;
@@ -760,7 +789,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __rs;
}
};
-
+
/// Partial specialization for shared_future<R&>
template<typename _Res>
class shared_future<_Res&> : public __basic_future<_Res&>
@@ -768,18 +797,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef __basic_future<_Res&> _Base_type;
public:
- constexpr shared_future() : _Base_type() { }
+ constexpr shared_future() noexcept : _Base_type() { }
/// Copy constructor
shared_future(const shared_future& __sf) : _Base_type(__sf) { }
/// Construct from a future rvalue
- shared_future(future<_Res&>&& __uf)
+ shared_future(future<_Res&>&& __uf) noexcept
: _Base_type(std::move(__uf))
{ }
/// Construct from a shared_future rvalue
- shared_future(shared_future&& __sf)
+ shared_future(shared_future&& __sf) noexcept
: _Base_type(std::move(__sf))
{ }
@@ -789,14 +818,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return *this;
}
- shared_future& operator=(shared_future&& __sf)
+ shared_future& operator=(shared_future&& __sf) noexcept
{
shared_future(std::move(__sf))._M_swap(*this);
return *this;
}
/// Retrieving the value
- _Res&
+ _Res&
get() { return this->_M_get_result()._M_get(); }
};
@@ -807,18 +836,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef __basic_future<void> _Base_type;
public:
- constexpr shared_future() : _Base_type() { }
+ constexpr shared_future() noexcept : _Base_type() { }
/// Copy constructor
shared_future(const shared_future& __sf) : _Base_type(__sf) { }
/// Construct from a future rvalue
- shared_future(future<void>&& __uf)
+ shared_future(future<void>&& __uf) noexcept
: _Base_type(std::move(__uf))
{ }
/// Construct from a shared_future rvalue
- shared_future(shared_future&& __sf)
+ shared_future(shared_future&& __sf) noexcept
: _Base_type(std::move(__sf))
{ }
@@ -828,33 +857,33 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return *this;
}
- shared_future& operator=(shared_future&& __sf)
+ shared_future& operator=(shared_future&& __sf) noexcept
{
shared_future(std::move(__sf))._M_swap(*this);
return *this;
}
// Retrieving the value
- void
+ void
get() { this->_M_get_result(); }
};
// Now we can define the protected __basic_future constructors.
template<typename _Res>
inline __basic_future<_Res>::
- __basic_future(const shared_future<_Res>& __sf)
+ __basic_future(const shared_future<_Res>& __sf) noexcept
: _M_state(__sf._M_state)
{ }
template<typename _Res>
inline __basic_future<_Res>::
- __basic_future(shared_future<_Res>&& __sf)
+ __basic_future(shared_future<_Res>&& __sf) noexcept
: _M_state(std::move(__sf._M_state))
{ }
template<typename _Res>
inline __basic_future<_Res>::
- __basic_future(future<_Res>&& __uf)
+ __basic_future(future<_Res>&& __uf) noexcept
: _M_state(std::move(__uf._M_state))
{ }
@@ -880,7 +909,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef __future_base::_Result<_Res> _Res_type;
typedef typename __future_base::_Ptr<_Res_type>::type _Ptr_type;
template<typename, typename> friend class _State::_Setter;
-
+
shared_ptr<_State> _M_future;
_Ptr_type _M_storage;
@@ -890,7 +919,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_storage(new _Res_type())
{ }
- promise(promise&& __rhs)
+ promise(promise&& __rhs) noexcept
: _M_future(std::move(__rhs._M_future)),
_M_storage(std::move(__rhs._M_storage))
{ }
@@ -911,7 +940,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Assignment
promise&
- operator=(promise&& __rhs)
+ operator=(promise&& __rhs) noexcept
{
promise(std::move(__rhs)).swap(*this);
return *this;
@@ -920,7 +949,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
promise& operator=(const promise&) = delete;
void
- swap(promise& __rhs)
+ swap(promise& __rhs) noexcept
{
_M_future.swap(__rhs._M_future);
_M_storage.swap(__rhs._M_storage);
@@ -956,7 +985,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Res>
inline void
- swap(promise<_Res>& __x, promise<_Res>& __y)
+ swap(promise<_Res>& __x, promise<_Res>& __y) noexcept
{ __x.swap(__y); }
template<typename _Res, typename _Alloc>
@@ -982,8 +1011,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_storage(new _Res_type())
{ }
- promise(promise&& __rhs)
- : _M_future(std::move(__rhs._M_future)),
+ promise(promise&& __rhs) noexcept
+ : _M_future(std::move(__rhs._M_future)),
_M_storage(std::move(__rhs._M_storage))
{ }
@@ -1003,7 +1032,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Assignment
promise&
- operator=(promise&& __rhs)
+ operator=(promise&& __rhs) noexcept
{
promise(std::move(__rhs)).swap(*this);
return *this;
@@ -1012,7 +1041,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
promise& operator=(const promise&) = delete;
void
- swap(promise& __rhs)
+ swap(promise& __rhs) noexcept
{
_M_future.swap(__rhs._M_future);
_M_storage.swap(__rhs._M_storage);
@@ -1057,7 +1086,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_storage(new _Res_type())
{ }
- promise(promise&& __rhs)
+ promise(promise&& __rhs) noexcept
: _M_future(std::move(__rhs._M_future)),
_M_storage(std::move(__rhs._M_storage))
{ }
@@ -1078,7 +1107,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Assignment
promise&
- operator=(promise&& __rhs)
+ operator=(promise&& __rhs) noexcept
{
promise(std::move(__rhs)).swap(*this);
return *this;
@@ -1087,7 +1116,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
promise& operator=(const promise&) = delete;
void
- swap(promise& __rhs)
+ swap(promise& __rhs) noexcept
{
_M_future.swap(__rhs._M_future);
_M_storage.swap(__rhs._M_storage);
@@ -1175,7 +1204,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
template<typename _Res, typename... _Args>
- struct __future_base::_Task_state<_Res(_Args...)>
+ struct __future_base::_Task_state<_Res(_Args...)>
: __future_base::_State_base
{
typedef _Res _Res_type;
@@ -1226,7 +1255,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public:
// Construction and destruction
- packaged_task() { }
+ packaged_task() noexcept { }
template<typename _Fn>
explicit
@@ -1252,21 +1281,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
packaged_task& operator=(packaged_task&) = delete;
// Move support
- packaged_task(packaged_task&& __other)
+ packaged_task(packaged_task&& __other) noexcept
{ this->swap(__other); }
- packaged_task& operator=(packaged_task&& __other)
+ packaged_task& operator=(packaged_task&& __other) noexcept
{
packaged_task(std::move(__other)).swap(*this);
return *this;
}
void
- swap(packaged_task& __other)
+ swap(packaged_task& __other) noexcept
{ _M_state.swap(__other._M_state); }
bool
- valid() const
+ valid() const noexcept
{ return static_cast<bool>(_M_state); }
// Result retrieval
@@ -1294,7 +1323,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Res, typename... _ArgTypes>
inline void
swap(packaged_task<_Res(_ArgTypes...)>& __x,
- packaged_task<_Res(_ArgTypes...)>& __y)
+ packaged_task<_Res(_ArgTypes...)>& __y) noexcept
{ __x.swap(__y); }
template<typename _Res, typename _Alloc>
@@ -1334,7 +1363,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public:
typedef _Res _Res_type;
- explicit
+ explicit
_Async_state(std::function<_Res()>&& __fn)
: _M_result(new _Result<_Res>()), _M_fn(std::move(__fn)),
_M_thread(mem_fn(&_Async_state::_M_do_run), this)
@@ -1356,14 +1385,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
thread _M_thread;
};
- /// async
+ /// async
template<typename _Fn, typename... _Args>
future<typename result_of<_Fn(_Args...)>::type>
async(launch __policy, _Fn&& __fn, _Args&&... __args)
{
typedef typename result_of<_Fn(_Args...)>::type result_type;
std::shared_ptr<__future_base::_State_base> __state;
- if (__policy == launch::async)
+ if ((__policy & (launch::async|launch::deferred)) == launch::async)
{
typedef typename __future_base::_Async_state<result_type> _State;
__state = std::make_shared<_State>(std::bind<result_type>(
@@ -1384,7 +1413,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__async_sfinae_helper<typename decay<_Fn>::type, _Fn, _Args...>::type
async(_Fn&& __fn, _Args&&... __args)
{
- return async(launch::any, std::forward<_Fn>(__fn),
+ return async(launch::async|launch::deferred, std::forward<_Fn>(__fn),
std::forward<_Args>(__args)...);
}
diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread
index 4fa5e505146..ab85735154e 100644
--- a/libstdc++-v3/include/std/thread
+++ b/libstdc++-v3/include/std/thread
@@ -179,8 +179,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Returns a value that hints at the number of hardware thread contexts.
static unsigned int
- hardware_concurrency() noexcept
- { return 0; }
+ hardware_concurrency() noexcept;
private:
void
@@ -260,12 +259,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
#endif
#ifdef _GLIBCXX_USE_NANOSLEEP
- /// sleep_until
- template<typename _Clock, typename _Duration>
- inline void
- sleep_until(const chrono::time_point<_Clock, _Duration>& __atime)
- { sleep_for(__atime - _Clock::now()); }
-
/// sleep_for
template<typename _Rep, typename _Period>
inline void
@@ -285,6 +278,12 @@ _GLIBCXX_END_NAMESPACE_VERSION
::nanosleep(&__ts, 0);
}
+
+ /// sleep_until
+ template<typename _Clock, typename _Duration>
+ inline void
+ sleep_until(const chrono::time_point<_Clock, _Duration>& __atime)
+ { sleep_for(__atime - _Clock::now()); }
#endif
_GLIBCXX_END_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index fee94e26e52..10272ccb1b2 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -36,6 +36,7 @@
#else
#include <utility>
+#include <bits/uses_allocator.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
@@ -81,10 +82,35 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr _Head_base(const _Head& __h)
: _Head(__h) { }
- template<typename _UHead>
+ template<typename _UHead, typename = typename
+ enable_if<!is_convertible<_UHead,
+ __uses_alloc_base>::value>::type>
_Head_base(_UHead&& __h)
: _Head(std::forward<_UHead>(__h)) { }
+ _Head_base(__uses_alloc0)
+ : _Head() { }
+
+ template<typename _Alloc>
+ _Head_base(__uses_alloc1<_Alloc> __a)
+ : _Head(allocator_arg, *__a._M_a) { }
+
+ template<typename _Alloc>
+ _Head_base(__uses_alloc2<_Alloc> __a)
+ : _Head(*__a._M_a) { }
+
+ template<typename _UHead>
+ _Head_base(__uses_alloc0, _UHead&& __uhead)
+ : _Head(std::forward<_UHead>(__uhead)) { }
+
+ template<typename _Alloc, typename _UHead>
+ _Head_base(__uses_alloc1<_Alloc> __a, _UHead&& __uhead)
+ : _Head(allocator_arg, *__a._M_a, std::forward<_UHead>(__uhead)) { }
+
+ template<typename _Alloc, typename _UHead>
+ _Head_base(__uses_alloc2<_Alloc> __a, _UHead&& __uhead)
+ : _Head(std::forward<_UHead>(__uhead), *__a._M_a) { }
+
_Head& _M_head() noexcept { return *this; }
const _Head& _M_head() const noexcept { return *this; }
};
@@ -98,10 +124,36 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr _Head_base(const _Head& __h)
: _M_head_impl(__h) { }
- template<typename _UHead>
+ template<typename _UHead, typename = typename
+ enable_if<!is_convertible<_UHead,
+ __uses_alloc_base>::value>::type>
_Head_base(_UHead&& __h)
: _M_head_impl(std::forward<_UHead>(__h)) { }
+ _Head_base(__uses_alloc0)
+ : _M_head_impl() { }
+
+ template<typename _Alloc>
+ _Head_base(__uses_alloc1<_Alloc> __a)
+ : _M_head_impl(allocator_arg, *__a._M_a) { }
+
+ template<typename _Alloc>
+ _Head_base(__uses_alloc2<_Alloc> __a)
+ : _M_head_impl(*__a._M_a) { }
+
+ template<typename _UHead>
+ _Head_base(__uses_alloc0, _UHead&& __uhead)
+ : _M_head_impl(std::forward<_UHead>(__uhead)) { }
+
+ template<typename _Alloc, typename _UHead>
+ _Head_base(__uses_alloc1<_Alloc> __a, _UHead&& __uhead)
+ : _M_head_impl(allocator_arg, *__a._M_a, std::forward<_UHead>(__uhead))
+ { }
+
+ template<typename _Alloc, typename _UHead>
+ _Head_base(__uses_alloc2<_Alloc> __a, _UHead&& __uhead)
+ : _M_head_impl(std::forward<_UHead>(__uhead), *__a._M_a) { }
+
_Head& _M_head() noexcept { return _M_head_impl; }
const _Head& _M_head() const noexcept { return _M_head_impl; }
@@ -128,6 +180,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
template<std::size_t, typename...> friend class _Tuple_impl;
+ _Tuple_impl() = default;
+
+ template<typename _Alloc>
+ _Tuple_impl(allocator_arg_t, const _Alloc&) { }
+
+ template<typename _Alloc>
+ _Tuple_impl(allocator_arg_t, const _Alloc&, const _Tuple_impl&) { }
+
+ template<typename _Alloc>
+ _Tuple_impl(allocator_arg_t, const _Alloc&, _Tuple_impl&&) { }
+
protected:
void _M_swap(_Tuple_impl&) noexcept { /* no-op */ }
};
@@ -160,7 +223,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr _Tuple_impl(const _Head& __head, const _Tail&... __tail)
: _Inherited(__tail...), _Base(__head) { }
- template<typename _UHead, typename... _UTail>
+ template<typename _UHead, typename... _UTail, typename = typename
+ enable_if<sizeof...(_Tail) == sizeof...(_UTail)>::type>
explicit
_Tuple_impl(_UHead&& __head, _UTail&&... __tail)
: _Inherited(std::forward<_UTail>(__tail)...),
@@ -169,8 +233,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr _Tuple_impl(const _Tuple_impl&) = default;
_Tuple_impl(_Tuple_impl&& __in)
- noexcept(std::is_nothrow_move_constructible<_Head>::value
- && std::is_nothrow_move_constructible<_Inherited>::value)
+ noexcept(__and_<is_nothrow_move_constructible<_Head>,
+ is_nothrow_move_constructible<_Inherited>>::value)
: _Inherited(std::move(__in._M_tail())),
_Base(std::forward<_Head>(__in._M_head())) { }
@@ -183,6 +247,52 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: _Inherited(std::move(__in._M_tail())),
_Base(std::forward<_UHead>(__in._M_head())) { }
+ template<typename _Alloc>
+ _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a)
+ : _Inherited(__tag, __a),
+ _Base(__use_alloc<_Head>(__a)) { }
+
+ template<typename _Alloc>
+ _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
+ const _Head& __head, const _Tail&... __tail)
+ : _Inherited(__tag, __a, __tail...),
+ _Base(__use_alloc<_Head, _Alloc, _Head>(__a), __head) { }
+
+ template<typename _Alloc, typename _UHead, typename... _UTail,
+ typename = typename enable_if<sizeof...(_Tail)
+ == sizeof...(_UTail)>::type>
+ _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
+ _UHead&& __head, _UTail&&... __tail)
+ : _Inherited(__tag, __a, std::forward<_UTail>(__tail)...),
+ _Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
+ std::forward<_UHead>(__head)) { }
+
+ template<typename _Alloc>
+ _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
+ const _Tuple_impl& __in)
+ : _Inherited(__tag, __a, __in._M_tail()),
+ _Base(__use_alloc<_Head, _Alloc, _Head>(__a), __in._M_head()) { }
+
+ template<typename _Alloc>
+ _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
+ _Tuple_impl&& __in)
+ : _Inherited(__tag, __a, std::move(__in._M_tail())),
+ _Base(__use_alloc<_Head, _Alloc, _Head>(__a),
+ std::forward<_Head>(__in._M_head())) { }
+
+ template<typename _Alloc, typename... _UElements>
+ _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
+ const _Tuple_impl<_Idx, _UElements...>& __in)
+ : _Inherited(__tag, __a, __in._M_tail()),
+ _Base(__use_alloc<_Head, _Alloc, _Head>(__a), __in._M_head()) { }
+
+ template<typename _Alloc, typename _UHead, typename... _UTails>
+ _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
+ _Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
+ : _Inherited(__tag, __a, std::move(__in._M_tail())),
+ _Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
+ std::forward<_UHead>(__in._M_head())) { }
+
_Tuple_impl&
operator=(const _Tuple_impl& __in)
{
@@ -193,8 +303,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Tuple_impl&
operator=(_Tuple_impl&& __in)
- noexcept(std::is_nothrow_move_assignable<_Head>::value
- && std::is_nothrow_move_assignable<_Inherited>::value)
+ noexcept(__and_<is_nothrow_move_assignable<_Head>,
+ is_nothrow_move_assignable<_Inherited>>::value)
{
_M_head() = std::forward<_Head>(__in._M_head());
_M_tail() = std::move(__in._M_tail());
@@ -247,9 +357,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: _Inherited(__elements...) { }
template<typename... _UElements, typename = typename
- std::enable_if<sizeof...(_UElements)
- == sizeof...(_Elements)>::type>
- explicit
+ enable_if<__and_<integral_constant<bool, sizeof...(_UElements)
+ == sizeof...(_Elements)>,
+ __and_<is_convertible<_UElements,
+ _Elements>...>>::value>::type>
+ explicit
tuple(_UElements&&... __elements)
: _Inherited(std::forward<_UElements>(__elements)...) { }
@@ -257,18 +369,67 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
tuple(tuple&&) = default;
template<typename... _UElements, typename = typename
- std::enable_if<sizeof...(_UElements)
- == sizeof...(_Elements)>::type>
+ enable_if<__and_<integral_constant<bool, sizeof...(_UElements)
+ == sizeof...(_Elements)>,
+ __and_<is_convertible<const _UElements&,
+ _Elements>...>>::value>::type>
tuple(const tuple<_UElements...>& __in)
: _Inherited(static_cast<const _Tuple_impl<0, _UElements...>&>(__in))
{ }
template<typename... _UElements, typename = typename
- std::enable_if<sizeof...(_UElements)
- == sizeof...(_Elements)>::type>
+ enable_if<__and_<integral_constant<bool, sizeof...(_UElements)
+ == sizeof...(_Elements)>,
+ __and_<is_convertible<_UElements,
+ _Elements>...>>::value>::type>
tuple(tuple<_UElements...>&& __in)
: _Inherited(static_cast<_Tuple_impl<0, _UElements...>&&>(__in)) { }
+ // allocator-extended constructors
+
+ template<typename _Alloc>
+ tuple(allocator_arg_t __tag, const _Alloc& __a)
+ : _Inherited(__tag, __a) { }
+
+ template<typename _Alloc>
+ tuple(allocator_arg_t __tag, const _Alloc& __a,
+ const _Elements&... __elements)
+ : _Inherited(__tag, __a, __elements...) { }
+
+ template<typename _Alloc, typename... _UElements, typename = typename
+ enable_if<sizeof...(_UElements)
+ == sizeof...(_Elements)>::type>
+ tuple(allocator_arg_t __tag, const _Alloc& __a,
+ _UElements&&... __elements)
+ : _Inherited(__tag, __a, std::forward<_UElements>(__elements)...)
+ { }
+
+ template<typename _Alloc>
+ tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple& __in)
+ : _Inherited(__tag, __a, static_cast<const _Inherited&>(__in)) { }
+
+ template<typename _Alloc>
+ tuple(allocator_arg_t __tag, const _Alloc& __a, tuple&& __in)
+ : _Inherited(__tag, __a, static_cast<_Inherited&&>(__in)) { }
+
+ template<typename _Alloc, typename... _UElements, typename = typename
+ enable_if<sizeof...(_UElements)
+ == sizeof...(_Elements)>::type>
+ tuple(allocator_arg_t __tag, const _Alloc& __a,
+ const tuple<_UElements...>& __in)
+ : _Inherited(__tag, __a,
+ static_cast<const _Tuple_impl<0, _UElements...>&>(__in))
+ { }
+
+ template<typename _Alloc, typename... _UElements, typename = typename
+ enable_if<sizeof...(_UElements)
+ == sizeof...(_Elements)>::type>
+ tuple(allocator_arg_t __tag, const _Alloc& __a,
+ tuple<_UElements...>&& __in)
+ : _Inherited(__tag, __a,
+ static_cast<_Tuple_impl<0, _UElements...>&&>(__in))
+ { }
+
tuple&
operator=(const tuple& __in)
{
@@ -278,15 +439,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
tuple&
operator=(tuple&& __in)
- noexcept(std::is_nothrow_move_assignable<_Inherited>::value)
+ noexcept(is_nothrow_move_assignable<_Inherited>::value)
{
static_cast<_Inherited&>(*this) = std::move(__in);
return *this;
}
template<typename... _UElements, typename = typename
- std::enable_if<sizeof...(_UElements)
- == sizeof...(_Elements)>::type>
+ enable_if<sizeof...(_UElements)
+ == sizeof...(_Elements)>::type>
tuple&
operator=(const tuple<_UElements...>& __in)
{
@@ -295,8 +456,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
template<typename... _UElements, typename = typename
- std::enable_if<sizeof...(_UElements)
- == sizeof...(_Elements)>::type>
+ enable_if<sizeof...(_UElements)
+ == sizeof...(_Elements)>::type>
tuple&
operator=(tuple<_UElements...>&& __in)
{
@@ -331,7 +492,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr tuple(const _T1& __a1, const _T2& __a2)
: _Inherited(__a1, __a2) { }
- template<typename _U1, typename _U2>
+ template<typename _U1, typename _U2, typename = typename
+ enable_if<__and_<is_convertible<_U1, _T1>,
+ is_convertible<_U2, _T2>>::value>::type>
explicit
tuple(_U1&& __a1, _U2&& __a2)
: _Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { }
@@ -339,23 +502,77 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr tuple(const tuple&) = default;
tuple(tuple&&) = default;
- template<typename _U1, typename _U2>
+ template<typename _U1, typename _U2, typename = typename
+ enable_if<__and_<is_convertible<const _U1&, _T1>,
+ is_convertible<const _U2&, _T2>>::value>::type>
tuple(const tuple<_U1, _U2>& __in)
: _Inherited(static_cast<const _Tuple_impl<0, _U1, _U2>&>(__in)) { }
- template<typename _U1, typename _U2>
+ template<typename _U1, typename _U2, typename = typename
+ enable_if<__and_<is_convertible<_U1, _T1>,
+ is_convertible<_U2, _T2>>::value>::type>
tuple(tuple<_U1, _U2>&& __in)
: _Inherited(static_cast<_Tuple_impl<0, _U1, _U2>&&>(__in)) { }
- template<typename _U1, typename _U2>
+ template<typename _U1, typename _U2, typename = typename
+ enable_if<__and_<is_convertible<const _U1&, _T1>,
+ is_convertible<const _U2&, _T2>>::value>::type>
tuple(const pair<_U1, _U2>& __in)
: _Inherited(__in.first, __in.second) { }
- template<typename _U1, typename _U2>
- tuple(pair<_U1, _U2>&& __in)
+ template<typename _U1, typename _U2, typename = typename
+ enable_if<__and_<is_convertible<_U1, _T1>,
+ is_convertible<_U2, _T2>>::value>::type>
+ tuple(pair<_U1, _U2>&& __in)
: _Inherited(std::forward<_U1>(__in.first),
std::forward<_U2>(__in.second)) { }
+ // allocator-extended constructors
+
+ template<typename _Alloc>
+ tuple(allocator_arg_t __tag, const _Alloc& __a)
+ : _Inherited(__tag, __a) { }
+
+ template<typename _Alloc>
+ tuple(allocator_arg_t __tag, const _Alloc& __a,
+ const _T1& __a1, const _T2& __a2)
+ : _Inherited(__tag, __a, __a1, __a2) { }
+
+ template<typename _Alloc, typename _U1, typename _U2>
+ tuple(allocator_arg_t __tag, const _Alloc& __a, _U1&& __a1, _U2&& __a2)
+ : _Inherited(__tag, __a, std::forward<_U1>(__a1),
+ std::forward<_U2>(__a2)) { }
+
+ template<typename _Alloc>
+ tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple& __in)
+ : _Inherited(__tag, __a, static_cast<const _Inherited&>(__in)) { }
+
+ template<typename _Alloc>
+ tuple(allocator_arg_t __tag, const _Alloc& __a, tuple&& __in)
+ : _Inherited(__tag, __a, static_cast<_Inherited&&>(__in)) { }
+
+ template<typename _Alloc, typename _U1, typename _U2>
+ tuple(allocator_arg_t __tag, const _Alloc& __a,
+ const tuple<_U1, _U2>& __in)
+ : _Inherited(__tag, __a,
+ static_cast<const _Tuple_impl<0, _U1, _U2>&>(__in))
+ { }
+
+ template<typename _Alloc, typename _U1, typename _U2>
+ tuple(allocator_arg_t __tag, const _Alloc& __a, tuple<_U1, _U2>&& __in)
+ : _Inherited(__tag, __a, static_cast<_Tuple_impl<0, _U1, _U2>&&>(__in))
+ { }
+
+ template<typename _Alloc, typename _U1, typename _U2>
+ tuple(allocator_arg_t __tag, const _Alloc& __a,
+ const pair<_U1, _U2>& __in)
+ : _Inherited(__tag, __a, __in.first, __in.second) { }
+
+ template<typename _Alloc, typename _U1, typename _U2>
+ tuple(allocator_arg_t __tag, const _Alloc& __a, pair<_U1, _U2>&& __in)
+ : _Inherited(__tag, __a, std::forward<_U1>(__in.first),
+ std::forward<_U2>(__in.second)) { }
+
tuple&
operator=(const tuple& __in)
{
@@ -365,7 +582,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
tuple&
operator=(tuple&& __in)
- noexcept(std::is_nothrow_move_assignable<_Inherited>::value)
+ noexcept(is_nothrow_move_assignable<_Inherited>::value)
{
static_cast<_Inherited&>(*this) = std::move(__in);
return *this;
@@ -412,6 +629,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
/// tuple (1-element).
+ // TODO: Should be simply removed when c++/49225 is fixed, worst case
+ // together with a different way to constrain the constructors
+ // of the primary template.
template<typename _T1>
class tuple<_T1> : public _Tuple_impl<0, _T1>
{
@@ -426,7 +646,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: _Inherited(__a1) { }
template<typename _U1, typename = typename
- std::enable_if<std::is_convertible<_U1, _T1>::value>::type>
+ enable_if<is_convertible<_U1, _T1>::value>::type>
explicit
tuple(_U1&& __a1)
: _Inherited(std::forward<_U1>(__a1)) { }
@@ -434,14 +654,48 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr tuple(const tuple&) = default;
tuple(tuple&&) = default;
- template<typename _U1>
+ template<typename _U1, typename = typename
+ enable_if<is_convertible<const _U1&, _T1>::value>::type>
tuple(const tuple<_U1>& __in)
: _Inherited(static_cast<const _Tuple_impl<0, _U1>&>(__in)) { }
- template<typename _U1>
+ template<typename _U1, typename = typename
+ enable_if<is_convertible<_U1, _T1>::value>::type>
tuple(tuple<_U1>&& __in)
: _Inherited(static_cast<_Tuple_impl<0, _U1>&&>(__in)) { }
+ // allocator-extended constructors
+
+ template<typename _Alloc>
+ tuple(allocator_arg_t __tag, const _Alloc& __a)
+ : _Inherited(__tag, __a) { }
+
+ template<typename _Alloc>
+ tuple(allocator_arg_t __tag, const _Alloc& __a, const _T1& __a1)
+ : _Inherited(__tag, __a, __a1) { }
+
+ // TODO: constrain for is_uses_allocator_constructible<_T1, _U1&&, _Alloc>
+ template<typename _Alloc, typename _U1>
+ tuple(allocator_arg_t __tag, const _Alloc& __a, _U1&& __a1)
+ : _Inherited(__tag, __a, std::forward<_U1>(__a1)) { }
+
+ template<typename _Alloc>
+ tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple& __in)
+ : _Inherited(__tag, __a, static_cast<const _Inherited&>(__in)) { }
+
+ template<typename _Alloc>
+ tuple(allocator_arg_t __tag, const _Alloc& __a, tuple&& __in)
+ : _Inherited(__tag, __a, static_cast<_Inherited&&>(__in)) { }
+
+ template<typename _Alloc, typename _U1>
+ tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple<_U1>& __in)
+ : _Inherited(__tag, __a, static_cast<const _Tuple_impl<0, _U1>&>(__in))
+ { }
+
+ template<typename _Alloc, typename _U1>
+ tuple(allocator_arg_t __tag, const _Alloc& __a, tuple<_U1>&& __in)
+ : _Inherited(__tag, __a, static_cast<_Tuple_impl<0, _U1>&&>(__in)) { }
+
tuple&
operator=(const tuple& __in)
{
@@ -451,7 +705,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
tuple&
operator=(tuple&& __in)
- noexcept(std::is_nothrow_move_assignable<_Inherited>::value)
+ noexcept(is_nothrow_move_assignable<_Inherited>::value)
{
static_cast<_Inherited&>(*this) = std::move(__in);
return *this;
@@ -804,6 +1058,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const _Swallow_assign ignore{};
+ /// Partial specialization for tuples
+ template<typename... _Types, typename _Alloc>
+ struct uses_allocator<tuple<_Types...>, _Alloc> : true_type { };
+
/**
* Stores a tuple of indices. Used by bind() to extract the elements
* in a tuple.
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 184e28ba8dc..a8842eda95b 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -59,9 +59,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp, _Tp>
struct integral_constant;
- template<typename, typename, typename...>
+ template<typename...>
struct __or_;
+ template<typename _B1>
+ struct __or_<_B1>
+ : public _B1
+ { };
+
template<typename _B1, typename _B2>
struct __or_<_B1, _B2>
: public conditional<_B1::value, _B1, _B2>::type
@@ -72,9 +77,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: public conditional<_B1::value, _B1, __or_<_B2, _B3, _Bn...>>::type
{ };
- template<typename, typename, typename...>
+ template<typename...>
struct __and_;
+ template<typename _B1>
+ struct __and_<_B1>
+ : public _B1
+ { };
+
template<typename _B1, typename _B2>
struct __and_<_B1, _B2>
: public conditional<_B1::value, _B2, _B1>::type
diff --git a/libstdc++-v3/src/future.cc b/libstdc++-v3/src/future.cc
index d6149cbbf6d..94ae6f170d5 100644
--- a/libstdc++-v3/src/future.cc
+++ b/libstdc++-v3/src/future.cc
@@ -28,10 +28,10 @@ namespace
{
struct future_error_category : public std::error_category
{
- future_error_category() {}
+ future_error_category() noexcept {}
virtual const char*
- name() const
+ name() const noexcept
{ return "future"; }
virtual std::string message(int __ec) const
@@ -60,7 +60,7 @@ namespace
};
const future_error_category&
- __future_category_instance()
+ __future_category_instance() noexcept
{
static const future_error_category __fec;
return __fec;
@@ -71,13 +71,13 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- const error_category& future_category()
+ const error_category& future_category() noexcept
{ return __future_category_instance(); }
- future_error::~future_error() throw() { }
+ future_error::~future_error() noexcept { }
- const char*
- future_error::what() const throw() { return _M_code.message().c_str(); }
+ const char*
+ future_error::what() const noexcept { return _M_code.message().c_str(); }
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
&& defined(_GLIBCXX_ATOMIC_BUILTINS_4)
diff --git a/libstdc++-v3/src/thread.cc b/libstdc++-v3/src/thread.cc
index c164e8a0161..cc23c19768f 100644
--- a/libstdc++-v3/src/thread.cc
+++ b/libstdc++-v3/src/thread.cc
@@ -26,6 +26,16 @@
#include <thread>
#include <cerrno>
+#if defined(_GLIBCXX_USE_GET_NPROCS)
+# include <sys/sysinfo.h>
+# define _GLIBCXX_NPROCS get_nprocs()
+#elif defined(_GLIBCXX_USE_SC_NPROCESSORS_ONLN)
+# include <unistd.h>
+# define _GLIBCXX_NPROCS sysconf(_SC_NPROCESSORS_ONLN)
+#else
+# define _GLIBCXX_NPROCS 0
+#endif
+
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
namespace std _GLIBCXX_VISIBILITY(default)
@@ -98,6 +108,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
}
+ unsigned int
+ thread::hardware_concurrency() noexcept
+ {
+ int __n = _GLIBCXX_NPROCS;
+ if (__n < 0)
+ __n = 0;
+ return __n;
+ }
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
diff --git a/libstdc++-v3/testsuite/20_util/allocator_traits/members/allocate_hint.cc b/libstdc++-v3/testsuite/20_util/allocator_traits/members/allocate_hint.cc
new file mode 100644
index 00000000000..6a26adc9f9e
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/allocator_traits/members/allocate_hint.cc
@@ -0,0 +1,90 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// 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 <memory>
+#include <cstddef>
+#include <testsuite_hooks.h>
+
+struct X { };
+
+template<typename T>
+struct hintable_allocator
+{
+ typedef T value_type;
+ struct const_void_pointer { };
+ typedef unsigned size_type;
+
+ hintable_allocator() : called(false) { }
+
+ bool called;
+
+ // this is the overload that should get called:
+ T* allocate(size_type n, const_void_pointer) { called = true; return 0; }
+
+ // none of these should get called:
+ T* allocate(size_type n);
+ T* allocate(size_type n, void*);
+ T* allocate(size_type n, const void*);
+ T* allocate(size_type n, const_void_pointer) const;
+};
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::allocator_traits<hintable_allocator<X>> traits_type;
+ traits_type::allocator_type a;
+ traits_type::const_void_pointer v;
+ X* p = traits_type::allocate(a, 1, v);
+ VERIFY( a.called );
+}
+
+template<typename T>
+struct unhintable_allocator
+{
+ typedef T value_type;
+ typedef unsigned size_type;
+
+ unhintable_allocator() : called(false) { }
+
+ bool called;
+
+ // this is the overload that should get called:
+ T* allocate(size_type n) { called = true; return 0; }
+
+ // this should not get called:
+ T* allocate(size_type n, void*);
+};
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::allocator_traits<unhintable_allocator<X>> traits_type;
+ traits_type::allocator_type a;
+ traits_type::const_void_pointer v;
+ X* p = traits_type::allocate(a, 1, v);
+ VERIFY( a.called );
+}
+
+int main()
+{
+ test01();
+ test02();
+}
diff --git a/libstdc++-v3/testsuite/20_util/allocator_traits/members/construct.cc b/libstdc++-v3/testsuite/20_util/allocator_traits/members/construct.cc
new file mode 100644
index 00000000000..a133fb0d637
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/allocator_traits/members/construct.cc
@@ -0,0 +1,79 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// 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 <memory>
+#include <cstddef>
+#include <testsuite_hooks.h>
+
+struct X
+{
+ static int counter;
+ X() { }
+ X(const X&) { ++counter; }
+ explicit X(int) { ++counter; }
+ X(int, int) { ++counter; }
+ X(int, int, int) { ++counter; }
+};
+
+int X::counter = 0;
+
+template<typename T>
+struct fake_allocator
+{
+ typedef T value_type;
+
+ fake_allocator() : counter() {}
+
+ int counter;
+
+ T* allocate(std::size_t n) { return (T*)new char[n*sizeof(T)]; }
+ void deallocate(T* p, std::size_t) { delete[] (char*)p; }
+
+ // don't actually construct anything when these are called
+ void construct(T* p) { ++counter; }
+ void construct(T* p, int, int) { ++counter; }
+};
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::allocator_traits<fake_allocator<X>> traits_type;
+ traits_type::allocator_type a;
+ X* p = traits_type::allocate(a, 1);
+ traits_type::construct(a, p);
+ VERIFY( a.counter == 1 );
+ traits_type::construct(a, p, 1);
+ VERIFY( a.counter == 1 );
+ VERIFY( X::counter == 1 );
+ traits_type::destroy(a, p);
+ traits_type::construct(a, p, 1, 1);
+ VERIFY( a.counter == 2 );
+ VERIFY( X::counter == 1 );
+ traits_type::construct(a, p, 1, 1, 1);
+ VERIFY( a.counter == 2 );
+ VERIFY( X::counter == 2 );
+ traits_type::destroy(a, p);
+ traits_type::deallocate(a, p, 1);
+}
+
+int main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/20_util/allocator_traits/members/destroy.cc b/libstdc++-v3/testsuite/20_util/allocator_traits/members/destroy.cc
new file mode 100644
index 00000000000..a74efb215c8
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/allocator_traits/members/destroy.cc
@@ -0,0 +1,84 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// 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 <memory>
+#include <new>
+#include <testsuite_hooks.h>
+
+struct X
+{
+ static int counter;
+ ~X() { ++counter; }
+};
+
+int X::counter = 0;
+
+template<typename T>
+struct allocator_with_destroy
+{
+ typedef T value_type;
+
+ allocator_with_destroy() : called() { }
+
+ void destroy(T* p) { called = true; }
+
+ int called;
+};
+
+template<typename T>
+struct allocator_without_destroy
+{
+ typedef T value_type;
+
+ allocator_without_destroy() : called() { }
+
+ int called;
+};
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::allocator_traits<allocator_with_destroy<X>> traits_type;
+ traits_type::allocator_type a;
+ X* p = 0;
+ traits_type::destroy(a, p);
+ VERIFY( a.called );
+ VERIFY( X::counter == 0 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::allocator_traits<allocator_without_destroy<X>> traits_type;
+ traits_type::allocator_type a;
+ char buf[sizeof(X)];
+ X* p = ::new (static_cast<void*>(buf)) X();
+ traits_type::destroy(a, p);
+ VERIFY( !a.called );
+ VERIFY( X::counter == 1 );
+}
+
+int main()
+{
+ test01();
+ test02();
+}
diff --git a/libstdc++-v3/testsuite/20_util/allocator_traits/members/max_size.cc b/libstdc++-v3/testsuite/20_util/allocator_traits/members/max_size.cc
new file mode 100644
index 00000000000..61403ce7c6a
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/allocator_traits/members/max_size.cc
@@ -0,0 +1,67 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// 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 <memory>
+#include <limits>
+#include <type_traits>
+#include <testsuite_hooks.h>
+
+struct X { };
+
+template<typename T>
+struct maxsize_allocator
+{
+ typedef T value_type;
+ typedef unsigned size_type;
+
+ size_type max_size() const { return 100; }
+};
+
+template<typename T>
+struct unsized_allocator
+{
+ typedef T value_type;
+};
+
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::allocator_traits<maxsize_allocator<X>> traits_type;
+ traits_type::allocator_type a;
+ auto size = a.max_size();
+ VERIFY( traits_type::max_size(a) == size );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::allocator_traits<unsized_allocator<X>> traits_type;
+ traits_type::allocator_type a;
+ auto size = std::numeric_limits<traits_type::size_type>::max();
+ VERIFY( traits_type::max_size(a) == size );
+}
+
+int main()
+{
+ test01();
+ test02();
+}
diff --git a/libstdc++-v3/testsuite/20_util/allocator_traits/members/select.cc b/libstdc++-v3/testsuite/20_util/allocator_traits/members/select.cc
new file mode 100644
index 00000000000..eac924b05fd
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/allocator_traits/members/select.cc
@@ -0,0 +1,68 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// 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 <memory>
+#include <testsuite_hooks.h>
+
+struct X { };
+
+template<typename T>
+struct alloc1
+{
+ typedef T value_type;
+
+ int id;
+};
+
+template<typename T>
+struct alloc2
+{
+ typedef T value_type;
+
+ int id;
+
+ alloc2 select_on_container_copy_construction() const
+ { return alloc2{id+1}; }
+};
+
+
+void test01()
+{
+ typedef std::allocator_traits<alloc1<X>> traits_type;
+ traits_type::allocator_type a{1};
+ const traits_type::allocator_type& a2
+ = traits_type::select_on_container_copy_construction(a);
+ VERIFY( a2.id == a.id );
+}
+
+void test02()
+{
+ typedef std::allocator_traits<alloc1<X>> traits_type;
+ traits_type::allocator_type a{1};
+ const traits_type::allocator_type& a2
+ = traits_type::select_on_container_copy_construction(a);
+ VERIFY( a2.id != a.id );
+}
+
+int main()
+{
+ test01();
+ test02();
+}
diff --git a/libstdc++-v3/testsuite/20_util/allocator_traits/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/allocator_traits/requirements/explicit_instantiation.cc
new file mode 100644
index 00000000000..13d3135cb14
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/allocator_traits/requirements/explicit_instantiation.cc
@@ -0,0 +1,29 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// 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/>.
+
+// NB: This file is for testing memory with NO OTHER INCLUDES.
+
+#include <memory>
+
+namespace std
+{
+ typedef short test_type;
+ template struct allocator_traits<std::allocator<test_type>>;
+}
diff --git a/libstdc++-v3/testsuite/20_util/allocator_traits/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/allocator_traits/requirements/typedefs.cc
new file mode 100644
index 00000000000..346824ffc2b
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/allocator_traits/requirements/typedefs.cc
@@ -0,0 +1,52 @@
+// { dg-options "-std=gnu++0x" }
+//
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// 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/>.
+
+//
+// NB: This file is for testing memory with NO OTHER INCLUDES.
+
+#include <memory>
+
+// { dg-do compile }
+
+template<typename T>
+void test01()
+{
+ // Check for required typedefs
+ typedef std::allocator_traits<T> test_type;
+ typedef typename test_type::pointer pointer;
+ typedef typename test_type::const_pointer const_pointer;
+ typedef typename test_type::void_pointer void_pointer;
+ typedef typename test_type::const_void_pointer const_void_pointer;
+ typedef typename test_type::difference_type difference_type;
+ typedef typename test_type::size_type size_type;
+ typedef typename test_type::propagate_on_container_copy_assignment
+ propagate_on_container_copy_assignment;
+ typedef typename test_type::propagate_on_container_move_assignment
+ propagate_on_container_move_assignment;
+ typedef typename test_type::propagate_on_container_swap
+ propagate_on_container_swap;
+}
+
+struct S { };
+
+int main()
+{
+ test01<std::allocator<int>>();
+ test01<std::allocator<S>>();
+}
diff --git a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
index 3ca56e9c333..8fcdab40a58 100644
--- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
@@ -19,7 +19,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-error "static assertion failed" "" { target *-*-* } 1715 }
+// { dg-error "static assertion failed" "" { target *-*-* } 1725 }
#include <utility>
diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
index c92df36b348..77328d8a4c2 100644
--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
@@ -48,5 +48,5 @@ void test01()
// { dg-error "instantiated from here" "" { target *-*-* } 40 }
// { dg-error "instantiated from here" "" { target *-*-* } 42 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1501 }
-// { dg-error "declaration of" "" { target *-*-* } 1465 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1511 }
+// { dg-error "declaration of" "" { target *-*-* } 1475 }
diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
index 2bb62cba715..572953eef27 100644
--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
@@ -48,5 +48,5 @@ void test01()
// { dg-error "instantiated from here" "" { target *-*-* } 40 }
// { dg-error "instantiated from here" "" { target *-*-* } 42 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1425 }
-// { dg-error "declaration of" "" { target *-*-* } 1389 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1435 }
+// { dg-error "declaration of" "" { target *-*-* } 1399 }
diff --git a/libstdc++-v3/testsuite/20_util/pointer_traits/pointer_to.cc b/libstdc++-v3/testsuite/20_util/pointer_traits/pointer_to.cc
new file mode 100644
index 00000000000..f33582e540c
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/pointer_traits/pointer_to.cc
@@ -0,0 +1,52 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// 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 <memory>
+#include <testsuite_hooks.h>
+
+struct Ptr
+{
+ typedef bool element_type;
+ bool* value;
+
+ static Ptr pointer_to(bool& b) { return Ptr{&b}; }
+};
+
+void test01()
+{
+ bool test = true;
+ Ptr p{&test};
+
+ VERIFY( std::pointer_traits<Ptr>::pointer_to(test).value == &test );
+}
+
+void test02()
+{
+ bool test = true;
+
+ VERIFY( std::pointer_traits<bool*>::pointer_to(test) == &test );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/pointer_traits/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/pointer_traits/requirements/explicit_instantiation.cc
new file mode 100644
index 00000000000..38043d4eac6
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/pointer_traits/requirements/explicit_instantiation.cc
@@ -0,0 +1,31 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// 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/>.
+
+// NB: This file is for testing memory with NO OTHER INCLUDES.
+
+#include <memory>
+
+namespace std
+{
+ typedef short test_type;
+ template struct pointer_traits<test_type*>;
+ template struct pointer_traits<shared_ptr<test_type>>;
+ template struct pointer_traits<unique_ptr<test_type>>;
+}
diff --git a/libstdc++-v3/testsuite/20_util/pointer_traits/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/pointer_traits/requirements/typedefs.cc
new file mode 100644
index 00000000000..c682557a0e3
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/pointer_traits/requirements/typedefs.cc
@@ -0,0 +1,45 @@
+// { dg-options "-std=gnu++0x" }
+//
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// 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/>.
+
+//
+// NB: This file is for testing memory with NO OTHER INCLUDES.
+
+#include <memory>
+
+// { dg-do compile }
+
+template<typename Ptr>
+void test01()
+{
+ // Check for required typedefs
+ typedef std::pointer_traits<Ptr> test_type;
+ typedef typename test_type::pointer pointer;
+ typedef typename test_type::element_type element_type;
+ typedef typename test_type::difference_type difference_type;
+}
+
+int main()
+{
+ test01<int*>();
+ test01<void*>();
+ test01<std::shared_ptr<int>>();
+ test01<std::shared_ptr<void>>();
+ test01<std::unique_ptr<int>>();
+ test01<std::unique_ptr<void>>();
+}
diff --git a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc
index 14076a2d121..e6a71c3fe5d 100644
--- a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc
@@ -51,4 +51,4 @@ test04()
// { dg-error "instantiated from here" "" { target *-*-* } 46 }
// { dg-error "denominator cannot be zero" "" { target *-*-* } 268 }
// { dg-error "out of range" "" { target *-*-* } 269 }
-// { dg-error "overflow in constant expression" "" { target *-*-* } 99 }
+// { dg-error "overflow in constant expression" "" { target *-*-* } 109 }
diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/allocators.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/allocators.cc
new file mode 100644
index 00000000000..ae9dc8d7be2
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/tuple/cons/allocators.cc
@@ -0,0 +1,169 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// 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/>.
+
+// 20.4.2.1 [tuple.cnstr] Allocator-extended constructors
+
+#include <memory>
+#include <tuple>
+#include <testsuite_hooks.h>
+
+struct MyAlloc { };
+
+// type that can't be constructed with an allocator
+struct CannotUse
+{
+ CannotUse(int = 0, int = 0) : ok(true) { }
+
+ bool ok;
+};
+
+// type that can be constructed with an allocator
+// but which has uses_allocator == false
+struct DoesNotUse
+{
+ typedef MyAlloc allocator_type;
+
+ DoesNotUse(int = 0) : ok(true) { }
+ DoesNotUse(std::allocator_arg_t, MyAlloc, int = 0) : ok(false) { }
+ DoesNotUse(MyAlloc) : ok(false) { }
+ DoesNotUse(int, MyAlloc) : ok(false) { }
+
+ DoesNotUse(const DoesNotUse&) : ok(true) { }
+ DoesNotUse(std::allocator_arg_t, MyAlloc, const DoesNotUse&) : ok(false) { }
+ DoesNotUse(const DoesNotUse&, MyAlloc) : ok(false) { }
+
+ DoesNotUse(DoesNotUse&&) : ok(true) { }
+ DoesNotUse(std::allocator_arg_t, MyAlloc, DoesNotUse&&) : ok(false) { }
+ DoesNotUse(DoesNotUse&&, MyAlloc) : ok(false) { }
+
+ bool ok;
+};
+
+namespace std
+{
+ template<typename A>
+ struct uses_allocator<DoesNotUse, A> : false_type { };
+}
+
+// type that can be constructed with an allocator as second argument
+struct UsesWithTag
+{
+ typedef MyAlloc allocator_type;
+
+ UsesWithTag(int = 0) : ok(false) { }
+ UsesWithTag(std::allocator_arg_t, MyAlloc, int = 0) : ok(true) { }
+ UsesWithTag(MyAlloc) : ok(false) { }
+ UsesWithTag(int, MyAlloc) : ok(false) { }
+
+ UsesWithTag(const UsesWithTag&) : ok(false) { }
+ UsesWithTag(std::allocator_arg_t, MyAlloc, const UsesWithTag&) : ok(true) { }
+ UsesWithTag(const UsesWithTag&, MyAlloc) : ok(false) { }
+
+ UsesWithTag(UsesWithTag&&) : ok(false) { }
+ UsesWithTag(std::allocator_arg_t, MyAlloc, UsesWithTag&&) : ok(true) { }
+ UsesWithTag(UsesWithTag&&, MyAlloc) : ok(false) { }
+
+ bool ok;
+};
+
+// type that can be constructed with an allocator as last argument
+struct UsesWithoutTag
+{
+ typedef MyAlloc allocator_type;
+
+ UsesWithoutTag(int = 0) : ok(false) { }
+ UsesWithoutTag(MyAlloc) : ok(true) { }
+ UsesWithoutTag(int, MyAlloc) : ok(true) { }
+
+ UsesWithoutTag(const UsesWithoutTag&) : ok(false) { }
+ UsesWithoutTag(const UsesWithoutTag&, MyAlloc) : ok(true) { }
+
+ UsesWithoutTag(UsesWithoutTag&&) : ok(false) { }
+ UsesWithoutTag(UsesWithoutTag&&, MyAlloc) : ok(true) { }
+
+ bool ok;
+};
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using std::allocator_arg;
+ using std::tuple;
+ using std::make_tuple;
+ using std::get;
+
+ typedef CannotUse T1;
+ typedef DoesNotUse T2;
+ typedef UsesWithTag T3;
+ typedef UsesWithoutTag T4;
+ typedef tuple<T1, T2, T3, T4> test_type;
+
+ MyAlloc a;
+
+ // default construction
+ test_type t1(allocator_arg, a);
+ VERIFY( get<0>(t1).ok );
+ VERIFY( get<1>(t1).ok );
+ VERIFY( get<2>(t1).ok );
+ VERIFY( get<3>(t1).ok );
+
+ // copy construction
+ test_type t2(allocator_arg, a, t1);
+ VERIFY( get<0>(t2).ok );
+ VERIFY( get<1>(t2).ok );
+ VERIFY( get<2>(t2).ok );
+ VERIFY( get<3>(t2).ok );
+
+ // move construction
+ test_type t3(allocator_arg, a, std::move(t1));
+ VERIFY( get<0>(t3).ok );
+ VERIFY( get<1>(t3).ok );
+ VERIFY( get<2>(t3).ok );
+ VERIFY( get<3>(t3).ok );
+
+ // construction from int
+ test_type t4(allocator_arg, a, 1, 2, 3, 4);
+ VERIFY( get<0>(t4).ok );
+ VERIFY( get<1>(t4).ok );
+ VERIFY( get<2>(t4).ok );
+ VERIFY( get<3>(t4).ok );
+
+ auto ints = make_tuple(1, 2, 3, 4);
+
+ // construction from lvalue tuple of ints
+ test_type t5(allocator_arg, a, ints);
+ VERIFY( get<0>(t5).ok );
+ VERIFY( get<1>(t5).ok );
+ VERIFY( get<2>(t5).ok );
+ VERIFY( get<3>(t2).ok );
+
+ // construction from rvalue tuple of ints
+ test_type t6(allocator_arg, a, std::move(ints));
+ VERIFY( get<0>(t6).ok );
+ VERIFY( get<1>(t6).ok );
+ VERIFY( get<2>(t6).ok );
+ VERIFY( get<3>(t6).ok );
+
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/tuple/moveable2.cc b/libstdc++-v3/testsuite/20_util/tuple/moveable2.cc
index f0800742118..5ed8de56a69 100644
--- a/libstdc++-v3/testsuite/20_util/tuple/moveable2.cc
+++ b/libstdc++-v3/testsuite/20_util/tuple/moveable2.cc
@@ -1,6 +1,6 @@
// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2008, 2009 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
@@ -17,7 +17,6 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
#include <tuple>
#include <utility>
@@ -30,9 +29,8 @@ struct MoveOnly
MoveOnly& operator=(MoveOnly&&)
{ return *this; }
-private:
- MoveOnly(MoveOnly const&); // = delete
- MoveOnly& operator=(MoveOnly const&); // = delete
+ MoveOnly(MoveOnly const&) = delete;
+ MoveOnly& operator=(MoveOnly const&) = delete;
};
MoveOnly
diff --git a/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc b/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
new file mode 100644
index 00000000000..b6b706c67eb
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
@@ -0,0 +1,48 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// 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/>.
+
+// 20.4.2.1 [tuple.cnstr] Allocator-extended constructors
+
+#include <memory>
+#include <tuple>
+
+struct MyAlloc { };
+
+struct Type
+{
+ typedef MyAlloc allocator_type; // uses_allocator<Type, MyAlloc> is true
+
+ explicit Type(int) { }
+
+ Type(std::allocator_arg_t, MyAlloc) { }
+ Type(MyAlloc) { }
+};
+
+void test01()
+{
+ using std::allocator_arg;
+ using std::tuple;
+
+ MyAlloc a;
+
+ tuple<Type> t(allocator_arg, a, 1);
+}
+// { dg-error "no matching function" "" { target *-*-* } 112 }
+// { dg-excess-errors "note" }
diff --git a/libstdc++-v3/testsuite/20_util/uses_allocator/construction.cc b/libstdc++-v3/testsuite/20_util/uses_allocator/construction.cc
new file mode 100644
index 00000000000..94fca79c252
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/uses_allocator/construction.cc
@@ -0,0 +1,108 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// 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/>.
+
+// 20.6.7.2 uses-allocator construction
+
+#include <memory>
+#include <tuple>
+#include <testsuite_hooks.h>
+
+struct MyAlloc { };
+
+// type that can't be constructed with an allocator
+struct CannotUse
+{
+ CannotUse(int) : ok(true) { }
+
+ bool ok;
+};
+
+// type that can be constructed with an allocator
+// but which has uses_allocator == false
+struct DoesNotUse
+{
+ typedef MyAlloc allocator_type;
+
+ DoesNotUse(int) : ok(true) { }
+ DoesNotUse(std::allocator_arg_t, MyAlloc, int) : ok(false) { }
+ DoesNotUse(int, MyAlloc) : ok(false) { }
+
+ bool ok;
+};
+
+namespace std
+{
+ template<typename A>
+ struct uses_allocator<DoesNotUse, A> : false_type { };
+}
+
+// type that can be constructed with an allocator as second argument
+struct UsesWithTag
+{
+ typedef MyAlloc allocator_type;
+
+ UsesWithTag(int) : ok(false) { }
+ UsesWithTag(std::allocator_arg_t, MyAlloc, int) : ok(true) { }
+ UsesWithTag(int, MyAlloc) : ok(false) { }
+
+ bool ok;
+};
+
+// type that can be constructed with an allocator as last argument
+struct UsesWithoutTag
+{
+ typedef MyAlloc allocator_type;
+
+ UsesWithoutTag(int) : ok(false) { }
+ UsesWithoutTag(int, MyAlloc) : ok(true) { }
+
+ bool ok;
+};
+
+
+template<typename TestType, typename... T>
+ bool test2(T... args)
+ {
+ using std::allocator_arg;
+ using std::tuple;
+ using std::get;
+
+ tuple<TestType, T...> t(allocator_arg, MyAlloc(), 1, args...);
+
+ return get<0>(t).ok;
+ }
+
+template<typename... T>
+ void test(T... args)
+ {
+ bool test __attribute__((unused)) = true;
+
+ VERIFY( test2<CannotUse>(args...) );
+ VERIFY( test2<DoesNotUse>(args...) );
+ VERIFY( test2<UsesWithTag>(args...) );
+ VERIFY( test2<UsesWithoutTag>(args...) );
+ }
+
+int main()
+{
+ test();
+ test(1);
+ test(1, 2);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
index 9db39d2b445..ace80cf79c0 100644
--- a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
@@ -51,9 +51,9 @@ main()
// { dg-warning "note" "" { target *-*-* } 485 }
// { dg-warning "note" "" { target *-*-* } 479 }
// { dg-warning "note" "" { target *-*-* } 469 }
-// { dg-warning "note" "" { target *-*-* } 633 }
+// { dg-warning "note" "" { target *-*-* } 887 }
// { dg-warning "note" "" { target *-*-* } 1056 }
// { dg-warning "note" "" { target *-*-* } 1050 }
// { dg-warning "note" "" { target *-*-* } 342 }
// { dg-warning "note" "" { target *-*-* } 292 }
-// { dg-warning "note" "" { target *-*-* } 214 }
+// { dg-warning "note" "" { target *-*-* } 224 }
diff --git a/libstdc++-v3/testsuite/30_threads/async/any.cc b/libstdc++-v3/testsuite/30_threads/async/any.cc
index 40c103f9601..fe4deeb52b9 100644
--- a/libstdc++-v3/testsuite/30_threads/async/any.cc
+++ b/libstdc++-v3/testsuite/30_threads/async/any.cc
@@ -6,7 +6,7 @@
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// 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
@@ -41,7 +41,7 @@ void test01()
int a = 1;
int b = 10;
int c = 100;
- future<int> f1 = async(launch::any, sum(), a, ref(b), cref(c));
+ future<int> f1 = async(launch::async|launch::deferred, sum(), a, ref(b), cref(c));
future<int> f2 = async(sum(), a, ref(b), cref(c));
VERIFY( f1.valid() );
diff --git a/libstdc++-v3/testsuite/30_threads/async/launch.cc b/libstdc++-v3/testsuite/30_threads/async/launch.cc
new file mode 100644
index 00000000000..78fa2f70d76
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/async/launch.cc
@@ -0,0 +1,94 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// 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 <future>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ using std::launch;
+
+ const launch none{};
+ const launch both = launch::async|launch::deferred;
+ const launch all = ~none;
+
+ VERIFY( (none & both) == none );
+ VERIFY( (none | both) == both );
+ VERIFY( (none ^ both) == both );
+
+ VERIFY( (none & all) == none );
+ VERIFY( (none | all) == all );
+ VERIFY( (none ^ all) == all );
+
+ VERIFY( (both & all) == both );
+ VERIFY( (both | all) == all );
+ VERIFY( (both ^ all) == ~both );
+
+ VERIFY( (none & launch::async) == none );
+ VERIFY( (none & launch::deferred) == none );
+
+ VERIFY( (none | launch::async) == launch::async );
+ VERIFY( (none | launch::deferred) == launch::deferred );
+
+ VERIFY( (none ^ launch::async) == launch::async );
+ VERIFY( (none ^ launch::deferred) == launch::deferred );
+
+ VERIFY( (none & none) == none );
+ VERIFY( (none | none) == none );
+ VERIFY( (none ^ none) == none );
+
+ VERIFY( (both & both) == both );
+ VERIFY( (both | both) == both );
+ VERIFY( (both ^ both) == none );
+
+ VERIFY( (all & all) == all );
+ VERIFY( (all | all) == all );
+ VERIFY( (all ^ all) == none );
+
+ launch l = none;
+
+ l &= none;
+ VERIFY( l == none );
+ l |= none;
+ VERIFY( l == none );
+ l ^= none;
+ VERIFY( l == none );
+
+ l &= both;
+ VERIFY( l == none );
+ l |= both;
+ VERIFY( l == both );
+ l ^= both;
+ VERIFY( l == none );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/async/sync.cc b/libstdc++-v3/testsuite/30_threads/async/sync.cc
index f1d13773773..1daf01238a2 100644
--- a/libstdc++-v3/testsuite/30_threads/async/sync.cc
+++ b/libstdc++-v3/testsuite/30_threads/async/sync.cc
@@ -6,7 +6,7 @@
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// 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
@@ -41,7 +41,7 @@ void test01()
int a = 1;
int b = 10;
int c = 100;
- future<int> f1 = async(launch::sync, sum(), a, ref(b), cref(c));
+ future<int> f1 = async(launch::deferred, sum(), a, ref(b), cref(c));
VERIFY( f1.valid() );
VERIFY( f1.get() == 111 );
diff --git a/libstdc++-v3/testsuite/30_threads/thread/members/hardware_concurrency.cc b/libstdc++-v3/testsuite/30_threads/thread/members/hardware_concurrency.cc
index c2917ca6f1c..51d024dacdb 100644
--- a/libstdc++-v3/testsuite/30_threads/thread/members/hardware_concurrency.cc
+++ b/libstdc++-v3/testsuite/30_threads/thread/members/hardware_concurrency.cc
@@ -4,8 +4,9 @@
// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
// { dg-require-cstdint "" }
// { dg-require-gthreads "" }
+// { dg-require-nprocs "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 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
@@ -29,8 +30,7 @@ int main()
{
bool test __attribute__((unused)) = true;
- // Current implementation punts on this.
- VERIFY( std::thread::hardware_concurrency() == 0 );
+ VERIFY( std::thread::hardware_concurrency() >= 1 );
return 0;
}
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand_debug.cc
index e41e073b1ec..65d9c11ac52 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand_debug.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand_debug.cc
@@ -1,7 +1,7 @@
+// { dg-require-debug-mode "" }
// { dg-require-time "" }
// This can take long on simulators, timing out the test.
-// { dg-options "-D_GLIBCXX_DEBUG -DITERATIONS=5" { target simulator } }
-// { dg-options "-D_GLIBCXX_DEBUG" }
+// { dg-options "-DITERATIONS=5" { target simulator } }
// { dg-timeout-factor 2.0 }
// -*- C++ -*-
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand_debug.cc
index 8729f4142f8..bc5a596b4ff 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand_debug.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand_debug.cc
@@ -1,7 +1,7 @@
+// { dg-require-debug-mode "" }
// { dg-require-time "" }
// This can take long on simulators, timing out the test.
-// { dg-options "-D_GLIBCXX_DEBUG -DITERATIONS=5" { target simulator } }
-// { dg-options "-D_GLIBCXX_DEBUG" }
+// { dg-options "-DITERATIONS=5" { target simulator } }
// { dg-timeout-factor 2.0 }
// -*- C++ -*-
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand_debug.cc
index bfb2ed4484e..3a9fc3c631f 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand_debug.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand_debug.cc
@@ -1,5 +1,5 @@
+// { dg-require-debug-mode "" }
// { dg-require-time "" }
-// { dg-options "-D_GLIBCXX_DEBUG" }
// { dg-timeout-factor 2.0 }
// -*- C++ -*-
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand_debug.cc
index c39eb0df311..065ca9de357 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand_debug.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand_debug.cc
@@ -1,5 +1,5 @@
+// { dg-require-debug-mode "" }
// { dg-require-time "" }
-// { dg-options "-D_GLIBCXX_DEBUG" }
// { dg-timeout-factor 2.0 }
// -*- C++ -*-
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand_debug.cc
index dda99151716..1d6dcf1bdb4 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand_debug.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand_debug.cc
@@ -1,7 +1,7 @@
+// { dg-require-debug-mode "" }
// { dg-require-time "" }
// This can take long on simulators, timing out the test.
-// { dg-options "-D_GLIBCXX_DEBUG -DITERATIONS=5" { target simulator } }
-// { dg-options "-D_GLIBCXX_DEBUG" }
+// { dg-options "-DITERATIONS=5" { target simulator } }
// { dg-timeout-factor 2.0 }
// -*- C++ -*-
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand_debug.cc
index 934d96d0bc7..75b31f037be 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand_debug.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand_debug.cc
@@ -1,7 +1,7 @@
+// { dg-require-debug-mode "" }
// { dg-require-time "" }
// This can take long on simulators, timing out the test.
-// { dg-options "-D_GLIBCXX_DEBUG -DITERATIONS=5" { target simulator } }
-// { dg-options "-D_GLIBCXX_DEBUG" }
+// { dg-options "-DITERATIONS=5" { target simulator } }
// { dg-timeout-factor 2.0 }
// -*- C++ -*-
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc
index 146fc1f1ce8..1e85d016121 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc
@@ -1,7 +1,7 @@
+// { dg-require-debug-mode "" }
// { dg-require-time "" }
// This can take long on simulators, timing out the test.
-// { dg-options "-D_GLIBCXX_DEBUG -DITERATIONS=5" { target simulator } }
-// { dg-options "-D_GLIBCXX_DEBUG" }
+// { dg-options "-DITERATIONS=5" { target simulator } }
// { dg-timeout-factor 2.0 }
// -*- C++ -*-
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand_debug.cc
index 5d7ada8c9de..701e7d8e095 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand_debug.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand_debug.cc
@@ -1,7 +1,7 @@
+// { dg-require-debug-mode "" }
// { dg-require-time "" }
// This can take long on simulators, timing out the test.
-// { dg-options "-D_GLIBCXX_DEBUG -DITERATIONS=5" { target simulator } }
-// { dg-options "-D_GLIBCXX_DEBUG" }
+// { dg-options "-DITERATIONS=5" { target simulator } }
// { dg-timeout-factor 2.0 }
// -*- C++ -*-
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand_debug.cc
index b075e5b5d8f..19a201da443 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand_debug.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand_debug.cc
@@ -1,7 +1,7 @@
+// { dg-require-debug-mode "" }
// { dg-require-time "" }
// This can take long on simulators, timing out the test.
-// { dg-options "-D_GLIBCXX_DEBUG -DITERATIONS=5" { target simulator } }
-// { dg-options "-D_GLIBCXX_DEBUG" }
+// { dg-options "-DITERATIONS=5" { target simulator } }
// { dg-timeout-factor 2.0 }
// -*- C++ -*-
diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp
index 43695f01b1c..46d3ce9e71a 100644
--- a/libstdc++-v3/testsuite/lib/dg-options.exp
+++ b/libstdc++-v3/testsuite/lib/dg-options.exp
@@ -179,6 +179,15 @@ proc dg-require-binary-io { args } {
return
}
+proc dg-require-nprocs { args } {
+ if { ![ check_v3_target_nprocs ] } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ return
+ }
+ return
+}
+
proc add_options_for_no_pch { flags } {
# This forces any generated and possibly included PCH to be invalid.
return "-D__GLIBCXX__=99999999"
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 151c9422f0c..d39e8ea182c 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -1579,4 +1579,67 @@ proc check_v3_target_binary_io { } {
return $et_binary_io
}
+proc check_v3_target_nprocs { } {
+ global cxxflags
+ global DEFAULT_CXXFLAGS
+ global et_nprocs
+
+ global tool
+
+ if { ![info exists et_nprocs_target_name] } {
+ set et_nprocs_target_name ""
+ }
+
+ # If the target has changed since we set the cached value, clear it.
+ set current_target [current_target_name]
+ if { $current_target != $et_nprocs_target_name } {
+ verbose "check_v3_target_nprocs: `$et_nprocs_target_name'" 2
+ set et_nprocs_target_name $current_target
+ if [info exists et_nprocs] {
+ verbose "check_v3_target_nprocs: removing cached result" 2
+ unset et_nprocs
+ }
+ }
+
+ if [info exists et_nprocs] {
+ verbose "check_v3_target_nprocs: using cached result" 2
+ } else {
+ set et_nprocs 0
+
+ # Set up and preprocess a C++0x test program that depends
+ # on either get_nprocs or sysconf to be available.
+ set src nprocs[pid].cc
+
+ set f [open $src "w"]
+ puts $f "#include <bits/c++config.h>"
+ puts $f "#if defined(_GLIBCXX_USE_GET_NPROCS)"
+ puts $f "#elif defined(_GLIBCXX_USE_SYSCONF)"
+ puts $f "# include <unistd.h>"
+ puts $f "# if !defined(_SC_NPROCESSORS_ONLN)"
+ puts $f "# error No sysconf option"
+ puts $f "# endif"
+ puts $f "#else"
+ puts $f "# error No get_nprocs or sysconf"
+ puts $f "#endif"
+ close $f
+
+ set cxxflags_saved $cxxflags
+ set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+
+ set lines [v3_target_compile $src /dev/null preprocess ""]
+ set cxxflags $cxxflags_saved
+ file delete $src
+
+ if [string match "" $lines] {
+ # No error message, preprocess succeeded.
+ set et_nprocs 1
+ } else {
+ verbose "check_v3_target_nprocs: compilation failed" 2
+ }
+ }
+ verbose "check_v3_target_nprocs: $et_nprocs" 2
+ return $et_nprocs
+}
+
+
set additional_prunes ""
diff --git a/libstdc++-v3/testsuite/util/testsuite_abi.cc b/libstdc++-v3/testsuite/util/testsuite_abi.cc
index ea100b6817f..f1f5ad66347 100644
--- a/libstdc++-v3/testsuite/util/testsuite_abi.cc
+++ b/libstdc++-v3/testsuite/util/testsuite_abi.cc
@@ -194,6 +194,7 @@ check_version(symbol& test, bool added)
known_versions.push_back("GLIBCXX_3.4.14");
known_versions.push_back("GLIBCXX_3.4.15");
known_versions.push_back("GLIBCXX_3.4.16");
+ known_versions.push_back("GLIBCXX_3.4.17");
known_versions.push_back("GLIBCXX_LDBL_3.4");
known_versions.push_back("GLIBCXX_LDBL_3.4.7");
known_versions.push_back("GLIBCXX_LDBL_3.4.10");