summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/clang/clang/0001-libcxx-use-constexpr-when-using-glibc.patch
blob: c295276ea97328f07b94cbc9c0ffbda0a57305e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
From e57d8fcd1d70c4be85f8f07722d1c1d61fe51d2a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 19 May 2016 23:22:52 -0700
Subject: [PATCH] libcxx: use constexpr when using glibc

POSIX does not permit using PTHREAD_COND_INITIALIZER except for static
initialization, and certainly does not permit using it as a value

also POSIX does not specify the type of the object (it's opaque) so if
there are any types for which their code would be invalid C++, then their
code is invalid

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 include/__mutex_base | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/__mutex_base b/include/__mutex_base
index 3b2453f1b..08f35434f 100644
--- a/include/__mutex_base
+++ b/include/__mutex_base
@@ -48,7 +48,10 @@ class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mut
 public:
     _LIBCPP_INLINE_VISIBILITY
 #ifndef _LIBCPP_CXX03_LANG
-    constexpr mutex() = default;
+#ifdef __GLIBC__
+    constexpr
+#endif
+    mutex() = default;
 #else
     mutex() _NOEXCEPT {__m_ = (__libcpp_mutex_t)_LIBCPP_MUTEX_INITIALIZER;}
 #endif
@@ -296,7 +299,10 @@ class _LIBCPP_TYPE_VIS condition_variable
 public:
     _LIBCPP_INLINE_VISIBILITY
 #ifndef _LIBCPP_CXX03_LANG
-    constexpr condition_variable() _NOEXCEPT = default;
+#ifdef __GLIBC__
+    constexpr
+#endif
+    condition_variable() _NOEXCEPT = default;
 #else
     condition_variable() _NOEXCEPT {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;}
 #endif
-- 
2.13.1