[PATCH] D18174: Fix libcxx build on musl

Shoaib Meenai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 30 20:43:00 PDT 2017


smeenai added inline comments.


================
Comment at: include/__mutex_base:51
 #ifndef _LIBCPP_CXX03_LANG
-    constexpr mutex() = default;
+#ifdef __GLIBC__
+    constexpr
----------------
EricWF wrote:
> Limiting `constexpr` to GLIBC implementations only is incorrect; you want to exclude MUSL.
> 
> Also MUSL is wrong for not allowing `pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER` to be a constant expression, and MUSL should fix that.
I've used `__builtin_constant_p` to wok around a similarly non-conforming `PTHREAD_MUTEX_INITIALIZER` (from pthread-win32, which defines it to be `(void *)-1`): see the last part of https://stackoverflow.com/a/10376574/382079. It's a terrible hack, but it works.


https://reviews.llvm.org/D18174





More information about the cfe-commits mailing list