[llvm-branch-commits] [libcxx] fa21c5d - [libc++] Make feature-test macros consistent with availability macros
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jun 22 17:33:25 PDT 2021
Author: Louis Dionne
Date: 2021-06-22T20:29:42-04:00
New Revision: fa21c5d4cf8cf00347e89bc3c50fbaf6a5c185dd
URL: https://github.com/llvm/llvm-project/commit/fa21c5d4cf8cf00347e89bc3c50fbaf6a5c185dd
DIFF: https://github.com/llvm/llvm-project/commit/fa21c5d4cf8cf00347e89bc3c50fbaf6a5c185dd.diff
LOG: [libc++] Make feature-test macros consistent with availability macros
Before this patch, feature-test macros didn't take special availability
markup into account, which means that feature-test macros can sometimes
appear to "lie". For example, if you compile in C++20 mode and target
macOS 10.13, the __cpp_lib_filesystem feature-test macro will be provided
even though the <filesystem> declarations are marked as unavailable.
This patch fixes that.
rdar://68142369
Differential Revision: https://reviews.llvm.org/D94983
(cherry picked from commit 76fc35752d19ac605c1c1fd757af9c7c3bb4a906)
Added:
Modified:
libcxx/include/__availability
libcxx/include/version
libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
libcxx/utils/generate_feature_test_macro_components.py
Removed:
libcxx/test/std/input.output/filesystems/fs.req.macros/feature_macro.pass.cpp
################################################################################
diff --git a/libcxx/include/__availability b/libcxx/include/__availability
index db2267c8eb16f..cc3b6fabdab17 100644
--- a/libcxx/include/__availability
+++ b/libcxx/include/__availability
@@ -43,6 +43,14 @@
// as unavailable. When vendors decide to ship the feature as part of their
// shared library, they can update the markup appropriately.
//
+// Furthermore, many features in the standard library have corresponding
+// feature-test macros. When a feature is made unavailable on some deployment
+// target, a macro should be defined to signal that it is unavailable. That
+// macro can then be picked up when feature-test macros are generated (see
+// generate_feature_test_macro_components.py) to make sure that feature-test
+// macros don't announce a feature as being implemented if it has been marked
+// as unavailable.
+//
// Note that this mechanism is disabled by default in the "upstream" libc++.
// Availability annotations are only meaningful when shipping libc++ inside
// a platform (i.e. as a system library), and so vendors that want them should
@@ -76,6 +84,8 @@
// This controls the availability of std::shared_mutex and std::shared_timed_mutex,
// which were added to the dylib later.
# define _LIBCPP_AVAILABILITY_SHARED_MUTEX
+// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex
+// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex
// These macros control the availability of std::bad_optional_access and
// other exception types. These were put in the shared library to prevent
@@ -114,6 +124,7 @@
# define _LIBCPP_AVAILABILITY_FILESYSTEM
# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP
+// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem
// This controls the availability of std::to_chars.
# define _LIBCPP_AVAILABILITY_TO_CHARS
@@ -122,6 +133,10 @@
// which requires shared library support for various operations
// (see libcxx/src/atomic.cpp).
# define _LIBCPP_AVAILABILITY_SYNC
+// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait
+// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier
+// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch
+// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore
#elif defined(__APPLE__)
@@ -130,6 +145,14 @@
__attribute__((availability(ios,strict,introduced=10.0))) \
__attribute__((availability(tvos,strict,introduced=10.0))) \
__attribute__((availability(watchos,strict,introduced=3.0)))
+# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) || \
+ (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 100000) || \
+ (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 100000) || \
+ (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 30000)
+# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex
+# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex
+# endif
+
# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS \
__attribute__((availability(macosx,strict,introduced=10.13))) \
__attribute__((availability(ios,strict,introduced=11.0))) \
@@ -139,27 +162,34 @@
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST \
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
+
# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \
__attribute__((availability(macosx,strict,introduced=10.12))) \
__attribute__((availability(ios,strict,introduced=10.0))) \
__attribute__((availability(tvos,strict,introduced=10.0))) \
__attribute__((availability(watchos,strict,introduced=3.0)))
+
# define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \
__attribute__((availability(macosx,strict,introduced=10.12))) \
__attribute__((availability(ios,strict,introduced=10.0))) \
__attribute__((availability(tvos,strict,introduced=10.0))) \
__attribute__((availability(watchos,strict,introduced=3.0)))
+
# define _LIBCPP_AVAILABILITY_FUTURE_ERROR \
__attribute__((availability(ios,strict,introduced=6.0)))
+
# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \
__attribute__((availability(macosx,strict,introduced=10.9))) \
__attribute__((availability(ios,strict,introduced=7.0)))
+
# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \
__attribute__((availability(macosx,strict,introduced=10.9))) \
__attribute__((availability(ios,strict,introduced=7.0)))
+
# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \
__attribute__((availability(macosx,strict,introduced=10.9))) \
__attribute__((availability(ios,strict,introduced=7.0)))
+
# define _LIBCPP_AVAILABILITY_FILESYSTEM \
__attribute__((availability(macosx,strict,introduced=10.15))) \
__attribute__((availability(ios,strict,introduced=13.0))) \
@@ -175,10 +205,23 @@
_Pragma("clang attribute pop") \
_Pragma("clang attribute pop") \
_Pragma("clang attribute pop")
+# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \
+ (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \
+ (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000) || \
+ (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000)
+# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem
+# endif
+
# define _LIBCPP_AVAILABILITY_TO_CHARS \
_LIBCPP_AVAILABILITY_FILESYSTEM
+
+ // Note: Those are not ABI-stable yet, so we can't ship them.
# define _LIBCPP_AVAILABILITY_SYNC \
__attribute__((unavailable))
+# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait
+# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier
+# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch
+# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore
#else
diff --git a/libcxx/include/version b/libcxx/include/version
index 813bc1ab9e6ad..c021db8bddd77 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -184,7 +184,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_quoted_string_io 201304L
# define __cpp_lib_result_of_sfinae 201210L
# define __cpp_lib_robust_nonmodifying_seq_ops 201304L
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)
# define __cpp_lib_shared_timed_mutex 201402L
# endif
# define __cpp_lib_string_udls 201304L
@@ -213,7 +213,9 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_clamp 201603L
# define __cpp_lib_enable_shared_from_this 201603L
// # define __cpp_lib_execution 201603L
-# define __cpp_lib_filesystem 201703L
+# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem)
+# define __cpp_lib_filesystem 201703L
+# endif
# define __cpp_lib_gcd_lcm 201606L
// # define __cpp_lib_hardware_interference_size 201703L
# if defined(_LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS)
@@ -241,7 +243,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_raw_memory_algorithms 201606L
# define __cpp_lib_sample 201603L
# define __cpp_lib_scoped_lock 201703L
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex)
# define __cpp_lib_shared_mutex 201505L
# endif
# define __cpp_lib_shared_ptr_arrays 201611L
@@ -279,10 +281,10 @@ __cpp_lib_void_t 201411L <type_traits>
# if !defined(_LIBCPP_HAS_NO_THREADS)
// # define __cpp_lib_atomic_value_initialization 201911L
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait)
# define __cpp_lib_atomic_wait 201907L
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier)
# define __cpp_lib_barrier 201907L
# endif
// # define __cpp_lib_bind_front 201907L
@@ -326,7 +328,7 @@ __cpp_lib_void_t 201411L <type_traits>
# if !defined(_LIBCPP_HAS_NO_THREADS)
// # define __cpp_lib_jthread 201911L
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch)
# define __cpp_lib_latch 201907L
# endif
# define __cpp_lib_list_remove_return_type 201806L
@@ -336,7 +338,7 @@ __cpp_lib_void_t 201411L <type_traits>
// # define __cpp_lib_polymorphic_allocator 201902L
// # define __cpp_lib_ranges 201811L
# define __cpp_lib_remove_cvref 201711L
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore)
# define __cpp_lib_semaphore 201907L
# endif
# define __cpp_lib_shift 201806L
diff --git a/libcxx/test/std/input.output/filesystems/fs.req.macros/feature_macro.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.req.macros/feature_macro.pass.cpp
deleted file mode 100644
index 6b7052b2403d3..0000000000000
--- a/libcxx/test/std/input.output/filesystems/fs.req.macros/feature_macro.pass.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <filesystem>
-
-// #define __cpp_lib_filesystem 201703L
-
-#include <filesystem>
-#include "test_macros.h"
-
-#if TEST_STD_VER >= 17
-#ifndef __cpp_lib_filesystem
-#error Filesystem feature test macro is not defined (__cpp_lib_filesystem)
-#elif __cpp_lib_filesystem != 201703L
-#error Filesystem feature test macro has an incorrect value (__cpp_lib_filesystem)
-#endif
-#else // TEST_STD_VER < 17
-#ifdef __cpp_lib_filesystem
-#error Filesystem feature test macro should not be defined before C++17
-#endif
-#endif
-
-int main(int, char**) {
- return 0;
-}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp
index b964e0c6921e2..c8a837115adef 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp
@@ -248,7 +248,7 @@
# endif
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait)
# ifndef __cpp_lib_atomic_wait
# error "__cpp_lib_atomic_wait should be defined in c++20"
# endif
@@ -257,7 +257,7 @@
# endif
# else
# ifdef __cpp_lib_atomic_wait
-# error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) is not defined!"
# endif
# endif
@@ -367,7 +367,7 @@
# endif
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait)
# ifndef __cpp_lib_atomic_wait
# error "__cpp_lib_atomic_wait should be defined in c++2b"
# endif
@@ -376,7 +376,7 @@
# endif
# else
# ifdef __cpp_lib_atomic_wait
-# error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) is not defined!"
# endif
# endif
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.pass.cpp
index b193095403e9a..80f7d9ca24b41 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.pass.cpp
@@ -44,7 +44,7 @@
#elif TEST_STD_VER == 20
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier)
# ifndef __cpp_lib_barrier
# error "__cpp_lib_barrier should be defined in c++20"
# endif
@@ -53,13 +53,13 @@
# endif
# else
# ifdef __cpp_lib_barrier
-# error "__cpp_lib_barrier should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_barrier should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier) is not defined!"
# endif
# endif
#elif TEST_STD_VER > 20
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier)
# ifndef __cpp_lib_barrier
# error "__cpp_lib_barrier should be defined in c++2b"
# endif
@@ -68,7 +68,7 @@
# endif
# else
# ifdef __cpp_lib_barrier
-# error "__cpp_lib_barrier should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_barrier should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier) is not defined!"
# endif
# endif
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp
index 6e47bdf3b5fef..c361569cb1d6d 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp
@@ -51,11 +51,17 @@
# error "__cpp_lib_char8_t should not be defined before c++20"
# endif
-# ifndef __cpp_lib_filesystem
-# error "__cpp_lib_filesystem should be defined in c++17"
-# endif
-# if __cpp_lib_filesystem != 201703L
-# error "__cpp_lib_filesystem should have the value 201703L in c++17"
+# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem)
+# ifndef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should be defined in c++17"
+# endif
+# if __cpp_lib_filesystem != 201703L
+# error "__cpp_lib_filesystem should have the value 201703L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should not be defined when !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) is not defined!"
+# endif
# endif
#elif TEST_STD_VER == 20
@@ -73,11 +79,17 @@
# endif
# endif
-# ifndef __cpp_lib_filesystem
-# error "__cpp_lib_filesystem should be defined in c++20"
-# endif
-# if __cpp_lib_filesystem != 201703L
-# error "__cpp_lib_filesystem should have the value 201703L in c++20"
+# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem)
+# ifndef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should be defined in c++20"
+# endif
+# if __cpp_lib_filesystem != 201703L
+# error "__cpp_lib_filesystem should have the value 201703L in c++20"
+# endif
+# else
+# ifdef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should not be defined when !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) is not defined!"
+# endif
# endif
#elif TEST_STD_VER > 20
@@ -95,11 +107,17 @@
# endif
# endif
-# ifndef __cpp_lib_filesystem
-# error "__cpp_lib_filesystem should be defined in c++2b"
-# endif
-# if __cpp_lib_filesystem != 201703L
-# error "__cpp_lib_filesystem should have the value 201703L in c++2b"
+# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem)
+# ifndef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should be defined in c++2b"
+# endif
+# if __cpp_lib_filesystem != 201703L
+# error "__cpp_lib_filesystem should have the value 201703L in c++2b"
+# endif
+# else
+# ifdef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should not be defined when !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) is not defined!"
+# endif
# endif
#endif // TEST_STD_VER > 20
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.pass.cpp
index 29e8fd617bbfe..56db3ba66b450 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.pass.cpp
@@ -44,7 +44,7 @@
#elif TEST_STD_VER == 20
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch)
# ifndef __cpp_lib_latch
# error "__cpp_lib_latch should be defined in c++20"
# endif
@@ -53,13 +53,13 @@
# endif
# else
# ifdef __cpp_lib_latch
-# error "__cpp_lib_latch should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_latch should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch) is not defined!"
# endif
# endif
#elif TEST_STD_VER > 20
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch)
# ifndef __cpp_lib_latch
# error "__cpp_lib_latch should be defined in c++2b"
# endif
@@ -68,7 +68,7 @@
# endif
# else
# ifdef __cpp_lib_latch
-# error "__cpp_lib_latch should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_latch should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch) is not defined!"
# endif
# endif
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.pass.cpp
index febeb6f6c6155..79e31aa06a3f4 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.pass.cpp
@@ -44,7 +44,7 @@
#elif TEST_STD_VER == 20
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore)
# ifndef __cpp_lib_semaphore
# error "__cpp_lib_semaphore should be defined in c++20"
# endif
@@ -53,13 +53,13 @@
# endif
# else
# ifdef __cpp_lib_semaphore
-# error "__cpp_lib_semaphore should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_semaphore should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore) is not defined!"
# endif
# endif
#elif TEST_STD_VER > 20
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore)
# ifndef __cpp_lib_semaphore
# error "__cpp_lib_semaphore should be defined in c++2b"
# endif
@@ -68,7 +68,7 @@
# endif
# else
# ifdef __cpp_lib_semaphore
-# error "__cpp_lib_semaphore should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_semaphore should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore) is not defined!"
# endif
# endif
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp
index 953fd0a37790a..d26a453f83c3d 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp
@@ -41,7 +41,7 @@
# error "__cpp_lib_shared_mutex should not be defined before c++17"
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++14"
# endif
@@ -50,13 +50,13 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!"
# endif
# endif
#elif TEST_STD_VER == 17
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex)
# ifndef __cpp_lib_shared_mutex
# error "__cpp_lib_shared_mutex should be defined in c++17"
# endif
@@ -65,11 +65,11 @@
# endif
# else
# ifdef __cpp_lib_shared_mutex
-# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) is not defined!"
# endif
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++17"
# endif
@@ -78,13 +78,13 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!"
# endif
# endif
#elif TEST_STD_VER == 20
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex)
# ifndef __cpp_lib_shared_mutex
# error "__cpp_lib_shared_mutex should be defined in c++20"
# endif
@@ -93,11 +93,11 @@
# endif
# else
# ifdef __cpp_lib_shared_mutex
-# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) is not defined!"
# endif
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++20"
# endif
@@ -106,13 +106,13 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!"
# endif
# endif
#elif TEST_STD_VER > 20
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex)
# ifndef __cpp_lib_shared_mutex
# error "__cpp_lib_shared_mutex should be defined in c++2b"
# endif
@@ -121,11 +121,11 @@
# endif
# else
# ifdef __cpp_lib_shared_mutex
-# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) is not defined!"
# endif
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++2b"
# endif
@@ -134,7 +134,7 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!"
# endif
# endif
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
index 9e96e2e116e01..1de99be54e309 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
@@ -1133,7 +1133,7 @@
# error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17"
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++14"
# endif
@@ -1142,7 +1142,7 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!"
# endif
# endif
@@ -1534,11 +1534,17 @@
# endif
# endif
-# ifndef __cpp_lib_filesystem
-# error "__cpp_lib_filesystem should be defined in c++17"
-# endif
-# if __cpp_lib_filesystem != 201703L
-# error "__cpp_lib_filesystem should have the value 201703L in c++17"
+# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem)
+# ifndef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should be defined in c++17"
+# endif
+# if __cpp_lib_filesystem != 201703L
+# error "__cpp_lib_filesystem should have the value 201703L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should not be defined when !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) is not defined!"
+# endif
# endif
# ifndef __cpp_lib_gcd_lcm
@@ -1883,7 +1889,7 @@
# error "__cpp_lib_semaphore should not be defined before c++20"
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex)
# ifndef __cpp_lib_shared_mutex
# error "__cpp_lib_shared_mutex should be defined in c++17"
# endif
@@ -1892,7 +1898,7 @@
# endif
# else
# ifdef __cpp_lib_shared_mutex
-# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) is not defined!"
# endif
# endif
@@ -1910,7 +1916,7 @@
# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++17"
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++17"
# endif
@@ -1919,7 +1925,7 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!"
# endif
# endif
@@ -2223,7 +2229,7 @@
# endif
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait)
# ifndef __cpp_lib_atomic_wait
# error "__cpp_lib_atomic_wait should be defined in c++20"
# endif
@@ -2232,11 +2238,11 @@
# endif
# else
# ifdef __cpp_lib_atomic_wait
-# error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) is not defined!"
# endif
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier)
# ifndef __cpp_lib_barrier
# error "__cpp_lib_barrier should be defined in c++20"
# endif
@@ -2245,7 +2251,7 @@
# endif
# else
# ifdef __cpp_lib_barrier
-# error "__cpp_lib_barrier should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_barrier should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier) is not defined!"
# endif
# endif
@@ -2575,11 +2581,17 @@
# endif
# endif
-# ifndef __cpp_lib_filesystem
-# error "__cpp_lib_filesystem should be defined in c++20"
-# endif
-# if __cpp_lib_filesystem != 201703L
-# error "__cpp_lib_filesystem should have the value 201703L in c++20"
+# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem)
+# ifndef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should be defined in c++20"
+# endif
+# if __cpp_lib_filesystem != 201703L
+# error "__cpp_lib_filesystem should have the value 201703L in c++20"
+# endif
+# else
+# ifdef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should not be defined when !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) is not defined!"
+# endif
# endif
# ifndef __cpp_lib_gcd_lcm
@@ -2795,7 +2807,7 @@
# endif
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch)
# ifndef __cpp_lib_latch
# error "__cpp_lib_latch should be defined in c++20"
# endif
@@ -2804,7 +2816,7 @@
# endif
# else
# ifdef __cpp_lib_latch
-# error "__cpp_lib_latch should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_latch should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch) is not defined!"
# endif
# endif
@@ -3019,7 +3031,7 @@
# error "__cpp_lib_scoped_lock should have the value 201703L in c++20"
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore)
# ifndef __cpp_lib_semaphore
# error "__cpp_lib_semaphore should be defined in c++20"
# endif
@@ -3028,11 +3040,11 @@
# endif
# else
# ifdef __cpp_lib_semaphore
-# error "__cpp_lib_semaphore should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_semaphore should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore) is not defined!"
# endif
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex)
# ifndef __cpp_lib_shared_mutex
# error "__cpp_lib_shared_mutex should be defined in c++20"
# endif
@@ -3041,7 +3053,7 @@
# endif
# else
# ifdef __cpp_lib_shared_mutex
-# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) is not defined!"
# endif
# endif
@@ -3059,7 +3071,7 @@
# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++20"
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++20"
# endif
@@ -3068,7 +3080,7 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!"
# endif
# endif
@@ -3429,7 +3441,7 @@
# endif
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait)
# ifndef __cpp_lib_atomic_wait
# error "__cpp_lib_atomic_wait should be defined in c++2b"
# endif
@@ -3438,11 +3450,11 @@
# endif
# else
# ifdef __cpp_lib_atomic_wait
-# error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) is not defined!"
# endif
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier)
# ifndef __cpp_lib_barrier
# error "__cpp_lib_barrier should be defined in c++2b"
# endif
@@ -3451,7 +3463,7 @@
# endif
# else
# ifdef __cpp_lib_barrier
-# error "__cpp_lib_barrier should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_barrier should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier) is not defined!"
# endif
# endif
@@ -3781,11 +3793,17 @@
# endif
# endif
-# ifndef __cpp_lib_filesystem
-# error "__cpp_lib_filesystem should be defined in c++2b"
-# endif
-# if __cpp_lib_filesystem != 201703L
-# error "__cpp_lib_filesystem should have the value 201703L in c++2b"
+# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem)
+# ifndef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should be defined in c++2b"
+# endif
+# if __cpp_lib_filesystem != 201703L
+# error "__cpp_lib_filesystem should have the value 201703L in c++2b"
+# endif
+# else
+# ifdef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should not be defined when !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) is not defined!"
+# endif
# endif
# ifndef __cpp_lib_gcd_lcm
@@ -4004,7 +4022,7 @@
# endif
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch)
# ifndef __cpp_lib_latch
# error "__cpp_lib_latch should be defined in c++2b"
# endif
@@ -4013,7 +4031,7 @@
# endif
# else
# ifdef __cpp_lib_latch
-# error "__cpp_lib_latch should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_latch should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch) is not defined!"
# endif
# endif
@@ -4228,7 +4246,7 @@
# error "__cpp_lib_scoped_lock should have the value 201703L in c++2b"
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore)
# ifndef __cpp_lib_semaphore
# error "__cpp_lib_semaphore should be defined in c++2b"
# endif
@@ -4237,11 +4255,11 @@
# endif
# else
# ifdef __cpp_lib_semaphore
-# error "__cpp_lib_semaphore should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_semaphore should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore) is not defined!"
# endif
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex)
# ifndef __cpp_lib_shared_mutex
# error "__cpp_lib_shared_mutex should be defined in c++2b"
# endif
@@ -4250,7 +4268,7 @@
# endif
# else
# ifdef __cpp_lib_shared_mutex
-# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) is not defined!"
# endif
# endif
@@ -4268,7 +4286,7 @@
# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++2b"
# endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++2b"
# endif
@@ -4277,7 +4295,7 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!"
# endif
# endif
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index 00de15dae24a2..342e15691eb90 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -111,14 +111,14 @@ def add_version_header(tc):
"name": "__cpp_lib_atomic_wait",
"values": { "c++20": 201907 },
"headers": ["atomic"],
- "depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
- "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
+ "depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait)",
+ "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait)",
}, {
"name": "__cpp_lib_barrier",
"values": { "c++20": 201907 },
"headers": ["barrier"],
- "depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
- "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
+ "depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier)",
+ "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier)",
}, {
"name": "__cpp_lib_bind_front",
"values": { "c++20": 201907 },
@@ -270,6 +270,8 @@ def add_version_header(tc):
"name": "__cpp_lib_filesystem",
"values": { "c++17": 201703 },
"headers": ["filesystem"],
+ "depends": "!defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem)",
+ "internal_depends": "!defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem)"
}, {
"name": "__cpp_lib_gcd_lcm",
"values": { "c++17": 201606 },
@@ -383,8 +385,8 @@ def add_version_header(tc):
"name": "__cpp_lib_latch",
"values": { "c++20": 201907 },
"headers": ["latch"],
- "depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
- "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
+ "depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch)",
+ "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch)",
}, {
"name": "__cpp_lib_launder",
"values": { "c++17": 201606 },
@@ -496,14 +498,14 @@ def add_version_header(tc):
"name": "__cpp_lib_semaphore",
"values": { "c++20": 201907 },
"headers": ["semaphore"],
- "depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
- "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
+ "depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore)",
+ "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore)",
}, {
"name": "__cpp_lib_shared_mutex",
"values": { "c++17": 201505 },
"headers": ["shared_mutex"],
- "depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
- "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
+ "depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex)",
+ "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex)",
}, {
"name": "__cpp_lib_shared_ptr_arrays",
"values": { "c++17": 201611 },
@@ -516,8 +518,8 @@ def add_version_header(tc):
"name": "__cpp_lib_shared_timed_mutex",
"values": { "c++14": 201402 },
"headers": ["shared_mutex"],
- "depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
- "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
+ "depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)",
+ "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)",
}, {
"name": "__cpp_lib_shift",
"values": { "c++20": 201806 },
More information about the llvm-branch-commits
mailing list