This avoids using an libc++ internal macro in our tests.
Reviewed By: #libc, philnik, ldionne
Differential Revision: https://reviews.llvm.org/D119563
#include <cassert>
#include <chrono> // for nanoseconds
-#ifndef _LIBCPP_HAS_NO_THREADS
-# include <thread> // for thread_id
+#include "test_macros.h"
+
+#ifndef TEST_HAS_NO_THREADS
+# include <thread> // for thread_id
#endif
struct TriviallyCopyable {
int main(int, char**) {
test(TriviallyCopyable(42));
test(std::chrono::nanoseconds(2));
-#ifndef _LIBCPP_HAS_NO_THREADS
+#ifndef TEST_HAS_NO_THREADS
test(std::this_thread::get_id());
#endif
#include <memory>
#include <type_traits>
-#ifndef _LIBCPP_HAS_NO_THREADS
-# include <thread>
-#endif
-
#include "test_macros.h"
+#ifndef TEST_HAS_NO_THREADS
+# include <thread>
+#endif
+
template <class A, bool Integral>
struct test_atomic
{
test<LargeTriviallyCopyable>();
#endif
-#ifndef _LIBCPP_HAS_NO_THREADS
+#ifndef TEST_HAS_NO_THREADS
test<std::thread::id>();
#endif
test<std::chrono::nanoseconds>();
#include <unordered_set>
#include <vector>
-#ifndef _LIBCPP_HAS_NO_THREADS
-# include <mutex>
+#include "test_macros.h"
+
+#ifndef TEST_HAS_NO_THREADS
+# include <mutex>
#endif
#include "compare_types.h"
static_assert(
!check_equality_comparable_with<std::list<int>, std::vector<int> >());
-#ifndef _LIBCPP_HAS_NO_THREADS
+#ifndef TEST_HAS_NO_THREADS
static_assert(!check_equality_comparable_with<std::lock_guard<std::mutex>,
std::lock_guard<std::mutex> >());
static_assert(!check_equality_comparable_with<std::lock_guard<std::mutex>,
#include <unordered_map>
#include <vector>
-#ifndef _LIBCPP_HAS_NO_THREADS
-# include <mutex>
+#include "test_macros.h"
+
+#ifndef TEST_HAS_NO_THREADS
+# include <mutex>
#endif
#include "type_classification/moveconstructible.h"
#include <set>
#include <stack>
#include <span>
-#ifndef _LIBCPP_HAS_NO_THREADS
-# include <thread>
-#endif
#include <tuple>
#include <type_traits>
#include <unordered_map>
#ifndef TEST_HAS_NO_LOCALIZATION
# include <regex>
#endif
+#ifndef TEST_HAS_NO_THREADS
+# include <thread>
+#endif
// Validate default template argument.
static_assert(std::same_as<std::formatter<int>, std::formatter<int, char>>);
#ifndef TEST_HAS_NO_LOCALIZATION
assert_formatter_is_disabled<std::sub_match<CharT*>, CharT>();
#endif
-#ifndef _LIBCPP_HAS_NO_THREADS
+#ifndef TEST_HAS_NO_THREADS
assert_formatter_is_disabled<std::thread::id, CharT>();
#endif
assert_formatter_is_disabled<std::unique_ptr<int>, CharT>();
# define TEST_HAS_NO_CHAR8_T
#endif
+#if defined(_LIBCPP_HAS_NO_THREADS)
+# define TEST_HAS_NO_THREADS
+#endif
+
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif