diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -143,7 +143,24 @@ option(LIBCXXABI_HERMETIC_STATIC_LIBRARY "Do not export any symbols from the static library." ${LIBCXXABI_HERMETIC_STATIC_LIBRARY_DEFAULT}) -set(LIBCXXABI_TEST_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/test/lit.site.cfg.in" CACHE STRING +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-shared-gcc.cfg.in") +elseif(MINGW) + set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-mingw.cfg.in") +elseif(WIN32) # clang-cl + if (LIBCXXABI_ENABLE_SHARED) + set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-shared-clangcl.cfg.in") + else() + set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-static-clangcl.cfg.in") + endif() +else() + if (LIBCXXABI_ENABLE_SHARED) + set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-shared.cfg.in") + else() + set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-static.cfg.in") + endif() +endif() +set(LIBCXXABI_TEST_CONFIG "${LIBCXXABI_DEFAULT_TEST_CONFIG}" CACHE STRING "The path to the Lit testing configuration to use when running the tests. If a relative path is provided, it is assumed to be relative to '/libcxxabi/test/configs'.") if (NOT IS_ABSOLUTE "${LIBCXXABI_TEST_CONFIG}") diff --git a/libcxxabi/test/configs/apple-libc++abi-backdeployment.cfg.in b/libcxxabi/test/configs/apple-libc++abi-backdeployment.cfg.in --- a/libcxxabi/test/configs/apple-libc++abi-backdeployment.cfg.in +++ b/libcxxabi/test/configs/apple-libc++abi-backdeployment.cfg.in @@ -45,7 +45,7 @@ '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '' )) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' + + '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' + '-I %{libcxx}/test/support -I %{libcxx}/src' )) config.substitutions.append(('%{link_flags}', diff --git a/libcxxabi/test/configs/apple-libc++abi-shared.cfg.in b/libcxxabi/test/configs/apple-libc++abi-shared.cfg.in --- a/libcxxabi/test/configs/apple-libc++abi-shared.cfg.in +++ b/libcxxabi/test/configs/apple-libc++abi-shared.cfg.in @@ -6,7 +6,7 @@ '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '' )) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' + + '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' + '-I %{libcxx}/test/support -I %{libcxx}/src' )) config.substitutions.append(('%{link_flags}', diff --git a/libcxxabi/test/configs/cmake-bridge.cfg.in b/libcxxabi/test/configs/cmake-bridge.cfg.in --- a/libcxxabi/test/configs/cmake-bridge.cfg.in +++ b/libcxxabi/test/configs/cmake-bridge.cfg.in @@ -33,3 +33,8 @@ config.substitutions.append(('%{cxx-target-include}', '@LIBCXXABI_HEADER_DIR@/%{triple}/include/c++/v1')) config.substitutions.append(('%{lib}', '@LIBCXXABI_LIBRARY_DIR@')) config.substitutions.append(('%{executor}', '@LIBCXXABI_EXECUTOR@')) + +if @LIBCXXABI_USE_LLVM_UNWINDER@: + config.substitutions.append(('%{maybe-include-libunwind}', '-I "@LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL@"')) +else: + config.substitutions.append(('%{maybe-include-libunwind}', '')) diff --git a/libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in b/libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in --- a/libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in +++ b/libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in @@ -4,8 +4,8 @@ config.substitutions.append(('%{flags}','')) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} ' + - '-D__LIBC_NO_CPP_MATH_OVERLOADS__ -DLIBCXXABI_NO_TIMER ' + + '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} ' + + '-D__LIBC_NO_CPP_MATH_OVERLOADS__ ' + '-D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' + '-I %{libcxx}/test/support -I %{libcxx}/src' )) diff --git a/libcxxabi/test/configs/llvm-libc++abi-merged.cfg.in b/libcxxabi/test/configs/llvm-libc++abi-merged.cfg.in --- a/libcxxabi/test/configs/llvm-libc++abi-merged.cfg.in +++ b/libcxxabi/test/configs/llvm-libc++abi-merged.cfg.in @@ -6,7 +6,7 @@ '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '' )) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' + + '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' + '-I %{libcxx}/test/support -I %{libcxx}/src' )) config.substitutions.append(('%{link_flags}', diff --git a/libcxxabi/test/configs/apple-libc++abi-shared.cfg.in b/libcxxabi/test/configs/llvm-libc++abi-mingw.cfg.in copy from libcxxabi/test/configs/apple-libc++abi-shared.cfg.in copy to libcxxabi/test/configs/llvm-libc++abi-mingw.cfg.in --- a/libcxxabi/test/configs/apple-libc++abi-shared.cfg.in +++ b/libcxxabi/test/configs/llvm-libc++abi-mingw.cfg.in @@ -1,24 +1,22 @@ -# Testing configuration for Apple's system libc++abi. +# This testing configuration handles running the test suite against LLVM's libc++abi +# using either a DLL or a static library, with MinGW/Clang on Windows. lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') -config.substitutions.append(('%{flags}', - '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '' -)) +config.substitutions.append(('%{flags}', '')) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' + - '-I %{libcxx}/test/support -I %{libcxx}/src' + '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -I %{libcxx}/test/support -I %{libcxx}/src -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS' )) config.substitutions.append(('%{link_flags}', '-nostdlib++ -L %{lib} -lc++ -lc++abi' )) config.substitutions.append(('%{exec}', - '%{executor} --execdir %T --env DYLD_LIBRARY_PATH=%{lib} -- ' + '%{executor} --execdir %T --env PATH=%{lib} -- ' )) import os, site site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils')) -import libcxx.test.params, libcxx.test.newconfig, libcxx.test.newconfig +import libcxx.test.params, libcxx.test.newconfig libcxx.test.newconfig.configure( libcxx.test.params.DEFAULT_PARAMETERS, libcxx.test.features.DEFAULT_FEATURES, diff --git a/libcxxabi/test/configs/llvm-libc++abi-shared-clangcl.cfg.in b/libcxxabi/test/configs/llvm-libc++abi-shared-clangcl.cfg.in new file mode 100644 --- /dev/null +++ b/libcxxabi/test/configs/llvm-libc++abi-shared-clangcl.cfg.in @@ -0,0 +1,25 @@ +# This testing configuration handles running the test suite against LLVM's libc++abi +# using a DLL, with Clang-cl on Windows. + +lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') + +config.substitutions.append(('%{flags}', '--driver-mode=g++')) +config.substitutions.append(('%{compile_flags}', + '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -I %{libcxx}/test/support -I %{libcxx}/src -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' +)) +config.substitutions.append(('%{link_flags}', + '-nostdlib -L %{lib} -lc++ -lc++abi -lmsvcrt -lmsvcprt -loldnames' +)) +config.substitutions.append(('%{exec}', + '%{executor} --execdir %T --env PATH=%{lib} -- ' +)) + +import os, site +site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils')) +import libcxx.test.params, libcxx.test.newconfig +libcxx.test.newconfig.configure( + libcxx.test.params.DEFAULT_PARAMETERS, + libcxx.test.features.DEFAULT_FEATURES, + config, + lit_config +) diff --git a/libcxxabi/test/configs/llvm-libc++abi-shared-gcc.cfg.in b/libcxxabi/test/configs/llvm-libc++abi-shared-gcc.cfg.in new file mode 100644 --- /dev/null +++ b/libcxxabi/test/configs/llvm-libc++abi-shared-gcc.cfg.in @@ -0,0 +1,26 @@ +# This testing configuration handles running the test suite against LLVM's libc++abi +# using a shared library, with GCC. This is done differently from Clang because +# GCC does not support the -nostdlib++ command-line flag. + +lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') + +config.substitutions.append(('%{flags}', '')) +config.substitutions.append(('%{compile_flags}', + '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -I %{libcxx}/test/support -I %{libcxx}/src -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS' +)) +config.substitutions.append(('%{link_flags}', + '-L %{lib} -Wl,-rpath,%{lib} -nodefaultlibs -lc++ -lc++abi -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc -latomic' +)) +config.substitutions.append(('%{exec}', + '%{executor} --execdir %T -- ' +)) + +import os, site +site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils')) +import libcxx.test.params, libcxx.test.newconfig +libcxx.test.newconfig.configure( + libcxx.test.params.DEFAULT_PARAMETERS, + libcxx.test.features.DEFAULT_FEATURES, + config, + lit_config +) diff --git a/libcxxabi/test/configs/llvm-libc++abi-merged.cfg.in b/libcxxabi/test/configs/llvm-libc++abi-shared.cfg.in copy from libcxxabi/test/configs/llvm-libc++abi-merged.cfg.in copy to libcxxabi/test/configs/llvm-libc++abi-shared.cfg.in --- a/libcxxabi/test/configs/llvm-libc++abi-merged.cfg.in +++ b/libcxxabi/test/configs/llvm-libc++abi-shared.cfg.in @@ -1,4 +1,5 @@ -# Testing configuration for libc++abi when merged into a libc++ shared library. +# This testing configuration handles running the test suite against LLVM's libc++abi +# using a shared library. lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') @@ -6,11 +7,10 @@ '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '' )) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' + - '-I %{libcxx}/test/support -I %{libcxx}/src' + '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -I %{libcxx}/test/support -I %{libcxx}/src -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS' )) config.substitutions.append(('%{link_flags}', - '-nostdlib++ -L %{lib} -Wl,-rpath,%{lib} -lc++ -pthread' + '-nostdlib++ -L %{lib} -Wl,-rpath,%{lib} -lc++ -lc++abi -pthread' )) config.substitutions.append(('%{exec}', '%{executor} --execdir %T -- ' @@ -18,7 +18,7 @@ import os, site site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils')) -import libcxx.test.params, libcxx.test.newconfig, libcxx.test.newconfig +import libcxx.test.params, libcxx.test.newconfig libcxx.test.newconfig.configure( libcxx.test.params.DEFAULT_PARAMETERS, libcxx.test.features.DEFAULT_FEATURES, diff --git a/libcxxabi/test/configs/llvm-libc++abi-static-clangcl.cfg.in b/libcxxabi/test/configs/llvm-libc++abi-static-clangcl.cfg.in new file mode 100644 --- /dev/null +++ b/libcxxabi/test/configs/llvm-libc++abi-static-clangcl.cfg.in @@ -0,0 +1,25 @@ +# This testing configuration handles running the test suite against LLVM's libc++abi +# using a static library, with Clang-cl on Windows. + +lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') + +config.substitutions.append(('%{flags}', '--driver-mode=g++')) +config.substitutions.append(('%{compile_flags}', + '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -I %{libcxx}/test/support -I %{libcxx}/src -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' +)) +config.substitutions.append(('%{link_flags}', + '-nostdlib -L %{lib} -llibc++ -llibc++abi -lmsvcrt -lmsvcprt -loldnames' +)) +config.substitutions.append(('%{exec}', + '%{executor} --execdir %T --env PATH=%{lib} -- ' +)) + +import os, site +site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils')) +import libcxx.test.params, libcxx.test.newconfig +libcxx.test.newconfig.configure( + libcxx.test.params.DEFAULT_PARAMETERS, + libcxx.test.features.DEFAULT_FEATURES, + config, + lit_config +) diff --git a/libcxxabi/test/configs/llvm-libc++abi-merged.cfg.in b/libcxxabi/test/configs/llvm-libc++abi-static.cfg.in copy from libcxxabi/test/configs/llvm-libc++abi-merged.cfg.in copy to libcxxabi/test/configs/llvm-libc++abi-static.cfg.in --- a/libcxxabi/test/configs/llvm-libc++abi-merged.cfg.in +++ b/libcxxabi/test/configs/llvm-libc++abi-static.cfg.in @@ -1,4 +1,5 @@ -# Testing configuration for libc++abi when merged into a libc++ shared library. +# This testing configuration handles running the test suite against LLVM's libc++abi +# using a static library. lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') @@ -6,11 +7,10 @@ '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '' )) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' + - '-I %{libcxx}/test/support -I %{libcxx}/src' + '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -I %{libcxx}/test/support -I %{libcxx}/src -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS' )) config.substitutions.append(('%{link_flags}', - '-nostdlib++ -L %{lib} -Wl,-rpath,%{lib} -lc++ -pthread' + '-nostdlib++ -L %{lib} -lc++ -lc++abi -pthread' )) config.substitutions.append(('%{exec}', '%{executor} --execdir %T -- ' @@ -18,7 +18,7 @@ import os, site site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils')) -import libcxx.test.params, libcxx.test.newconfig, libcxx.test.newconfig +import libcxx.test.params, libcxx.test.newconfig libcxx.test.newconfig.configure( libcxx.test.params.DEFAULT_PARAMETERS, libcxx.test.features.DEFAULT_FEATURES, diff --git a/libcxxabi/test/cxa_thread_atexit_test.pass.cpp b/libcxxabi/test/cxa_thread_atexit_test.pass.cpp --- a/libcxxabi/test/cxa_thread_atexit_test.pass.cpp +++ b/libcxxabi/test/cxa_thread_atexit_test.pass.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: libcxxabi-no-threads +// UNSUPPORTED: libcpp-has-no-threads // REQUIRES: linux #include diff --git a/libcxxabi/test/forced_unwind3.pass.cpp b/libcxxabi/test/forced_unwind3.pass.cpp --- a/libcxxabi/test/forced_unwind3.pass.cpp +++ b/libcxxabi/test/forced_unwind3.pass.cpp @@ -10,7 +10,7 @@ // what pthread_cancel does. // UNSUPPORTED: c++03 -// UNSUPPORTED: libcxxabi-no-threads +// UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: no-exceptions #include diff --git a/libcxxabi/test/guard_test_basic.pass.cpp b/libcxxabi/test/guard_test_basic.pass.cpp --- a/libcxxabi/test/guard_test_basic.pass.cpp +++ b/libcxxabi/test/guard_test_basic.pass.cpp @@ -8,6 +8,13 @@ // // UNSUPPORTED: c++03 +// Necessary because we include a private header of libc++abi, which +// only understands _LIBCXXABI_HAS_NO_THREADS. +#include "test_macros.h" +#ifdef TEST_HAS_NO_THREADS +# define _LIBCXXABI_HAS_NO_THREADS +#endif + #define TESTING_CXA_GUARD #include "../src/cxa_guard_impl.h" #include @@ -117,7 +124,7 @@ int main(int, char**) { { -#if defined(_LIBCXXABI_HAS_NO_THREADS) +#if defined(TEST_HAS_NO_THREADS) static_assert(CurrentImplementation == Implementation::NoThreads, ""); static_assert(std::is_same::value, ""); #else @@ -129,7 +136,7 @@ #endif } { -#if (defined(__APPLE__) || defined(__linux__)) && !defined(_LIBCXXABI_HAS_NO_THREADS) +#if (defined(__APPLE__) || defined(__linux__)) && !defined(TEST_HAS_NO_THREADS) assert(PlatformThreadID); #endif if (PlatformThreadID != nullptr) { diff --git a/libcxxabi/test/guard_threaded_test.pass.cpp b/libcxxabi/test/guard_threaded_test.pass.cpp --- a/libcxxabi/test/guard_threaded_test.pass.cpp +++ b/libcxxabi/test/guard_threaded_test.pass.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03 -// UNSUPPORTED: libcxxabi-no-threads +// UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: no-exceptions #define TESTING_CXA_GUARD diff --git a/libcxxabi/test/libcxxabi/test/config.py b/libcxxabi/test/libcxxabi/test/config.py --- a/libcxxabi/test/libcxxabi/test/config.py +++ b/libcxxabi/test/libcxxabi/test/config.py @@ -50,7 +50,7 @@ self.cxx.compile_flags += ['-funwind-tables'] if not self.get_lit_bool('enable_threads', True): self.cxx.compile_flags += ['-D_LIBCXXABI_HAS_NO_THREADS'] - self.config.available_features.add('libcxxabi-no-threads') + self.config.available_features.add('libcpp-has-no-threads') super(Configuration, self).configure_compile_flags() def configure_compile_flags_header_includes(self): diff --git a/libcxxabi/test/test_exception_storage.pass.cpp b/libcxxabi/test/test_exception_storage.pass.cpp --- a/libcxxabi/test/test_exception_storage.pass.cpp +++ b/libcxxabi/test/test_exception_storage.pass.cpp @@ -14,6 +14,8 @@ #include "../src/cxa_exception.h" +#include "test_macros.h" + typedef __cxxabiv1::__cxa_eh_globals globals_t ; void *thread_code (void *parm) { @@ -29,20 +31,20 @@ std::printf("Got different globals!\n"); *result = (size_t) glob1; -#ifndef _LIBCXXABI_HAS_NO_THREADS +#ifndef TEST_HAS_NO_THREADS sleep ( 1 ); #endif return parm; } -#ifndef _LIBCXXABI_HAS_NO_THREADS +#ifndef TEST_HAS_NO_THREADS #define NUMTHREADS 10 size_t thread_globals [ NUMTHREADS ] = { 0 }; std::__libcpp_thread_t threads [ NUMTHREADS ]; #endif int main() { -#ifndef _LIBCXXABI_HAS_NO_THREADS +#ifndef TEST_HAS_NO_THREADS // Make the threads, let them run, and wait for them to finish for ( int i = 0; i < NUMTHREADS; ++i ) std::__libcpp_thread_create ( threads + i, thread_code, (void *) (thread_globals + i)); @@ -65,10 +67,10 @@ } } return retVal; -#else // _LIBCXXABI_HAS_NO_THREADS +#else // TEST_HAS_NO_THREADS size_t thread_globals; thread_code(&thread_globals); // Check that __cxa_get_globals() is not NULL. return (thread_globals == 0) ? 1 : 0; -#endif // !_LIBCXXABI_HAS_NO_THREADS +#endif // !TEST_HAS_NO_THREADS } diff --git a/libcxxabi/test/test_fallback_malloc.pass.cpp b/libcxxabi/test/test_fallback_malloc.pass.cpp --- a/libcxxabi/test/test_fallback_malloc.pass.cpp +++ b/libcxxabi/test/test_fallback_malloc.pass.cpp @@ -11,6 +11,13 @@ #include <__threading_support> +// Necessary because we include a private source file of libc++abi, which +// only understands _LIBCXXABI_HAS_NO_THREADS. +#include "test_macros.h" +#ifdef TEST_HAS_NO_THREADS +# define _LIBCXXABI_HAS_NO_THREADS +#endif + typedef std::deque container; // #define DEBUG_FALLBACK_MALLOC diff --git a/libcxxabi/test/test_guard.pass.cpp b/libcxxabi/test/test_guard.pass.cpp --- a/libcxxabi/test/test_guard.pass.cpp +++ b/libcxxabi/test/test_guard.pass.cpp @@ -6,17 +6,16 @@ // //===----------------------------------------------------------------------===// -#include "cxxabi.h" - #include - -#ifndef _LIBCXXABI_HAS_NO_THREADS -#include -#include "make_test_thread.h" -#endif +#include #include "test_macros.h" +#ifndef TEST_HAS_NO_THREADS +# include +# include "make_test_thread.h" +#endif + // Ensure that we initialize each variable once and only once. namespace test1 { static int run_count = 0; @@ -83,7 +82,7 @@ } } -#ifndef _LIBCXXABI_HAS_NO_THREADS +#ifndef TEST_HAS_NO_THREADS // A simple thread test of two threads racing to initialize a variable. This // isn't guaranteed to catch any particular threading problems. namespace test4 { @@ -136,14 +135,14 @@ assert(run_count == 1); } } -#endif /* _LIBCXXABI_HAS_NO_THREADS */ +#endif /* TEST_HAS_NO_THREADS */ int main(int, char**) { test1::test(); test2::test(); test3::test(); -#ifndef _LIBCXXABI_HAS_NO_THREADS +#ifndef TEST_HAS_NO_THREADS test4::test(); test5::test(); #endif diff --git a/libcxxabi/test/thread_local_destruction_order.pass.cpp b/libcxxabi/test/thread_local_destruction_order.pass.cpp --- a/libcxxabi/test/thread_local_destruction_order.pass.cpp +++ b/libcxxabi/test/thread_local_destruction_order.pass.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03 -// UNSUPPORTED: libcxxabi-no-threads +// UNSUPPORTED: libcpp-has-no-threads #include #include