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

Jon Roelofs jonathan at codesourcery.com
Thu Aug 21 13:58:13 PDT 2014


It'll take a bit more to fish out the changes to the tests (mostly adding 'XFAIL: libcxx-single-threaded')

================
Comment at: include/__config:126
@@ -121,1 +125,3 @@
 
+#if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_POSIX_THREADS) || _POSIX_THREADS <= 0)
+#  error <unistd.h> suggests that your system doesn't have PTHREADS... \
----------------
@mclow earlier you suggested having just the build define this with -D_LIBCPP_HAS_NO_THREADS. I thought adding this as a error/warning might be nice.

Another thing I've just realized: if this is only set during the build, then how to I arrange for it to be set in an installed system? I don't want my users to have to -D_LIBCPP_HAS_NO_THREADS whenever they want to use libcxx.

================
Comment at: include/thread:110
@@ +109,3 @@
+#ifdef _LIBCPP_HAS_NO_THREADS
+#error <thread> is not supported on this system
+#else // !_LIBCPP_HAS_NO_THREADS
----------------
s/system/single threaded system/

================
Comment at: src/thread.cpp:33
@@ -29,2 +32,3 @@
 
+
 _LIBCPP_BEGIN_NAMESPACE_STD
----------------
un-necessary whitespace change

http://reviews.llvm.org/D3969






More information about the cfe-commits mailing list