[PATCH] D19344: [libc++] fix constexpr error when build with MUSL and macro redef warning when no exception

Weiming Zhao via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 20 21:09:20 PDT 2016

weimingz added inline comments.

Comment at: include/__config:300
@@ -299,3 +299,3 @@
-#if !(__has_feature(cxx_exceptions))
+#if !(__has_feature(cxx_exceptions)) && !defined(_LIBCPP_NO_EXCEPTIONS)
Is this change OK?

Comment at: include/__mutex_base:43
@@ -42,3 +42,3 @@
      constexpr mutex() _NOEXCEPT : __m_(PTHREAD_MUTEX_INITIALIZER) {}
EricWF wrote:
> This is not OK. It's critical that mutex have a constexpr constructor that it runs during the "Constant initialization" phase of static initialization.
> Heres an example of the difference this makes: https://godbolt.org/g/3cvlMJ
> Also the constructor is specified as being constexpr in C++11. We can't turn that off. 
> If one particular pthread implementation is broken then we need a fix targeted to only that implementation.  However this seems like a pthread bug and not a libc++ bug.
The macro has an "#else" part.  I'm not familiar with this, but it seems the constexpr an "optional feature".


More information about the cfe-commits mailing list