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

Jon Roelofs jonathan at codesourcery.com
Thu Aug 21 09:00:12 PDT 2014


I have another set of patches for the tests that this affects. Should I merge them all and include them here?

================
Comment at: include/__config:126
@@ -121,1 +125,3 @@
 
+#if defined(_POSIX_THREADS) && _POSIX_THREADS > 0
+#  define _LIBCPP_HAS_NO_THREADS 0
----------------
Marshall Clow wrote:
> 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.
> 
Wait, do you mean that this hunk should just go away? Or do you mean that it should be:


```
#if !defined(_LIBCPP_HAS_NO_THREADS) && defined(_POSIX_THREADS) && _POSIX_THREADS > 0
#define _LIBCPP_HAS_NO_THREADS
#endif
```

I'm not sure I understand what you're asking for here.

================
Comment at: include/__mutex_base:25
@@ -24,1 +24,3 @@
 
+#if !_LIBCPP_HAS_NO_THREADS
+
----------------
Marshall Clow wrote:
> this should just be #ifndef _LIBCPP_HAS_NO_THREADS
Ok, I'll change all of them to that style.

================
Comment at: include/__mutex_base:33
@@ -30,2 +32,3 @@
     _LIBCPP_INLINE_VISIBILITY
+
 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
----------------
Marshall Clow wrote:
> Whitespace change?
Looks like... I'll get rid of it.

http://reviews.llvm.org/D3969






More information about the cfe-commits mailing list