[libcxx-commits] [PATCH] D68075: Do not #error if no OS is #defined

David Zarzycki via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 26 21:07:45 PDT 2019


davezarzycki added a comment.

The two tests:

  clang/test/Headers/arm-fp16-header.c
  clang/test/Headers/arm-neon-header.c

As to why they specify "none" as the OS, I can only speculate. For example: ARM CPUs are popular with embedded/freestanding targets. In any case, it should work and it does work with the GNU C++ standard library.

If you want a simpler __config file then perhaps what follows is the way to go. The only downside to this change is that old compilers on POSIX platforms might need to pass `-D_LIBCPP_HAS_THREAD_API_PTHREAD` because `__has_include` doesn't work.

  --- __config.orig	2019-09-27 06:51:51.598527020 +0300
  +++ __config	2019-09-27 07:00:10.082234165 +0300
  @@ -1069,21 +1069,12 @@
       !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \
       !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \
       !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
  -#  if defined(__FreeBSD__) || \
  -      defined(__Fuchsia__) || \
  -      defined(__wasi__) || \
  -      defined(__NetBSD__) || \
  -      defined(__linux__) || \
  -      defined(__GNU__) || \
  -      defined(__APPLE__) || \
  -      defined(__CloudABI__) || \
  -      defined(__sun__) || \
  -      (defined(__MINGW32__) && __has_include(<pthread.h>))
  -#    define _LIBCPP_HAS_THREAD_API_PTHREAD
  -#  elif defined(_LIBCPP_WIN32API)
  +#  if defined(_LIBCPP_WIN32API)
   #    define _LIBCPP_HAS_THREAD_API_WIN32
  +#  elif __has_include(<pthread.h>)
  +#    define _LIBCPP_HAS_THREAD_API_PTHREAD
   #  else
  -#    error "No thread API"
  +#    define _LIBCPP_HAS_NO_THREADS
   #  endif // _LIBCPP_HAS_THREAD_API
   #endif // _LIBCPP_HAS_NO_THREADS
   


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68075





More information about the libcxx-commits mailing list