[PATCH] D65370: libcxx: Define __STDCPP_THREADS__ to 1, not to __cplusplus.

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 07:30:35 PDT 2019


thakis added a comment.

I started moving this into __config, but that raises several questions:

1. We probably only want to set it there if _LIBCPP_HAS_NO_THREADS is not defined:

  #if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__)
  #define __STDCPP_THREADS__ 1
  #endif



2. If the compiler does set `__STDCPP_THREADS__` but `_LIBCPP_HAS_NO_THREADS` is set, that should probably be an error:

  #if defined(__STDCPP_THREADS__) && defined(_LIBCPP_HAS_NO_THREADS)
  #error _LIBCPP_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is.
  #endif

But now if a compiler does set `__STDCPP_THREADS__` it's kind of out of libc++'s control. Once the clang half is implemented, maybe there's going to be some flag to cause it to not set that define and we could mention that here – but then again putting compiler-specific diags in libc++ is a bit strange as well.

So I guess I'll land this with those two tweaks and then maybe adjust when I move the define into clang.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65370/new/

https://reviews.llvm.org/D65370





More information about the llvm-commits mailing list