<div dir="ltr">Forgot to add "Differential Revision: <a href="https://reviews.llvm.org/D65370">https://reviews.llvm.org/D65370</a>", sigh.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 30, 2019 at 10:31 AM Nico Weber via libcxx-commits <<a href="mailto:libcxx-commits@lists.llvm.org">libcxx-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: nico<br>
Date: Tue Jul 30 07:32:47 2019<br>
New Revision: 367316<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=367316&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=367316&view=rev</a><br>
Log:<br>
libcxx: Define __STDCPP_THREADS__ to 1, not to __cplusplus.<br>
<br>
[cpp.predefined]p2:<br>
<br>
   __STDCPP_THREADS__<br>
    Defined, and has the value integer literal 1, if and only if a program<br>
    can have more than one thread of execution .<br>
<br>
Also define it only if it's not defined already, since it's supposed<br>
to be defined by the compiler.<br>
<br>
Also move it from thread to __config (which requires setting it only<br>
if _LIBCPP_HAS_NO_THREADS is not defined).<br>
<br>
Part of PR33230. The intent is to eventually make the compiler define<br>
this instead.<br>
<br>
Modified:<br>
    libcxx/trunk/include/__config<br>
    libcxx/trunk/include/thread<br>
    libcxx/trunk/test/std/thread/macro.pass.cpp<br>
<br>
Modified: libcxx/trunk/include/__config<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=367316&r1=367315&r2=367316&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=367316&r1=367315&r2=367316&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/__config (original)<br>
+++ libcxx/trunk/include/__config Tue Jul 30 07:32:47 2019<br>
@@ -1097,6 +1097,14 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit<br>
        _LIBCPP_HAS_NO_THREADS is defined.<br>
 #endif<br>
<br>
+#if defined(__STDCPP_THREADS__) && defined(_LIBCPP_HAS_NO_THREADS)<br>
+#error _LIBCPP_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is set.<br>
+#endif<br>
+<br>
+#if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__)<br>
+#define __STDCPP_THREADS__ 1<br>
+#endif<br>
+<br>
 // The glibc and Bionic implementation of pthreads implements<br>
 // pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32<br>
 // mutexes have no destroy mechanism.<br>
<br>
Modified: libcxx/trunk/include/thread<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/thread?rev=367316&r1=367315&r2=367316&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/thread?rev=367316&r1=367315&r2=367316&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/thread (original)<br>
+++ libcxx/trunk/include/thread Tue Jul 30 07:32:47 2019<br>
@@ -14,8 +14,6 @@<br>
<br>
     thread synopsis<br>
<br>
-#define __STDCPP_THREADS__ __cplusplus<br>
-<br>
 namespace std<br>
 {<br>
<br>
@@ -107,8 +105,6 @@ void sleep_for(const chrono::duration<Re<br>
 _LIBCPP_PUSH_MACROS<br>
 #include <__undef_macros><br>
<br>
-#define __STDCPP_THREADS__ __cplusplus<br>
-<br>
 #ifdef _LIBCPP_HAS_NO_THREADS<br>
 #error <thread> is not supported on this single threaded system<br>
 #else // !_LIBCPP_HAS_NO_THREADS<br>
<br>
Modified: libcxx/trunk/test/std/thread/macro.pass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/macro.pass.cpp?rev=367316&r1=367315&r2=367316&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/macro.pass.cpp?rev=367316&r1=367315&r2=367316&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/thread/macro.pass.cpp (original)<br>
+++ libcxx/trunk/test/std/thread/macro.pass.cpp Tue Jul 30 07:32:47 2019<br>
@@ -10,7 +10,7 @@<br>
<br>
 // <thread><br>
<br>
-// #define __STDCPP_THREADS__ __cplusplus<br>
+// #define __STDCPP_THREADS__ 1<br>
<br>
 #include <thread><br>
<br>
@@ -20,6 +20,8 @@ int main(int, char**)<br>
 {<br>
 #ifndef __STDCPP_THREADS__<br>
 #error __STDCPP_THREADS__ is not defined<br>
+#elif __STDCPP_THREADS__ != 1<br>
+#error __STDCPP_THREADS__ has the wrong value<br>
 #endif<br>
<br>
   return 0;<br>
<br>
<br>
_______________________________________________<br>
libcxx-commits mailing list<br>
<a href="mailto:libcxx-commits@lists.llvm.org" target="_blank">libcxx-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-commits</a><br>
</blockquote></div>