summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/clang/files/0001-use-constexpr-when-using-glibc.patch
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2016-03-15 05:02:20 +0000
committerKhem Raj <raj.khem@gmail.com>2016-03-15 05:02:20 +0000
commitefd9112095b216b5fd20523147650b0f4147e62f (patch)
tree7a5fa47d5a3e8b35ab9d009bc9c3bff3f08e3cb8 /recipes-devtools/clang/files/0001-use-constexpr-when-using-glibc.patch
parent3d92b955605420840c4925b590eb66e2d42237a4 (diff)
downloadmeta-clang-efd9112095b216b5fd20523147650b0f4147e62f.tar.gz
libcxx,libcxxabi: Fix build on musl
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'recipes-devtools/clang/files/0001-use-constexpr-when-using-glibc.patch')
-rw-r--r--recipes-devtools/clang/files/0001-use-constexpr-when-using-glibc.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/recipes-devtools/clang/files/0001-use-constexpr-when-using-glibc.patch b/recipes-devtools/clang/files/0001-use-constexpr-when-using-glibc.patch
new file mode 100644
index 0000000..f66de8f
--- /dev/null
+++ b/recipes-devtools/clang/files/0001-use-constexpr-when-using-glibc.patch
@@ -0,0 +1,56 @@
1From 21ddd574f6e9b321614d39a7765f1ad98aa09f54 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 15 Mar 2016 04:56:27 +0000
4Subject: [PATCH] use constexpr when using glibc
5
6POSIX does not permit using PTHREAD_COND_INITIALIZER except for static
7initialization, and certainly does not permit using it as a value
8
9also POSIX does not specify the type of the object (it's opaque) so if
10there are any types for which their code would be invalid C++, then their
11code is invalid
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 include/__mutex_base | 11 ++++++++---
16 1 file changed, 8 insertions(+), 3 deletions(-)
17
18diff --git a/include/__mutex_base b/include/__mutex_base
19index b019b47..10ad9f2 100644
20--- a/include/__mutex_base
21+++ b/include/__mutex_base
22@@ -33,7 +33,10 @@ class _LIBCPP_TYPE_VIS mutex
23 public:
24 _LIBCPP_INLINE_VISIBILITY
25 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
26- constexpr mutex() _NOEXCEPT : __m_(PTHREAD_MUTEX_INITIALIZER) {}
27+#ifdef __GLIBC__
28+ constexpr
29+#endif
30+ mutex() _NOEXCEPT : __m_(PTHREAD_MUTEX_INITIALIZER) {}
31 #else
32 mutex() _NOEXCEPT {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
33 #endif
34@@ -63,7 +66,6 @@ extern const try_to_lock_t try_to_lock;
35 extern const adopt_lock_t adopt_lock;
36
37 #else
38-
39 constexpr defer_lock_t defer_lock = defer_lock_t();
40 constexpr try_to_lock_t try_to_lock = try_to_lock_t();
41 constexpr adopt_lock_t adopt_lock = adopt_lock_t();
42@@ -272,7 +274,10 @@ class _LIBCPP_TYPE_VIS condition_variable
43 public:
44 _LIBCPP_INLINE_VISIBILITY
45 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
46- constexpr condition_variable() : __cv_(PTHREAD_COND_INITIALIZER) {}
47+#ifdef __GLIBC__
48+ constexpr
49+#endif
50+ condition_variable() : __cv_(PTHREAD_COND_INITIALIZER) {}
51 #else
52 condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
53 #endif
54--
551.9.1
56