[libcxx-commits] [libcxx] 76fc357 - [libc++] Make feature-test macros consistent with availability macros
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Feb 4 08:40:37 PST 2021
Author: Louis Dionne
Date: 2021-02-04T11:40:22-05:00
New Revision: 76fc35752d19ac605c1c1fd757af9c7c3bb4a906
URL: https://github.com/llvm/llvm-project/commit/76fc35752d19ac605c1c1fd757af9c7c3bb4a906
DIFF: https://github.com/llvm/llvm-project/commit/76fc35752d19ac605c1c1fd757af9c7c3bb4a906.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
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 db2267c8eb16..cc3b6fabdab1 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 9b37c30d2acd..696a9ef0939a 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -185,7 +185,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
@@ -214,7 +214,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)
@@ -242,7 +244,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
@@ -280,10 +282,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
@@ -328,7 +330,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
@@ -338,7 +340,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 6b7052b2403d..000000000000
--- 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 b964e0c6921e..c8a837115ade 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 b193095403e9..80f7d9ca24b4 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 6e47bdf3b5fe..c361569cb1d6 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 29e8fd617bbf..56db3ba66b45 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 febeb6f6c615..79e31aa06a3f 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 953fd0a37790..d26a453f83c3 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 1bb4928bd552..16a537c5e0e8 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
@@ -1142,7 +1142,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
@@ -1151,7 +1151,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
@@ -1543,11 +1543,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
# ifdef __cpp_lib_format
@@ -1896,7 +1902,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
@@ -1905,7 +1911,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
@@ -1923,7 +1929,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
@@ -1932,7 +1938,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
@@ -2236,7 +2242,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
@@ -2245,11 +2251,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
@@ -2258,7 +2264,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
@@ -2582,11 +2588,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
# if !defined(_LIBCPP_VERSION)
@@ -2815,7 +2827,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
@@ -2824,7 +2836,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
@@ -3039,7 +3051,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
@@ -3048,11 +3060,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
@@ -3061,7 +3073,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
@@ -3079,7 +3091,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
@@ -3088,7 +3100,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
@@ -3449,7 +3461,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
@@ -3458,11 +3470,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
@@ -3471,7 +3483,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
@@ -3795,11 +3807,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
# if !defined(_LIBCPP_VERSION)
@@ -4031,7 +4049,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
@@ -4040,7 +4058,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
@@ -4255,7 +4273,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
@@ -4264,11 +4282,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
@@ -4277,7 +4295,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
@@ -4295,7 +4313,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
@@ -4304,7 +4322,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 5537d9b9f1cc..41d561976425 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 },
@@ -269,6 +269,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_format",
"values": { "c++20": 201907 },
@@ -387,8 +389,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 },
@@ -500,14 +502,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 },
@@ -520,8 +522,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 libcxx-commits
mailing list