[PATCH] [libc++] Allow libc++ to be built on systems without POSIX threads

Marshall Clow mclow.lists at gmail.com
Thu Aug 21 08:49:35 PDT 2014


See the inline comments; I think that _LIBCPP_HAS_NO_THREADS should be defined when building single-threaded, and not defined otherwise (that would match the rest of the libc++ config macros).

Also, aren't there a bunch of tests that are going to need to change?

================
Comment at: include/__config:126
@@ -121,1 +125,3 @@
 
+#if defined(_POSIX_THREADS) && _POSIX_THREADS > 0
+#  define _LIBCPP_HAS_NO_THREADS 0
----------------
This should be wrapped in an "#ifndef _LIBCPP_HAS_NO_THREADS" block, and should just define it, rather than give it a 0/1 value.

This will allow someone to build an "no threads" version of libcpp by -D _LIBCPP_HAS_NO_THREADS on the command line.


================
Comment at: include/__mutex_base:25
@@ -24,1 +24,3 @@
 
+#if !_LIBCPP_HAS_NO_THREADS
+
----------------
this should just be #ifndef _LIBCPP_HAS_NO_THREADS

================
Comment at: include/__mutex_base:33
@@ -30,2 +32,3 @@
     _LIBCPP_INLINE_VISIBILITY
+
 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
----------------
Whitespace change?

http://reviews.llvm.org/D3969






More information about the cfe-commits mailing list