[PATCH] D21637: [libcxx] Don't use pthread initializers in constexpr constructors
Julien Ramseier via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 30 00:57:04 PDT 2016
elram updated this revision to Diff 62339.
http://reviews.llvm.org/D21637
Files:
include/__mutex_base
Index: include/__mutex_base
===================================================================
--- include/__mutex_base
+++ include/__mutex_base
@@ -34,16 +34,20 @@
class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex
{
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+ __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;
+#else
__libcpp_mutex_t __m_;
+#endif
public:
_LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
- constexpr mutex() _NOEXCEPT : __m_(_LIBCPP_MUTEX_INITIALIZER) {}
+ constexpr mutex() _NOEXCEPT _LIBCPP_DEFAULT
#else
mutex() _NOEXCEPT {__m_ = (__libcpp_mutex_t)_LIBCPP_MUTEX_INITIALIZER;}
#endif
- ~mutex();
+ ~mutex();
private:
mutex(const mutex&);// = delete;
@@ -287,13 +291,18 @@
class _LIBCPP_TYPE_VIS condition_variable
{
- __libcpp_condvar_t __cv_;
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+ __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER;
+#else
+ __libcpp_condvar_t __cv_;
+#endif
+
public:
_LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
- constexpr condition_variable() : __cv_(_LIBCPP_CONDVAR_INITIALIZER) {}
+ constexpr condition_variable() _NOEXCEPT _LIBCPP_DEFAULT
#else
- condition_variable() {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;}
+ condition_variable() _NOEXCEPT {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;}
#endif
~condition_variable();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21637.62339.patch
Type: text/x-patch
Size: 1438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160630/626dce1b/attachment-0001.bin>
More information about the cfe-commits
mailing list