[libcxxabi] r291440 - [libcxxabi] Cleanup and adapt for r291275. NFC.
Asiri Rathnayake via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 9 03:57:22 PST 2017
Author: asiri
Date: Mon Jan 9 05:57:21 2017
New Revision: 291440
URL: http://llvm.org/viewvc/llvm-project?rev=291440&view=rev
Log:
[libcxxabi] Cleanup and adapt for r291275. NFC.
+ Now that libcxxabi shares the same threading API as libcxx, a whole
chunk of code in src/config.h is made redundant (I missed this earlier).
+ r291275 split off the externalized-thread-api libcxx configuration from the
external-thread-library libcxx configuration. libcxxabi should follow the
same approach.
Modified:
libcxxabi/trunk/CMakeLists.txt
libcxxabi/trunk/src/config.h
libcxxabi/trunk/test/CMakeLists.txt
libcxxabi/trunk/test/lit.site.cfg.in
Modified: libcxxabi/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=291440&r1=291439&r2=291440&view=diff
==============================================================================
--- libcxxabi/trunk/CMakeLists.txt (original)
+++ libcxxabi/trunk/CMakeLists.txt Mon Jan 9 05:57:21 2017
@@ -125,6 +125,9 @@ option(LIBCXXABI_HAS_PTHREAD_API "Ignore
option(LIBCXXABI_HAS_EXTERNAL_THREAD_API
"Build libc++abi with an externalized threading API.
This option may only be set to ON when LIBCXXABI_ENABLE_THREADS=ON." OFF)
+option(LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY
+ "Build libc++abi with an externalized threading library.
+ This option may only be set to ON when LIBCXXABI_ENABLE_THREADS=ON" OFF)
option(LIBCXXABI_BUILD_32_BITS "Build 32 bit libc++abi." ${LLVM_BUILD_32_BITS})
option(LIBCXXABI_INCLUDE_TESTS "Generate build targets for the libc++abi unit tests." ${LLVM_INCLUDE_TESTS})
set(LIBCXXABI_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.")
@@ -367,16 +370,28 @@ if (NOT LIBCXXABI_ENABLE_THREADS)
" be set to ON when LIBCXXABI_ENABLE_THREADS"
" is also set to ON.")
endif()
+ if (LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY)
+ message(FATAL_ERROR "LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY can only"
+ " be set to ON when LIBCXXABI_ENABLE_THREADS"
+ " is also set to ON.")
+ endif()
add_definitions(-D_LIBCXXABI_HAS_NO_THREADS)
endif()
-if (LIBCXXABI_HAS_PTHREAD_API AND LIBCXXABI_HAS_EXTERNAL_THREAD_API)
- message(FATAL_ERROR "The options LIBCXXABI_HAS_EXTERNAL_THREAD_API"
- "and LIBCXXABI_HAS_PTHREAD_API cannot be both"
- "set to ON at the same time.")
+if (LIBCXXABI_HAS_EXTERNAL_THREAD_API)
+ if (LIBCXXABI_HAS_PTHREAD_API)
+ message(FATAL_ERROR "The options LIBCXXABI_HAS_EXTERNAL_THREAD_API"
+ " and LIBCXXABI_HAS_PTHREAD_API cannot be both"
+ " set to ON at the same time.")
+ endif()
+ if (LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY)
+ message(FATAL_ERROR "The options LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY"
+ " and LIBCXXABI_HAS_EXTERNAL_THREAD_API cannot be both"
+ " set to ON at the same time.")
+ endif()
endif()
-if (LIBCXXABI_HAS_EXTERNAL_THREAD_API AND LIBCXXABI_ENABLE_SHARED)
+if (LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY AND LIBCXXABI_ENABLE_SHARED)
# Need to allow unresolved symbols if this is to work with shared library builds
if (APPLE)
add_link_flags("-undefined dynamic_lookup")
@@ -388,11 +403,14 @@ endif()
if (LIBCXXABI_HAS_PTHREAD_API)
add_definitions(-D_LIBCPP_HAS_THREAD_API_PTHREAD)
- add_definitions(-D_LIBCXXABI_USE_THREAD_API_PTHREAD)
endif()
if (LIBCXXABI_HAS_EXTERNAL_THREAD_API)
- add_definitions(-D_LIBCXXABI_HAS_THREAD_API_EXTERNAL)
+ add_definitions(-D_LIBCPP_HAS_THREAD_API_EXTERNAL)
+endif()
+
+if (LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY)
+ add_definitions(-D_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL)
endif()
if (MSVC)
Modified: libcxxabi/trunk/src/config.h
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/config.h?rev=291440&r1=291439&r2=291440&view=diff
==============================================================================
--- libcxxabi/trunk/src/config.h (original)
+++ libcxxabi/trunk/src/config.h Mon Jan 9 05:57:21 2017
@@ -16,41 +16,6 @@
#include <unistd.h>
-#ifndef __has_attribute
- #define __has_attribute(x) 0
-#endif
-
-// Configure inline visibility attributes
-#if defined(_WIN32)
- #if defined(_MSC_VER) && !defined(__clang__)
- // Using Microsoft Visual C++ compiler
- #define _LIBCXXABI_INLINE_VISIBILITY __forceinline
- #else
- #if __has_attribute(__internal_linkage__)
- #define _LIBCXXABI_INLINE_VISIBILITY __attribute__ ((__internal_linkage__, __always_inline__))
- #else
- #define _LIBCXXABI_INLINE_VISIBILITY __attribute__ ((__always_inline__))
- #endif
- #endif
-#else
- #if __has_attribute(__internal_linkage__)
- #define _LIBCXXABI_INLINE_VISIBILITY __attribute__ ((__internal_linkage__, __always_inline__))
- #else
- #define _LIBCXXABI_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
- #endif
-#endif
-
-// Try and deduce a threading api if one has not been explicitly set.
-#if !defined(_LIBCXXABI_HAS_NO_THREADS) && \
- !defined(_LIBCXXABI_HAS_THREAD_API_EXTERNAL) && \
- !defined(_LIBCXXABI_USE_THREAD_API_PTHREAD)
- #if defined(_POSIX_THREADS) && _POSIX_THREADS >= 0
- #define _LIBCXXABI_USE_THREAD_API_PTHREAD
- #else
- #error "No thread API"
- #endif
-#endif
-
// Set this in the CXXFLAGS when you need it, because otherwise we'd have to
// #if !defined(__linux__) && !defined(__APPLE__) && ...
// and so-on for *every* platform.
Modified: libcxxabi/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/CMakeLists.txt?rev=291440&r1=291439&r2=291440&view=diff
==============================================================================
--- libcxxabi/trunk/test/CMakeLists.txt (original)
+++ libcxxabi/trunk/test/CMakeLists.txt Mon Jan 9 05:57:21 2017
@@ -17,7 +17,7 @@ pythonize_bool(LIBCXXABI_ENABLE_SHARED)
pythonize_bool(LIBCXXABI_ENABLE_THREADS)
pythonize_bool(LIBCXXABI_ENABLE_EXCEPTIONS)
pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
-pythonize_bool(LIBCXXABI_HAS_EXTERNAL_THREAD_API)
+pythonize_bool(LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY)
set(LIBCXXABI_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
"TargetInfo to use when setting up test environment.")
set(LIBCXXABI_EXECUTOR "None" CACHE STRING
@@ -35,7 +35,7 @@ else()
set(LIBCXXABI_TEST_DEPS cxxabi_static)
endif()
-if (LIBCXXABI_HAS_EXTERNAL_THREAD_API)
+if (LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY)
list(APPEND LIBCXXABI_TEST_DEPS cxx_external_threads)
endif()
Modified: libcxxabi/trunk/test/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/lit.site.cfg.in?rev=291440&r1=291439&r2=291440&view=diff
==============================================================================
--- libcxxabi/trunk/test/lit.site.cfg.in (original)
+++ libcxxabi/trunk/test/lit.site.cfg.in Mon Jan 9 05:57:21 2017
@@ -19,7 +19,7 @@ config.enable_exceptions = "@LIBC
config.host_triple = "@LLVM_HOST_TRIPLE@"
config.target_triple = "@TARGET_TRIPLE@"
config.use_target = len("@LIBCXXABI_TARGET_TRIPLE@") > 0
-config.cxx_ext_threads = "@LIBCXXABI_HAS_EXTERNAL_THREAD_API@"
+config.cxx_ext_threads = "@LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY@"
# Let the main config do the real work.
lit_config.load_config(config, "@LIBCXXABI_SOURCE_DIR@/test/lit.cfg")
More information about the cfe-commits
mailing list