summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-18 05:26:28 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-18 05:26:28 +0000
commitf1cd63ec5edabe50519f93140a554f53b92d3e0a (patch)
tree991b2524d0f174578979bf67e18962015ea4b711 /libstdc++-v3
parent2f2639928aeeee7b4f0bdffc81807e900d6ddcd7 (diff)
downloadgcc-f1cd63ec5edabe50519f93140a554f53b92d3e0a.tar.gz
2012-06-18 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 188721 using svnmerge git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@188723 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog27
-rw-r--r--libstdc++-v3/doc/xml/manual/status_cxx2011.xml11
-rw-r--r--libstdc++-v3/include/ext/concurrence.h25
-rw-r--r--libstdc++-v3/include/ext/rope11
-rw-r--r--libstdc++-v3/include/std/mutex4
-rw-r--r--libstdc++-v3/include/std/tuple13
-rw-r--r--libstdc++-v3/testsuite/20_util/tuple/53648.cc44
-rw-r--r--libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc2
8 files changed, 125 insertions, 12 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 83ed8b21d2f..0aeb6c06223 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,30 @@
+2012-06-15 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ PR libstdc++/53578
+ * include/ext/concurrence.h (__recursive_mutex::_S_destroy): Fix
+ narrowing conversion.
+ * include/std/mutex (__recursive_mutex_base::_S_destroy): Likewise.
+
+2012-06-14 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ PR libstdc++/53270
+ * include/ext/concurrence.h (__mutex, __recursive_mutex, __cond): Use
+ NSDMI in C++11 mode.
+ * include/ext/rope (_Refcount_Base): Likewise. Destroy mutex in
+ destructor when initialized by function.
+
+2012-06-14 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ PR libstdc++/53648
+ * include/std/tuple (__empty_not_final): Do not use EBO for tuples.
+ * testsuite/20_util/tuple/53648.cc: New.
+ * testsuite/20_util/uses_allocator/cons_neg.cc: Adjust dg-error line
+ number.
+
+2012-06-14 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * doc/xml/manual/status_cxx2011.xml: Correct C++11 status table.
+
2012-06-01 Jonathan Wakely <jwakely.gcc@gmail.com>
* doc/xml/manual/status_cxx2011.xml: Correct C++11 status table.
diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
index 15d1337b0cd..adef5aebc72 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
@@ -1037,7 +1037,7 @@ particular release.
<entry>20.12.4</entry>
<entry>Scoped allocator adaptor members</entry>
<entry>Partial</entry>
- <entry/>
+ <entry>Missing std::pair piecewise construction.</entry>
</row>
<row>
<entry>20.12.5</entry>
@@ -1231,10 +1231,12 @@ particular release.
<entry/>
</row>
<row>
+ <?dbhtml bgcolor="#B0B0B0" ?>
<entry>22.4.1</entry>
<entry>The <code>ctype</code> category</entry>
- <entry>Y</entry>
- <entry/>
+ <entry>Partial</entry>
+ <entry>Missing <code>codecvt&lt;char16_t></code> and
+ <code>codecvt&lt;char32_t></code></entry>
</row>
<row>
<entry>22.4.2</entry>
@@ -2314,10 +2316,9 @@ particular release.
<entry/>
</row>
<row>
- <?dbhtml bgcolor="#C8B0B0" ?>
<entry>29.8</entry>
<entry>Fences</entry>
- <entry>N</entry>
+ <entry>Y</entry>
<entry/>
</row>
<row>
diff --git a/libstdc++-v3/include/ext/concurrence.h b/libstdc++-v3/include/ext/concurrence.h
index fc8f63f827e..25e218b1108 100644
--- a/libstdc++-v3/include/ext/concurrence.h
+++ b/libstdc++-v3/include/ext/concurrence.h
@@ -143,7 +143,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class __mutex
{
private:
+#if __GTHREADS && defined __GTHREAD_MUTEX_INIT \
+ && defined __GXX_EXPERIMENTAL_CXX0X__
+ __gthread_mutex_t _M_mutex = __GTHREAD_MUTEX_INIT;
+#else
__gthread_mutex_t _M_mutex;
+#endif
__mutex(const __mutex&);
__mutex& operator=(const __mutex&);
@@ -155,8 +160,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__gthread_active_p())
{
#if defined __GTHREAD_MUTEX_INIT
+# ifndef __GXX_EXPERIMENTAL_CXX0X__
__gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
_M_mutex = __tmp;
+# endif
#else
__GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
#endif
@@ -201,7 +208,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class __recursive_mutex
{
private:
+#if __GTHREADS && defined __GTHREAD_RECURSIVE_MUTEX_INIT \
+ && defined __GXX_EXPERIMENTAL_CXX0X__
+ __gthread_recursive_mutex_t _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT;
+#else
__gthread_recursive_mutex_t _M_mutex;
+#endif
__recursive_mutex(const __recursive_mutex&);
__recursive_mutex& operator=(const __recursive_mutex&);
@@ -213,8 +225,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__gthread_active_p())
{
#if defined __GTHREAD_RECURSIVE_MUTEX_INIT
+# ifndef __GXX_EXPERIMENTAL_CXX0X__
__gthread_recursive_mutex_t __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
_M_mutex = __tmp;
+# endif
#else
__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
#endif
@@ -270,7 +284,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// matches a gthr-win32.h recursive mutex
template<typename _Rm>
- static typename __enable_if<sizeof(&_Rm::sema), void>::__type
+ static typename __enable_if<(bool)sizeof(&_Rm::sema), void>::__type
_S_destroy(_Rm* __mx)
{
__gthread_mutex_t __tmp;
@@ -279,7 +293,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// matches a recursive mutex with a member 'actual'
template<typename _Rm>
- static typename __enable_if<sizeof(&_Rm::actual), void>::__type
+ static typename __enable_if<(bool)sizeof(&_Rm::actual), void>::__type
_S_destroy(_Rm* __mx)
{ __gthread_mutex_destroy(&__mx->actual); }
@@ -319,7 +333,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class __cond
{
private:
+#if __GTHREADS && defined __GTHREAD_COND_INIT \
+ && defined __GXX_EXPERIMENTAL_CXX0X__
+ __gthread_cond_t _M_cond = __GTHREAD_COND_INIT;
+#else
__gthread_cond_t _M_cond;
+#endif
__cond(const __cond&);
__cond& operator=(const __cond&);
@@ -331,8 +350,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__gthread_active_p())
{
#if defined __GTHREAD_COND_INIT
+# ifndef __GXX_EXPERIMENTAL_CXX0X__
__gthread_cond_t __tmp = __GTHREAD_COND_INIT;
_M_cond = __tmp;
+# endif
#else
__GTHREAD_COND_INIT_FUNCTION(&_M_cond);
#endif
diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope
index 5e82811757c..15cb423df68 100644
--- a/libstdc++-v3/include/ext/rope
+++ b/libstdc++-v3/include/ext/rope
@@ -458,13 +458,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
volatile _RC_t _M_ref_count;
// Constructor
+#if defined __GTHREAD_MUTEX_INIT && defined __GXX_EXPERIMENTAL_CXX0X__
+ __gthread_mutex_t _M_ref_count_lock = __GTHREAD_MUTEX_INIT;
+#else
__gthread_mutex_t _M_ref_count_lock;
+#endif
_Refcount_Base(_RC_t __n) : _M_ref_count(__n), _M_ref_count_lock()
{
#ifdef __GTHREAD_MUTEX_INIT
+# ifndef __GXX_EXPERIMENTAL_CXX0X__
__gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
_M_ref_count_lock = __tmp;
+# endif
#elif defined(__GTHREAD_MUTEX_INIT_FUNCTION)
__GTHREAD_MUTEX_INIT_FUNCTION (&_M_ref_count_lock);
#else
@@ -472,6 +478,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
}
+#ifndef __GTHREAD_MUTEX_INIT
+ ~_Refcount_Base()
+ { __gthread_mutex_destroy(&_M_ref_count_lock); }
+#endif
+
void
_M_incr()
{
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index a7ebace2c88..34d64c5b65f 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -116,13 +116,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// matches a recursive mutex with a member 'actual'
template<typename _Rm>
- static typename enable_if<sizeof(&_Rm::actual), void>::type
+ static typename enable_if<(bool)sizeof(&_Rm::actual), void>::type
_S_destroy(_Rm* __mx)
{ __gthread_mutex_destroy(&__mx->actual); }
// matches a gthr-win32.h recursive mutex
template<typename _Rm>
- static typename enable_if<sizeof(&_Rm::sema), void>::type
+ static typename enable_if<(bool)sizeof(&_Rm::sema), void>::type
_S_destroy(_Rm* __mx)
{
__gthread_mutex_t __tmp;
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 4d4691f104f..fb9e09fffe8 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -1,6 +1,7 @@
// <tuple> -*- C++ -*-
-// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
+// 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
@@ -201,10 +202,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void _M_swap(_Tuple_impl&) noexcept { /* no-op */ }
};
+ template<typename _Tp>
+ struct __is_empty_non_tuple : is_empty<_Tp> { };
+
+ // Using EBO for elements that are tuples causes ambiguous base errors.
+ template<typename _El0, typename... _El>
+ struct __is_empty_non_tuple<tuple<_El0, _El...>> : false_type { };
+
// Use the Empty Base-class Optimization for empty, non-final types.
template<typename _Tp>
using __empty_not_final
- = typename conditional<__is_final(_Tp), false_type, is_empty<_Tp>>::type;
+ = typename conditional<__is_final(_Tp), false_type,
+ __is_empty_non_tuple<_Tp>>::type;
/**
* Recursive tuple implementation. Here we store the @c Head element
diff --git a/libstdc++-v3/testsuite/20_util/tuple/53648.cc b/libstdc++-v3/testsuite/20_util/tuple/53648.cc
new file mode 100644
index 00000000000..5671e444349
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/tuple/53648.cc
@@ -0,0 +1,44 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2012 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/>.
+
+// libstdc++/53648
+
+#include <tuple>
+#include <type_traits>
+
+using std::tuple;
+
+struct A { };
+
+template class tuple<tuple<>>;
+template class tuple<tuple<tuple<>>>;
+template class tuple<A, tuple<A, tuple<A, tuple<A>>>>;
+template class tuple<tuple<tuple<A, A>, A>, A>;
+
+// Verify the following QoI properties are preserved
+
+static_assert( std::is_empty<tuple<>>::value, "tuple<> is empty" );
+
+static_assert( std::is_empty<tuple<tuple<>>>::value,
+ "tuple<tuple<>> is empty" );
+
+static_assert( sizeof(tuple<char, tuple<>>) == sizeof(char),
+ "tuple<> is eligible for EBO" );
+
diff --git a/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc b/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
index 73a0d0f7029..d81dd35d096 100644
--- a/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
@@ -44,4 +44,4 @@ void test01()
tuple<Type> t(allocator_arg, a, 1);
}
-// { dg-error "no matching function" "" { target *-*-* } 112 }
+// { dg-error "no matching function" "" { target *-*-* } 113 }