[libcxx-commits] [libcxx] [llvm] [libc++] Refactor the configuration macros to being always defined (PR #112094)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 4 11:53:39 PST 2024


https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/112094

>From e27bca339a1adc9ff52fdc110cd33af9b03deec0 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Sat, 12 Oct 2024 14:09:11 +0200
Subject: [PATCH] [libc++] Refactor the configuration macros to being always
 defined

---
 libcxx/CMakeLists.txt                         |  32 +--
 .../docs/DesignDocs/ThreadingSupportAPI.rst   |   6 +-
 libcxx/include/__algorithm/find.h             |   6 +-
 .../__algorithm/lexicographical_compare.h     |   6 +-
 libcxx/include/__algorithm/sort.h             |   4 +-
 libcxx/include/__atomic/aliases.h             |   2 +-
 libcxx/include/__atomic/atomic_sync.h         |   6 +-
 libcxx/include/__atomic/cxx_atomic_impl.h     |   4 +-
 libcxx/include/__chrono/convert_to_tm.h       |   3 +-
 libcxx/include/__chrono/formatter.h           |  24 +--
 .../include/__chrono/high_resolution_clock.h  |   2 +-
 libcxx/include/__chrono/ostream.h             |   8 +-
 .../include/__chrono/parser_std_format_spec.h |   4 +-
 libcxx/include/__chrono/statically_widen.h    |   6 +-
 libcxx/include/__chrono/steady_clock.h        |   2 +-
 libcxx/include/__chrono/time_zone.h           |   7 +-
 libcxx/include/__chrono/time_zone_link.h      |   6 +-
 libcxx/include/__chrono/tzdb.h                |   7 +-
 libcxx/include/__chrono/tzdb_list.h           |   7 +-
 libcxx/include/__chrono/zoned_time.h          |   7 +-
 .../__condition_variable/condition_variable.h |   8 +-
 libcxx/include/__config                       |  61 +++---
 libcxx/include/__config_site.in               |  33 +--
 libcxx/include/__configuration/abi.h          |   8 +-
 libcxx/include/__configuration/availability.h |  12 +-
 libcxx/include/__filesystem/directory_entry.h |   4 +-
 .../include/__filesystem/directory_iterator.h |   4 +-
 libcxx/include/__filesystem/operations.h      |   4 +-
 libcxx/include/__filesystem/path.h            |  28 +--
 .../recursive_directory_iterator.h            |   4 +-
 libcxx/include/__format/concepts.h            |   2 +-
 libcxx/include/__format/format_arg_store.h    |   4 +-
 libcxx/include/__format/format_context.h      |  16 +-
 libcxx/include/__format/format_functions.h    |  38 ++--
 .../include/__format/format_parse_context.h   |   2 +-
 libcxx/include/__format/formatter_bool.h      |   2 +-
 libcxx/include/__format/formatter_char.h      |   8 +-
 .../__format/formatter_floating_point.h       |   8 +-
 libcxx/include/__format/formatter_integral.h  |   8 +-
 libcxx/include/__format/formatter_output.h    |  13 +-
 libcxx/include/__format/formatter_string.h    |   4 +-
 .../include/__format/parser_std_format_spec.h |  24 +--
 libcxx/include/__format/unicode.h             |  12 +-
 libcxx/include/__format/write_escaped.h       |   5 +-
 libcxx/include/__functional/hash.h            |   4 +-
 libcxx/include/__fwd/fstream.h                |   2 +-
 libcxx/include/__fwd/ios.h                    |   2 +-
 libcxx/include/__fwd/istream.h                |   2 +-
 libcxx/include/__fwd/ostream.h                |   2 +-
 libcxx/include/__fwd/sstream.h                |   2 +-
 libcxx/include/__fwd/streambuf.h              |   2 +-
 libcxx/include/__fwd/string.h                 |  10 +-
 libcxx/include/__fwd/string_view.h            |   4 +-
 libcxx/include/__locale                       |  28 +--
 libcxx/include/__locale_dir/locale_base_api.h |   2 +-
 .../locale_base_api/bsd_locale_defaults.h     |   8 +-
 .../locale_base_api/bsd_locale_fallbacks.h    |   8 +-
 libcxx/include/__mbstate_t.h                  |   4 +-
 libcxx/include/__memory/shared_ptr.h          |  12 +-
 .../synchronized_pool_resource.h              |   8 +-
 libcxx/include/__mutex/mutex.h                |   4 +-
 libcxx/include/__ostream/basic_ostream.h      |  10 +-
 libcxx/include/__ostream/print.h              |  22 +-
 libcxx/include/__random/random_device.h       |   4 +-
 libcxx/include/__ranges/istream_view.h        |   2 +-
 .../include/__stop_token/atomic_unique_lock.h |   2 +-
 libcxx/include/__stop_token/stop_callback.h   |   4 +-
 libcxx/include/__stop_token/stop_source.h     |   4 +-
 libcxx/include/__stop_token/stop_state.h      |   4 +-
 libcxx/include/__stop_token/stop_token.h      |   4 +-
 libcxx/include/__string/char_traits.h         |   6 +-
 .../__support/xlocale/__posix_l_fallback.h    |  10 +-
 .../__support/xlocale/__strtonum_fallback.h   |   2 +-
 libcxx/include/__thread/formatter.h           |   4 +-
 libcxx/include/__thread/id.h                  |   4 +-
 libcxx/include/__thread/jthread.h             |   4 +-
 libcxx/include/__thread/support.h             |  12 +-
 libcxx/include/__thread/this_thread.h         |   4 +-
 libcxx/include/__thread/thread.h              |  10 +-
 .../include/__thread/timed_backoff_policy.h   |   4 +-
 libcxx/include/__type_traits/is_integral.h    |   2 +-
 libcxx/include/__vector/vector.h              |   2 +-
 libcxx/include/barrier                        |   4 +-
 libcxx/include/chrono                         |   7 +-
 libcxx/include/codecvt                        |  12 +-
 libcxx/include/complex                        |   6 +-
 libcxx/include/condition_variable             |   4 +-
 libcxx/include/cstdlib                        |   2 +-
 libcxx/include/deque                          |   2 +-
 libcxx/include/format                         |   2 +-
 libcxx/include/fstream                        |   4 +-
 libcxx/include/future                         |   4 +-
 libcxx/include/iomanip                        |   4 +-
 libcxx/include/ios                            |   8 +-
 libcxx/include/iosfwd                         |   6 +-
 libcxx/include/iostream                       |   2 +-
 libcxx/include/istream                        |   6 +-
 libcxx/include/latch                          |   4 +-
 libcxx/include/list                           |   2 +-
 libcxx/include/locale                         |  42 ++--
 libcxx/include/mutex                          |   4 +-
 libcxx/include/ostream                        |   4 +-
 libcxx/include/print                          |  42 ++--
 libcxx/include/ranges                         |   2 +-
 libcxx/include/regex                          |  34 ++--
 libcxx/include/semaphore                      |   4 +-
 libcxx/include/shared_mutex                   |   4 +-
 libcxx/include/sstream                        |   4 +-
 libcxx/include/stdatomic.h                    |   2 +-
 libcxx/include/stop_token                     |   4 +-
 libcxx/include/streambuf                      |   6 +-
 libcxx/include/string                         |  16 +-
 libcxx/include/string_view                    |   4 +-
 libcxx/include/syncstream                     |  20 +-
 libcxx/include/thread                         |   4 +-
 libcxx/include/vector                         |   2 +-
 libcxx/include/version                        |  20 +-
 libcxx/include/wchar.h                        |   4 +-
 libcxx/modules/std.compat.cppm.in             |   2 +-
 libcxx/modules/std.compat/clocale.inc         |   4 +-
 libcxx/modules/std.compat/cstdlib.inc         |   2 +-
 libcxx/modules/std.compat/cwchar.inc          |   4 +-
 libcxx/modules/std.compat/cwctype.inc         |   4 +-
 libcxx/modules/std.cppm.in                    |  28 +--
 libcxx/modules/std/atomic.inc                 |   2 +-
 libcxx/modules/std/barrier.inc                |   4 +-
 libcxx/modules/std/chrono.inc                 |  20 +-
 libcxx/modules/std/clocale.inc                |   4 +-
 libcxx/modules/std/codecvt.inc                |   4 +-
 libcxx/modules/std/complex.inc                |   4 +-
 libcxx/modules/std/condition_variable.inc     |   4 +-
 libcxx/modules/std/cstdlib.inc                |   2 +-
 libcxx/modules/std/cwchar.inc                 |   4 +-
 libcxx/modules/std/cwctype.inc                |   4 +-
 libcxx/modules/std/filesystem.inc             |  12 +-
 libcxx/modules/std/format.inc                 |  10 +-
 libcxx/modules/std/fstream.inc                |  14 +-
 libcxx/modules/std/future.inc                 |   4 +-
 libcxx/modules/std/iomanip.inc                |   4 +-
 libcxx/modules/std/ios.inc                    |   6 +-
 libcxx/modules/std/iosfwd.inc                 |   4 +-
 libcxx/modules/std/iostream.inc               |   6 +-
 libcxx/modules/std/istream.inc                |   8 +-
 libcxx/modules/std/latch.inc                  |   4 +-
 libcxx/modules/std/locale.inc                 |   4 +-
 libcxx/modules/std/memory.inc                 |   4 +-
 libcxx/modules/std/mutex.inc                  |   4 +-
 libcxx/modules/std/ostream.inc                |  10 +-
 libcxx/modules/std/print.inc                  |   4 +-
 libcxx/modules/std/random.inc                 |   2 +-
 libcxx/modules/std/ranges.inc                 |   6 +-
 libcxx/modules/std/regex.inc                  |  16 +-
 libcxx/modules/std/semaphore.inc              |   4 +-
 libcxx/modules/std/shared_mutex.inc           |   4 +-
 libcxx/modules/std/spanstream.inc             |   8 +-
 libcxx/modules/std/sstream.inc                |  12 +-
 libcxx/modules/std/stop_token.inc             |   4 +-
 libcxx/modules/std/streambuf.inc              |   6 +-
 libcxx/modules/std/string.inc                 |   6 +-
 libcxx/modules/std/string_view.inc            |   2 +-
 libcxx/modules/std/strstream.inc              |   4 +-
 libcxx/modules/std/syncstream.inc             |   8 +-
 libcxx/modules/std/thread.inc                 |   8 +-
 libcxx/src/algorithm.cpp                      |   2 +-
 libcxx/src/call_once.cpp                      |  10 +-
 libcxx/src/chrono.cpp                         |   4 +-
 .../include/tzdb/tzdb_list_private.h          |  12 +-
 libcxx/src/filesystem/time_utils.h            |   4 +-
 libcxx/src/include/atomic_support.h           |   8 +-
 libcxx/src/include/config_elast.h             |   2 +-
 libcxx/src/ios.cpp                            |   2 +-
 libcxx/src/ios.instantiations.cpp             |   4 +-
 libcxx/src/iostream.cpp                       |  20 +-
 libcxx/src/locale.cpp                         | 188 +++++++++---------
 libcxx/src/memory.cpp                         |   6 +-
 libcxx/src/memory_resource.cpp                |   4 +-
 libcxx/src/ostream.cpp                        |   4 +-
 libcxx/src/print.cpp                          |   4 +-
 libcxx/src/random_shuffle.cpp                 |   8 +-
 libcxx/src/std_stream.h                       |   6 +-
 libcxx/src/string.cpp                         |  26 +--
 libcxx/src/system_error.cpp                   |   6 +-
 .../std_format_spec_string_unicode.bench.cpp  |   4 +-
 ...ormat_spec_string_unicode_escape.bench.cpp |   4 +-
 .../depr/depr.c.headers/extern_c.pass.cpp     |   6 +-
 .../feature_test_macro/ftm_metadata.sh.py     |   4 +-
 .../libcxx/feature_test_macro/test_data.json  |   5 +-
 .../feature_test_macro/version_header.sh.py   |   4 +-
 .../version_header_implementation.sh.py       |   4 +-
 libcxx/test/libcxx/include_as_c.sh.cpp        |  14 +-
 ...lity-with-pedantic-errors.compile.pass.cpp |   2 +-
 .../format.functions.tests.h                  |   6 +-
 .../barrier.version.compile.pass.cpp          |  12 +-
 .../filesystem.version.compile.pass.cpp       |  16 +-
 .../fstream.version.compile.pass.cpp          |   4 +-
 .../iomanip.version.compile.pass.cpp          |  20 +-
 .../latch.version.compile.pass.cpp            |  12 +-
 .../mutex.version.compile.pass.cpp            |  16 +-
 .../semaphore.version.compile.pass.cpp        |  12 +-
 .../shared_mutex.version.compile.pass.cpp     |  36 ++--
 .../stop_token.version.compile.pass.cpp       |  12 +-
 .../thread.version.compile.pass.cpp           |  12 +-
 .../version.version.compile.pass.cpp          | 140 ++++++-------
 .../format.functions.tests.h                  |   6 +-
 .../format.functions.tests.h                  |   6 +-
 .../format.functions.tests.h                  |   4 +-
 libcxx/test/support/filesystem_test_helper.h  |   2 +-
 libcxx/test/support/test_macros.h             |  20 +-
 .../clang_tidy_checks/internal_ftm_use.cpp    |  24 ---
 .../generate_feature_test_macro_components.py |  40 ++--
 libcxx/utils/libcxx/header_information.py     |  28 +--
 libcxx/utils/libcxx/test/dsl.py               |   2 +-
 libcxx/utils/libcxx/test/features.py          |  51 +++--
 runtimes/cmake/Modules/HandleFlags.cmake      |   6 -
 214 files changed, 1052 insertions(+), 1072 deletions(-)

diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 95a7d10f055ea7..93fc7b1aeec433 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -734,26 +734,26 @@ endfunction()
 # Configuration file flags =====================================================
 config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION)
 config_define(${LIBCXX_ABI_NAMESPACE} _LIBCPP_ABI_NAMESPACE)
-config_define_if(LIBCXX_ABI_FORCE_ITANIUM _LIBCPP_ABI_FORCE_ITANIUM)
-config_define_if(LIBCXX_ABI_FORCE_MICROSOFT _LIBCPP_ABI_FORCE_MICROSOFT)
-config_define_if_not(LIBCXX_ENABLE_THREADS _LIBCPP_HAS_NO_THREADS)
-config_define_if_not(LIBCXX_ENABLE_MONOTONIC_CLOCK _LIBCPP_HAS_NO_MONOTONIC_CLOCK)
-config_define_if_not(LIBCXX_HAS_TERMINAL_AVAILABLE _LIBCPP_HAS_NO_TERMINAL)
+config_define(${LIBCXX_ABI_FORCE_ITANIUM} _LIBCPP_ABI_FORCE_ITANIUM)
+config_define(${LIBCXX_ABI_FORCE_MICROSOFT} _LIBCPP_ABI_FORCE_MICROSOFT)
+config_define(${LIBCXX_ENABLE_THREADS} _LIBCPP_HAS_THREADS)
+config_define(${LIBCXX_ENABLE_MONOTONIC_CLOCK} _LIBCPP_HAS_MONOTONIC_CLOCK)
+config_define(${LIBCXX_HAS_TERMINAL_AVAILABLE} _LIBCPP_HAS_TERMINAL)
 if (NOT LIBCXX_TYPEINFO_COMPARISON_IMPLEMENTATION STREQUAL "default")
   config_define("${LIBCXX_TYPEINFO_COMPARISON_IMPLEMENTATION}" _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION)
 endif()
-config_define_if(LIBCXX_HAS_PTHREAD_API _LIBCPP_HAS_THREAD_API_PTHREAD)
-config_define_if(LIBCXX_HAS_EXTERNAL_THREAD_API _LIBCPP_HAS_THREAD_API_EXTERNAL)
-config_define_if(LIBCXX_HAS_WIN32_THREAD_API _LIBCPP_HAS_THREAD_API_WIN32)
-config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC)
+config_define(${LIBCXX_HAS_PTHREAD_API} _LIBCPP_HAS_THREAD_API_PTHREAD)
+config_define(${LIBCXX_HAS_EXTERNAL_THREAD_API} _LIBCPP_HAS_THREAD_API_EXTERNAL)
+config_define(${LIBCXX_HAS_WIN32_THREAD_API} _LIBCPP_HAS_THREAD_API_WIN32)
+config_define(${LIBCXX_HAS_MUSL_LIBC} _LIBCPP_HAS_MUSL_LIBC)
 config_define_if(LIBCXX_NO_VCRUNTIME _LIBCPP_NO_VCRUNTIME)
-config_define_if_not(LIBCXX_ENABLE_FILESYSTEM _LIBCPP_HAS_NO_FILESYSTEM)
-config_define_if_not(LIBCXX_ENABLE_RANDOM_DEVICE _LIBCPP_HAS_NO_RANDOM_DEVICE)
-config_define_if_not(LIBCXX_ENABLE_LOCALIZATION _LIBCPP_HAS_NO_LOCALIZATION)
-config_define_if_not(LIBCXX_ENABLE_UNICODE _LIBCPP_HAS_NO_UNICODE)
-config_define_if_not(LIBCXX_ENABLE_WIDE_CHARACTERS _LIBCPP_HAS_NO_WIDE_CHARACTERS)
-config_define_if_not(LIBCXX_ENABLE_TIME_ZONE_DATABASE _LIBCPP_HAS_NO_TIME_ZONE_DATABASE)
-config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
+config_define(${LIBCXX_ENABLE_FILESYSTEM} _LIBCPP_HAS_FILESYSTEM)
+config_define(${LIBCXX_ENABLE_RANDOM_DEVICE} _LIBCPP_HAS_RANDOM_DEVICE)
+config_define(${LIBCXX_ENABLE_LOCALIZATION} _LIBCPP_HAS_LOCALIZATION)
+config_define(${LIBCXX_ENABLE_UNICODE} _LIBCPP_HAS_UNICODE)
+config_define(${LIBCXX_ENABLE_WIDE_CHARACTERS} _LIBCPP_HAS_WIDE_CHARACTERS)
+config_define(${LIBCXX_ENABLE_TIME_ZONE_DATABASE} _LIBCPP_HAS_TIME_ZONE_DATABASE)
+config_define(${LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS} _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS)
 
 # TODO: Remove in LLVM 21. We're leaving an error to make this fail explicitly.
 if (LIBCXX_ENABLE_ASSERTIONS)
diff --git a/libcxx/docs/DesignDocs/ThreadingSupportAPI.rst b/libcxx/docs/DesignDocs/ThreadingSupportAPI.rst
index e7f3de54e6782a..d103c49e25952f 100644
--- a/libcxx/docs/DesignDocs/ThreadingSupportAPI.rst
+++ b/libcxx/docs/DesignDocs/ThreadingSupportAPI.rst
@@ -45,9 +45,9 @@ API but leaves out the implementation.
 Threading Configuration Macros
 ==============================
 
-**_LIBCPP_HAS_NO_THREADS**
-  This macro is defined when libc++ is built without threading support. It
-  should not be manually defined by the user.
+**_LIBCPP_HAS_THREADS**
+  This macro is set to 1 when libc++ is built with threading support. Otherwise
+  it is set to 0. It should not be manually defined by the user.
 
 **_LIBCPP_HAS_THREAD_API_EXTERNAL**
   This macro is defined when libc++ should use the ``<__external_threading>``
diff --git a/libcxx/include/__algorithm/find.h b/libcxx/include/__algorithm/find.h
index 6f23ec3f6fc69d..14b8a7804887b0 100644
--- a/libcxx/include/__algorithm/find.h
+++ b/libcxx/include/__algorithm/find.h
@@ -29,7 +29,7 @@
 #include <__utility/move.h>
 #include <limits>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 #  include <cwchar>
 #endif
 
@@ -65,7 +65,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find(_Tp* __first, _T
   return __last;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class _Tp,
           class _Up,
           class _Proj,
@@ -77,7 +77,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find(_Tp* __first, _T
     return __ret;
   return __last;
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // TODO: This should also be possible to get right with different signedness
 // cast integral types to allow vectorization
diff --git a/libcxx/include/__algorithm/lexicographical_compare.h b/libcxx/include/__algorithm/lexicographical_compare.h
index 1de3ca13e1b45c..ebe7e3b56a292e 100644
--- a/libcxx/include/__algorithm/lexicographical_compare.h
+++ b/libcxx/include/__algorithm/lexicographical_compare.h
@@ -26,7 +26,7 @@
 #include <__type_traits/is_trivially_lexicographically_comparable.h>
 #include <__type_traits/is_volatile.h>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 #  include <cwchar>
 #endif
 
@@ -78,14 +78,14 @@ __lexicographical_compare(_Tp* __first1, _Tp* __last1, _Tp* __first2, _Tp* __las
       return __last1 - __first1 < __last2 - __first2;
     return __res < 0;
   }
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   else if constexpr (is_same<__remove_cv_t<_Tp>, wchar_t>::value) {
     auto __res = std::__constexpr_wmemcmp(__first1, __first2, std::min(__last1 - __first1, __last2 - __first2));
     if (__res == 0)
       return __last1 - __first1 < __last2 - __first2;
     return __res < 0;
   }
-#  endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  endif // _LIBCPP_HAS_WIDE_CHARACTERS
   else {
     auto __res = std::mismatch(__first1, __last1, __first2, __last2);
     if (__res.second == __last2)
diff --git a/libcxx/include/__algorithm/sort.h b/libcxx/include/__algorithm/sort.h
index 39868b8b6a30ae..ed828b6d723147 100644
--- a/libcxx/include/__algorithm/sort.h
+++ b/libcxx/include/__algorithm/sort.h
@@ -851,7 +851,7 @@ template <class _Comp, class _RandomAccessIterator>
 void __sort(_RandomAccessIterator, _RandomAccessIterator, _Comp);
 
 extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<char>&, char*>(char*, char*, __less<char>&);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
 #endif
 extern template _LIBCPP_EXPORTED_FROM_ABI void
@@ -896,7 +896,7 @@ template <class _Type>
 using __sort_is_specialized_in_library = __is_any_of<
     _Type,
     char,
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
     wchar_t,
 #endif
     signed char,
diff --git a/libcxx/include/__atomic/aliases.h b/libcxx/include/__atomic/aliases.h
index 3c84747bebb816..37d11dd0aabf36 100644
--- a/libcxx/include/__atomic/aliases.h
+++ b/libcxx/include/__atomic/aliases.h
@@ -43,7 +43,7 @@ using atomic_char8_t = atomic<char8_t>;
 #endif
 using atomic_char16_t = atomic<char16_t>;
 using atomic_char32_t = atomic<char32_t>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 using atomic_wchar_t = atomic<wchar_t>;
 #endif
 
diff --git a/libcxx/include/__atomic/atomic_sync.h b/libcxx/include/__atomic/atomic_sync.h
index aaf81f58731a98..08f3497fef9f45 100644
--- a/libcxx/include/__atomic/atomic_sync.h
+++ b/libcxx/include/__atomic/atomic_sync.h
@@ -69,7 +69,7 @@ struct __atomic_wait_poll_impl {
   }
 };
 
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
 
 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile*) _NOEXCEPT;
 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile*) _NOEXCEPT;
@@ -163,7 +163,7 @@ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void __atomic_notify_all(const _
   std::__cxx_atomic_notify_all(__atomic_waitable_traits<__decay_t<_AtomicWaitable> >::__atomic_contention_address(__a));
 }
 
-#else // _LIBCPP_HAS_NO_THREADS
+#else // _LIBCPP_HAS_THREADS
 
 template <class _AtomicWaitable, class _Poll>
 _LIBCPP_HIDE_FROM_ABI void __atomic_wait_unless(const _AtomicWaitable& __a, _Poll&& __poll, memory_order __order) {
@@ -177,7 +177,7 @@ _LIBCPP_HIDE_FROM_ABI void __atomic_notify_one(const _AtomicWaitable&) {}
 template <class _AtomicWaitable>
 _LIBCPP_HIDE_FROM_ABI void __atomic_notify_all(const _AtomicWaitable&) {}
 
-#endif // _LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 
 template <typename _Tp>
 _LIBCPP_HIDE_FROM_ABI bool __cxx_nonatomic_compare_equal(_Tp const& __lhs, _Tp const& __rhs) {
diff --git a/libcxx/include/__atomic/cxx_atomic_impl.h b/libcxx/include/__atomic/cxx_atomic_impl.h
index 86a57d1d5d8ff2..acffb0fa8f5d9f 100644
--- a/libcxx/include/__atomic/cxx_atomic_impl.h
+++ b/libcxx/include/__atomic/cxx_atomic_impl.h
@@ -25,7 +25,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
+#if _LIBCPP_HAS_GCC_ATOMIC_IMP
 
 // [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because
 // the default operator= in an object is not volatile, a byte-by-byte copy
@@ -260,7 +260,7 @@ __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_o
 
 #  define __cxx_atomic_is_lock_free(__s) __atomic_is_lock_free(__s, 0)
 
-#elif defined(_LIBCPP_HAS_C_ATOMIC_IMP)
+#elif _LIBCPP_HAS_C_ATOMIC_IMP
 
 template <typename _Tp>
 struct __cxx_atomic_base_impl {
diff --git a/libcxx/include/__chrono/convert_to_tm.h b/libcxx/include/__chrono/convert_to_tm.h
index 3a51019b80784a..5f1b2632f629a5 100644
--- a/libcxx/include/__chrono/convert_to_tm.h
+++ b/libcxx/include/__chrono/convert_to_tm.h
@@ -180,8 +180,7 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _ChronoT& __value) {
     // Has no time information.
   } else if constexpr (same_as<_ChronoT, chrono::local_info>) {
     // Has no time information.
-#    if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&                          \
-        !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#    if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
   } else if constexpr (__is_specialization_v<_ChronoT, chrono::zoned_time>) {
     return std::__convert_to_tm<_Tm>(
         chrono::sys_time<typename _ChronoT::duration>{__value.get_local_time().time_since_epoch()});
diff --git a/libcxx/include/__chrono/formatter.h b/libcxx/include/__chrono/formatter.h
index 8389e2cbf9e595..c1b57209b938d9 100644
--- a/libcxx/include/__chrono/formatter.h
+++ b/libcxx/include/__chrono/formatter.h
@@ -12,7 +12,7 @@
 
 #include <__config>
 
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
 
 #  include <__algorithm/ranges_copy.h>
 #  include <__chrono/calendar.h>
@@ -143,8 +143,7 @@ __format_sub_seconds(basic_stringstream<_CharT>& __sstr, const chrono::hh_mm_ss<
                    __value.fractional_width);
 }
 
-#    if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) &&                   \
-        !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#    if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
 template <class _CharT, class _Duration, class _TimeZonePtr>
 _LIBCPP_HIDE_FROM_ABI void
 __format_sub_seconds(basic_stringstream<_CharT>& __sstr, const chrono::zoned_time<_Duration, _TimeZonePtr>& __value) {
@@ -156,8 +155,7 @@ template <class _Tp>
 consteval bool __use_fraction() {
   if constexpr (__is_time_point<_Tp>)
     return chrono::hh_mm_ss<typename _Tp::duration>::fractional_width;
-#    if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) &&                   \
-        !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#    if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
   else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
     return chrono::hh_mm_ss<typename _Tp::duration>::fractional_width;
 #    endif
@@ -232,7 +230,7 @@ _LIBCPP_HIDE_FROM_ABI __time_zone __convert_to_time_zone([[maybe_unused]] const
 #    if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
   if constexpr (same_as<_Tp, chrono::sys_info>)
     return {__value.abbrev, __value.offset};
-#      if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#      if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
   else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
     return __formatter::__convert_to_time_zone(__value.get_info());
 #      endif
@@ -450,7 +448,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_ok(const _Tp& __value) {
     return true;
   else if constexpr (same_as<_Tp, chrono::local_info>)
     return true;
-#      if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#      if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
   else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
     return true;
 #      endif
@@ -500,7 +498,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_name_ok(const _Tp& __value) {
     return true;
   else if constexpr (same_as<_Tp, chrono::local_info>)
     return true;
-#      if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#      if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
   else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
     return true;
 #      endif
@@ -550,7 +548,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __date_ok(const _Tp& __value) {
     return true;
   else if constexpr (same_as<_Tp, chrono::local_info>)
     return true;
-#      if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#      if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
   else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
     return true;
 #      endif
@@ -600,7 +598,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __month_name_ok(const _Tp& __value) {
     return true;
   else if constexpr (same_as<_Tp, chrono::local_info>)
     return true;
-#      if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#      if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
   else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
     return true;
 #      endif
@@ -964,7 +962,7 @@ struct formatter<chrono::local_info, _CharT> : public __formatter_chrono<_CharT>
     return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags{});
   }
 };
-#      if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#      if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
 // Note due to how libc++'s formatters are implemented there is no need to add
 // the exposition only local-time-format-t abstraction.
 template <class _Duration, class _TimeZonePtr, __fmt_char_type _CharT>
@@ -977,13 +975,13 @@ struct formatter<chrono::zoned_time<_Duration, _TimeZonePtr>, _CharT> : public _
     return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__clock);
   }
 };
-#      endif // !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#      endif // _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
 #    endif   // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
 
 #  endif // if _LIBCPP_STD_VER >= 20
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // !_LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 
 #endif //  _LIBCPP___CHRONO_FORMATTER_H
diff --git a/libcxx/include/__chrono/high_resolution_clock.h b/libcxx/include/__chrono/high_resolution_clock.h
index 0697fd2de9b4de..d324c7f0283bfe 100644
--- a/libcxx/include/__chrono/high_resolution_clock.h
+++ b/libcxx/include/__chrono/high_resolution_clock.h
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 namespace chrono {
 
-#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
+#if _LIBCPP_HAS_MONOTONIC_CLOCK
 typedef steady_clock high_resolution_clock;
 #else
 typedef system_clock high_resolution_clock;
diff --git a/libcxx/include/__chrono/ostream.h b/libcxx/include/__chrono/ostream.h
index 3420fb12bcdb0b..ca6d1605d0f87e 100644
--- a/libcxx/include/__chrono/ostream.h
+++ b/libcxx/include/__chrono/ostream.h
@@ -12,7 +12,7 @@
 
 #include <__config>
 
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
 
 #  include <__chrono/calendar.h>
 #  include <__chrono/day.h>
@@ -86,7 +86,7 @@ _LIBCPP_HIDE_FROM_ABI auto __units_suffix() {
   else if constexpr (same_as<typename _Period::type, nano>)
     return _LIBCPP_STATICALLY_WIDEN(_CharT, "ns");
   else if constexpr (same_as<typename _Period::type, micro>)
-#    ifndef _LIBCPP_HAS_NO_UNICODE
+#    if _LIBCPP_HAS_UNICODE
     return _LIBCPP_STATICALLY_WIDEN(_CharT, "\u00b5s");
 #    else
     return _LIBCPP_STATICALLY_WIDEN(_CharT, "us");
@@ -307,7 +307,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const local_info& __info) {
              _LIBCPP_STATICALLY_WIDEN(_CharT, "{}: {{{}, {}}}"), __result(), __info.first, __info.second);
 }
 
-#      if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#      if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
 template <class _CharT, class _Traits, class _Duration, class _TimeZonePtr>
 _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, const zoned_time<_Duration, _TimeZonePtr>& __tp) {
@@ -322,6 +322,6 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const zoned_time<_Duration, _Ti
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // !_LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 
 #endif // _LIBCPP___CHRONO_OSTREAM_H
diff --git a/libcxx/include/__chrono/parser_std_format_spec.h b/libcxx/include/__chrono/parser_std_format_spec.h
index c9cfcc6d572f41..3976864c12b983 100644
--- a/libcxx/include/__chrono/parser_std_format_spec.h
+++ b/libcxx/include/__chrono/parser_std_format_spec.h
@@ -12,7 +12,7 @@
 
 #include <__config>
 
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 
 #  include <__format/concepts.h>
 #  include <__format/format_error.h>
@@ -416,6 +416,6 @@ class _LIBCPP_TEMPLATE_VIS __parser_chrono {
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#endif // _LIBCPP_HAS_LOCALIZATION
 
 #endif // _LIBCPP___CHRONO_PARSER_STD_FORMAT_SPEC_H
diff --git a/libcxx/include/__chrono/statically_widen.h b/libcxx/include/__chrono/statically_widen.h
index 680483a59ac2c4..40e085633b8c16 100644
--- a/libcxx/include/__chrono/statically_widen.h
+++ b/libcxx/include/__chrono/statically_widen.h
@@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 #if _LIBCPP_STD_VER >= 20
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <__fmt_char_type _CharT>
 _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __str, const wchar_t* __wstr) {
   if constexpr (same_as<_CharT, char>)
@@ -33,7 +33,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __s
     return __wstr;
 }
 #    define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str, L##__str)
-#  else // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  else // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // Without this indirection the unit test test/libcxx/modules_include.sh.cpp
 // fails for the CI build "No wide characters". This seems like a bug.
@@ -43,7 +43,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __s
   return __str;
 }
 #    define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str)
-#  endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 #endif // _LIBCPP_STD_VER >= 20
 
diff --git a/libcxx/include/__chrono/steady_clock.h b/libcxx/include/__chrono/steady_clock.h
index 612a7f156e6343..1b247b2c286094 100644
--- a/libcxx/include/__chrono/steady_clock.h
+++ b/libcxx/include/__chrono/steady_clock.h
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 namespace chrono {
 
-#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
+#if _LIBCPP_HAS_MONOTONIC_CLOCK
 class _LIBCPP_EXPORTED_FROM_ABI steady_clock {
 public:
   typedef nanoseconds duration;
diff --git a/libcxx/include/__chrono/time_zone.h b/libcxx/include/__chrono/time_zone.h
index de11dac1eef0c2..3bfe482a146244 100644
--- a/libcxx/include/__chrono/time_zone.h
+++ b/libcxx/include/__chrono/time_zone.h
@@ -37,8 +37,7 @@ _LIBCPP_PUSH_MACROS
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#  if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&   \
-      !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
 
 namespace chrono {
 
@@ -170,8 +169,8 @@ operator<=>(const time_zone& __x, const time_zone& __y) noexcept {
 
 } // namespace chrono
 
-#  endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
-         // && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
+         // _LIBCPP_HAS_LOCALIZATION
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__chrono/time_zone_link.h b/libcxx/include/__chrono/time_zone_link.h
index 7b15f6ae39278e..a408bff5decc1f 100644
--- a/libcxx/include/__chrono/time_zone_link.h
+++ b/libcxx/include/__chrono/time_zone_link.h
@@ -31,8 +31,7 @@ _LIBCPP_PUSH_MACROS
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#  if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&   \
-      !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
 
 namespace chrono {
 
@@ -68,7 +67,8 @@ operator<=>(const time_zone_link& __x, const time_zone_link& __y) noexcept {
 
 } // namespace chrono
 
-#  endif // _LIBCPP_STD_VER >= 20
+#  endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
+         // _LIBCPP_HAS_LOCALIZATION
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__chrono/tzdb.h b/libcxx/include/__chrono/tzdb.h
index 5bbb82f4424171..8052043e647655 100644
--- a/libcxx/include/__chrono/tzdb.h
+++ b/libcxx/include/__chrono/tzdb.h
@@ -36,8 +36,7 @@ _LIBCPP_PUSH_MACROS
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#  if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&   \
-      !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
 
 namespace chrono {
 
@@ -85,8 +84,8 @@ struct tzdb {
 
 } // namespace chrono
 
-#  endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
-         // && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
+         // _LIBCPP_HAS_LOCALIZATION
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__chrono/tzdb_list.h b/libcxx/include/__chrono/tzdb_list.h
index 18446d9926d9dc..9c507764c97a7a 100644
--- a/libcxx/include/__chrono/tzdb_list.h
+++ b/libcxx/include/__chrono/tzdb_list.h
@@ -29,8 +29,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#  if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&   \
-      !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
 
 namespace chrono {
 
@@ -99,8 +98,8 @@ _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const tzdb& reload_tzdb();
 
 } // namespace chrono
 
-#  endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
-         // && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
+         // _LIBCPP_HAS_LOCALIZATION
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__chrono/zoned_time.h b/libcxx/include/__chrono/zoned_time.h
index c7252cb003b8e4..272fa047426758 100644
--- a/libcxx/include/__chrono/zoned_time.h
+++ b/libcxx/include/__chrono/zoned_time.h
@@ -40,8 +40,7 @@ _LIBCPP_PUSH_MACROS
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#  if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&   \
-      !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
 
 namespace chrono {
 
@@ -217,8 +216,8 @@ operator==(const zoned_time<_Duration1, _TimeZonePtr>& __lhs, const zoned_time<_
 
 } // namespace chrono
 
-#  endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
-         // && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
+         // _LIBCPP_HAS_LOCALIZATION
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__condition_variable/condition_variable.h b/libcxx/include/__condition_variable/condition_variable.h
index 61412541b4b51a..499e6f0f295dd3 100644
--- a/libcxx/include/__condition_variable/condition_variable.h
+++ b/libcxx/include/__condition_variable/condition_variable.h
@@ -33,7 +33,7 @@ _LIBCPP_PUSH_MACROS
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
 
 // enum class cv_status
 _LIBCPP_DECLARE_STRONG_ENUM(cv_status){no_timeout, timeout};
@@ -91,7 +91,7 @@ class _LIBCPP_EXPORTED_FROM_ABI condition_variable {
   _LIBCPP_HIDE_FROM_ABI void
   __do_timed_wait(unique_lock<mutex>& __lk, chrono::time_point<_Clock, chrono::nanoseconds>) _NOEXCEPT;
 };
-#endif // !_LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 
 template <class _Rep, class _Period, __enable_if_t<is_floating_point<_Rep>::value, int> = 0>
 inline _LIBCPP_HIDE_FROM_ABI chrono::nanoseconds __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) {
@@ -140,7 +140,7 @@ inline _LIBCPP_HIDE_FROM_ABI chrono::nanoseconds __safe_nanosecond_cast(chrono::
   return nanoseconds(__result);
 }
 
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
 template <class _Predicate>
 void condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred) {
   while (!__pred())
@@ -235,7 +235,7 @@ inline void condition_variable::__do_timed_wait(unique_lock<mutex>& __lk,
   wait_for(__lk, __tp - _Clock::now());
 }
 
-#endif // _LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 308dcc998fc1c8..a2a1aa2b2978df 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -806,10 +806,10 @@ typedef __char32_t char32_t;
 
 // Thread API
 // clang-format off
-#  if !defined(_LIBCPP_HAS_NO_THREADS) &&                                                                              \
-      !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) &&                                                                      \
-      !defined(_LIBCPP_HAS_THREAD_API_WIN32) &&                                                                        \
-      !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
+#  if _LIBCPP_HAS_THREADS &&                                                                                           \
+      !_LIBCPP_HAS_THREAD_API_PTHREAD &&                                                                               \
+      !_LIBCPP_HAS_THREAD_API_WIN32 &&                                                                                 \
+      !_LIBCPP_HAS_THREAD_API_EXTERNAL
 
 #    if defined(__FreeBSD__) ||                                                                                        \
         defined(__wasi__) ||                                                                                           \
@@ -823,18 +823,21 @@ typedef __char32_t char32_t;
         defined(_AIX) ||                                                                                               \
         defined(__EMSCRIPTEN__)
 // clang-format on
-#      define _LIBCPP_HAS_THREAD_API_PTHREAD
+#      undef _LIBCPP_HAS_THREAD_API_PTHREAD
+#      define _LIBCPP_HAS_THREAD_API_PTHREAD 1
 #    elif defined(__Fuchsia__)
 // TODO(44575): Switch to C11 thread API when possible.
-#      define _LIBCPP_HAS_THREAD_API_PTHREAD
+#      undef _LIBCPP_HAS_THREAD_API_PTHREAD
+#      define _LIBCPP_HAS_THREAD_API_PTHREAD 1
 #    elif defined(_LIBCPP_WIN32API)
-#      define _LIBCPP_HAS_THREAD_API_WIN32
+#      undef _LIBCPP_HAS_THREAD_API_WIN32
+#      define _LIBCPP_HAS_THREAD_API_WIN32 1
 #    else
 #      error "No thread API"
 #    endif // _LIBCPP_HAS_THREAD_API
-#  endif   // _LIBCPP_HAS_NO_THREADS
+#  endif   // _LIBCPP_HAS_THREADS
 
-#  if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
+#  if _LIBCPP_HAS_THREAD_API_PTHREAD
 #    if defined(__ANDROID__) && __ANDROID_API__ >= 30
 #      define _LIBCPP_HAS_COND_CLOCKWAIT 1
 #    elif defined(_LIBCPP_GLIBC_PREREQ)
@@ -850,22 +853,19 @@ typedef __char32_t char32_t;
 #    define _LIBCPP_HAS_COND_CLOCKWAIT 0
 #  endif
 
-#  if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
-#    error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \
-       _LIBCPP_HAS_NO_THREADS is not defined.
+#  if !_LIBCPP_HAS_THREADS && _LIBCPP_HAS_THREAD_API_PTHREAD
+#    error _LIBCPP_HAS_THREAD_API_PTHREAD may only be true when _LIBCPP_HAS_THREADS is true.
 #  endif
 
-#  if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
-#    error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \
-       _LIBCPP_HAS_NO_THREADS is defined.
+#  if !_LIBCPP_HAS_THREADS && _LIBCPP_HAS_THREAD_API_EXTERNAL
+#    error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be true when _LIBCPP_HAS_THREADS is true.
 #  endif
 
-#  if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS)
-#    error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \
-       _LIBCPP_HAS_NO_THREADS is defined.
+#  if !_LIBCPP_HAS_MONOTONIC_CLOCK && _LIBCPP_HAS_THREADS
+#    error _LIBCPP_HAS_MONOTONIC_CLOCK may only be false when _LIBCPP_HAS_THREADS is false.
 #  endif
 
-#  if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__)
+#  if _LIBCPP_HAS_THREADS && !defined(__STDCPP_THREADS__)
 #    define __STDCPP_THREADS__ 1
 #  endif
 
@@ -880,9 +880,9 @@ typedef __char32_t char32_t;
 // TODO(EricWF): Enable this optimization on Bionic after speaking to their
 //               respective stakeholders.
 // clang-format off
-#  if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) ||                                               \
-      (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) ||                                                 \
-       defined(_LIBCPP_HAS_THREAD_API_WIN32)
+#  if (_LIBCPP_HAS_THREAD_API_PTHREAD && defined(__GLIBC__)) ||                                                        \
+      (_LIBCPP_HAS_THREAD_API_C11 && defined(__Fuchsia__)) ||                                                          \
+       _LIBCPP_HAS_THREAD_API_WIN32
 // clang-format on
 #    define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION 1
 #  else
@@ -897,25 +897,28 @@ typedef __char32_t char32_t;
 //
 // TODO(EricWF): This is potentially true for some pthread implementations
 // as well.
-#  if (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) || defined(_LIBCPP_HAS_THREAD_API_WIN32)
+#  if (_LIBCPP_HAS_THREAD_API_C11 && defined(__Fuchsia__)) || _LIBCPP_HAS_THREAD_API_WIN32
 #    define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION 1
 #  else
 #    define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION 0
 #  endif
 
 #  if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) ||                        \
-      defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__) || defined(__LLVM_LIBC__)
+      _LIBCPP_HAS_MUSL_LIBC || defined(__OpenBSD__) || defined(__LLVM_LIBC__)
 #    define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
 #  endif
 
 #  if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
-#    define _LIBCPP_HAS_C_ATOMIC_IMP
+#    define _LIBCPP_HAS_C_ATOMIC_IMP 1
+#    define _LIBCPP_HAS_GCC_ATOMIC_IMP 0
+#    define _LIBCPP_HAS_EXTERNAL_ATOMIC_IMP 0
 #  elif defined(_LIBCPP_COMPILER_GCC)
-#    define _LIBCPP_HAS_GCC_ATOMIC_IMP
+#    define _LIBCPP_HAS_C_ATOMIC_IMP 0
+#    define _LIBCPP_HAS_GCC_ATOMIC_IMP 1
+#    define _LIBCPP_HAS_EXTERNAL_ATOMIC_IMP 0
 #  endif
 
-#  if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) &&                                    \
-      !defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP)
+#  if !_LIBCPP_HAS_C_ATOMIC_IMP && !_LIBCPP_HAS_GCC_ATOMIC_IMP && !_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP
 #    define _LIBCPP_HAS_ATOMIC_HEADER 0
 #  else
 #    define _LIBCPP_HAS_ATOMIC_HEADER 1
@@ -976,7 +979,7 @@ typedef __char32_t char32_t;
 // When wide characters are disabled, it can be useful to have a quick way of
 // disabling it without having to resort to #if-#endif, which has a larger
 // impact on readability.
-#  if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
+#  if !_LIBCPP_HAS_WIDE_CHARACTERS
 #    define _LIBCPP_IF_WIDE_CHARACTERS(...)
 #  else
 #    define _LIBCPP_IF_WIDE_CHARACTERS(...) __VA_ARGS__
diff --git a/libcxx/include/__config_site.in b/libcxx/include/__config_site.in
index bf2d31d8eeb1b9..a9b92de7623834 100644
--- a/libcxx/include/__config_site.in
+++ b/libcxx/include/__config_site.in
@@ -11,26 +11,27 @@
 
 #cmakedefine _LIBCPP_ABI_VERSION @_LIBCPP_ABI_VERSION@
 #cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@
-#cmakedefine _LIBCPP_ABI_FORCE_ITANIUM
-#cmakedefine _LIBCPP_ABI_FORCE_MICROSOFT
-#cmakedefine _LIBCPP_HAS_NO_THREADS
-#cmakedefine _LIBCPP_HAS_NO_MONOTONIC_CLOCK
-#cmakedefine _LIBCPP_HAS_NO_TERMINAL
-#cmakedefine _LIBCPP_HAS_MUSL_LIBC
-#cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD
-#cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL
-#cmakedefine _LIBCPP_HAS_THREAD_API_WIN32
+#cmakedefine01 _LIBCPP_ABI_FORCE_ITANIUM
+#cmakedefine01 _LIBCPP_ABI_FORCE_MICROSOFT
+#cmakedefine01 _LIBCPP_HAS_THREADS
+#cmakedefine01 _LIBCPP_HAS_MONOTONIC_CLOCK
+#cmakedefine01 _LIBCPP_HAS_TERMINAL
+#cmakedefine01 _LIBCPP_HAS_MUSL_LIBC
+#cmakedefine01 _LIBCPP_HAS_THREAD_API_PTHREAD
+#cmakedefine01 _LIBCPP_HAS_THREAD_API_EXTERNAL
+#cmakedefine01 _LIBCPP_HAS_THREAD_API_WIN32
+#define _LIBCPP_HAS_THREAD_API_C11 0 // FIXME: Is this guarding dead code?
 #cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
-#cmakedefine _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
+#cmakedefine01 _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
 #cmakedefine _LIBCPP_NO_VCRUNTIME
 #cmakedefine _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION @_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION@
-#cmakedefine _LIBCPP_HAS_NO_FILESYSTEM
-#cmakedefine _LIBCPP_HAS_NO_RANDOM_DEVICE
-#cmakedefine _LIBCPP_HAS_NO_LOCALIZATION
-#cmakedefine _LIBCPP_HAS_NO_UNICODE
-#cmakedefine _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#cmakedefine01 _LIBCPP_HAS_FILESYSTEM
+#cmakedefine01 _LIBCPP_HAS_RANDOM_DEVICE
+#cmakedefine01 _LIBCPP_HAS_LOCALIZATION
+#cmakedefine01 _LIBCPP_HAS_UNICODE
+#cmakedefine01 _LIBCPP_HAS_WIDE_CHARACTERS
 #cmakedefine _LIBCPP_HAS_NO_STD_MODULES
-#cmakedefine _LIBCPP_HAS_NO_TIME_ZONE_DATABASE
+#cmakedefine01 _LIBCPP_HAS_TIME_ZONE_DATABASE
 #cmakedefine _LIBCPP_INSTRUMENTED_WITH_ASAN
 
 // PSTL backends
diff --git a/libcxx/include/__configuration/abi.h b/libcxx/include/__configuration/abi.h
index 7095d56c6dc39d..8c8d3044570019 100644
--- a/libcxx/include/__configuration/abi.h
+++ b/libcxx/include/__configuration/abi.h
@@ -23,11 +23,11 @@
 // that Windows compilers pretending to be MSVC++ target the Microsoft ABI,
 // and allow the user to explicitly specify the ABI to handle cases where this
 // heuristic falls short.
-#if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT)
-#  error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined"
-#elif defined(_LIBCPP_ABI_FORCE_ITANIUM)
+#if _LIBCPP_ABI_FORCE_ITANIUM && _LIBCPP_ABI_FORCE_MICROSOFT
+#  error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be true"
+#elif _LIBCPP_ABI_FORCE_ITANIUM
 #  define _LIBCPP_ABI_ITANIUM
-#elif defined(_LIBCPP_ABI_FORCE_MICROSOFT)
+#elif _LIBCPP_ABI_FORCE_MICROSOFT
 #  define _LIBCPP_ABI_MICROSOFT
 #else
 #  if defined(_WIN32) && defined(_MSC_VER)
diff --git a/libcxx/include/__configuration/availability.h b/libcxx/include/__configuration/availability.h
index 173999c46807c3..d805c5a4d978d3 100644
--- a/libcxx/include/__configuration/availability.h
+++ b/libcxx/include/__configuration/availability.h
@@ -70,22 +70,20 @@
 // For backwards compatibility, allow users to define _LIBCPP_DISABLE_AVAILABILITY
 // for a while.
 #if defined(_LIBCPP_DISABLE_AVAILABILITY)
-#  if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
-#    define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
-#  endif
+#  undef _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
+#  define _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS 0
 #endif
 
 // Availability markup is disabled when building the library, or when a non-Clang
 // compiler is used because only Clang supports the necessary attributes.
 #if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCXXABI_BUILDING_LIBRARY) || !defined(_LIBCPP_COMPILER_CLANG_BASED)
-#  if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
-#    define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
-#  endif
+#  undef _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
+#  define _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS 0
 #endif
 
 // When availability annotations are disabled, we take for granted that features introduced
 // in all versions of the library are available.
-#if defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
+#if !_LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
 
 #  define _LIBCPP_INTRODUCED_IN_LLVM_20 1
 #  define _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE /* nothing */
diff --git a/libcxx/include/__filesystem/directory_entry.h b/libcxx/include/__filesystem/directory_entry.h
index d5daa3fefcde67..7d0c01b98def6b 100644
--- a/libcxx/include/__filesystem/directory_entry.h
+++ b/libcxx/include/__filesystem/directory_entry.h
@@ -34,7 +34,7 @@
 _LIBCPP_PUSH_MACROS
 #include <__undef_macros>
 
-#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#if _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
@@ -469,7 +469,7 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
 
 _LIBCPP_END_NAMESPACE_FILESYSTEM
 
-#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#endif // _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM
 
 _LIBCPP_POP_MACROS
 
diff --git a/libcxx/include/__filesystem/directory_iterator.h b/libcxx/include/__filesystem/directory_iterator.h
index 621e9bf9258efb..f5085b39ebf93e 100644
--- a/libcxx/include/__filesystem/directory_iterator.h
+++ b/libcxx/include/__filesystem/directory_iterator.h
@@ -30,7 +30,7 @@
 _LIBCPP_PUSH_MACROS
 #include <__undef_macros>
 
-#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#if _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
@@ -143,7 +143,7 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
 
 #  endif // _LIBCPP_STD_VER >= 20
 
-#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#endif // _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM
 
 _LIBCPP_POP_MACROS
 
diff --git a/libcxx/include/__filesystem/operations.h b/libcxx/include/__filesystem/operations.h
index f588189ed1d9de..904023d2fb332b 100644
--- a/libcxx/include/__filesystem/operations.h
+++ b/libcxx/include/__filesystem/operations.h
@@ -27,7 +27,7 @@
 #  pragma GCC system_header
 #endif
 
-#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#if _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
@@ -305,6 +305,6 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
 
 _LIBCPP_END_NAMESPACE_FILESYSTEM
 
-#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#endif // _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM
 
 #endif // _LIBCPP___FILESYSTEM_OPERATIONS_H
diff --git a/libcxx/include/__filesystem/path.h b/libcxx/include/__filesystem/path.h
index 88c800fdf86d08..509d1cc8052f0d 100644
--- a/libcxx/include/__filesystem/path.h
+++ b/libcxx/include/__filesystem/path.h
@@ -25,7 +25,7 @@
 #include <string>
 #include <string_view>
 
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <iomanip> // for quoted
 #  include <locale>
 #endif
@@ -199,7 +199,7 @@ _LIBCPP_EXPORTED_FROM_ABI size_t __char_to_wide(const string&, wchar_t*, size_t)
 template <class _ECharT>
 struct _PathCVT;
 
-#  if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  if _LIBCPP_HAS_LOCALIZATION
 template <class _ECharT>
 struct _PathCVT {
   static_assert(__can_convert_char<_ECharT>::value, "Char type not convertible");
@@ -258,7 +258,7 @@ struct _PathCVT {
     __append_range(__dest, _Traits::__range_begin(__s), _Traits::__range_end(__s));
   }
 };
-#  endif // !_LIBCPP_HAS_NO_LOCALIZATION
+#  endif // _LIBCPP_HAS_LOCALIZATION
 
 template <>
 struct _PathCVT<__path_value> {
@@ -420,7 +420,7 @@ class _LIBCPP_EXPORTED_FROM_ABI path {
   }
 
   /*
-  #if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+  #if _LIBCPP_HAS_LOCALIZATION
     // TODO Implement locale conversions.
     template <class _Source, class = _EnableIfPathable<_Source, void> >
     path(const _Source& __src, const locale& __loc, format = format::auto_format);
@@ -682,7 +682,7 @@ class _LIBCPP_EXPORTED_FROM_ABI path {
     return __s;
   }
 
-#    if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#    if _LIBCPP_HAS_LOCALIZATION
   template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
   _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator> string(const _Allocator& __a = _Allocator()) const {
     using _Str = basic_string<_ECharT, _Traits, _Allocator>;
@@ -725,7 +725,7 @@ class _LIBCPP_EXPORTED_FROM_ABI path {
     std::replace(__s.begin(), __s.end(), '\\', '/');
     return __s;
   }
-#    endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
+#    endif // _LIBCPP_HAS_LOCALIZATION
 #  else    /* _LIBCPP_WIN32API */
 
   _LIBCPP_HIDE_FROM_ABI std::string string() const { return __pn_; }
@@ -735,7 +735,7 @@ class _LIBCPP_EXPORTED_FROM_ABI path {
   _LIBCPP_HIDE_FROM_ABI std::string u8string() const { return __pn_; }
 #    endif
 
-#    if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#    if _LIBCPP_HAS_LOCALIZATION
   template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
   _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator> string(const _Allocator& __a = _Allocator()) const {
     using _CVT = __widen_from_utf8<sizeof(_ECharT) * __CHAR_BIT__>;
@@ -746,12 +746,12 @@ class _LIBCPP_EXPORTED_FROM_ABI path {
     return __s;
   }
 
-#      ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#      if _LIBCPP_HAS_WIDE_CHARACTERS
   _LIBCPP_HIDE_FROM_ABI std::wstring wstring() const { return string<wchar_t>(); }
 #      endif
   _LIBCPP_HIDE_FROM_ABI std::u16string u16string() const { return string<char16_t>(); }
   _LIBCPP_HIDE_FROM_ABI std::u32string u32string() const { return string<char32_t>(); }
-#    endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
+#    endif // _LIBCPP_HAS_LOCALIZATION
 
   // generic format observers
   _LIBCPP_HIDE_FROM_ABI std::string generic_string() const { return __pn_; }
@@ -761,19 +761,19 @@ class _LIBCPP_EXPORTED_FROM_ABI path {
   _LIBCPP_HIDE_FROM_ABI std::string generic_u8string() const { return __pn_; }
 #    endif
 
-#    if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#    if _LIBCPP_HAS_LOCALIZATION
   template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
   _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator>
   generic_string(const _Allocator& __a = _Allocator()) const {
     return string<_ECharT, _Traits, _Allocator>(__a);
   }
 
-#      ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#      if _LIBCPP_HAS_WIDE_CHARACTERS
   _LIBCPP_HIDE_FROM_ABI std::wstring generic_wstring() const { return string<wchar_t>(); }
 #      endif
   _LIBCPP_HIDE_FROM_ABI std::u16string generic_u16string() const { return string<char16_t>(); }
   _LIBCPP_HIDE_FROM_ABI std::u32string generic_u32string() const { return string<char32_t>(); }
-#    endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
+#    endif // _LIBCPP_HAS_LOCALIZATION
 #  endif   /* !_LIBCPP_WIN32API */
 
 private:
@@ -866,7 +866,7 @@ class _LIBCPP_EXPORTED_FROM_ABI path {
   iterator begin() const;
   iterator end() const;
 
-#  if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  if _LIBCPP_HAS_LOCALIZATION
   template <
       class _CharT,
       class _Traits,
@@ -895,7 +895,7 @@ class _LIBCPP_EXPORTED_FROM_ABI path {
     __p = __tmp;
     return __is;
   }
-#  endif // !_LIBCPP_HAS_NO_LOCALIZATION
+#  endif // _LIBCPP_HAS_LOCALIZATION
 
 private:
   inline _LIBCPP_HIDE_FROM_ABI path& __assign_view(__string_view const& __s) {
diff --git a/libcxx/include/__filesystem/recursive_directory_iterator.h b/libcxx/include/__filesystem/recursive_directory_iterator.h
index 1be92a8bd5f492..ad01a9982b6906 100644
--- a/libcxx/include/__filesystem/recursive_directory_iterator.h
+++ b/libcxx/include/__filesystem/recursive_directory_iterator.h
@@ -29,7 +29,7 @@
 _LIBCPP_PUSH_MACROS
 #include <__undef_macros>
 
-#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#if _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
@@ -156,7 +156,7 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
 
 #  endif // _LIBCPP_STD_VER >= 20
 
-#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#endif // _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM
 
 _LIBCPP_POP_MACROS
 
diff --git a/libcxx/include/__format/concepts.h b/libcxx/include/__format/concepts.h
index 737783ed4bdeca..2c40e3e3149171 100644
--- a/libcxx/include/__format/concepts.h
+++ b/libcxx/include/__format/concepts.h
@@ -34,7 +34,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template <class _CharT>
 concept __fmt_char_type =
     same_as<_CharT, char>
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
     || same_as<_CharT, wchar_t>
 #  endif
     ;
diff --git a/libcxx/include/__format/format_arg_store.h b/libcxx/include/__format/format_arg_store.h
index 847b39d428515e..8b2c95c657c9bd 100644
--- a/libcxx/include/__format/format_arg_store.h
+++ b/libcxx/include/__format/format_arg_store.h
@@ -49,7 +49,7 @@ template <class _Context, same_as<typename _Context::char_type> _Tp>
 consteval __arg_t __determine_arg_t() {
   return __arg_t::__char_type;
 }
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class _Context, class _CharT>
   requires(same_as<typename _Context::char_type, wchar_t> && same_as<_CharT, char>)
 consteval __arg_t __determine_arg_t() {
@@ -173,7 +173,7 @@ _LIBCPP_HIDE_FROM_ABI basic_format_arg<_Context> __create_format_arg(_Tp& __valu
   // final else requires no adjustment.
   if constexpr (__arg == __arg_t::__char_type)
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
     if constexpr (same_as<typename _Context::char_type, wchar_t> && same_as<_Dp, char>)
       return basic_format_arg<_Context>{__arg, static_cast<wchar_t>(static_cast<unsigned char>(__value))};
     else
diff --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h
index ecbf62770cdead..4dbfdbc02a2676 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -24,7 +24,7 @@
 #include <__utility/move.h>
 #include <__variant/monostate.h>
 
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <__locale>
 #  include <optional>
 #endif
@@ -44,7 +44,7 @@ template <class _OutIt, class _CharT>
   requires output_iterator<_OutIt, const _CharT&>
 class _LIBCPP_TEMPLATE_VIS basic_format_context;
 
-#  ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#  if _LIBCPP_HAS_LOCALIZATION
 /**
  * Helper to create a basic_format_context.
  *
@@ -66,7 +66,7 @@ __format_context_create(_OutIt __out_it, basic_format_args<basic_format_context<
 #  endif
 
 using format_context = basic_format_context<back_insert_iterator<__format::__output_buffer<char>>, char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 using wformat_context = basic_format_context< back_insert_iterator<__format::__output_buffer<wchar_t>>, wchar_t>;
 #  endif
 
@@ -88,7 +88,7 @@ class
   _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context> arg(size_t __id) const noexcept {
     return __args_.get(__id);
   }
-#  ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#  if _LIBCPP_HAS_LOCALIZATION
   _LIBCPP_HIDE_FROM_ABI std::locale locale() {
     if (!__loc_)
       __loc_ = std::locale{};
@@ -101,7 +101,7 @@ class
 private:
   iterator __out_it_;
   basic_format_args<basic_format_context> __args_;
-#  ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#  if _LIBCPP_HAS_LOCALIZATION
 
   // The Standard doesn't specify how the locale is stored.
   // [format.context]/6
@@ -163,7 +163,7 @@ class _LIBCPP_TEMPLATE_VIS basic_format_context<typename __format::__retarget_bu
   template <class _Context>
   _LIBCPP_HIDE_FROM_ABI explicit basic_format_context(iterator __out_it, _Context& __ctx)
       : __out_it_(std::move(__out_it)),
-#  ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#  if _LIBCPP_HAS_LOCALIZATION
         __loc_([](void* __c) { return static_cast<_Context*>(__c)->locale(); }),
 #  endif
         __ctx_(std::addressof(__ctx)),
@@ -193,7 +193,7 @@ class _LIBCPP_TEMPLATE_VIS basic_format_context<typename __format::__retarget_bu
   _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context> arg(size_t __id) const noexcept {
     return __arg_(__ctx_, __id);
   }
-#  ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#  if _LIBCPP_HAS_LOCALIZATION
   _LIBCPP_HIDE_FROM_ABI std::locale locale() { return __loc_(__ctx_); }
 #  endif
   _LIBCPP_HIDE_FROM_ABI iterator out() { return std::move(__out_it_); }
@@ -202,7 +202,7 @@ class _LIBCPP_TEMPLATE_VIS basic_format_context<typename __format::__retarget_bu
 private:
   iterator __out_it_;
 
-#  ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#  if _LIBCPP_HAS_LOCALIZATION
   std::locale (*__loc_)(void* __ctx);
 #  endif
 
diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index b3cda8bf844918..3991363c0124e8 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -40,7 +40,7 @@
 #include <string>
 #include <string_view>
 
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <__locale>
 #endif
 
@@ -61,7 +61,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 // to do this optimization now.
 
 using format_args = basic_format_args<format_context>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 using wformat_args = basic_format_args<wformat_context>;
 #  endif
 
@@ -70,7 +70,7 @@ template <class _Context = format_context, class... _Args>
   return std::__format_arg_store<_Context, _Args...>(__args...);
 }
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class... _Args>
 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI __format_arg_store<wformat_context, _Args...> make_wformat_args(_Args&... __args) {
   return std::__format_arg_store<wformat_context, _Args...>(__args...);
@@ -355,7 +355,7 @@ struct _LIBCPP_TEMPLATE_VIS __runtime_format_string {
 };
 
 _LIBCPP_HIDE_FROM_ABI inline __runtime_format_string<char> runtime_format(string_view __fmt) noexcept { return __fmt; }
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
 _LIBCPP_HIDE_FROM_ABI inline __runtime_format_string<wchar_t> runtime_format(wstring_view __fmt) noexcept {
   return __fmt;
 }
@@ -397,7 +397,7 @@ struct _LIBCPP_TEMPLATE_VIS basic_format_string {
 template <class... _Args>
 using format_string = basic_format_string<char, type_identity_t<_Args>...>;
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class... _Args>
 using wformat_string = basic_format_string<wchar_t, type_identity_t<_Args>...>;
 #  endif
@@ -426,7 +426,7 @@ _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt vformat_to(_OutIt __out_it, s
   return std::__vformat_to(std::move(__out_it), __fmt, __args);
 }
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <output_iterator<const wchar_t&> _OutIt>
 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
 vformat_to(_OutIt __out_it, wstring_view __fmt, wformat_args __args) {
@@ -440,7 +440,7 @@ format_to(_OutIt __out_it, format_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat_to(std::move(__out_it), __fmt.get(), std::make_format_args(__args...));
 }
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <output_iterator<const wchar_t&> _OutIt, class... _Args>
 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
 format_to(_OutIt __out_it, wformat_string<_Args...> __fmt, _Args&&... __args) {
@@ -457,7 +457,7 @@ template <class = void>
   return __res;
 }
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 // TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup
 // fires too eagerly, see http://llvm.org/PR61563.
 template <class = void>
@@ -475,7 +475,7 @@ format(format_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat(__fmt.get(), std::make_format_args(__args...));
 }
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class... _Args>
 [[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring
 format(wformat_string<_Args...> __fmt, _Args&&... __args) {
@@ -501,7 +501,7 @@ format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, format_string<_Args.
   return std::__vformat_to_n<format_context>(std::move(__out_it), __n, __fmt.get(), std::make_format_args(__args...));
 }
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <output_iterator<const wchar_t&> _OutIt, class... _Args>
 _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
 format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, wformat_string<_Args...> __fmt, _Args&&... __args) {
@@ -523,7 +523,7 @@ formatted_size(format_string<_Args...> __fmt, _Args&&... __args) {
   return std::__vformatted_size(__fmt.get(), basic_format_args{std::make_format_args(__args...)});
 }
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class... _Args>
 [[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t
 formatted_size(wformat_string<_Args...> __fmt, _Args&&... __args) {
@@ -531,7 +531,7 @@ formatted_size(wformat_string<_Args...> __fmt, _Args&&... __args) {
 }
 #  endif
 
-#  ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#  if _LIBCPP_HAS_LOCALIZATION
 
 template <class _OutIt, class _CharT, class _FormatOutIt>
   requires(output_iterator<_OutIt, const _CharT&>)
@@ -558,7 +558,7 @@ vformat_to(_OutIt __out_it, locale __loc, string_view __fmt, format_args __args)
   return std::__vformat_to(std::move(__out_it), std::move(__loc), __fmt, __args);
 }
 
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <output_iterator<const wchar_t&> _OutIt>
 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
 vformat_to(_OutIt __out_it, locale __loc, wstring_view __fmt, wformat_args __args) {
@@ -572,7 +572,7 @@ format_to(_OutIt __out_it, locale __loc, format_string<_Args...> __fmt, _Args&&.
   return std::vformat_to(std::move(__out_it), std::move(__loc), __fmt.get(), std::make_format_args(__args...));
 }
 
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <output_iterator<const wchar_t&> _OutIt, class... _Args>
 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
 format_to(_OutIt __out_it, locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
@@ -590,7 +590,7 @@ vformat(locale __loc, string_view __fmt, format_args __args) {
   return __res;
 }
 
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
 // TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup
 // fires too eagerly, see http://llvm.org/PR61563.
 template <class = void>
@@ -608,7 +608,7 @@ format(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat(std::move(__loc), __fmt.get(), std::make_format_args(__args...));
 }
 
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class... _Args>
 [[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring
 format(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
@@ -637,7 +637,7 @@ _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> format_to
       std::move(__out_it), __n, std::move(__loc), __fmt.get(), std::make_format_args(__args...));
 }
 
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <output_iterator<const wchar_t&> _OutIt, class... _Args>
 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> format_to_n(
     _OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
@@ -661,7 +661,7 @@ formatted_size(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
   return std::__vformatted_size(std::move(__loc), __fmt.get(), basic_format_args{std::make_format_args(__args...)});
 }
 
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class... _Args>
 [[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t
 formatted_size(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
@@ -669,7 +669,7 @@ formatted_size(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args)
 }
 #    endif
 
-#  endif // _LIBCPP_HAS_NO_LOCALIZATION
+#  endif // _LIBCPP_HAS_LOCALIZATION
 
 #endif // _LIBCPP_STD_VER >= 20
 
diff --git a/libcxx/include/__format/format_parse_context.h b/libcxx/include/__format/format_parse_context.h
index 54c23014e7dc60..459db751c9df08 100644
--- a/libcxx/include/__format/format_parse_context.h
+++ b/libcxx/include/__format/format_parse_context.h
@@ -94,7 +94,7 @@ class _LIBCPP_TEMPLATE_VIS basic_format_parse_context {
 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_format_parse_context);
 
 using format_parse_context = basic_format_parse_context<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 using wformat_parse_context = basic_format_parse_context<wchar_t>;
 #  endif
 
diff --git a/libcxx/include/__format/formatter_bool.h b/libcxx/include/__format/formatter_bool.h
index a43eba53c93701..d08acd474439ca 100644
--- a/libcxx/include/__format/formatter_bool.h
+++ b/libcxx/include/__format/formatter_bool.h
@@ -20,7 +20,7 @@
 #include <__format/parser_std_format_spec.h>
 #include <__utility/unreachable.h>
 
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <__locale>
 #endif
 
diff --git a/libcxx/include/__format/formatter_char.h b/libcxx/include/__format/formatter_char.h
index a96acba08d5ca5..8b8fd2d42c9f36 100644
--- a/libcxx/include/__format/formatter_char.h
+++ b/libcxx/include/__format/formatter_char.h
@@ -77,21 +77,21 @@ struct _LIBCPP_TEMPLATE_VIS __formatter_char {
 template <>
 struct _LIBCPP_TEMPLATE_VIS formatter<char, char> : public __formatter_char<char> {};
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 struct _LIBCPP_TEMPLATE_VIS formatter<char, wchar_t> : public __formatter_char<wchar_t> {};
 
 template <>
 struct _LIBCPP_TEMPLATE_VIS formatter<wchar_t, wchar_t> : public __formatter_char<wchar_t> {};
-#  endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 #  if _LIBCPP_STD_VER >= 23
 template <>
 inline constexpr bool enable_nonlocking_formatter_optimization<char> = true;
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 inline constexpr bool enable_nonlocking_formatter_optimization<wchar_t> = true;
-#    endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    endif // _LIBCPP_HAS_WIDE_CHARACTERS
 #  endif   // _LIBCPP_STD_VER >= 23
 
 #endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__format/formatter_floating_point.h b/libcxx/include/__format/formatter_floating_point.h
index 90720a5098f0f8..e04fffb683c3a6 100644
--- a/libcxx/include/__format/formatter_floating_point.h
+++ b/libcxx/include/__format/formatter_floating_point.h
@@ -38,7 +38,7 @@
 #include <__utility/unreachable.h>
 #include <cmath>
 
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <__locale>
 #endif
 
@@ -491,7 +491,7 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer(
   }
 }
 
-#  ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#  if _LIBCPP_HAS_LOCALIZATION
 template <class _OutIt, class _Fp, class _CharT>
 _LIBCPP_HIDE_FROM_ABI _OutIt __format_locale_specific_form(
     _OutIt __out_it,
@@ -576,7 +576,7 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __format_locale_specific_form(
   // alignment
   return __formatter::__fill(std::move(__out_it), __padding.__after_, __specs.__fill_);
 }
-#  endif // _LIBCPP_HAS_NO_LOCALIZATION
+#  endif // _LIBCPP_HAS_LOCALIZATION
 
 template <class _OutIt, class _CharT>
 _LIBCPP_HIDE_FROM_ABI _OutIt __format_floating_point_non_finite(
@@ -705,7 +705,7 @@ __format_floating_point(_Tp __value, _FormatContext& __ctx, __format_spec::__par
     }
   }
 
-#  ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#  if _LIBCPP_HAS_LOCALIZATION
   if (__specs.__std_.__locale_specific_form_)
     return __formatter::__format_locale_specific_form(__ctx.out(), __buffer, __result, __ctx.locale(), __specs);
 #  endif
diff --git a/libcxx/include/__format/formatter_integral.h b/libcxx/include/__format/formatter_integral.h
index 0c04cce855a08c..996b7620b3e3f6 100644
--- a/libcxx/include/__format/formatter_integral.h
+++ b/libcxx/include/__format/formatter_integral.h
@@ -32,7 +32,7 @@
 #include <string>
 #include <string_view>
 
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <__locale>
 #endif
 
@@ -298,7 +298,7 @@ _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator __format_integer(
 
   _Iterator __last = __formatter::__to_buffer(__first, __end, __value, __base);
 
-#  ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#  if _LIBCPP_HAS_LOCALIZATION
   if (__specs.__std_.__locale_specific_form_) {
     const auto& __np  = std::use_facet<numpunct<_CharT>>(__ctx.locale());
     string __grouping = __np.grouping();
@@ -412,7 +412,7 @@ struct _LIBCPP_TEMPLATE_VIS __bool_strings<char> {
   static constexpr string_view __false{"false"};
 };
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 struct _LIBCPP_TEMPLATE_VIS __bool_strings<wchar_t> {
   static constexpr wstring_view __true{L"true"};
@@ -423,7 +423,7 @@ struct _LIBCPP_TEMPLATE_VIS __bool_strings<wchar_t> {
 template <class _CharT, class _FormatContext>
 _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
 __format_bool(bool __value, _FormatContext& __ctx, __format_spec::__parsed_specifications<_CharT> __specs) {
-#  ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#  if _LIBCPP_HAS_LOCALIZATION
   if (__specs.__std_.__locale_specific_form_) {
     const auto& __np           = std::use_facet<numpunct<_CharT>>(__ctx.locale());
     basic_string<_CharT> __str = __value ? __np.truename() : __np.falsename();
diff --git a/libcxx/include/__format/formatter_output.h b/libcxx/include/__format/formatter_output.h
index 457f5f53b2dc55..e1f1309cd2c532 100644
--- a/libcxx/include/__format/formatter_output.h
+++ b/libcxx/include/__format/formatter_output.h
@@ -169,7 +169,7 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, _CharT __value)
   }
 }
 
-#  ifndef _LIBCPP_HAS_NO_UNICODE
+#  if _LIBCPP_HAS_UNICODE
 template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt>
   requires(same_as<_CharT, char>)
 _LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) {
@@ -183,7 +183,7 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::
   return __out_it;
 }
 
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt>
   requires(same_as<_CharT, wchar_t> && sizeof(wchar_t) == 2)
 _LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) {
@@ -201,13 +201,13 @@ template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt>
 _LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) {
   return __formatter::__fill(std::move(__out_it), __n, __value.__data[0]);
 }
-#    endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-#  else    // _LIBCPP_HAS_NO_UNICODE
+#    endif // _LIBCPP_HAS_WIDE_CHARACTERS
+#  else    // _LIBCPP_HAS_UNICODE
 template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt>
 _LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) {
   return __formatter::__fill(std::move(__out_it), __n, __value.__data[0]);
 }
-#  endif   // _LIBCPP_HAS_NO_UNICODE
+#  endif   // _LIBCPP_HAS_UNICODE
 
 /// Writes the input to the output with the required padding.
 ///
@@ -295,8 +295,7 @@ _LIBCPP_HIDE_FROM_ABI auto __write_transformed(
 ///
 /// \pre !__specs.__has_precision()
 ///
-/// \note When \c _LIBCPP_HAS_NO_UNICODE is defined the function assumes the
-/// input is ASCII.
+/// \note When \c _LIBCPP_HAS_UNICODE is false the function assumes the input is ASCII.
 template <class _CharT>
 _LIBCPP_HIDE_FROM_ABI auto __write_string_no_precision(
     basic_string_view<_CharT> __str,
diff --git a/libcxx/include/__format/formatter_string.h b/libcxx/include/__format/formatter_string.h
index 23c880d7c6e844..826d6421c8631e 100644
--- a/libcxx/include/__format/formatter_string.h
+++ b/libcxx/include/__format/formatter_string.h
@@ -137,7 +137,7 @@ inline constexpr bool enable_nonlocking_formatter_optimization<basic_string<char
 template <class _Traits>
 inline constexpr bool enable_nonlocking_formatter_optimization<basic_string_view<char, _Traits>> = true;
 
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 inline constexpr bool enable_nonlocking_formatter_optimization<wchar_t*> = true;
 template <>
@@ -148,7 +148,7 @@ template <class _Traits, class _Allocator>
 inline constexpr bool enable_nonlocking_formatter_optimization<basic_string<wchar_t, _Traits, _Allocator>> = true;
 template <class _Traits>
 inline constexpr bool enable_nonlocking_formatter_optimization<basic_string_view<wchar_t, _Traits>> = true;
-#    endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    endif // _LIBCPP_HAS_WIDE_CHARACTERS
 #  endif   // _LIBCPP_STD_VER >= 23
 #endif     // _LIBCPP_STD_VER >= 20
 
diff --git a/libcxx/include/__format/parser_std_format_spec.h b/libcxx/include/__format/parser_std_format_spec.h
index 6bdf8e319ba44b..415261acf0ffe1 100644
--- a/libcxx/include/__format/parser_std_format_spec.h
+++ b/libcxx/include/__format/parser_std_format_spec.h
@@ -268,7 +268,7 @@ struct __code_point<char> {
   char __data[4] = {' '};
 };
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 struct __code_point<wchar_t> {
   wchar_t __data[4 / sizeof(wchar_t)] = {L' '};
@@ -321,7 +321,7 @@ struct __parsed_specifications {
 // value in formatting functions.
 static_assert(sizeof(__parsed_specifications<char>) == 16);
 static_assert(is_trivially_copyable_v<__parsed_specifications<char>>);
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 static_assert(sizeof(__parsed_specifications<wchar_t>) == 16);
 static_assert(is_trivially_copyable_v<__parsed_specifications<wchar_t>>);
 #  endif
@@ -580,11 +580,11 @@ class _LIBCPP_TEMPLATE_VIS __parser {
       std::__throw_format_error("The fill option contains an invalid value");
   }
 
-#  ifndef _LIBCPP_HAS_NO_UNICODE
+#  if _LIBCPP_HAS_UNICODE
   // range-fill and tuple-fill are identical
   template <contiguous_iterator _Iterator>
     requires same_as<_CharT, char>
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
           || (same_as<_CharT, wchar_t> && sizeof(wchar_t) == 2)
 #    endif
   _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end) {
@@ -617,7 +617,7 @@ class _LIBCPP_TEMPLATE_VIS __parser {
     return true;
   }
 
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
   template <contiguous_iterator _Iterator>
     requires(same_as<_CharT, wchar_t> && sizeof(wchar_t) == 4)
   _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end) {
@@ -643,9 +643,9 @@ class _LIBCPP_TEMPLATE_VIS __parser {
     return true;
   }
 
-#    endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
-#  else // _LIBCPP_HAS_NO_UNICODE
+#  else // _LIBCPP_HAS_UNICODE
   // range-fill and tuple-fill are identical
   template <contiguous_iterator _Iterator>
   _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end) {
@@ -670,7 +670,7 @@ class _LIBCPP_TEMPLATE_VIS __parser {
     return true;
   }
 
-#  endif // _LIBCPP_HAS_NO_UNICODE
+#  endif // _LIBCPP_HAS_UNICODE
 
   template <contiguous_iterator _Iterator>
   _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_sign(_Iterator& __begin) {
@@ -874,7 +874,7 @@ class _LIBCPP_TEMPLATE_VIS __parser {
 
 // Validates whether the reserved bitfields don't change the size.
 static_assert(sizeof(__parser<char>) == 16);
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 static_assert(sizeof(__parser<wchar_t>) == 16);
 #  endif
 
@@ -1026,7 +1026,7 @@ __column_width_result(size_t, _Iterator) -> __column_width_result<_Iterator>;
 ///   "rounded up".
 enum class __column_width_rounding { __down, __up };
 
-#  ifndef _LIBCPP_HAS_NO_UNICODE
+#  if _LIBCPP_HAS_UNICODE
 
 namespace __detail {
 template <contiguous_iterator _Iterator>
@@ -1148,7 +1148,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_Iterator> __estimate_colu
   __result.__width_ += __ascii_size;
   return __result;
 }
-#  else // !defined(_LIBCPP_HAS_NO_UNICODE)
+#  else // _LIBCPP_HAS_UNICODE
 template <class _CharT>
 _LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<typename basic_string_view<_CharT>::const_iterator>
 __estimate_column_width(basic_string_view<_CharT> __str, size_t __maximum, __column_width_rounding) noexcept {
@@ -1159,7 +1159,7 @@ __estimate_column_width(basic_string_view<_CharT> __str, size_t __maximum, __col
   return {__width, __str.begin() + __width};
 }
 
-#  endif // !defined(_LIBCPP_HAS_NO_UNICODE)
+#  endif // _LIBCPP_HAS_UNICODE
 
 } // namespace __format_spec
 
diff --git a/libcxx/include/__format/unicode.h b/libcxx/include/__format/unicode.h
index ce6d55ae346a3f..b4f22c739d6a12 100644
--- a/libcxx/include/__format/unicode.h
+++ b/libcxx/include/__format/unicode.h
@@ -54,7 +54,7 @@ struct __consume_result {
 };
 static_assert(sizeof(__consume_result) == sizeof(char32_t));
 
-#  ifndef _LIBCPP_HAS_NO_UNICODE
+#  if _LIBCPP_HAS_UNICODE
 
 /// Implements the grapheme cluster boundary rules
 ///
@@ -235,7 +235,7 @@ class __code_point_view<char> {
   _Iterator __last_;
 };
 
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
 _LIBCPP_HIDE_FROM_ABI constexpr bool __is_surrogate_pair_high(wchar_t __value) {
   return __value >= 0xd800 && __value <= 0xdbff;
 }
@@ -292,7 +292,7 @@ class __code_point_view<wchar_t> {
   _Iterator __first_;
   _Iterator __last_;
 };
-#    endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // State machine to implement the Extended Grapheme Cluster Boundary
 //
@@ -566,10 +566,10 @@ class __extended_grapheme_cluster_view {
 template <contiguous_iterator _Iterator>
 __extended_grapheme_cluster_view(_Iterator, _Iterator) -> __extended_grapheme_cluster_view<iter_value_t<_Iterator>>;
 
-#  else //  _LIBCPP_HAS_NO_UNICODE
+#  else // _LIBCPP_HAS_UNICODE
 
 // For ASCII every character is a "code point".
-// This makes it easier to write code agnostic of the _LIBCPP_HAS_NO_UNICODE define.
+// This makes it easier to write code agnostic of the _LIBCPP_HAS_UNICODE define.
 template <class _CharT>
 class __code_point_view {
   using _Iterator = typename basic_string_view<_CharT>::const_iterator;
@@ -591,7 +591,7 @@ class __code_point_view {
   _Iterator __last_;
 };
 
-#  endif //  _LIBCPP_HAS_NO_UNICODE
+#  endif // _LIBCPP_HAS_UNICODE
 
 } // namespace __unicode
 
diff --git a/libcxx/include/__format/write_escaped.h b/libcxx/include/__format/write_escaped.h
index 9c288a84d0c441..aa74940032f786 100644
--- a/libcxx/include/__format/write_escaped.h
+++ b/libcxx/include/__format/write_escaped.h
@@ -42,8 +42,7 @@ namespace __formatter {
 
 /// Writes a string using format's width estimation algorithm.
 ///
-/// \note When \c _LIBCPP_HAS_NO_UNICODE is defined the function assumes the
-/// input is ASCII.
+/// \note When \c _LIBCPP_HAS_UNICODE is false the function assumes the input is ASCII.
 template <class _CharT>
 _LIBCPP_HIDE_FROM_ABI auto
 __write_string(basic_string_view<_CharT> __str,
@@ -104,7 +103,7 @@ _LIBCPP_HIDE_FROM_ABI void __write_escape_ill_formed_code_unit(basic_string<_Cha
 template <class _CharT>
 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool
 __is_escaped_sequence_written(basic_string<_CharT>& __str, bool __last_escaped, char32_t __value) {
-#  ifdef _LIBCPP_HAS_NO_UNICODE
+#  if !_LIBCPP_HAS_UNICODE
   // For ASCII assume everything above 127 is printable.
   if (__value > 127)
     return false;
diff --git a/libcxx/include/__functional/hash.h b/libcxx/include/__functional/hash.h
index 87009dfa62ef59..c944572b0e221a 100644
--- a/libcxx/include/__functional/hash.h
+++ b/libcxx/include/__functional/hash.h
@@ -372,12 +372,12 @@ struct _LIBCPP_TEMPLATE_VIS hash<char32_t> : public __unary_function<char32_t, s
   _LIBCPP_HIDE_FROM_ABI size_t operator()(char32_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
 };
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<wchar_t> : public __unary_function<wchar_t, size_t> {
   _LIBCPP_HIDE_FROM_ABI size_t operator()(wchar_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
 };
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 template <>
 struct _LIBCPP_TEMPLATE_VIS hash<short> : public __unary_function<short, size_t> {
diff --git a/libcxx/include/__fwd/fstream.h b/libcxx/include/__fwd/fstream.h
index b4a112bfd4de64..e6c430dbf75be0 100644
--- a/libcxx/include/__fwd/fstream.h
+++ b/libcxx/include/__fwd/fstream.h
@@ -32,7 +32,7 @@ using ifstream = basic_ifstream<char>;
 using ofstream = basic_ofstream<char>;
 using fstream  = basic_fstream<char>;
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 using wfilebuf  = basic_filebuf<wchar_t>;
 using wifstream = basic_ifstream<wchar_t>;
 using wofstream = basic_ofstream<wchar_t>;
diff --git a/libcxx/include/__fwd/ios.h b/libcxx/include/__fwd/ios.h
index 48350709d4ce25..bb0c6eb49b52bd 100644
--- a/libcxx/include/__fwd/ios.h
+++ b/libcxx/include/__fwd/ios.h
@@ -24,7 +24,7 @@ template <class _CharT, class _Traits = char_traits<_CharT> >
 class _LIBCPP_TEMPLATE_VIS basic_ios;
 
 using ios = basic_ios<char>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 using wios = basic_ios<wchar_t>;
 #endif
 
diff --git a/libcxx/include/__fwd/istream.h b/libcxx/include/__fwd/istream.h
index a06907a6c8ef91..66a6708544e551 100644
--- a/libcxx/include/__fwd/istream.h
+++ b/libcxx/include/__fwd/istream.h
@@ -27,7 +27,7 @@ class _LIBCPP_TEMPLATE_VIS basic_iostream;
 using istream  = basic_istream<char>;
 using iostream = basic_iostream<char>;
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 using wistream  = basic_istream<wchar_t>;
 using wiostream = basic_iostream<wchar_t>;
 #endif
diff --git a/libcxx/include/__fwd/ostream.h b/libcxx/include/__fwd/ostream.h
index 3347e0f71d7a1c..ff5a3612ef877c 100644
--- a/libcxx/include/__fwd/ostream.h
+++ b/libcxx/include/__fwd/ostream.h
@@ -23,7 +23,7 @@ class _LIBCPP_TEMPLATE_VIS basic_ostream;
 
 using ostream = basic_ostream<char>;
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 using wostream = basic_ostream<wchar_t>;
 #endif
 
diff --git a/libcxx/include/__fwd/sstream.h b/libcxx/include/__fwd/sstream.h
index 39a9c3faf1f800..c176db6e5ada04 100644
--- a/libcxx/include/__fwd/sstream.h
+++ b/libcxx/include/__fwd/sstream.h
@@ -34,7 +34,7 @@ using istringstream = basic_istringstream<char>;
 using ostringstream = basic_ostringstream<char>;
 using stringstream  = basic_stringstream<char>;
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 using wstringbuf     = basic_stringbuf<wchar_t>;
 using wistringstream = basic_istringstream<wchar_t>;
 using wostringstream = basic_ostringstream<wchar_t>;
diff --git a/libcxx/include/__fwd/streambuf.h b/libcxx/include/__fwd/streambuf.h
index b35afa6afe3437..aee0ebb3ce0ffb 100644
--- a/libcxx/include/__fwd/streambuf.h
+++ b/libcxx/include/__fwd/streambuf.h
@@ -23,7 +23,7 @@ class _LIBCPP_TEMPLATE_VIS basic_streambuf;
 
 using streambuf = basic_streambuf<char>;
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 using wstreambuf = basic_streambuf<wchar_t>;
 #endif
 
diff --git a/libcxx/include/__fwd/string.h b/libcxx/include/__fwd/string.h
index f13a3594022e8b..89dec82d6ffcc5 100644
--- a/libcxx/include/__fwd/string.h
+++ b/libcxx/include/__fwd/string.h
@@ -34,7 +34,7 @@ struct char_traits<char16_t>;
 template <>
 struct char_traits<char32_t>;
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 struct char_traits<wchar_t>;
 #endif
@@ -44,7 +44,7 @@ class _LIBCPP_TEMPLATE_VIS basic_string;
 
 using string = basic_string<char>;
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 using wstring = basic_string<wchar_t>;
 #endif
 
@@ -63,7 +63,7 @@ using basic_string _LIBCPP_AVAILABILITY_PMR = std::basic_string<_CharT, _Traits,
 
 using string _LIBCPP_AVAILABILITY_PMR = basic_string<char>;
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 using wstring _LIBCPP_AVAILABILITY_PMR = basic_string<wchar_t>;
 #  endif
 
@@ -80,7 +80,7 @@ using u32string _LIBCPP_AVAILABILITY_PMR = basic_string<char32_t>;
 // clang-format off
 template <class _CharT, class _Traits, class _Allocator>
 class _LIBCPP_PREFERRED_NAME(string)
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       _LIBCPP_PREFERRED_NAME(wstring)
 #endif
 #if _LIBCPP_HAS_CHAR8_T
@@ -90,7 +90,7 @@ class _LIBCPP_PREFERRED_NAME(string)
       _LIBCPP_PREFERRED_NAME(u32string)
 #if _LIBCPP_STD_VER >= 17
       _LIBCPP_PREFERRED_NAME(pmr::string)
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
       _LIBCPP_PREFERRED_NAME(pmr::wstring)
 #  endif
 #  if _LIBCPP_HAS_CHAR8_T
diff --git a/libcxx/include/__fwd/string_view.h b/libcxx/include/__fwd/string_view.h
index e1acd874256110..b848cb7f60f5ff 100644
--- a/libcxx/include/__fwd/string_view.h
+++ b/libcxx/include/__fwd/string_view.h
@@ -28,14 +28,14 @@ typedef basic_string_view<char8_t> u8string_view;
 #endif
 typedef basic_string_view<char16_t> u16string_view;
 typedef basic_string_view<char32_t> u32string_view;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 typedef basic_string_view<wchar_t> wstring_view;
 #endif
 
 // clang-format off
 template <class _CharT, class _Traits>
 class _LIBCPP_PREFERRED_NAME(string_view)
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       _LIBCPP_PREFERRED_NAME(wstring_view)
 #endif
 #if _LIBCPP_HAS_CHAR8_T
diff --git a/libcxx/include/__locale b/libcxx/include/__locale
index 5fb0c19903cd5b..e601db0a339d9f 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -27,7 +27,7 @@
 #include <cstddef>
 #include <cstring>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 #  include <cwchar>
 #else
 #  include <__std_mbstate_t.h>
@@ -236,7 +236,7 @@ long collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) cons
 }
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>;
 #endif
 
@@ -263,7 +263,7 @@ protected:
   string_type do_transform(const char_type* __lo, const char_type* __hi) const override;
 };
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 class _LIBCPP_EXPORTED_FROM_ABI collate_byname<wchar_t> : public collate<wchar_t> {
   locale_t __l_;
@@ -449,7 +449,7 @@ public:
 template <class _CharT>
 class _LIBCPP_TEMPLATE_VIS ctype;
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 class _LIBCPP_EXPORTED_FROM_ABI ctype<wchar_t> : public locale::facet, public ctype_base {
 public:
@@ -514,7 +514,7 @@ protected:
   virtual const char_type*
   do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
 };
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 template <>
 class _LIBCPP_EXPORTED_FROM_ABI ctype<char> : public locale::facet, public ctype_base {
@@ -630,7 +630,7 @@ protected:
   const char_type* do_tolower(char_type* __low, const char_type* __high) const override;
 };
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 class _LIBCPP_EXPORTED_FROM_ABI ctype_byname<wchar_t> : public ctype<wchar_t> {
   locale_t __l_;
@@ -655,7 +655,7 @@ protected:
   const char_type*
   do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const override;
 };
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 template <class _CharT>
 inline _LIBCPP_HIDE_FROM_ABI bool isspace(_CharT __c, const locale& __loc) {
@@ -821,7 +821,7 @@ protected:
 
 // template <> class codecvt<wchar_t, char, mbstate_t>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 class _LIBCPP_EXPORTED_FROM_ABI codecvt<wchar_t, char, mbstate_t> : public locale::facet, public codecvt_base {
   locale_t __l_;
@@ -900,7 +900,7 @@ protected:
   virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
   virtual int do_max_length() const _NOEXCEPT;
 };
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // template <> class codecvt<char16_t, char, mbstate_t> // deprecated in C++20
 
@@ -1248,7 +1248,7 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname() {}
 _LIBCPP_SUPPRESS_DEPRECATED_POP
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>;
 #endif
 extern template class _LIBCPP_DEPRECATED_IN_CXX20
@@ -1438,7 +1438,7 @@ protected:
   string __grouping_;
 };
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 class _LIBCPP_EXPORTED_FROM_ABI numpunct<wchar_t> : public locale::facet {
 public:
@@ -1467,7 +1467,7 @@ protected:
   char_type __thousands_sep_;
   string __grouping_;
 };
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // template <class charT> class numpunct_byname
 
@@ -1490,7 +1490,7 @@ private:
   void __init(const char*);
 };
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<wchar_t> : public numpunct<wchar_t> {
 public:
@@ -1506,7 +1506,7 @@ protected:
 private:
   void __init(const char*);
 };
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__locale_dir/locale_base_api.h b/libcxx/include/__locale_dir/locale_base_api.h
index bef10db1e1e59b..dbb4a02feaa205 100644
--- a/libcxx/include/__locale_dir/locale_base_api.h
+++ b/libcxx/include/__locale_dir/locale_base_api.h
@@ -21,7 +21,7 @@
 #  include <__locale_dir/locale_base_api/openbsd.h>
 #elif defined(__Fuchsia__)
 #  include <__locale_dir/locale_base_api/fuchsia.h>
-#elif defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__wasi__) || _LIBCPP_HAS_MUSL_LIBC
 #  include <__locale_dir/locale_base_api/musl.h>
 #elif defined(__APPLE__)
 #  include <__locale_dir/locale_base_api/apple.h>
diff --git a/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h b/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h
index 52f31fb37236c1..e6ada580d1017f 100644
--- a/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h
+++ b/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h
@@ -17,7 +17,7 @@
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 #  include <wchar.h>
 #endif
 
@@ -40,7 +40,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 inline _LIBCPP_HIDE_FROM_ABI decltype(MB_CUR_MAX) __libcpp_mb_cur_max_l(locale_t __loc) { return MB_CUR_MAX_L(__loc); }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 inline _LIBCPP_HIDE_FROM_ABI wint_t __libcpp_btowc_l(int __c, locale_t __loc) { return ::btowc_l(__c, __loc); }
 
 inline _LIBCPP_HIDE_FROM_ABI int __libcpp_wctob_l(wint_t __c, locale_t __loc) { return ::wctob_l(__c, __loc); }
@@ -71,11 +71,11 @@ inline _LIBCPP_HIDE_FROM_ABI int __libcpp_mbtowc_l(wchar_t* __pwc, const char* _
 inline _LIBCPP_HIDE_FROM_ABI size_t __libcpp_mbrlen_l(const char* __s, size_t __n, mbstate_t* __ps, locale_t __loc) {
   return ::mbrlen_l(__s, __n, __ps, __loc);
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 inline _LIBCPP_HIDE_FROM_ABI lconv* __libcpp_localeconv_l(locale_t& __loc) { return ::localeconv_l(__loc); }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 inline _LIBCPP_HIDE_FROM_ABI size_t
 __libcpp_mbsrtowcs_l(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps, locale_t __loc) {
   return ::mbsrtowcs_l(__dest, __src, __len, __ps, __loc);
diff --git a/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h b/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h
index a8f45a931007c0..d514bdfaace903 100644
--- a/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h
+++ b/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h
@@ -20,7 +20,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 #  include <cwchar>
 #endif
 
@@ -35,7 +35,7 @@ inline _LIBCPP_HIDE_FROM_ABI decltype(MB_CUR_MAX) __libcpp_mb_cur_max_l(locale_t
   return MB_CUR_MAX;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 inline _LIBCPP_HIDE_FROM_ABI wint_t __libcpp_btowc_l(int __c, locale_t __l) {
   __locale_guard __current(__l);
   return btowc(__c);
@@ -78,14 +78,14 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __libcpp_mbrlen_l(const char* __s, size_t __
   __locale_guard __current(__l);
   return mbrlen(__s, __n, __ps);
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 inline _LIBCPP_HIDE_FROM_ABI lconv* __libcpp_localeconv_l(locale_t& __l) {
   __locale_guard __current(__l);
   return localeconv();
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 inline _LIBCPP_HIDE_FROM_ABI size_t
 __libcpp_mbsrtowcs_l(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps, locale_t __l) {
   __locale_guard __current(__l);
diff --git a/libcxx/include/__mbstate_t.h b/libcxx/include/__mbstate_t.h
index bfa6d617e2b8f5..e013384454b411 100644
--- a/libcxx/include/__mbstate_t.h
+++ b/libcxx/include/__mbstate_t.h
@@ -35,7 +35,7 @@
 #  define __CORRECT_ISO_CPP_WCHAR_H_PROTO
 #endif
 
-#if defined(_LIBCPP_HAS_MUSL_LIBC)
+#if _LIBCPP_HAS_MUSL_LIBC
 #  define __NEED_mbstate_t
 #  include <bits/alltypes.h>
 #  undef __NEED_mbstate_t
@@ -43,7 +43,7 @@
 #  include <bits/types/mbstate_t.h> // works on most Unixes
 #elif __has_include(<sys/_types/_mbstate_t.h>)
 #  include <sys/_types/_mbstate_t.h> // works on Darwin
-#elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) && __has_include_next(<wchar.h>)
+#elif _LIBCPP_HAS_WIDE_CHARACTERS && __has_include_next(<wchar.h>)
 #  include_next <wchar.h> // fall back to the C standard provider of mbstate_t
 #elif __has_include_next(<uchar.h>)
 #  include_next <uchar.h> // <uchar.h> is also required to make mbstate_t visible
diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h
index 0722b3f3e6d543..e4886b5f1c73c2 100644
--- a/libcxx/include/__memory/shared_ptr.h
+++ b/libcxx/include/__memory/shared_ptr.h
@@ -80,7 +80,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _ValueType>
 inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_relaxed_load(_ValueType const* __value) {
-#if !defined(_LIBCPP_HAS_NO_THREADS) && defined(__ATOMIC_RELAXED) &&                                                   \
+#if _LIBCPP_HAS_THREADS && defined(__ATOMIC_RELAXED) &&                                                                \
     (__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
   return __atomic_load_n(__value, __ATOMIC_RELAXED);
 #else
@@ -90,7 +90,7 @@ inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_relaxed_load(_ValueType const*
 
 template <class _ValueType>
 inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_acquire_load(_ValueType const* __value) {
-#if !defined(_LIBCPP_HAS_NO_THREADS) && defined(__ATOMIC_ACQUIRE) &&                                                   \
+#if _LIBCPP_HAS_THREADS && defined(__ATOMIC_ACQUIRE) &&                                                                \
     (__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
   return __atomic_load_n(__value, __ATOMIC_ACQUIRE);
 #else
@@ -100,7 +100,7 @@ inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_acquire_load(_ValueType const*
 
 template <class _Tp>
 inline _LIBCPP_HIDE_FROM_ABI _Tp __libcpp_atomic_refcount_increment(_Tp& __t) _NOEXCEPT {
-#if _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT && !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT && _LIBCPP_HAS_THREADS
   return __atomic_add_fetch(&__t, 1, __ATOMIC_RELAXED);
 #else
   return __t += 1;
@@ -109,7 +109,7 @@ inline _LIBCPP_HIDE_FROM_ABI _Tp __libcpp_atomic_refcount_increment(_Tp& __t) _N
 
 template <class _Tp>
 inline _LIBCPP_HIDE_FROM_ABI _Tp __libcpp_atomic_refcount_decrement(_Tp& __t) _NOEXCEPT {
-#if _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT && !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT && _LIBCPP_HAS_THREADS
   return __atomic_add_fetch(&__t, -1, __ATOMIC_ACQ_REL);
 #else
   return __t -= 1;
@@ -1581,7 +1581,7 @@ template <class _CharT, class _Traits, class _Yp>
 inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
 
-#if !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_HAS_THREADS
 
 class _LIBCPP_EXPORTED_FROM_ABI __sp_mut {
   void* __lx_;
@@ -1683,7 +1683,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak_explicit(
   return std::atomic_compare_exchange_weak(__p, __v, __w);
 }
 
-#endif // !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_HAS_THREADS
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__memory_resource/synchronized_pool_resource.h b/libcxx/include/__memory_resource/synchronized_pool_resource.h
index 2679afc16617ba..6384564afc917a 100644
--- a/libcxx/include/__memory_resource/synchronized_pool_resource.h
+++ b/libcxx/include/__memory_resource/synchronized_pool_resource.h
@@ -48,7 +48,7 @@ class _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI synchronized_pool_resou
   synchronized_pool_resource& operator=(const synchronized_pool_resource&) = delete;
 
   _LIBCPP_HIDE_FROM_ABI void release() {
-#  if !defined(_LIBCPP_HAS_NO_THREADS)
+#  if _LIBCPP_HAS_THREADS
     unique_lock<mutex> __lk(__mut_);
 #  endif
     __unsync_.release();
@@ -60,14 +60,14 @@ class _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI synchronized_pool_resou
 
 protected:
   _LIBCPP_HIDE_FROM_ABI_VIRTUAL void* do_allocate(size_t __bytes, size_t __align) override {
-#  if !defined(_LIBCPP_HAS_NO_THREADS)
+#  if _LIBCPP_HAS_THREADS
     unique_lock<mutex> __lk(__mut_);
 #  endif
     return __unsync_.allocate(__bytes, __align);
   }
 
   _LIBCPP_HIDE_FROM_ABI_VIRTUAL void do_deallocate(void* __p, size_t __bytes, size_t __align) override {
-#  if !defined(_LIBCPP_HAS_NO_THREADS)
+#  if _LIBCPP_HAS_THREADS
     unique_lock<mutex> __lk(__mut_);
 #  endif
     return __unsync_.deallocate(__p, __bytes, __align);
@@ -76,7 +76,7 @@ class _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI synchronized_pool_resou
   bool do_is_equal(const memory_resource& __other) const noexcept override; // key function
 
 private:
-#  if !defined(_LIBCPP_HAS_NO_THREADS)
+#  if _LIBCPP_HAS_THREADS
   mutex __mut_;
 #  endif
   unsynchronized_pool_resource __unsync_;
diff --git a/libcxx/include/__mutex/mutex.h b/libcxx/include/__mutex/mutex.h
index 9c0c9ad6b5997e..317320287902f5 100644
--- a/libcxx/include/__mutex/mutex.h
+++ b/libcxx/include/__mutex/mutex.h
@@ -17,7 +17,7 @@
 #  pragma GCC system_header
 #endif
 
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
@@ -48,6 +48,6 @@ static_assert(is_nothrow_default_constructible<mutex>::value, "the default const
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // _LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 
 #endif // _LIBCPP___MUTEX_MUTEX_H
diff --git a/libcxx/include/__ostream/basic_ostream.h b/libcxx/include/__ostream/basic_ostream.h
index fc72247725b490..c37566d2356caf 100644
--- a/libcxx/include/__ostream/basic_ostream.h
+++ b/libcxx/include/__ostream/basic_ostream.h
@@ -11,7 +11,7 @@
 
 #include <__config>
 
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 
 #  include <__exception/operations.h>
 #  include <__memory/shared_ptr.h>
@@ -801,7 +801,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) {
 
 #  if _LIBCPP_STD_VER >= 20
 
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class _Traits>
 basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, wchar_t) = delete;
 
@@ -820,7 +820,7 @@ basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, co
 template <class _Traits>
 basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char32_t*) = delete;
 
-#    endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 #    if _LIBCPP_HAS_CHAR8_T
 template <class _Traits>
@@ -851,7 +851,7 @@ basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const ch
 #  endif // _LIBCPP_STD_VER >= 20
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>;
 #  endif
 
@@ -859,6 +859,6 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
-#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#endif // _LIBCPP_HAS_LOCALIZATION
 
 #endif // _LIBCPP___OSTREAM_BASIC_OSTREAM_H
diff --git a/libcxx/include/__ostream/print.h b/libcxx/include/__ostream/print.h
index 82eb93a8457928..eb4233342214dd 100644
--- a/libcxx/include/__ostream/print.h
+++ b/libcxx/include/__ostream/print.h
@@ -11,7 +11,7 @@
 
 #include <__config>
 
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 
 #  include <__fwd/ostream.h>
 #  include <__iterator/ostreambuf_iterator.h>
@@ -94,7 +94,7 @@ _LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(ostream& __os, string_view _
 // is determined in the same way as the print(FILE*, ...) overloads.
 _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os);
 
-#    ifndef _LIBCPP_HAS_NO_UNICODE
+#    if _LIBCPP_HAS_UNICODE
 template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
 _LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, format_args __args, bool __write_nl) {
 #      if _LIBCPP_AVAILABILITY_HAS_PRINT == 0
@@ -122,7 +122,7 @@ _LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, fo
     if (__s) {
 #        ifndef _LIBCPP_WIN32API
       __print::__vprint_unicode_posix(__file, __fmt, __args, __write_nl, true);
-#        elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
+#        elif _LIBCPP_HAS_WIDE_CHARACTERS
     __print::__vprint_unicode_windows(__file, __fmt, __args, __write_nl, true);
 #        else
 #          error "Windows builds with wchar_t disabled are not supported."
@@ -141,23 +141,23 @@ template <class = void> // TODO PRINT template or availability markup fires too
 _LIBCPP_HIDE_FROM_ABI inline void vprint_unicode(ostream& __os, string_view __fmt, format_args __args) {
   std::__vprint_unicode(__os, __fmt, __args, false);
 }
-#    endif // _LIBCPP_HAS_NO_UNICODE
+#    endif // _LIBCPP_HAS_UNICODE
 
 template <class... _Args>
 _LIBCPP_HIDE_FROM_ABI void print(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) {
-#    ifndef _LIBCPP_HAS_NO_UNICODE
+#    if _LIBCPP_HAS_UNICODE
   if constexpr (__print::__use_unicode_execution_charset)
     std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), false);
   else
     std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), false);
-#    else  // _LIBCPP_HAS_NO_UNICODE
+#    else  // _LIBCPP_HAS_UNICODE
   std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), false);
-#    endif // _LIBCPP_HAS_NO_UNICODE
+#    endif // _LIBCPP_HAS_UNICODE
 }
 
 template <class... _Args>
 _LIBCPP_HIDE_FROM_ABI void println(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) {
-#    ifndef _LIBCPP_HAS_NO_UNICODE
+#    if _LIBCPP_HAS_UNICODE
   // Note the wording in the Standard is inefficient. The output of
   // std::format is a std::string which is then copied. This solution
   // just appends a newline at the end of the output.
@@ -165,9 +165,9 @@ _LIBCPP_HIDE_FROM_ABI void println(ostream& __os, format_string<_Args...> __fmt,
     std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), true);
   else
     std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), true);
-#    else  // _LIBCPP_HAS_NO_UNICODE
+#    else  // _LIBCPP_HAS_UNICODE
   std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), true);
-#    endif // _LIBCPP_HAS_NO_UNICODE
+#    endif // _LIBCPP_HAS_UNICODE
 }
 
 template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
@@ -179,6 +179,6 @@ _LIBCPP_HIDE_FROM_ABI inline void println(ostream& __os) {
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#endif // _LIBCPP_HAS_LOCALIZATION
 
 #endif // _LIBCPP___OSTREAM_PRINT_H
diff --git a/libcxx/include/__random/random_device.h b/libcxx/include/__random/random_device.h
index 52407943d2ec70..33ec585cc0efb9 100644
--- a/libcxx/include/__random/random_device.h
+++ b/libcxx/include/__random/random_device.h
@@ -21,7 +21,7 @@ _LIBCPP_PUSH_MACROS
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if !defined(_LIBCPP_HAS_NO_RANDOM_DEVICE)
+#if _LIBCPP_HAS_RANDOM_DEVICE
 
 class _LIBCPP_EXPORTED_FROM_ABI random_device {
 #  ifdef _LIBCPP_USING_DEV_RANDOM
@@ -72,7 +72,7 @@ class _LIBCPP_EXPORTED_FROM_ABI random_device {
   void operator=(const random_device&) = delete;
 };
 
-#endif // !_LIBCPP_HAS_NO_RANDOM_DEVICE
+#endif // _LIBCPP_HAS_RANDOM_DEVICE
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__ranges/istream_view.h b/libcxx/include/__ranges/istream_view.h
index 1820ef2a4c1f7e..ab05cb6ef1fe38 100644
--- a/libcxx/include/__ranges/istream_view.h
+++ b/libcxx/include/__ranges/istream_view.h
@@ -99,7 +99,7 @@ class basic_istream_view<_Val, _CharT, _Traits>::__iterator {
 template <class _Val>
 using istream_view = basic_istream_view<_Val, char>;
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class _Val>
 using wistream_view = basic_istream_view<_Val, wchar_t>;
 #  endif
diff --git a/libcxx/include/__stop_token/atomic_unique_lock.h b/libcxx/include/__stop_token/atomic_unique_lock.h
index 8fb70a4bfb510e..a698260ac7bbdc 100644
--- a/libcxx/include/__stop_token/atomic_unique_lock.h
+++ b/libcxx/include/__stop_token/atomic_unique_lock.h
@@ -133,7 +133,7 @@ class _LIBCPP_AVAILABILITY_SYNC __atomic_unique_lock {
   _LIBCPP_HIDE_FROM_ABI static constexpr auto __set_locked_bit = [](_State __state) { return __state | _LockedBit; };
 };
 
-#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__stop_token/stop_callback.h b/libcxx/include/__stop_token/stop_callback.h
index 8d7167a5f03467..a4d7a29953a024 100644
--- a/libcxx/include/__stop_token/stop_callback.h
+++ b/libcxx/include/__stop_token/stop_callback.h
@@ -31,7 +31,7 @@ _LIBCPP_PUSH_MACROS
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
 
 template <class _Callback>
 class _LIBCPP_AVAILABILITY_SYNC stop_callback : private __stop_callback_base {
@@ -93,7 +93,7 @@ class _LIBCPP_AVAILABILITY_SYNC stop_callback : private __stop_callback_base {
 template <class _Callback>
 _LIBCPP_AVAILABILITY_SYNC stop_callback(stop_token, _Callback) -> stop_callback<_Callback>;
 
-#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__stop_token/stop_source.h b/libcxx/include/__stop_token/stop_source.h
index 7243856ecdd08b..85d67efe06e9c5 100644
--- a/libcxx/include/__stop_token/stop_source.h
+++ b/libcxx/include/__stop_token/stop_source.h
@@ -22,7 +22,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
 
 struct nostopstate_t {
   explicit nostopstate_t() = default;
@@ -84,7 +84,7 @@ class _LIBCPP_AVAILABILITY_SYNC stop_source {
   __intrusive_shared_ptr<__stop_state> __state_;
 };
 
-#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__stop_token/stop_state.h b/libcxx/include/__stop_token/stop_state.h
index b0eed13a143cfc..84dc208dda36e6 100644
--- a/libcxx/include/__stop_token/stop_state.h
+++ b/libcxx/include/__stop_token/stop_state.h
@@ -24,7 +24,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
 
 struct __stop_callback_base : __intrusive_node_base<__stop_callback_base> {
   using __callback_fn_t = void(__stop_callback_base*) noexcept;
@@ -229,7 +229,7 @@ struct __intrusive_shared_ptr_traits<__stop_state> {
   }
 };
 
-#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__stop_token/stop_token.h b/libcxx/include/__stop_token/stop_token.h
index b2569738896a66..178b1728c3e528 100644
--- a/libcxx/include/__stop_token/stop_token.h
+++ b/libcxx/include/__stop_token/stop_token.h
@@ -20,7 +20,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
 
 class _LIBCPP_AVAILABILITY_SYNC stop_token {
 public:
@@ -56,7 +56,7 @@ class _LIBCPP_AVAILABILITY_SYNC stop_token {
   _LIBCPP_HIDE_FROM_ABI explicit stop_token(const __intrusive_shared_ptr<__stop_state>& __state) : __state_(__state) {}
 };
 
-#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__string/char_traits.h b/libcxx/include/__string/char_traits.h
index f59764bb0d048d..9574cde642e0e1 100644
--- a/libcxx/include/__string/char_traits.h
+++ b/libcxx/include/__string/char_traits.h
@@ -29,7 +29,7 @@
 #include <cstdio>
 #include <iosfwd>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 #  include <cwchar> // for wmemcpy
 #endif
 
@@ -234,7 +234,7 @@ struct __char_traits_base {
 
 // char_traits<wchar_t>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t> : __char_traits_base<wchar_t, wint_t, static_cast<wint_t>(WEOF)> {
   static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 int
@@ -255,7 +255,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t> : __char_traits_base<wchar_t, w
     return std::__constexpr_wmemchr(__s, __a, __n);
   }
 };
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 #if _LIBCPP_HAS_CHAR8_T
 
diff --git a/libcxx/include/__support/xlocale/__posix_l_fallback.h b/libcxx/include/__support/xlocale/__posix_l_fallback.h
index c8358918174709..cd1d52bcb2af64 100644
--- a/libcxx/include/__support/xlocale/__posix_l_fallback.h
+++ b/libcxx/include/__support/xlocale/__posix_l_fallback.h
@@ -20,7 +20,7 @@
 #include <string.h>
 #include <time.h>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 #  include <wchar.h>
 #  include <wctype.h>
 #endif
@@ -37,7 +37,7 @@ inline _LIBCPP_HIDE_FROM_ABI int toupper_l(int __c, locale_t) { return ::toupper
 
 inline _LIBCPP_HIDE_FROM_ABI int tolower_l(int __c, locale_t) { return ::tolower(__c); }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 inline _LIBCPP_HIDE_FROM_ABI int iswalpha_l(wint_t __c, locale_t) { return ::iswalpha(__c); }
 
 inline _LIBCPP_HIDE_FROM_ABI int iswblank_l(wint_t __c, locale_t) { return ::iswblank(__c); }
@@ -61,7 +61,7 @@ inline _LIBCPP_HIDE_FROM_ABI int iswxdigit_l(wint_t __c, locale_t) { return ::is
 inline _LIBCPP_HIDE_FROM_ABI wint_t towupper_l(wint_t __c, locale_t) { return ::towupper(__c); }
 
 inline _LIBCPP_HIDE_FROM_ABI wint_t towlower_l(wint_t __c, locale_t) { return ::towlower(__c); }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 inline _LIBCPP_HIDE_FROM_ABI int strcoll_l(const char* __s1, const char* __s2, locale_t) {
   return ::strcoll(__s1, __s2);
@@ -76,7 +76,7 @@ strftime_l(char* __s, size_t __max, const char* __format, const struct tm* __tm,
   return ::strftime(__s, __max, __format, __tm);
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 inline _LIBCPP_HIDE_FROM_ABI int wcscoll_l(const wchar_t* __ws1, const wchar_t* __ws2, locale_t) {
   return ::wcscoll(__ws1, __ws2);
 }
@@ -84,6 +84,6 @@ inline _LIBCPP_HIDE_FROM_ABI int wcscoll_l(const wchar_t* __ws1, const wchar_t*
 inline _LIBCPP_HIDE_FROM_ABI size_t wcsxfrm_l(wchar_t* __dest, const wchar_t* __src, size_t __n, locale_t) {
   return ::wcsxfrm(__dest, __src, __n);
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 #endif // _LIBCPP___SUPPORT_XLOCALE_POSIX_L_FALLBACK_H
diff --git a/libcxx/include/__support/xlocale/__strtonum_fallback.h b/libcxx/include/__support/xlocale/__strtonum_fallback.h
index b7eef5210ed374..5275aead35af97 100644
--- a/libcxx/include/__support/xlocale/__strtonum_fallback.h
+++ b/libcxx/include/__support/xlocale/__strtonum_fallback.h
@@ -18,7 +18,7 @@
 #include <__config>
 #include <stdlib.h>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 #  include <wchar.h>
 #endif
 
diff --git a/libcxx/include/__thread/formatter.h b/libcxx/include/__thread/formatter.h
index 9b54036dcab36b..dacf4cec44eaf2 100644
--- a/libcxx/include/__thread/formatter.h
+++ b/libcxx/include/__thread/formatter.h
@@ -31,7 +31,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#  ifndef _LIBCPP_HAS_NO_THREADS
+#  if _LIBCPP_HAS_THREADS
 
 template <__fmt_char_type _CharT>
 struct _LIBCPP_TEMPLATE_VIS formatter<__thread_id, _CharT> {
@@ -71,7 +71,7 @@ struct _LIBCPP_TEMPLATE_VIS formatter<__thread_id, _CharT> {
   __format_spec::__parser<_CharT> __parser_{.__alignment_ = __format_spec::__alignment::__right};
 };
 
-#  endif // !_LIBCPP_HAS_NO_THREADS
+#  endif // _LIBCPP_HAS_THREADS
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__thread/id.h b/libcxx/include/__thread/id.h
index 6db0ccbfe569b6..75c3b3436df7a4 100644
--- a/libcxx/include/__thread/id.h
+++ b/libcxx/include/__thread/id.h
@@ -22,7 +22,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
 class _LIBCPP_EXPORTED_FROM_ABI __thread_id;
 
 namespace this_thread {
@@ -114,7 +114,7 @@ inline _LIBCPP_HIDE_FROM_ABI __thread_id get_id() _NOEXCEPT { return __libcpp_th
 
 } // namespace this_thread
 
-#endif // !_LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__thread/jthread.h b/libcxx/include/__thread/jthread.h
index 9f3d41d39132bb..7289b835d39c3c 100644
--- a/libcxx/include/__thread/jthread.h
+++ b/libcxx/include/__thread/jthread.h
@@ -32,7 +32,7 @@
 _LIBCPP_PUSH_MACROS
 #include <__undef_macros>
 
-#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
@@ -129,7 +129,7 @@ class _LIBCPP_AVAILABILITY_SYNC jthread {
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
 
 _LIBCPP_POP_MACROS
 
diff --git a/libcxx/include/__thread/support.h b/libcxx/include/__thread/support.h
index 92f1c4415e4dfa..50a18daf2b685a 100644
--- a/libcxx/include/__thread/support.h
+++ b/libcxx/include/__thread/support.h
@@ -104,20 +104,20 @@ _LIBCPP_END_NAMESPACE_STD
 
 */
 
-#if !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_HAS_THREADS
 
-#  if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
+#  if _LIBCPP_HAS_THREAD_API_EXTERNAL
 #    include <__thread/support/external.h>
-#  elif defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
+#  elif _LIBCPP_HAS_THREAD_API_PTHREAD
 #    include <__thread/support/pthread.h>
-#  elif defined(_LIBCPP_HAS_THREAD_API_C11)
+#  elif _LIBCPP_HAS_THREAD_API_C11
 #    include <__thread/support/c11.h>
-#  elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
+#  elif _LIBCPP_HAS_THREAD_API_WIN32
 #    include <__thread/support/windows.h>
 #  else
 #    error "No threading API was selected"
 #  endif
 
-#endif // !_LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 
 #endif // _LIBCPP___THREAD_SUPPORT_H
diff --git a/libcxx/include/__thread/this_thread.h b/libcxx/include/__thread/this_thread.h
index c7521c90ed5baa..4df137711a7fd7 100644
--- a/libcxx/include/__thread/this_thread.h
+++ b/libcxx/include/__thread/this_thread.h
@@ -30,7 +30,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 namespace this_thread {
 
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
 
 _LIBCPP_EXPORTED_FROM_ABI void sleep_for(const chrono::nanoseconds& __ns);
 
@@ -68,7 +68,7 @@ inline _LIBCPP_HIDE_FROM_ABI void sleep_until(const chrono::time_point<chrono::s
 
 inline _LIBCPP_HIDE_FROM_ABI void yield() _NOEXCEPT { __libcpp_thread_yield(); }
 
-#endif // !_LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 
 } // namespace this_thread
 
diff --git a/libcxx/include/__thread/thread.h b/libcxx/include/__thread/thread.h
index 481a3f38b82f0f..f417abc07b87c5 100644
--- a/libcxx/include/__thread/thread.h
+++ b/libcxx/include/__thread/thread.h
@@ -25,7 +25,7 @@
 #include <__utility/forward.h>
 #include <tuple>
 
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <locale>
 #  include <sstream>
 #endif
@@ -39,7 +39,7 @@ _LIBCPP_PUSH_MACROS
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_HAS_THREADS
 
 template <class _Tp>
 class __thread_specific_ptr;
@@ -121,7 +121,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<__thread_id> : public __unary_function<__thread
   }
 };
 
-#  ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#  if _LIBCPP_HAS_LOCALIZATION
 template <class _CharT, class _Traits>
 _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) {
@@ -146,7 +146,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) {
   __sstr << __id.__id_;
   return __os << __sstr.str();
 }
-#  endif // _LIBCPP_HAS_NO_LOCALIZATION
+#  endif // _LIBCPP_HAS_LOCALIZATION
 
 class _LIBCPP_EXPORTED_FROM_ABI thread {
   __libcpp_thread_t __t_;
@@ -255,7 +255,7 @@ thread::thread(_Fp __f) {
 
 inline _LIBCPP_HIDE_FROM_ABI void swap(thread& __x, thread& __y) _NOEXCEPT { __x.swap(__y); }
 
-#endif // !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_HAS_THREADS
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__thread/timed_backoff_policy.h b/libcxx/include/__thread/timed_backoff_policy.h
index 838c918a57ef0d..35a72eb61f77e2 100644
--- a/libcxx/include/__thread/timed_backoff_policy.h
+++ b/libcxx/include/__thread/timed_backoff_policy.h
@@ -12,7 +12,7 @@
 
 #include <__config>
 
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
 
 #  include <__chrono/duration.h>
 #  include <__thread/support.h>
@@ -39,6 +39,6 @@ struct __libcpp_timed_backoff_policy {
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // _LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 
 #endif // _LIBCPP___THREAD_TIMED_BACKOFF_POLICY_H
diff --git a/libcxx/include/__type_traits/is_integral.h b/libcxx/include/__type_traits/is_integral.h
index 61178720a5938c..763b6ac3d1077d 100644
--- a/libcxx/include/__type_traits/is_integral.h
+++ b/libcxx/include/__type_traits/is_integral.h
@@ -25,7 +25,7 @@ template <>          struct __libcpp_is_integral<bool>               { enum { va
 template <>          struct __libcpp_is_integral<char>               { enum { value = 1 }; };
 template <>          struct __libcpp_is_integral<signed char>        { enum { value = 1 }; };
 template <>          struct __libcpp_is_integral<unsigned char>      { enum { value = 1 }; };
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>          struct __libcpp_is_integral<wchar_t>            { enum { value = 1 }; };
 #endif
 #if _LIBCPP_HAS_CHAR8_T
diff --git a/libcxx/include/__vector/vector.h b/libcxx/include/__vector/vector.h
index 173ef1dda2c57d..da15a27bc64a51 100644
--- a/libcxx/include/__vector/vector.h
+++ b/libcxx/include/__vector/vector.h
@@ -1381,7 +1381,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 bool vector<_Tp, _Allocator>::__invariants() const
 #if _LIBCPP_STD_VER >= 20
 template <>
 inline constexpr bool __format::__enable_insertable<vector<char>> = true;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 inline constexpr bool __format::__enable_insertable<vector<wchar_t>> = true;
 #  endif
diff --git a/libcxx/include/barrier b/libcxx/include/barrier
index 36c30c7fe2e755..c7df0e9e6e8d43 100644
--- a/libcxx/include/barrier
+++ b/libcxx/include/barrier
@@ -47,7 +47,7 @@ namespace std
 
 #include <__config>
 
-#if !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_HAS_THREADS
 
 #  include <__assert>
 #  include <__atomic/atomic_base.h>
@@ -294,7 +294,7 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
-#endif // !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_HAS_THREADS
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <atomic>
diff --git a/libcxx/include/chrono b/libcxx/include/chrono
index 0f4223270c9d29..42da1b4ab97562 100644
--- a/libcxx/include/chrono
+++ b/libcxx/include/chrono
@@ -965,15 +965,14 @@ constexpr chrono::year                                  operator ""y(unsigned lo
 #  include <__chrono/year_month_day.h>
 #  include <__chrono/year_month_weekday.h>
 
-#  if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  if _LIBCPP_HAS_LOCALIZATION
 #    include <__chrono/formatter.h>
 #    include <__chrono/ostream.h>
 #    include <__chrono/parser_std_format_spec.h>
 #    include <__chrono/statically_widen.h>
 #  endif
 
-#  if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&                            \
-      !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
 #    include <__chrono/leap_second.h>
 #    include <__chrono/time_zone.h>
 #    include <__chrono/time_zone_link.h>
@@ -1014,7 +1013,7 @@ constexpr chrono::year                                  operator ""y(unsigned lo
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 20
 #  include <charconv>
-#  if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  if _LIBCPP_HAS_LOCALIZATION
 #    include <locale>
 #    include <ostream>
 #  endif
diff --git a/libcxx/include/codecvt b/libcxx/include/codecvt
index 65cd752d69460e..8e0b52576d9c40 100644
--- a/libcxx/include/codecvt
+++ b/libcxx/include/codecvt
@@ -73,7 +73,7 @@ enum _LIBCPP_DEPRECATED_IN_CXX17 codecvt_mode { consume_header = 4, generate_hea
 template <class _Elem>
 class __codecvt_utf8;
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8<wchar_t> : public codecvt<wchar_t, char, mbstate_t> {
   unsigned long __maxcode_;
@@ -112,7 +112,7 @@ protected:
   int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
   int do_max_length() const _NOEXCEPT override;
 };
-#  endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
@@ -203,7 +203,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
 template <class _Elem, bool _LittleEndian>
 class __codecvt_utf16;
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<wchar_t, false> : public codecvt<wchar_t, char, mbstate_t> {
   unsigned long __maxcode_;
@@ -281,7 +281,7 @@ protected:
   int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
   int do_max_length() const _NOEXCEPT override;
 };
-#  endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
@@ -448,7 +448,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
 template <class _Elem>
 class __codecvt_utf8_utf16;
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16<wchar_t> : public codecvt<wchar_t, char, mbstate_t> {
   unsigned long __maxcode_;
@@ -487,7 +487,7 @@ protected:
   int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
   int do_max_length() const _NOEXCEPT override;
 };
-#  endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <>
diff --git a/libcxx/include/complex b/libcxx/include/complex
index 15e42800fbfa0a..2dc6d298e44f69 100644
--- a/libcxx/include/complex
+++ b/libcxx/include/complex
@@ -266,7 +266,7 @@ template<class T> complex<T> tanh (const complex<T>&);
 #include <cmath>
 #include <version>
 
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <sstream> // for std::basic_ostringstream
 #endif
 
@@ -1322,7 +1322,7 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> tan(const complex<_Tp>& __x) {
   return complex<_Tp>(__z.imag(), -__z.real());
 }
 
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 template <class _Tp, class _CharT, class _Traits>
 _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) {
@@ -1379,7 +1379,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) {
   __s << '(' << __x.real() << ',' << __x.imag() << ')';
   return __os << __s.str();
 }
-#endif // !_LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 
 #if _LIBCPP_STD_VER >= 26
 
diff --git a/libcxx/include/condition_variable b/libcxx/include/condition_variable
index 229a2ce103b5ed..f894407d9321b3 100644
--- a/libcxx/include/condition_variable
+++ b/libcxx/include/condition_variable
@@ -140,7 +140,7 @@ public:
 _LIBCPP_PUSH_MACROS
 #include <__undef_macros>
 
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
@@ -347,7 +347,7 @@ _LIBCPP_EXPORTED_FROM_ABI void notify_all_at_thread_exit(condition_variable&, un
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // !_LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 
 _LIBCPP_POP_MACROS
 
diff --git a/libcxx/include/cstdlib b/libcxx/include/cstdlib
index 1ecdd3a6d0328c..be0d9b8d7227a5 100644
--- a/libcxx/include/cstdlib
+++ b/libcxx/include/cstdlib
@@ -135,7 +135,7 @@ using ::div _LIBCPP_USING_IF_EXISTS;
 using ::ldiv _LIBCPP_USING_IF_EXISTS;
 using ::lldiv _LIBCPP_USING_IF_EXISTS;
 using ::mblen _LIBCPP_USING_IF_EXISTS;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 using ::mbtowc _LIBCPP_USING_IF_EXISTS;
 using ::wctomb _LIBCPP_USING_IF_EXISTS;
 using ::mbstowcs _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/include/deque b/libcxx/include/deque
index 1a83465b39ef81..13de29c507b50d 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -2604,7 +2604,7 @@ erase_if(deque<_Tp, _Allocator>& __c, _Predicate __pred) {
 
 template <>
 inline constexpr bool __format::__enable_insertable<std::deque<char>> = true;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 inline constexpr bool __format::__enable_insertable<std::deque<wchar_t>> = true;
 #  endif
diff --git a/libcxx/include/format b/libcxx/include/format
index 449e6f0bf3fb63..82a2e322868380 100644
--- a/libcxx/include/format
+++ b/libcxx/include/format
@@ -252,7 +252,7 @@ namespace std {
 #  include <string_view>
 #  include <tuple>
 
-#  if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 #    include <cwchar>
 #  endif
 #endif
diff --git a/libcxx/include/fstream b/libcxx/include/fstream
index dce0efc71d8e5f..e3b9abbbdcf056 100644
--- a/libcxx/include/fstream
+++ b/libcxx/include/fstream
@@ -217,7 +217,7 @@ _LIBCPP_PUSH_MACROS
 #  define _LIBCPP_HAS_OFF_T_FUNCTIONS 0
 #endif
 
-#if !defined(_LIBCPP_HAS_NO_FILESYSTEM) && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
@@ -1562,7 +1562,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_filebuf<char>;
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // !defined(_LIBCPP_HAS_NO_FILESYSTEM) && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#endif // _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
 
 _LIBCPP_POP_MACROS
 
diff --git a/libcxx/include/future b/libcxx/include/future
index f16f4234c48966..67d9b43ff22e32 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -364,7 +364,7 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
 
 #include <__config>
 
-#if !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_HAS_THREADS
 
 #  include <__assert>
 #  include <__chrono/duration.h>
@@ -2059,7 +2059,7 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
-#endif // !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_HAS_THREADS
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
 #  include <chrono>
diff --git a/libcxx/include/iomanip b/libcxx/include/iomanip
index 538fc413bb8ee2..bc3f860bd7a7d2 100644
--- a/libcxx/include/iomanip
+++ b/libcxx/include/iomanip
@@ -44,7 +44,7 @@ template <class charT, class traits, class Allocator>
 
 #include <__config>
 
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
 
 #  include <__ostream/basic_ostream.h>
 #  include <ios>
@@ -544,6 +544,6 @@ quoted(basic_string_view<_CharT, _Traits> __sv, _CharT __delim = _CharT('"'), _C
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // !_LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 
 #endif // _LIBCPP_IOMANIP
diff --git a/libcxx/include/ios b/libcxx/include/ios
index 546c5462f222db..2eb32f296aafcf 100644
--- a/libcxx/include/ios
+++ b/libcxx/include/ios
@@ -213,7 +213,7 @@ storage-class-specifier const error_category& iostream_category() noexcept;
 
 #include <__config>
 
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 
 #  include <__fwd/ios.h>
 #  include <__ios/fpos.h>
@@ -397,7 +397,7 @@ private:
   size_t __event_cap_;
 // TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
 // enabled with clang.
-#  if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
+#  if _LIBCPP_HAS_C_ATOMIC_IMP && _LIBCPP_HAS_THREADS
   static atomic<int> __xindex_;
 #  else
   static int __xindex_;
@@ -744,7 +744,7 @@ inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::set_rdbuf(basic_st
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>;
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>;
 #  endif
 
@@ -872,7 +872,7 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
-#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#endif // _LIBCPP_HAS_LOCALIZATION
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <atomic>
diff --git a/libcxx/include/iosfwd b/libcxx/include/iosfwd
index 9079ce21512f90..5e777c6b237356 100644
--- a/libcxx/include/iosfwd
+++ b/libcxx/include/iosfwd
@@ -131,7 +131,7 @@ class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator;
 template <class _State>
 class _LIBCPP_TEMPLATE_VIS fpos;
 typedef fpos<mbstate_t> streampos;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 typedef fpos<mbstate_t> wstreampos;
 #endif
 #if _LIBCPP_HAS_CHAR8_T
@@ -146,7 +146,7 @@ template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator =
 class basic_syncbuf;
 
 using syncbuf = basic_syncbuf<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 using wsyncbuf = basic_syncbuf<wchar_t>;
 #  endif
 
@@ -154,7 +154,7 @@ template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator =
 class basic_osyncstream;
 
 using osyncstream = basic_osyncstream<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 using wosyncstream = basic_osyncstream<wchar_t>;
 #  endif
 
diff --git a/libcxx/include/iostream b/libcxx/include/iostream
index 5df45c6d3f78e7..d3ecc6c551fdf8 100644
--- a/libcxx/include/iostream
+++ b/libcxx/include/iostream
@@ -55,7 +55,7 @@ extern _LIBCPP_EXPORTED_FROM_ABI ostream cout;
 extern _LIBCPP_EXPORTED_FROM_ABI ostream cerr;
 extern _LIBCPP_EXPORTED_FROM_ABI ostream clog;
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 extern _LIBCPP_EXPORTED_FROM_ABI wistream wcin;
 extern _LIBCPP_EXPORTED_FROM_ABI wostream wcout;
 extern _LIBCPP_EXPORTED_FROM_ABI wostream wcerr;
diff --git a/libcxx/include/istream b/libcxx/include/istream
index 45ca95369c51d3..0d6d6880f8aa0e 100644
--- a/libcxx/include/istream
+++ b/libcxx/include/istream
@@ -160,7 +160,7 @@ template <class Stream, class T>
 
 #include <__config>
 
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 
 #  include <__fwd/istream.h>
 #  include <__iterator/istreambuf_iterator.h>
@@ -1363,14 +1363,14 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) {
 }
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<wchar_t>;
 #  endif
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>;
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#endif // _LIBCPP_HAS_LOCALIZATION
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <concepts>
diff --git a/libcxx/include/latch b/libcxx/include/latch
index 92dadf68bcaabb..90cca27c50c376 100644
--- a/libcxx/include/latch
+++ b/libcxx/include/latch
@@ -42,7 +42,7 @@ namespace std
 
 #include <__config>
 
-#if !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_HAS_THREADS
 
 #  include <__assert>
 #  include <__atomic/atomic_base.h>
@@ -120,7 +120,7 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
-#endif // !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_HAS_THREADS
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <atomic>
diff --git a/libcxx/include/list b/libcxx/include/list
index 95302754271226..3b8399e26a2319 100644
--- a/libcxx/include/list
+++ b/libcxx/include/list
@@ -1710,7 +1710,7 @@ erase(list<_Tp, _Allocator>& __c, const _Up& __v) {
 
 template <>
 inline constexpr bool __format::__enable_insertable<std::list<char>> = true;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 inline constexpr bool __format::__enable_insertable<std::list<wchar_t>> = true;
 #  endif
diff --git a/libcxx/include/locale b/libcxx/include/locale
index 4706515b0a6c86..b77a724da72963 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -189,7 +189,7 @@ template <class charT> class messages_byname;
 
 #include <__config>
 
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 
 #  include <__algorithm/copy.h>
 #  include <__algorithm/equal.h>
@@ -580,7 +580,7 @@ int __num_get<_CharT>::__stage2_float_loop(
 }
 
 extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<wchar_t>;
 #  endif
 
@@ -1051,7 +1051,7 @@ _InputIterator num_get<_CharT, _InputIterator>::do_get(
 }
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<wchar_t>;
 #  endif
 
@@ -1169,7 +1169,7 @@ void __num_put<_CharT>::__widen_and_group_float(
 }
 
 extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<wchar_t>;
 #  endif
 
@@ -1456,7 +1456,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_ty
 }
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>;
 #  endif
 
@@ -1523,7 +1523,7 @@ _LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__x() const;
 template <>
 _LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__X() const;
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 _LIBCPP_EXPORTED_FROM_ABI const wstring* __time_get_c_storage<wchar_t>::__weeks() const;
 template <>
@@ -1992,7 +1992,7 @@ _InputIterator time_get<_CharT, _InputIterator>::do_get(
 }
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<wchar_t>;
 #  endif
 
@@ -2052,7 +2052,7 @@ private:
     /**/
 
 _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(char)
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(wchar_t)
 #  endif
 #  undef _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION
@@ -2088,7 +2088,7 @@ private:
 };
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<wchar_t>;
 #  endif
 
@@ -2101,7 +2101,7 @@ protected:
   __time_put(const string& __nm);
   ~__time_put();
   void __do_put(char* __nb, char*& __ne, const tm* __tm, char __fmt, char __mod) const;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   void __do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, char __fmt, char __mod) const;
 #  endif
 };
@@ -2177,7 +2177,7 @@ _OutputIterator time_put<_CharT, _OutputIterator>::do_put(
 }
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<wchar_t>;
 #  endif
 
@@ -2195,7 +2195,7 @@ protected:
 };
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<wchar_t>;
 #  endif
 
@@ -2262,7 +2262,7 @@ const bool moneypunct<_CharT, _International>::intl;
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, false>;
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, true>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, false>;
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, true>;
 #  endif
@@ -2320,7 +2320,7 @@ _LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<char, true>::init(const char*);
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, false>;
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, true>;
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 _LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<wchar_t, false>::init(const char*);
 template <>
@@ -2388,7 +2388,7 @@ void __money_get<_CharT>::__gather_info(
 }
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<wchar_t>;
 #  endif
 
@@ -2698,7 +2698,7 @@ _InputIterator money_get<_CharT, _InputIterator>::do_get(
 }
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<wchar_t>;
 #  endif
 
@@ -2876,7 +2876,7 @@ void __money_put<_CharT>::__format(
 }
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<wchar_t>;
 #  endif
 
@@ -3022,7 +3022,7 @@ _OutputIterator money_put<_CharT, _OutputIterator>::do_put(
 }
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<wchar_t>;
 #  endif
 
@@ -3107,7 +3107,7 @@ void messages<_CharT>::do_close(catalog __c) const {
 }
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<wchar_t>;
 #  endif
 
@@ -3126,7 +3126,7 @@ protected:
 };
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>;
 #  endif
 
@@ -3745,7 +3745,7 @@ _LIBCPP_POP_MACROS
 
 // NOLINTEND(libcpp-robust-against-adl)
 
-#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#endif // _LIBCPP_HAS_LOCALIZATION
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <atomic>
diff --git a/libcxx/include/mutex b/libcxx/include/mutex
index 427fce5f3ec463..60a7c9945909ce 100644
--- a/libcxx/include/mutex
+++ b/libcxx/include/mutex
@@ -214,7 +214,7 @@ _LIBCPP_PUSH_MACROS
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
 
 class _LIBCPP_EXPORTED_FROM_ABI recursive_mutex {
   __libcpp_recursive_mutex_t __m_;
@@ -491,7 +491,7 @@ private:
 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(scoped_lock);
 
 #  endif // _LIBCPP_STD_VER >= 17
-#endif   // !_LIBCPP_HAS_NO_THREADS
+#endif   // _LIBCPP_HAS_THREADS
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/ostream b/libcxx/include/ostream
index 83742882f7bb67..a58ac9b944fa2c 100644
--- a/libcxx/include/ostream
+++ b/libcxx/include/ostream
@@ -174,7 +174,7 @@ void vprint_nonunicode(ostream& os, string_view fmt, format_args args);
 
 #include <__config>
 
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 
 #  include <__ostream/basic_ostream.h>
 
@@ -188,7 +188,7 @@ void vprint_nonunicode(ostream& os, string_view fmt, format_args args);
 #    pragma GCC system_header
 #  endif
 
-#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#endif // _LIBCPP_HAS_LOCALIZATION
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <atomic>
diff --git a/libcxx/include/print b/libcxx/include/print
index 2798a6bda26262..6241534c9a31bc 100644
--- a/libcxx/include/print
+++ b/libcxx/include/print
@@ -54,7 +54,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 #ifdef _LIBCPP_WIN32API
 _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream);
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 // A wrapper for WriteConsoleW which is used to write to the Windows
 // console. This function is in the dylib to avoid pulling in windows.h
 // in the library headers. The function itself uses some private parts
@@ -65,14 +65,14 @@ _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream);
 //
 // Note the function is only implemented on the Windows platform.
 _LIBCPP_EXPORTED_FROM_ABI void __write_to_windows_console(FILE* __stream, wstring_view __view);
-#  endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  endif // _LIBCPP_HAS_WIDE_CHARACTERS
 #elif __has_include(<unistd.h>)
 _LIBCPP_EXPORTED_FROM_ABI bool __is_posix_terminal(FILE* __stream);
 #endif // _LIBCPP_WIN32API
 
 #if _LIBCPP_STD_VER >= 23
 
-#  ifndef _LIBCPP_HAS_NO_UNICODE
+#  if _LIBCPP_HAS_UNICODE
 // This is the code to transcode UTF-8 to UTF-16. This is used on
 // Windows for the native Unicode API. The code is modeled to make it
 // easier to extend to
@@ -90,7 +90,7 @@ namespace __unicode {
 template <class _Tp>
 concept __utf16_code_unit =
     same_as<_Tp, char16_t>
-#      ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#      if _LIBCPP_HAS_WIDE_CHARACTERS
     || same_as<_Tp, wchar_t>
 #      endif
     ;
@@ -102,7 +102,7 @@ concept __utf16_code_unit = same_as<_Tp, char16_t>;
 template <class _Tp>
 concept __utf32_code_unit =
     same_as<_Tp, char32_t>
-#      ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#      if _LIBCPP_HAS_WIDE_CHARACTERS
     || same_as<_Tp, wchar_t>
 #      endif
     ;
@@ -164,7 +164,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _OutIt __transcode(_InIt __first, _InIt __last,
 
 } // namespace __unicode
 
-#  endif //  _LIBCPP_HAS_NO_UNICODE
+#  endif //  _LIBCPP_HAS_UNICODE
 
 namespace __print {
 
@@ -184,7 +184,7 @@ namespace __print {
 //   (note at the time of writing Clang is hard-coded to UTF-8.)
 //
 
-#  ifdef _LIBCPP_HAS_NO_UNICODE
+#  if !_LIBCPP_HAS_UNICODE
 inline constexpr bool __use_unicode_execution_charset = false;
 #  elif defined(_MSVC_EXECUTION_CHARACTER_SET)
 // This is the same test MSVC STL uses in their implementation of <print>
@@ -199,7 +199,7 @@ _LIBCPP_HIDE_FROM_ABI inline bool __is_terminal([[maybe_unused]] FILE* __stream)
   // the behavior in the test. This is not part of the public API.
 #  ifdef _LIBCPP_TESTING_PRINT_IS_TERMINAL
   return _LIBCPP_TESTING_PRINT_IS_TERMINAL(__stream);
-#  elif _LIBCPP_AVAILABILITY_HAS_PRINT == 0 || defined(_LIBCPP_HAS_NO_TERMINAL)
+#  elif _LIBCPP_AVAILABILITY_HAS_PRINT == 0 || _LIBCPP_HAS_TERMINAL
   return false;
 #  elif defined(_LIBCPP_WIN32API)
   return std::__is_windows_terminal(__stream);
@@ -226,7 +226,7 @@ __vprint_nonunicode(FILE* __stream, string_view __fmt, format_args __args, bool
   }
 }
 
-#  ifndef _LIBCPP_HAS_NO_UNICODE
+#  if _LIBCPP_HAS_UNICODE
 
 // Note these helper functions are mainly used to aid testing.
 // On POSIX systems and Windows the output is no longer considered a
@@ -243,7 +243,7 @@ __vprint_unicode_posix(FILE* __stream, string_view __fmt, format_args __args, bo
   __print::__vprint_nonunicode(__stream, __fmt, __args, __write_nl);
 }
 
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
 _LIBCPP_HIDE_FROM_ABI inline void
 __vprint_unicode_windows(FILE* __stream, string_view __fmt, format_args __args, bool __write_nl, bool __is_terminal) {
@@ -281,7 +281,7 @@ __vprint_unicode_windows(FILE* __stream, string_view __fmt, format_args __args,
                              "__write_to_windows_console is not available.");
 #      endif
 }
-#    endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
 _LIBCPP_HIDE_FROM_ABI inline void
@@ -314,27 +314,27 @@ __vprint_unicode([[maybe_unused]] FILE* __stream,
 
 #    ifndef _LIBCPP_WIN32API
   __print::__vprint_unicode_posix(__stream, __fmt, __args, __write_nl, __print::__is_terminal(__stream));
-#    elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
+#    elif _LIBCPP_HAS_WIDE_CHARACTERS
   __print::__vprint_unicode_windows(__stream, __fmt, __args, __write_nl, __print::__is_terminal(__stream));
 #    else
 #      error "Windows builds with wchar_t disabled are not supported."
 #    endif
 }
 
-#  endif // _LIBCPP_HAS_NO_UNICODE
+#  endif // _LIBCPP_HAS_UNICODE
 
 } // namespace __print
 
 template <class... _Args>
 _LIBCPP_HIDE_FROM_ABI void print(FILE* __stream, format_string<_Args...> __fmt, _Args&&... __args) {
-#  ifndef _LIBCPP_HAS_NO_UNICODE
+#  if _LIBCPP_HAS_UNICODE
   if constexpr (__print::__use_unicode_execution_charset)
     __print::__vprint_unicode(__stream, __fmt.get(), std::make_format_args(__args...), false);
   else
     __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), false);
-#  else  // _LIBCPP_HAS_NO_UNICODE
+#  else  // _LIBCPP_HAS_UNICODE
   __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), false);
-#  endif // _LIBCPP_HAS_NO_UNICODE
+#  endif // _LIBCPP_HAS_UNICODE
 }
 
 template <class... _Args>
@@ -344,7 +344,7 @@ _LIBCPP_HIDE_FROM_ABI void print(format_string<_Args...> __fmt, _Args&&... __arg
 
 template <class... _Args>
 _LIBCPP_HIDE_FROM_ABI void println(FILE* __stream, format_string<_Args...> __fmt, _Args&&... __args) {
-#  ifndef _LIBCPP_HAS_NO_UNICODE
+#  if _LIBCPP_HAS_UNICODE
   // Note the wording in the Standard is inefficient. The output of
   // std::format is a std::string which is then copied. This solution
   // just appends a newline at the end of the output.
@@ -352,9 +352,9 @@ _LIBCPP_HIDE_FROM_ABI void println(FILE* __stream, format_string<_Args...> __fmt
     __print::__vprint_unicode(__stream, __fmt.get(), std::make_format_args(__args...), true);
   else
     __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), true);
-#  else  // _LIBCPP_HAS_NO_UNICODE
+#  else  // _LIBCPP_HAS_UNICODE
   __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), true);
-#  endif // _LIBCPP_HAS_NO_UNICODE
+#  endif // _LIBCPP_HAS_UNICODE
 }
 
 template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
@@ -372,7 +372,7 @@ _LIBCPP_HIDE_FROM_ABI void println(format_string<_Args...> __fmt, _Args&&... __a
   std::println(stdout, __fmt, std::forward<_Args>(__args)...);
 }
 
-#  ifndef _LIBCPP_HAS_NO_UNICODE
+#  if _LIBCPP_HAS_UNICODE
 template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
 _LIBCPP_HIDE_FROM_ABI inline void vprint_unicode(FILE* __stream, string_view __fmt, format_args __args) {
   __print::__vprint_unicode(__stream, __fmt, __args, false);
@@ -383,7 +383,7 @@ _LIBCPP_HIDE_FROM_ABI inline void vprint_unicode(string_view __fmt, format_args
   std::vprint_unicode(stdout, __fmt, __args);
 }
 
-#  endif // _LIBCPP_HAS_NO_UNICODE
+#  endif // _LIBCPP_HAS_UNICODE
 
 template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
 _LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(FILE* __stream, string_view __fmt, format_args __args) {
diff --git a/libcxx/include/ranges b/libcxx/include/ranges
index fa35874265de67..b17a399e0ed65b 100644
--- a/libcxx/include/ranges
+++ b/libcxx/include/ranges
@@ -415,7 +415,7 @@ namespace std {
 #  include <__ranges/view_interface.h>
 #  include <__ranges/views.h>
 
-#  if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  if _LIBCPP_HAS_LOCALIZATION
 #    include <__ranges/istream_view.h>
 #  endif
 #endif
diff --git a/libcxx/include/regex b/libcxx/include/regex
index 074b19865cb4ff..bd75e8de7db438 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -1054,19 +1054,19 @@ private:
 
   template <class _ForwardIterator>
   string_type __transform_primary(_ForwardIterator __f, _ForwardIterator __l, char) const;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   template <class _ForwardIterator>
   string_type __transform_primary(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const;
 #endif
   template <class _ForwardIterator>
   string_type __lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, char) const;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   template <class _ForwardIterator>
   string_type __lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const;
 #endif
   template <class _ForwardIterator>
   char_class_type __lookup_classname(_ForwardIterator __f, _ForwardIterator __l, bool __icase, char) const;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   template <class _ForwardIterator>
   char_class_type __lookup_classname(_ForwardIterator __f, _ForwardIterator __l, bool __icase, wchar_t) const;
 #endif
@@ -1075,7 +1075,7 @@ private:
   _LIBCPP_HIDE_FROM_ABI int __regex_traits_value(char __ch, int __radix) const {
     return __regex_traits_value(static_cast<unsigned char>(__ch), __radix);
   }
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   _LIBCPP_HIDE_FROM_ABI int __regex_traits_value(wchar_t __ch, int __radix) const;
 #endif
 };
@@ -1136,7 +1136,7 @@ regex_traits<_CharT>::__transform_primary(_ForwardIterator __f, _ForwardIterator
   return __d;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class _CharT>
 template <class _ForwardIterator>
 typename regex_traits<_CharT>::string_type
@@ -1180,7 +1180,7 @@ regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f, _ForwardIterato
   return __r;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class _CharT>
 template <class _ForwardIterator>
 typename regex_traits<_CharT>::string_type
@@ -1208,7 +1208,7 @@ regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f, _ForwardIterato
   }
   return __r;
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // lookup_classname
 
@@ -1223,7 +1223,7 @@ regex_traits<_CharT>::__lookup_classname(_ForwardIterator __f, _ForwardIterator
   return std::__get_classname(__s.c_str(), __icase);
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class _CharT>
 template <class _ForwardIterator>
 typename regex_traits<_CharT>::char_class_type
@@ -1239,7 +1239,7 @@ regex_traits<_CharT>::__lookup_classname(_ForwardIterator __f, _ForwardIterator
   }
   return __get_classname(__n.c_str(), __icase);
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 template <class _CharT>
 bool regex_traits<_CharT>::isctype(char_type __c, char_class_type __m) const {
@@ -1290,7 +1290,7 @@ int regex_traits<_CharT>::__regex_traits_value(unsigned char __ch, int __radix)
   return -1;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class _CharT>
 inline int regex_traits<_CharT>::__regex_traits_value(wchar_t __ch, int __radix) const {
   return __regex_traits_value(static_cast<unsigned char>(__ct_->narrow(__ch, char_type())), __radix);
@@ -1938,7 +1938,7 @@ public:
 
 template <>
 _LIBCPP_EXPORTED_FROM_ABI void __match_any_but_newline<char>::__exec(__state&) const;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 _LIBCPP_EXPORTED_FROM_ABI void __match_any_but_newline<wchar_t>::__exec(__state&) const;
 #endif
@@ -2262,7 +2262,7 @@ template <class _CharT, class _Traits = regex_traits<_CharT> >
 class _LIBCPP_TEMPLATE_VIS basic_regex;
 
 typedef basic_regex<char> regex;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 typedef basic_regex<wchar_t> wregex;
 #endif
 
@@ -4181,7 +4181,7 @@ void basic_regex<_CharT, _Traits>::__push_lookahead(const basic_regex& __exp, bo
 
 typedef sub_match<const char*> csub_match;
 typedef sub_match<string::const_iterator> ssub_match;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 typedef sub_match<const wchar_t*> wcsub_match;
 typedef sub_match<wstring::const_iterator> wssub_match;
 #endif
@@ -4526,7 +4526,7 @@ operator<<(basic_ostream<_CharT, _ST>& __os, const sub_match<_BiIter>& __m) {
 
 typedef match_results<const char*> cmatch;
 typedef match_results<string::const_iterator> smatch;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 typedef match_results<const wchar_t*> wcmatch;
 typedef match_results<wstring::const_iterator> wsmatch;
 #endif
@@ -5321,7 +5321,7 @@ class _LIBCPP_TEMPLATE_VIS regex_iterator;
 
 typedef regex_iterator<const char*> cregex_iterator;
 typedef regex_iterator<string::const_iterator> sregex_iterator;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 typedef regex_iterator<const wchar_t*> wcregex_iterator;
 typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
 #endif
@@ -5451,7 +5451,7 @@ class _LIBCPP_TEMPLATE_VIS regex_token_iterator;
 
 typedef regex_token_iterator<const char*> cregex_token_iterator;
 typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
 typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
 #endif
@@ -5810,7 +5810,7 @@ using match_results _LIBCPP_AVAILABILITY_PMR =
 using cmatch _LIBCPP_AVAILABILITY_PMR = match_results<const char*>;
 using smatch _LIBCPP_AVAILABILITY_PMR = match_results<std::pmr::string::const_iterator>;
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 using wcmatch _LIBCPP_AVAILABILITY_PMR = match_results<const wchar_t*>;
 using wsmatch _LIBCPP_AVAILABILITY_PMR = match_results<std::pmr::wstring::const_iterator>;
 #  endif
diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore
index 98122c96459a29..05c85bc810603e 100644
--- a/libcxx/include/semaphore
+++ b/libcxx/include/semaphore
@@ -47,7 +47,7 @@ using binary_semaphore = counting_semaphore<1>; // since C++20
 
 #include <__config>
 
-#if !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_HAS_THREADS
 
 #  include <__assert>
 #  include <__atomic/atomic_base.h>
@@ -177,7 +177,7 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
-#endif // !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_HAS_THREADS
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <atomic>
diff --git a/libcxx/include/shared_mutex b/libcxx/include/shared_mutex
index f63bd25493878b..68030e9ce8ff4e 100644
--- a/libcxx/include/shared_mutex
+++ b/libcxx/include/shared_mutex
@@ -124,7 +124,7 @@ template <class Mutex>
 
 #include <__config>
 
-#if !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_HAS_THREADS
 
 #  include <__chrono/duration.h>
 #  include <__chrono/steady_clock.h>
@@ -455,7 +455,7 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
-#endif // !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_HAS_THREADS
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <system_error>
diff --git a/libcxx/include/sstream b/libcxx/include/sstream
index df039194996d74..4f458c5dfce98c 100644
--- a/libcxx/include/sstream
+++ b/libcxx/include/sstream
@@ -314,7 +314,7 @@ typedef basic_stringstream<wchar_t> wstringstream;
 
 #include <__config>
 
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
 
 #  include <__fwd/sstream.h>
 #  include <__ostream/basic_ostream.h>
@@ -1283,7 +1283,7 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
-#endif // !_LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 
 #if _LIBCPP_STD_VER <= 20 && !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
 #  include <ostream>
diff --git a/libcxx/include/stdatomic.h b/libcxx/include/stdatomic.h
index 2f25b057df0874..f4e9b59c5fe59b 100644
--- a/libcxx/include/stdatomic.h
+++ b/libcxx/include/stdatomic.h
@@ -161,7 +161,7 @@ using std::atomic_char8_t _LIBCPP_USING_IF_EXISTS;
 #  endif
 using std::atomic_char16_t _LIBCPP_USING_IF_EXISTS;
 using std::atomic_char32_t _LIBCPP_USING_IF_EXISTS;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 using std::atomic_wchar_t _LIBCPP_USING_IF_EXISTS;
 #  endif
 
diff --git a/libcxx/include/stop_token b/libcxx/include/stop_token
index cf8d0cf9b91916..58e3649c07056b 100644
--- a/libcxx/include/stop_token
+++ b/libcxx/include/stop_token
@@ -33,7 +33,7 @@ namespace std {
 
 #include <__config>
 
-#if !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_HAS_THREADS
 
 #  if _LIBCPP_STD_VER >= 20
 #    include <__stop_token/stop_callback.h>
@@ -47,7 +47,7 @@ namespace std {
 #    pragma GCC system_header
 #  endif
 
-#endif // !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_HAS_THREADS
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <cstddef>
diff --git a/libcxx/include/streambuf b/libcxx/include/streambuf
index 906340ef03335e..3359c1b5bb8e92 100644
--- a/libcxx/include/streambuf
+++ b/libcxx/include/streambuf
@@ -109,7 +109,7 @@ protected:
 
 #include <__config>
 
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 
 #  include <__assert>
 #  include <__fwd/streambuf.h>
@@ -433,7 +433,7 @@ typename basic_streambuf<_CharT, _Traits>::int_type basic_streambuf<_CharT, _Tra
 
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>;
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>;
 #  endif
 
@@ -441,7 +441,7 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
-#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#endif // _LIBCPP_HAS_LOCALIZATION
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <cstdint>
diff --git a/libcxx/include/string b/libcxx/include/string
index 20e44eaca2ac7a..4abf66099e1f28 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -648,7 +648,7 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
 #include <string_view>
 #include <version>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 #  include <cwchar>
 #endif
 
@@ -2274,12 +2274,12 @@ private:
 #define _LIBCPP_DECLARE(...) extern template __VA_ARGS__;
 #ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
 _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, char)
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, wchar_t)
 #  endif
 #else
 _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, char)
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, wchar_t)
 #  endif
 #endif
@@ -4209,7 +4209,7 @@ _LIBCPP_EXPORTED_FROM_ABI string to_string(float __val);
 _LIBCPP_EXPORTED_FROM_ABI string to_string(double __val);
 _LIBCPP_EXPORTED_FROM_ABI string to_string(long double __val);
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 _LIBCPP_EXPORTED_FROM_ABI int stoi(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
 _LIBCPP_EXPORTED_FROM_ABI long stol(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
 _LIBCPP_EXPORTED_FROM_ABI unsigned long stoul(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
@@ -4229,7 +4229,7 @@ _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(unsigned long long __val);
 _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(float __val);
 _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(double __val);
 _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(long double __val);
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 template <class _CharT, class _Traits, class _Allocator>
 _LIBCPP_TEMPLATE_DATA_VIS const typename basic_string<_CharT, _Traits, _Allocator>::size_type
@@ -4257,7 +4257,7 @@ struct hash<basic_string<char16_t, char_traits<char16_t>, _Allocator> > : __stri
 template <class _Allocator>
 struct hash<basic_string<char32_t, char_traits<char32_t>, _Allocator> > : __string_hash<char32_t, _Allocator> {};
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class _Allocator>
 struct hash<basic_string<wchar_t, char_traits<wchar_t>, _Allocator> > : __string_hash<wchar_t, _Allocator> {};
 #endif
@@ -4313,7 +4313,7 @@ operator""s(const char* __str, size_t __len) {
   return basic_string<char>(__str, __len);
 }
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<wchar_t>
 operator""s(const wchar_t* __str, size_t __len) {
   return basic_string<wchar_t>(__str, __len);
@@ -4341,7 +4341,7 @@ operator""s(const char32_t* __str, size_t __len) {
 #  if _LIBCPP_STD_VER >= 20
 template <>
 inline constexpr bool __format::__enable_insertable<std::basic_string<char>> = true;
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 inline constexpr bool __format::__enable_insertable<std::basic_string<wchar_t>> = true;
 #    endif
diff --git a/libcxx/include/string_view b/libcxx/include/string_view
index 0edda7aeb1a77c..0c6a68b486f64e 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -913,7 +913,7 @@ struct hash<basic_string_view<char16_t, char_traits<char16_t> > > : __string_vie
 template <>
 struct hash<basic_string_view<char32_t, char_traits<char32_t> > > : __string_view_hash<char32_t> {};
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 struct hash<basic_string_view<wchar_t, char_traits<wchar_t> > > : __string_view_hash<wchar_t> {};
 #endif
@@ -925,7 +925,7 @@ inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<char> operator""sv(cons
   return basic_string_view<char>(__str, __len);
 }
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<wchar_t>
 operator""sv(const wchar_t* __str, size_t __len) noexcept {
   return basic_string_view<wchar_t>(__str, __len);
diff --git a/libcxx/include/syncstream b/libcxx/include/syncstream
index 72a5f6ca5c86c1..970706976e1ff1 100644
--- a/libcxx/include/syncstream
+++ b/libcxx/include/syncstream
@@ -119,7 +119,7 @@ namespace std {
 
 #include <__config>
 
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 
 #  include <__utility/move.h>
 #  include <ios>
@@ -127,7 +127,7 @@ namespace std {
 #  include <streambuf>
 #  include <string>
 
-#  ifndef _LIBCPP_HAS_NO_THREADS
+#  if _LIBCPP_HAS_THREADS
 #    include <map>
 #    include <mutex>
 #    include <shared_mutex>
@@ -160,7 +160,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 //
 // This helper singleton is used to implement the required
 // synchronisation guarantees.
-#    ifndef _LIBCPP_HAS_NO_THREADS
+#    if _LIBCPP_HAS_THREADS
 class __wrapped_streambuf_mutex {
   _LIBCPP_HIDE_FROM_ABI __wrapped_streambuf_mutex() = default;
 
@@ -233,7 +233,7 @@ private:
     return __it;
   }
 };
-#    endif // _LIBCPP_HAS_NO_THREADS
+#    endif // _LIBCPP_HAS_THREADS
 
 // basic_syncbuf
 
@@ -373,7 +373,7 @@ private:
     if (!__wrapped_)
       return false;
 
-#    ifndef _LIBCPP_HAS_NO_THREADS
+#    if _LIBCPP_HAS_THREADS
     lock_guard<mutex> __lock = __wrapped_streambuf_mutex::__instance().__get_lock(__wrapped_);
 #    endif
 
@@ -407,14 +407,14 @@ private:
   }
 
   _LIBCPP_HIDE_FROM_ABI void __inc_reference() {
-#    ifndef _LIBCPP_HAS_NO_THREADS
+#    if _LIBCPP_HAS_THREADS
     if (__wrapped_)
       __wrapped_streambuf_mutex::__instance().__inc_reference(__wrapped_);
 #    endif
   }
 
   _LIBCPP_HIDE_FROM_ABI void __dec_reference() noexcept {
-#    ifndef _LIBCPP_HAS_NO_THREADS
+#    if _LIBCPP_HAS_THREADS
     if (__wrapped_)
       __wrapped_streambuf_mutex::__instance().__dec_reference(__wrapped_);
 #    endif
@@ -422,7 +422,7 @@ private:
 };
 
 using std::syncbuf;
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
 using std::wsyncbuf;
 #    endif
 
@@ -505,7 +505,7 @@ private:
 };
 
 using std::osyncstream;
-#    ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#    if _LIBCPP_HAS_WIDE_CHARACTERS
 using std::wosyncstream;
 #    endif
 
@@ -515,6 +515,6 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
-#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#endif // _LIBCPP_HAS_LOCALIZATION
 
 #endif // _LIBCPP_SYNCSTREAM
diff --git a/libcxx/include/thread b/libcxx/include/thread
index 25cb7ce6d7231e..bfe7e4a4c51e5c 100644
--- a/libcxx/include/thread
+++ b/libcxx/include/thread
@@ -88,7 +88,7 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
 
 #include <__config>
 
-#if !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_HAS_THREADS
 
 #  include <__thread/formatter.h>
 #  include <__thread/jthread.h>
@@ -106,7 +106,7 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
 #    pragma GCC system_header
 #  endif
 
-#endif // !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_HAS_THREADS
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
 #  include <cstddef>
diff --git a/libcxx/include/vector b/libcxx/include/vector
index bd874811714ad4..f4fa758f6f6d18 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -356,7 +356,7 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++
 #  include <cstdint>
 #  include <cstdlib>
 #  include <iosfwd>
-#  if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  if _LIBCPP_HAS_LOCALIZATION
 #    include <locale>
 #  endif
 #  include <string>
diff --git a/libcxx/include/version b/libcxx/include/version
index cb75f3b2db681c..33e0c05aeafdb5 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -289,12 +289,12 @@ __cpp_lib_void_t                                        201411L <type_traits>
 # define __cpp_lib_make_reverse_iterator                201402L
 # define __cpp_lib_make_unique                          201304L
 # define __cpp_lib_null_iterators                       201304L
-# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+# if _LIBCPP_HAS_LOCALIZATION
 #   define __cpp_lib_quoted_string_io                   201304L
 # endif
 # define __cpp_lib_result_of_sfinae                     201210L
 # define __cpp_lib_robust_nonmodifying_seq_ops          201304L
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   define __cpp_lib_shared_timed_mutex                 201402L
 # endif
 # define __cpp_lib_string_udls                          201304L
@@ -319,7 +319,7 @@ __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
-# if !defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY
+# if _LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY
 #   define __cpp_lib_filesystem                         201703L
 # endif
 # define __cpp_lib_gcd_lcm                              201606L
@@ -348,10 +348,10 @@ __cpp_lib_void_t                                        201411L <type_traits>
 // # define __cpp_lib_parallel_algorithm                   201603L
 # define __cpp_lib_raw_memory_algorithms                201606L
 # define __cpp_lib_sample                               201603L
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   define __cpp_lib_scoped_lock                        201703L
 # endif
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   define __cpp_lib_shared_mutex                       201505L
 # endif
 # define __cpp_lib_shared_ptr_arrays                    201611L
@@ -380,7 +380,7 @@ __cpp_lib_void_t                                        201411L <type_traits>
 # if _LIBCPP_AVAILABILITY_HAS_SYNC
 #   define __cpp_lib_atomic_wait                        201907L
 # endif
-# if !defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC
+# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
 #   define __cpp_lib_barrier                            201907L
 # endif
 # define __cpp_lib_bind_front                           201907L
@@ -421,10 +421,10 @@ __cpp_lib_void_t                                        201411L <type_traits>
 // # define __cpp_lib_is_layout_compatible                 201907L
 # define __cpp_lib_is_nothrow_convertible               201806L
 // # define __cpp_lib_is_pointer_interconvertible          201907L
-# if !defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC
+# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
 #   define __cpp_lib_jthread                            201911L
 # endif
-# if !defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC
+# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
 #   define __cpp_lib_latch                              201907L
 # endif
 # define __cpp_lib_list_remove_return_type              201806L
@@ -437,7 +437,7 @@ __cpp_lib_void_t                                        201411L <type_traits>
 # endif
 # define __cpp_lib_ranges                               202110L
 # define __cpp_lib_remove_cvref                         201711L
-# if !defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC
+# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
 #   define __cpp_lib_semaphore                          201907L
 # endif
 # undef  __cpp_lib_shared_ptr_arrays
@@ -540,7 +540,7 @@ __cpp_lib_void_t                                        201411L <type_traits>
 // # define __cpp_lib_freestanding_optional                202311L
 // # define __cpp_lib_freestanding_string_view             202311L
 // # define __cpp_lib_freestanding_variant                 202311L
-# if !defined(_LIBCPP_HAS_NO_FILESYSTEM) && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+# if _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
 #   define __cpp_lib_fstream_native_handle              202306L
 # endif
 // # define __cpp_lib_function_ref                         202306L
diff --git a/libcxx/include/wchar.h b/libcxx/include/wchar.h
index c965b28e57c6c7..b7cd5d7fc62cde 100644
--- a/libcxx/include/wchar.h
+++ b/libcxx/include/wchar.h
@@ -137,7 +137,7 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
 #    endif
 #  endif
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 #    if defined(__cplusplus) && !defined(_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)
 extern "C++" {
 inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {
@@ -203,6 +203,6 @@ size_t wcsnrtombs(
     char* __restrict __dst, const wchar_t** __restrict __src, size_t __nwc, size_t __len, mbstate_t* __restrict __ps);
 } // extern "C"
 #    endif // __cplusplus && (_LIBCPP_MSVCRT || __MVS__)
-#  endif   // !_LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  endif   // _LIBCPP_HAS_WIDE_CHARACTERS
 
 #endif // _LIBCPP_WCHAR_H
diff --git a/libcxx/modules/std.compat.cppm.in b/libcxx/modules/std.compat.cppm.in
index fbc2c7d94cfabb..5cea1b75bfc170 100644
--- a/libcxx/modules/std.compat.cppm.in
+++ b/libcxx/modules/std.compat.cppm.in
@@ -24,7 +24,7 @@ module;
 #include <cfloat>
 #include <cinttypes>
 #include <climits>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <clocale>
 #endif
 #include <cmath>
diff --git a/libcxx/modules/std.compat/clocale.inc b/libcxx/modules/std.compat/clocale.inc
index 1a975c560a496d..bc1c0c4d1adc91 100644
--- a/libcxx/modules/std.compat/clocale.inc
+++ b/libcxx/modules/std.compat/clocale.inc
@@ -8,10 +8,10 @@
 //===----------------------------------------------------------------------===//
 
 export {
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
   using ::lconv _LIBCPP_USING_IF_EXISTS;
 
   using ::localeconv _LIBCPP_USING_IF_EXISTS;
   using ::setlocale _LIBCPP_USING_IF_EXISTS;
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 } // export
diff --git a/libcxx/modules/std.compat/cstdlib.inc b/libcxx/modules/std.compat/cstdlib.inc
index 94f5e7e8d7f451..84583d9efa59b6 100644
--- a/libcxx/modules/std.compat/cstdlib.inc
+++ b/libcxx/modules/std.compat/cstdlib.inc
@@ -45,7 +45,7 @@ export {
 
   // [c.mb.wcs], multibyte / wide string and character conversion functions
   using ::mblen _LIBCPP_USING_IF_EXISTS;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   using ::mbstowcs _LIBCPP_USING_IF_EXISTS;
   using ::mbtowc _LIBCPP_USING_IF_EXISTS;
   using ::wcstombs _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std.compat/cwchar.inc b/libcxx/modules/std.compat/cwchar.inc
index 4cad9281fb49a2..38df15653e4a14 100644
--- a/libcxx/modules/std.compat/cwchar.inc
+++ b/libcxx/modules/std.compat/cwchar.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export {
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
   using ::size_t _LIBCPP_USING_IF_EXISTS;
   using ::wint_t _LIBCPP_USING_IF_EXISTS;
@@ -76,5 +76,5 @@ export {
   using ::mbsrtowcs _LIBCPP_USING_IF_EXISTS;
   using ::wcrtomb _LIBCPP_USING_IF_EXISTS;
   using ::wcsrtombs _LIBCPP_USING_IF_EXISTS;
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 } // export
diff --git a/libcxx/modules/std.compat/cwctype.inc b/libcxx/modules/std.compat/cwctype.inc
index 8d06eaa379eaa2..d9c3c6556d490b 100644
--- a/libcxx/modules/std.compat/cwctype.inc
+++ b/libcxx/modules/std.compat/cwctype.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export {
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   using ::wctrans_t _LIBCPP_USING_IF_EXISTS;
   using ::wctype_t _LIBCPP_USING_IF_EXISTS;
   using ::wint_t _LIBCPP_USING_IF_EXISTS;
@@ -31,5 +31,5 @@ export {
   using ::towupper _LIBCPP_USING_IF_EXISTS;
   using ::wctrans _LIBCPP_USING_IF_EXISTS;
   using ::wctype _LIBCPP_USING_IF_EXISTS;
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 } // export
diff --git a/libcxx/modules/std.cppm.in b/libcxx/modules/std.cppm.in
index b4889e5a69e49b..b9d00df70658d8 100644
--- a/libcxx/modules/std.cppm.in
+++ b/libcxx/modules/std.cppm.in
@@ -35,11 +35,11 @@ module;
 #include <chrono>
 #include <cinttypes>
 #include <climits>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <clocale>
 #endif
 #include <cmath>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <codecvt>
 #endif
 #include <compare>
@@ -67,30 +67,30 @@ module;
 #include <flat_map>
 #include <format>
 #include <forward_list>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <fstream>
 #endif
 #include <functional>
 #include <future>
 #include <initializer_list>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <iomanip>
 #endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <ios>
 #endif
 #include <iosfwd>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <iostream>
 #endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <istream>
 #endif
 #include <iterator>
 #include <latch>
 #include <limits>
 #include <list>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <locale>
 #endif
 #include <map>
@@ -102,7 +102,7 @@ module;
 #include <numbers>
 #include <numeric>
 #include <optional>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <ostream>
 #endif
 #include <print>
@@ -110,7 +110,7 @@ module;
 #include <random>
 #include <ranges>
 #include <ratio>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <regex>
 #endif
 #include <scoped_allocator>
@@ -119,21 +119,21 @@ module;
 #include <shared_mutex>
 #include <source_location>
 #include <span>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <sstream>
 #endif
 #include <stack>
 #include <stdexcept>
 #include <stop_token>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <streambuf>
 #endif
 #include <string>
 #include <string_view>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <strstream>
 #endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if _LIBCPP_HAS_LOCALIZATION
 #  include <syncstream>
 #endif
 #include <system_error>
diff --git a/libcxx/modules/std/atomic.inc b/libcxx/modules/std/atomic.inc
index 6ed0f7e9c4f328..9a30fb7affe71f 100644
--- a/libcxx/modules/std/atomic.inc
+++ b/libcxx/modules/std/atomic.inc
@@ -73,7 +73,7 @@ export namespace std {
   using std::atomic_ullong _LIBCPP_USING_IF_EXISTS;
   using std::atomic_ulong _LIBCPP_USING_IF_EXISTS;
   using std::atomic_ushort _LIBCPP_USING_IF_EXISTS;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::atomic_wchar_t _LIBCPP_USING_IF_EXISTS;
 #endif
 
diff --git a/libcxx/modules/std/barrier.inc b/libcxx/modules/std/barrier.inc
index dadb67f7ef3301..2d6a888b4d4fc0 100644
--- a/libcxx/modules/std/barrier.inc
+++ b/libcxx/modules/std/barrier.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
   using std::barrier;
-#endif // _LIBCPP_HAS_NO_THREADS
+#endif
 } // namespace std
diff --git a/libcxx/modules/std/chrono.inc b/libcxx/modules/std/chrono.inc
index 8d313f755f7253..df21d1fbac5852 100644
--- a/libcxx/modules/std/chrono.inc
+++ b/libcxx/modules/std/chrono.inc
@@ -50,7 +50,7 @@ export namespace std {
     using std::chrono::round;
 
     // [time.duration.io], duration I/O
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
     using std::chrono::operator<<;
 #endif
     // using std::chrono::from_stream;
@@ -111,7 +111,7 @@ export namespace std {
 
     using std::chrono::file_time;
 
-#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
+#if _LIBCPP_HAS_MONOTONIC_CLOCK
     // [time.clock.steady], class steady_clock
     using std::chrono::steady_clock;
 #endif
@@ -191,8 +191,7 @@ export namespace std {
 
 #ifdef _LIBCPP_ENABLE_EXPERIMENTAL
 
-#  if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&                            \
-      !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
 
     // [time.zone.db], time zone database
     using std::chrono::tzdb;
@@ -208,8 +207,7 @@ export namespace std {
     using std::chrono::reload_tzdb;
     using std::chrono::remote_version;
 
-#  endif //  !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&
-         //  !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  endif //  _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
 
     // [time.zone.exception], exception classes
     using std::chrono::ambiguous_local_time;
@@ -219,8 +217,7 @@ export namespace std {
     using std::chrono::local_info;
     using std::chrono::sys_info;
 
-#  if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&                            \
-      !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
 
     // [time.zone.timezone], class time_zone
     using std::chrono::choose;
@@ -244,15 +241,14 @@ export namespace std {
     // [time.format], formatting
     using std::chrono::local_time_format;
 #    endif
-#  endif //  !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&
-         //  !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  endif //  _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
 #endif   // _LIBCPP_ENABLE_EXPERIMENTAL
 
   } // namespace chrono
 
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
   using std::formatter;
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif
 
   namespace chrono {
     // using std::chrono::parse;
diff --git a/libcxx/modules/std/clocale.inc b/libcxx/modules/std/clocale.inc
index 359868a61eb9d7..c336a97a9f1223 100644
--- a/libcxx/modules/std/clocale.inc
+++ b/libcxx/modules/std/clocale.inc
@@ -8,10 +8,10 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
   using std::lconv _LIBCPP_USING_IF_EXISTS;
 
   using std::localeconv _LIBCPP_USING_IF_EXISTS;
   using std::setlocale _LIBCPP_USING_IF_EXISTS;
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 } // namespace std
diff --git a/libcxx/modules/std/codecvt.inc b/libcxx/modules/std/codecvt.inc
index 277ef046349a9e..07accd513442dc 100644
--- a/libcxx/modules/std/codecvt.inc
+++ b/libcxx/modules/std/codecvt.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
 #  if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT)
   using std::codecvt_mode;
 
@@ -16,5 +16,5 @@ export namespace std {
   using std::codecvt_utf8;
   using std::codecvt_utf8_utf16;
 #  endif // _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT)
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif   // _LIBCPP_HAS_LOCALIZATION
 } // namespace std
diff --git a/libcxx/modules/std/complex.inc b/libcxx/modules/std/complex.inc
index 47a44420b127a9..1ad5f78d51fc51 100644
--- a/libcxx/modules/std/complex.inc
+++ b/libcxx/modules/std/complex.inc
@@ -19,10 +19,10 @@ export namespace std {
   using std::operator/;
 
   using std::operator==;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
   using std::operator>>;
   using std::operator<<;
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 
   // [complex.value.ops], values
   using std::imag;
diff --git a/libcxx/modules/std/condition_variable.inc b/libcxx/modules/std/condition_variable.inc
index b428918f90603d..c3197d6891bd31 100644
--- a/libcxx/modules/std/condition_variable.inc
+++ b/libcxx/modules/std/condition_variable.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
   // [thread.condition.condvar], class condition_variable
   using std::condition_variable;
   // [thread.condition.condvarany], class condition_variable_any
@@ -18,5 +18,5 @@ export namespace std {
   using std::notify_all_at_thread_exit;
 
   using std::cv_status;
-#endif // _LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 } // namespace std
diff --git a/libcxx/modules/std/cstdlib.inc b/libcxx/modules/std/cstdlib.inc
index 617cf3ff3ef6b7..bfa88760ac0cb4 100644
--- a/libcxx/modules/std/cstdlib.inc
+++ b/libcxx/modules/std/cstdlib.inc
@@ -45,7 +45,7 @@ export namespace std {
 
   // [c.mb.wcs], multibyte / wide string and character conversion functions
   using std::mblen _LIBCPP_USING_IF_EXISTS;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::mbstowcs _LIBCPP_USING_IF_EXISTS;
   using std::mbtowc _LIBCPP_USING_IF_EXISTS;
   using std::wcstombs _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std/cwchar.inc b/libcxx/modules/std/cwchar.inc
index 02b1713359b6aa..6fda1cf5cdc750 100644
--- a/libcxx/modules/std/cwchar.inc
+++ b/libcxx/modules/std/cwchar.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::mbstate_t _LIBCPP_USING_IF_EXISTS;
   using std::size_t _LIBCPP_USING_IF_EXISTS;
   using std::wint_t _LIBCPP_USING_IF_EXISTS;
@@ -76,5 +76,5 @@ export namespace std {
   using std::mbsrtowcs _LIBCPP_USING_IF_EXISTS;
   using std::wcrtomb _LIBCPP_USING_IF_EXISTS;
   using std::wcsrtombs _LIBCPP_USING_IF_EXISTS;
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 } // namespace std
diff --git a/libcxx/modules/std/cwctype.inc b/libcxx/modules/std/cwctype.inc
index 30e526aae0af6f..5d755d56e0103b 100644
--- a/libcxx/modules/std/cwctype.inc
+++ b/libcxx/modules/std/cwctype.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wctrans_t _LIBCPP_USING_IF_EXISTS;
   using std::wctype_t _LIBCPP_USING_IF_EXISTS;
   using std::wint_t _LIBCPP_USING_IF_EXISTS;
@@ -31,5 +31,5 @@ export namespace std {
   using std::towupper _LIBCPP_USING_IF_EXISTS;
   using std::wctrans _LIBCPP_USING_IF_EXISTS;
   using std::wctype _LIBCPP_USING_IF_EXISTS;
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 } // namespace std
diff --git a/libcxx/modules/std/filesystem.inc b/libcxx/modules/std/filesystem.inc
index 3214b49fe8d823..0437a328025016 100644
--- a/libcxx/modules/std/filesystem.inc
+++ b/libcxx/modules/std/filesystem.inc
@@ -18,7 +18,7 @@ export namespace std::filesystem {
   // [fs.class.filesystem.error], filesystem errors
   using std::filesystem::filesystem_error;
 
-#ifndef _LIBCPP_HAS_NO_FILESYSTEM
+#if _LIBCPP_HAS_FILESYSTEM
   // [fs.class.directory.entry], directory entries
   using std::filesystem::directory_entry;
 
@@ -31,7 +31,7 @@ export namespace std::filesystem {
 
   // [fs.class.rec.dir.itr], recursive directory iterators
   using std::filesystem::recursive_directory_iterator;
-#endif // _LIBCPP_HAS_NO_FILESYSTEM
+#endif // _LIBCPP_HAS_FILESYSTEM
 
   // [fs.rec.dir.itr.nonmembers], range access for recursive directory iterators
 
@@ -58,7 +58,7 @@ export namespace std::filesystem {
   using std::filesystem::operator|=;
   using std::filesystem::operator~;
 
-#ifndef _LIBCPP_HAS_NO_FILESYSTEM
+#if _LIBCPP_HAS_FILESYSTEM
   // [fs.op.funcs], filesystem operations
   using std::filesystem::absolute;
   using std::filesystem::canonical;
@@ -102,7 +102,7 @@ export namespace std::filesystem {
   using std::filesystem::symlink_status;
   using std::filesystem::temp_directory_path;
   using std::filesystem::weakly_canonical;
-#endif // _LIBCPP_HAS_NO_FILESYSTEM
+#endif // _LIBCPP_HAS_FILESYSTEM
 
   // [depr.fs.path.factory]
   using std::filesystem::u8path;
@@ -114,8 +114,8 @@ export namespace std {
 }
 
 export namespace std::ranges {
-#ifndef _LIBCPP_HAS_NO_FILESYSTEM
+#if _LIBCPP_HAS_FILESYSTEM
   using std::ranges::enable_borrowed_range;
   using std::ranges::enable_view;
-#endif // _LIBCPP_HAS_NO_FILESYSTEM
+#endif // _LIBCPP_HAS_FILESYSTEM
 } // namespace std::ranges
diff --git a/libcxx/modules/std/format.inc b/libcxx/modules/std/format.inc
index 8daf0de85cc412..fb0f971aeb0e99 100644
--- a/libcxx/modules/std/format.inc
+++ b/libcxx/modules/std/format.inc
@@ -11,21 +11,21 @@ export namespace std {
   // [format.context], class template basic_format_context
   using std::basic_format_context;
   using std::format_context;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wformat_context;
 #endif
 
   // [format.args], class template basic_format_args
   using std::basic_format_args;
   using std::format_args;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wformat_args;
 #endif
 
   // [format.fmt.string], class template basic_format_string
   using std::basic_format_string;
   using std::format_string;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wformat_string;
 #endif
 #if _LIBCPP_STD_VER >= 26
@@ -55,7 +55,7 @@ export namespace std {
   // [format.parse.ctx], class template basic_format_parse_context
   using std::basic_format_parse_context;
   using std::format_parse_context;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wformat_parse_context;
 #endif
 
@@ -75,7 +75,7 @@ export namespace std {
 
   // [format.arg.store], class template format-arg-store
   using std::make_format_args;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::make_wformat_args;
 #endif
 
diff --git a/libcxx/modules/std/fstream.inc b/libcxx/modules/std/fstream.inc
index b0017949af5403..1773c5509e9a75 100644
--- a/libcxx/modules/std/fstream.inc
+++ b/libcxx/modules/std/fstream.inc
@@ -8,37 +8,37 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
   using std::basic_filebuf;
 
-#  ifndef _LIBCPP_HAS_NO_FILESYSTEM
+#  if _LIBCPP_HAS_FILESYSTEM
   using std::swap;
 #  endif
 
   using std::filebuf;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wfilebuf;
 #  endif
 
   using std::basic_ifstream;
 
   using std::ifstream;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wifstream;
 #  endif
 
   using std::basic_ofstream;
 
   using std::ofstream;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wofstream;
 #  endif
 
   using std::basic_fstream;
 
   using std::fstream;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wfstream;
 #  endif
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 } // namespace std
diff --git a/libcxx/modules/std/future.inc b/libcxx/modules/std/future.inc
index 2500ad1dee2740..1abf9b3ef612fb 100644
--- a/libcxx/modules/std/future.inc
+++ b/libcxx/modules/std/future.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
   using std::future_errc;
   using std::future_status;
   using std::launch;
@@ -51,5 +51,5 @@ export namespace std {
 
   // [futures.async], function template async
   using std::async;
-#endif // _LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 } // namespace std
diff --git a/libcxx/modules/std/iomanip.inc b/libcxx/modules/std/iomanip.inc
index 35a52efcd20b0b..f525f81cf117d2 100644
--- a/libcxx/modules/std/iomanip.inc
+++ b/libcxx/modules/std/iomanip.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
   using std::get_money;
   using std::get_time;
   using std::put_money;
@@ -21,5 +21,5 @@ export namespace std {
   using std::setw;
 
   using std::quoted;
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 } // namespace std
diff --git a/libcxx/modules/std/ios.inc b/libcxx/modules/std/ios.inc
index eeed5398c5a684..d9e1e97fad55a6 100644
--- a/libcxx/modules/std/ios.inc
+++ b/libcxx/modules/std/ios.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
   using std::fpos;
   // based on [tab:fpos.operations]
   using std::operator!=; // Note not affected by P1614, seems like a bug.
@@ -69,8 +69,8 @@ export namespace std {
 
   // [iosfwd.syn]
   using std::ios;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wios;
 #  endif
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 } // namespace std
diff --git a/libcxx/modules/std/iosfwd.inc b/libcxx/modules/std/iosfwd.inc
index 952057d691fc40..81bdddec8afef4 100644
--- a/libcxx/modules/std/iosfwd.inc
+++ b/libcxx/modules/std/iosfwd.inc
@@ -9,7 +9,7 @@
 
 export namespace std {
   using std::streampos;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wstreampos;
 #endif
   using std::u16streampos;
@@ -30,7 +30,7 @@ export namespace std {
   using std::osyncstream;
   using std::syncbuf;
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wosyncstream;
   using std::wsyncbuf;
 #  endif
diff --git a/libcxx/modules/std/iostream.inc b/libcxx/modules/std/iostream.inc
index d6e20364960575..76ff94923dea4d 100644
--- a/libcxx/modules/std/iostream.inc
+++ b/libcxx/modules/std/iostream.inc
@@ -8,17 +8,17 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
   using std::cerr;
   using std::cin;
   using std::clog;
   using std::cout;
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wcerr;
   using std::wcin;
   using std::wclog;
   using std::wcout;
 #  endif
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 } // namespace std
diff --git a/libcxx/modules/std/istream.inc b/libcxx/modules/std/istream.inc
index fdb1854014036f..19fcd5db3de704 100644
--- a/libcxx/modules/std/istream.inc
+++ b/libcxx/modules/std/istream.inc
@@ -8,23 +8,23 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
   using std::basic_istream;
 
   using std::istream;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wistream;
 #  endif
 
   using std::basic_iostream;
 
   using std::iostream;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wiostream;
 #  endif
 
   using std::ws;
 
   using std::operator>>;
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 } // namespace std
diff --git a/libcxx/modules/std/latch.inc b/libcxx/modules/std/latch.inc
index 922a55e038ec37..c64be15808e253 100644
--- a/libcxx/modules/std/latch.inc
+++ b/libcxx/modules/std/latch.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
   using std::latch;
-#endif // _LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 } // namespace std
diff --git a/libcxx/modules/std/locale.inc b/libcxx/modules/std/locale.inc
index 8975453864226b..cdc7441ece52ef 100644
--- a/libcxx/modules/std/locale.inc
+++ b/libcxx/modules/std/locale.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
   // [locale], locale
   using std::has_facet;
   using std::locale;
@@ -77,5 +77,5 @@ export namespace std {
 
 #  endif // _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_WSTRING_CONVERT)
 
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 } // namespace std
diff --git a/libcxx/modules/std/memory.inc b/libcxx/modules/std/memory.inc
index 4c4cccfd7cf2fe..82056e426d06c9 100644
--- a/libcxx/modules/std/memory.inc
+++ b/libcxx/modules/std/memory.inc
@@ -191,7 +191,7 @@ export namespace std {
   using std::inout_ptr;
 #endif // _LIBCPP_STD_VER >= 23
 
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
   // [depr.util.smartptr.shared.atomic]
   using std::atomic_is_lock_free;
 
@@ -208,5 +208,5 @@ export namespace std {
   using std::atomic_compare_exchange_strong_explicit;
   using std::atomic_compare_exchange_weak;
   using std::atomic_compare_exchange_weak_explicit;
-#endif // _LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 } // namespace std
diff --git a/libcxx/modules/std/mutex.inc b/libcxx/modules/std/mutex.inc
index 24c7f2e598a8bd..7a12506424a2d7 100644
--- a/libcxx/modules/std/mutex.inc
+++ b/libcxx/modules/std/mutex.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
   // [thread.mutex.class], class mutex
   using std::mutex;
   // [thread.mutex.recursive], class recursive_mutex
@@ -36,7 +36,7 @@ export namespace std {
   // [thread.lock.algorithm], generic locking algorithms
   using std::lock;
   using std::try_lock;
-#endif // _LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 
   using std::once_flag;
 
diff --git a/libcxx/modules/std/ostream.inc b/libcxx/modules/std/ostream.inc
index 0e0e2d54fe6bae..e124e6618eec22 100644
--- a/libcxx/modules/std/ostream.inc
+++ b/libcxx/modules/std/ostream.inc
@@ -8,11 +8,11 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
   using std::basic_ostream;
 
   using std::ostream;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wostream;
 #  endif
 
@@ -33,10 +33,10 @@ export namespace std {
   using std::println;
 
   using std::vprint_nonunicode;
-#    ifndef _LIBCPP_HAS_NO_UNICODE
+#    if _LIBCPP_HAS_UNICODE
   using std::vprint_unicode;
-#    endif // _LIBCPP_HAS_NO_UNICODE
+#    endif // _LIBCPP_HAS_UNICODE
 #  endif   // _LIBCPP_STD_VER >= 23
 
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 } // namespace std
diff --git a/libcxx/modules/std/print.inc b/libcxx/modules/std/print.inc
index 1ca52c70068872..5354025ca8bd80 100644
--- a/libcxx/modules/std/print.inc
+++ b/libcxx/modules/std/print.inc
@@ -14,8 +14,8 @@ export namespace std {
   using std::println;
 
   using std::vprint_nonunicode;
-#  ifndef _LIBCPP_HAS_NO_UNICODE
+#  if _LIBCPP_HAS_UNICODE
   using std::vprint_unicode;
-#  endif // _LIBCPP_HAS_NO_UNICODE
+#  endif // _LIBCPP_HAS_UNICODE
 #endif   // _LIBCPP_STD_VER >= 23
 } // namespace std
diff --git a/libcxx/modules/std/random.inc b/libcxx/modules/std/random.inc
index 0b003fdd8902e4..0ab6945247c975 100644
--- a/libcxx/modules/std/random.inc
+++ b/libcxx/modules/std/random.inc
@@ -42,7 +42,7 @@ export namespace std {
 
   using std::default_random_engine;
 
-#ifndef _LIBCPP_HAS_NO_RANDOM_DEVICE
+#if _LIBCPP_HAS_RANDOM_DEVICE
   // [rand.device], class random_device
   using std::random_device;
 #endif
diff --git a/libcxx/modules/std/ranges.inc b/libcxx/modules/std/ranges.inc
index f71efe948ede10..a5e2a2b4583c19 100644
--- a/libcxx/modules/std/ranges.inc
+++ b/libcxx/modules/std/ranges.inc
@@ -125,18 +125,18 @@ export namespace std {
     } // namespace views
 #endif // _LIBCPP_STD_VER >= 23
 
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
     // [range.istream], istream view
     using std::ranges::basic_istream_view;
     using std::ranges::istream_view;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
     using std::ranges::wistream_view;
 #  endif
 
     namespace views {
       using std::ranges::views::istream;
     }
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 
     // Note: This declaration not in the synopsis or explicitly in the wording.
     // However it is needed for the range adaptors.
diff --git a/libcxx/modules/std/regex.inc b/libcxx/modules/std/regex.inc
index 8217e34bc22c84..9d0c58075b582f 100644
--- a/libcxx/modules/std/regex.inc
+++ b/libcxx/modules/std/regex.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
   // [re.const], regex constants
   namespace regex_constants {
     using std::regex_constants::error_type;
@@ -37,7 +37,7 @@ export namespace std {
   using std::basic_regex;
 
   using std::regex;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wregex;
 #  endif
 
@@ -49,7 +49,7 @@ export namespace std {
 
   using std::csub_match;
   using std::ssub_match;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wcsub_match;
   using std::wssub_match;
 #  endif
@@ -65,7 +65,7 @@ export namespace std {
 
   using std::cmatch;
   using std::smatch;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wcmatch;
   using std::wsmatch;
 #  endif
@@ -88,7 +88,7 @@ export namespace std {
 
   using std::cregex_iterator;
   using std::sregex_iterator;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wcregex_iterator;
   using std::wsregex_iterator;
 #  endif
@@ -98,7 +98,7 @@ export namespace std {
 
   using std::cregex_token_iterator;
   using std::sregex_token_iterator;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wcregex_token_iterator;
   using std::wsregex_token_iterator;
 #  endif
@@ -108,10 +108,10 @@ export namespace std {
 
     using std::pmr::cmatch;
     using std::pmr::smatch;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
     using std::pmr::wcmatch;
     using std::pmr::wsmatch;
 #  endif
   }    // namespace pmr
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 } // namespace std
diff --git a/libcxx/modules/std/semaphore.inc b/libcxx/modules/std/semaphore.inc
index a8c8a1b6018e18..7b47554fb6e35f 100644
--- a/libcxx/modules/std/semaphore.inc
+++ b/libcxx/modules/std/semaphore.inc
@@ -8,10 +8,10 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
   // [thread.sema.cnt], class template counting_semaphore
   using std::counting_semaphore;
 
   using std::binary_semaphore;
-#endif // _LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 } // namespace std
diff --git a/libcxx/modules/std/shared_mutex.inc b/libcxx/modules/std/shared_mutex.inc
index 5f09446e38bc77..95102fc1ffee3c 100644
--- a/libcxx/modules/std/shared_mutex.inc
+++ b/libcxx/modules/std/shared_mutex.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
   // [thread.sharedmutex.class], class shared_­mutex
   using std::shared_mutex;
   // [thread.sharedtimedmutex.class], class shared_­timed_­mutex
@@ -16,5 +16,5 @@ export namespace std {
   // [thread.lock.shared], class template shared_­lock
   using std::shared_lock;
   using std::swap;
-#endif // _LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 } // namespace std
diff --git a/libcxx/modules/std/spanstream.inc b/libcxx/modules/std/spanstream.inc
index e6383a185e0798..e5b096e993307b 100644
--- a/libcxx/modules/std/spanstream.inc
+++ b/libcxx/modules/std/spanstream.inc
@@ -14,28 +14,28 @@ export namespace std {
   using std::swap;
 
   using std::spanbuf;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wspanbuf;
 #  endif
 
   using std::basic_ispanstream;
 
   using std::ispanstream;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wispanstream;
 #  endif
 
   using std::basic_ospanstream;
 
   using std::ospanstream;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wospanstream;
 #  endif
 
   using std::basic_spanstream;
 
   using std::spanstream;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wspanstream;
 #  endif
 #endif
diff --git a/libcxx/modules/std/sstream.inc b/libcxx/modules/std/sstream.inc
index 2218001290d0f0..99ec3b34e5af07 100644
--- a/libcxx/modules/std/sstream.inc
+++ b/libcxx/modules/std/sstream.inc
@@ -8,35 +8,35 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
   using std::basic_stringbuf;
 
   using std::swap;
 
   using std::stringbuf;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wstringbuf;
 #  endif
 
   using std::basic_istringstream;
 
   using std::istringstream;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wistringstream;
 #  endif
 
   using std::basic_ostringstream;
 
   using std::ostringstream;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wostringstream;
 #  endif
 
   using std::basic_stringstream;
 
   using std::stringstream;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wstringstream;
 #  endif
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 } // namespace std
diff --git a/libcxx/modules/std/stop_token.inc b/libcxx/modules/std/stop_token.inc
index 5daf4609611f87..b5c7eb215fb636 100644
--- a/libcxx/modules/std/stop_token.inc
+++ b/libcxx/modules/std/stop_token.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
   // [stoptoken], class stop_­token
   using std::stop_token;
 
@@ -21,5 +21,5 @@ export namespace std {
 
   // [stopcallback], class template stop_­callback
   using std::stop_callback;
-#endif // _LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 } // namespace std
diff --git a/libcxx/modules/std/streambuf.inc b/libcxx/modules/std/streambuf.inc
index 32914cfe53687d..fac076765ea22d 100644
--- a/libcxx/modules/std/streambuf.inc
+++ b/libcxx/modules/std/streambuf.inc
@@ -8,11 +8,11 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
   using std::basic_streambuf;
   using std::streambuf;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wstreambuf;
 #  endif
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif // _LIBCPP_HAS_LOCALIZATION
 } // namespace std
diff --git a/libcxx/modules/std/string.inc b/libcxx/modules/std/string.inc
index 322317c98c0180..8e14be8dcbe41f 100644
--- a/libcxx/modules/std/string.inc
+++ b/libcxx/modules/std/string.inc
@@ -37,7 +37,7 @@ export namespace std {
 #if _LIBCPP_HAS_CHAR8_T
   using std::u8string;
 #endif
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wstring;
 #endif
 
@@ -51,7 +51,7 @@ export namespace std {
   using std::stoul;
   using std::stoull;
   using std::to_string;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::to_wstring;
 #endif
 
@@ -63,7 +63,7 @@ export namespace std {
 #if _LIBCPP_HAS_CHAR8_T
     using std::pmr::u8string;
 #endif
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
     using std::pmr::wstring;
 #endif
   } // namespace pmr
diff --git a/libcxx/modules/std/string_view.inc b/libcxx/modules/std/string_view.inc
index 1237f4516e7d00..4de1c8b58c2e57 100644
--- a/libcxx/modules/std/string_view.inc
+++ b/libcxx/modules/std/string_view.inc
@@ -30,7 +30,7 @@ export namespace std {
 #if _LIBCPP_HAS_CHAR8_T
   using std::u8string_view;
 #endif
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wstring_view;
 #endif
 
diff --git a/libcxx/modules/std/strstream.inc b/libcxx/modules/std/strstream.inc
index 808796701abaeb..5b9d45ad9e8fc7 100644
--- a/libcxx/modules/std/strstream.inc
+++ b/libcxx/modules/std/strstream.inc
@@ -8,12 +8,12 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
 #  if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_STRSTREAM)
   using std::istrstream;
   using std::ostrstream;
   using std::strstream;
   using std::strstreambuf;
 #  endif // _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_STRSTREAM)
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#endif   // _LIBCPP_HAS_LOCALIZATION
 } // namespace std
diff --git a/libcxx/modules/std/syncstream.inc b/libcxx/modules/std/syncstream.inc
index e3fb391b67c636..ed4cae04d1b8b7 100644
--- a/libcxx/modules/std/syncstream.inc
+++ b/libcxx/modules/std/syncstream.inc
@@ -8,21 +8,21 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
+#if _LIBCPP_HAS_LOCALIZATION && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
   using std::basic_syncbuf;
 
   // [syncstream.syncbuf.special], specialized algorithms
   using std::swap;
 
   using std::syncbuf;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wsyncbuf;
 #  endif
   using std::basic_osyncstream;
 
   using std::osyncstream;
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   using std::wosyncstream;
 #  endif
-#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
+#endif // _LIBCPP_HAS_LOCALIZATION && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
 } // namespace std
diff --git a/libcxx/modules/std/thread.inc b/libcxx/modules/std/thread.inc
index 61e3191f3197b8..694539e1a0c5e2 100644
--- a/libcxx/modules/std/thread.inc
+++ b/libcxx/modules/std/thread.inc
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 export namespace std {
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
   // [thread.thread.class], class thread
   using std::thread;
 
@@ -29,14 +29,14 @@ export namespace std {
   // [thread.thread.id]
   using std::operator==;
   using std::operator<=>;
-#  ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#  if _LIBCPP_HAS_LOCALIZATION
   using std::operator<<;
-#  endif // _LIBCPP_HAS_NO_LOCALIZATION
+#  endif // _LIBCPP_HAS_LOCALIZATION
 
 #  if _LIBCPP_STD_VER >= 23
   using std::formatter;
 #  endif
 
   using std::hash;
-#endif // _LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 } // namespace std
diff --git a/libcxx/src/algorithm.cpp b/libcxx/src/algorithm.cpp
index a7c39b5e5183a4..d388fee5f99cc1 100644
--- a/libcxx/src/algorithm.cpp
+++ b/libcxx/src/algorithm.cpp
@@ -26,7 +26,7 @@ void __sort(RandomAccessIterator first, RandomAccessIterator last, Comp comp) {
 
 // clang-format off
 template void __sort<__less<char>&, char*>(char*, char*, __less<char>&);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
 #endif
 template void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
diff --git a/libcxx/src/call_once.cpp b/libcxx/src/call_once.cpp
index 5744347f84b20c..a398eaecfd009d 100644
--- a/libcxx/src/call_once.cpp
+++ b/libcxx/src/call_once.cpp
@@ -9,7 +9,7 @@
 #include <__mutex/once_flag.h>
 #include <__utility/exception_guard.h>
 
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
 #  include <__thread/support.h>
 #endif
 
@@ -23,13 +23,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 // call into dispatch_once_f instead of here. Relevant radar this code needs to
 // keep in sync with:  7741191.
 
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
 static constinit __libcpp_mutex_t mut  = _LIBCPP_MUTEX_INITIALIZER;
 static constinit __libcpp_condvar_t cv = _LIBCPP_CONDVAR_INITIALIZER;
 #endif
 
 void __call_once(volatile once_flag::_State_type& flag, void* arg, void (*func)(void*)) {
-#if defined(_LIBCPP_HAS_NO_THREADS)
+#if !_LIBCPP_HAS_THREADS
 
   if (flag == once_flag::_Unset) {
     auto guard = std::__make_exception_guard([&flag] { flag = once_flag::_Unset; });
@@ -39,7 +39,7 @@ void __call_once(volatile once_flag::_State_type& flag, void* arg, void (*func)(
     guard.__complete();
   }
 
-#else // !_LIBCPP_HAS_NO_THREADS
+#else // !_LIBCPP_HAS_THREADS
 
   __libcpp_mutex_lock(&mut);
   while (flag == once_flag::_Pending)
@@ -64,7 +64,7 @@ void __call_once(volatile once_flag::_State_type& flag, void* arg, void (*func)(
     __libcpp_mutex_unlock(&mut);
   }
 
-#endif // !_LIBCPP_HAS_NO_THREADS
+#endif // !_LIBCPP_HAS_THREADS
 }
 
 _LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/src/chrono.cpp b/libcxx/src/chrono.cpp
index 986360d0368a09..f17ea5542bd99d 100644
--- a/libcxx/src/chrono.cpp
+++ b/libcxx/src/chrono.cpp
@@ -152,7 +152,7 @@ system_clock::time_point system_clock::from_time_t(time_t t) noexcept { return s
 //  instead.
 //
 
-#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
+#if _LIBCPP_HAS_MONOTONIC_CLOCK
 
 #  if defined(__APPLE__)
 
@@ -230,7 +230,7 @@ const bool steady_clock::is_steady;
 
 steady_clock::time_point steady_clock::now() noexcept { return __libcpp_steady_clock_now(); }
 
-#endif // !_LIBCPP_HAS_NO_MONOTONIC_CLOCK
+#endif // _LIBCPP_HAS_MONOTONIC_CLOCK
 
 } // namespace chrono
 
diff --git a/libcxx/src/experimental/include/tzdb/tzdb_list_private.h b/libcxx/src/experimental/include/tzdb/tzdb_list_private.h
index 0be7b8e5a10058..ead64e6bb21dd4 100644
--- a/libcxx/src/experimental/include/tzdb/tzdb_list_private.h
+++ b/libcxx/src/experimental/include/tzdb/tzdb_list_private.h
@@ -18,7 +18,7 @@
 // When threads are available, we use std::mutex over std::shared_mutex
 // due to the increased overhead of std::shared_mutex.
 // See shared_mutex_vs_mutex.bench.cpp
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
 #  include <mutex>
 #endif
 
@@ -48,7 +48,7 @@ class tzdb_list::__impl {
   __impl() { __load_no_lock(); }
 
   [[nodiscard]] const tzdb& __load() {
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
     unique_lock __lock{__mutex_};
 #endif
     __load_no_lock();
@@ -58,14 +58,14 @@ class tzdb_list::__impl {
   using const_iterator = tzdb_list::const_iterator;
 
   const tzdb& __front() const noexcept {
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
     unique_lock __lock{__mutex_};
 #endif
     return __tzdb_.front();
   }
 
   const_iterator __erase_after(const_iterator __p) {
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
     unique_lock __lock{__mutex_};
 #endif
 
@@ -74,7 +74,7 @@ class tzdb_list::__impl {
   }
 
   const_iterator __begin() const noexcept {
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
     unique_lock __lock{__mutex_};
 #endif
     return __tzdb_.begin();
@@ -89,7 +89,7 @@ class tzdb_list::__impl {
   // pre: The caller ensures the locking, if needed, is done.
   void __load_no_lock() { chrono::__init_tzdb(__tzdb_.emplace_front(), __rules_.emplace_front()); }
 
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
   mutable mutex __mutex_;
 #endif
   forward_list<tzdb> __tzdb_;
diff --git a/libcxx/src/filesystem/time_utils.h b/libcxx/src/filesystem/time_utils.h
index 13f0d6f3b726ec..89352e5bd6abbb 100644
--- a/libcxx/src/filesystem/time_utils.h
+++ b/libcxx/src/filesystem/time_utils.h
@@ -299,7 +299,7 @@ inline TimeSpec extract_mtime(StatT const& st) { return st.st_mtim; }
 inline TimeSpec extract_atime(StatT const& st) { return st.st_atim; }
 #endif
 
-#ifndef _LIBCPP_HAS_NO_FILESYSTEM
+#if _LIBCPP_HAS_FILESYSTEM
 
 #  if !defined(_LIBCPP_WIN32API)
 inline bool posix_utimes(const path& p, std::array<TimeSpec, 2> const& TS, error_code& ec) {
@@ -342,7 +342,7 @@ inline file_time_type __extract_last_write_time(const path& p, const StatT& st,
   return fs_time::convert_from_timespec(ts);
 }
 
-#endif // !_LIBCPP_HAS_NO_FILESYSTEM
+#endif // _LIBCPP_HAS_FILESYSTEM
 
 } // namespace detail
 
diff --git a/libcxx/src/include/atomic_support.h b/libcxx/src/include/atomic_support.h
index c4bc34ffc1cd2f..410f64b2671113 100644
--- a/libcxx/src/include/atomic_support.h
+++ b/libcxx/src/include/atomic_support.h
@@ -21,7 +21,7 @@
 #  define _LIBCPP_HAS_ATOMIC_BUILTINS
 #endif
 
-#if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS)
+#if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && _LIBCPP_HAS_THREADS
 #  if defined(_LIBCPP_WARNING)
 _LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported")
 #  else
@@ -33,7 +33,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 namespace {
 
-#if defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS)
+#if defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && _LIBCPP_HAS_THREADS
 
 enum __libcpp_atomic_order {
   _AO_Relaxed = __ATOMIC_RELAXED,
@@ -80,7 +80,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool __libcpp_atomic_compare_exchange(
   return __atomic_compare_exchange_n(__val, __expected, __after, true, __success_order, __fail_order);
 }
 
-#else // _LIBCPP_HAS_NO_THREADS
+#else // _LIBCPP_HAS_THREADS
 
 enum __libcpp_atomic_order { _AO_Relaxed, _AO_Consume, _AO_Acquire, _AO_Release, _AO_Acq_Rel, _AO_Seq };
 
@@ -123,7 +123,7 @@ __libcpp_atomic_compare_exchange(_ValueType* __val, _ValueType* __expected, _Val
   return false;
 }
 
-#endif // _LIBCPP_HAS_NO_THREADS
+#endif // _LIBCPP_HAS_THREADS
 
 } // namespace
 
diff --git a/libcxx/src/include/config_elast.h b/libcxx/src/include/config_elast.h
index 158b93e20040dd..7edff2d9375d46 100644
--- a/libcxx/src/include/config_elast.h
+++ b/libcxx/src/include/config_elast.h
@@ -33,7 +33,7 @@
 // No _LIBCPP_ELAST needed on WASI
 #elif defined(__EMSCRIPTEN__)
 // No _LIBCPP_ELAST needed on Emscripten
-#elif defined(__linux__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__linux__) || _LIBCPP_HAS_MUSL_LIBC
 #  define _LIBCPP_ELAST 4095
 #elif defined(__APPLE__)
 // No _LIBCPP_ELAST needed on Apple
diff --git a/libcxx/src/ios.cpp b/libcxx/src/ios.cpp
index 74d33b4b2f1bce..4bb6f80e0ec31c 100644
--- a/libcxx/src/ios.cpp
+++ b/libcxx/src/ios.cpp
@@ -116,7 +116,7 @@ locale ios_base::getloc() const {
 }
 
 // xalloc
-#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_HAS_C_ATOMIC_IMP && _LIBCPP_HAS_THREADS
 atomic<int> ios_base::__xindex_{0};
 #else
 int ios_base::__xindex_ = 0;
diff --git a/libcxx/src/ios.instantiations.cpp b/libcxx/src/ios.instantiations.cpp
index aac7a68684cea4..a8d267f7cfd42d 100644
--- a/libcxx/src/ios.instantiations.cpp
+++ b/libcxx/src/ios.instantiations.cpp
@@ -23,7 +23,7 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<char>;
 template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<char>;
 template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_iostream<char>;
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<wchar_t>;
 template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<wchar_t>;
 template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<wchar_t>;
@@ -37,7 +37,7 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_stringstream<char>
 template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostringstream<char>;
 template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istringstream<char>;
 
-#ifndef _LIBCPP_HAS_NO_FILESYSTEM
+#if _LIBCPP_HAS_FILESYSTEM
 template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ifstream<char>;
 template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ofstream<char>;
 template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_filebuf<char>;
diff --git a/libcxx/src/iostream.cpp b/libcxx/src/iostream.cpp
index 48d2fdb866a332..6d49a9bee82319 100644
--- a/libcxx/src/iostream.cpp
+++ b/libcxx/src/iostream.cpp
@@ -30,7 +30,7 @@ alignas(istream) _LIBCPP_EXPORTED_FROM_ABI char cin[sizeof(istream)]
 alignas(__stdinbuf<char>) static char __cin[sizeof(__stdinbuf<char>)];
 static mbstate_t mb_cin;
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 alignas(wistream) _LIBCPP_EXPORTED_FROM_ABI char wcin[sizeof(wistream)]
 #  if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
     __asm__("?wcin@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_istream at _WU?$char_traits at _W@" _LIBCPP_ABI_NAMESPACE_STR
@@ -39,7 +39,7 @@ alignas(wistream) _LIBCPP_EXPORTED_FROM_ABI char wcin[sizeof(wistream)]
         ;
 alignas(__stdinbuf<wchar_t>) static char __wcin[sizeof(__stdinbuf<wchar_t>)];
 static mbstate_t mb_wcin;
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI char cout[sizeof(ostream)]
 #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
@@ -50,7 +50,7 @@ alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI char cout[sizeof(ostream)]
 alignas(__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)];
 static mbstate_t mb_cout;
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI char wcout[sizeof(wostream)]
 #  if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
     __asm__("?wcout@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream at _WU?$char_traits at _W@" _LIBCPP_ABI_NAMESPACE_STR
@@ -59,7 +59,7 @@ alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI char wcout[sizeof(wostream)]
         ;
 alignas(__stdoutbuf<wchar_t>) static char __wcout[sizeof(__stdoutbuf<wchar_t>)];
 static mbstate_t mb_wcout;
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI char cerr[sizeof(ostream)]
 #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
@@ -70,7 +70,7 @@ alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI char cerr[sizeof(ostream)]
 alignas(__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)];
 static mbstate_t mb_cerr;
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI char wcerr[sizeof(wostream)]
 #  if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
     __asm__("?wcerr@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream at _WU?$char_traits at _W@" _LIBCPP_ABI_NAMESPACE_STR
@@ -79,7 +79,7 @@ alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI char wcerr[sizeof(wostream)]
         ;
 alignas(__stdoutbuf<wchar_t>) static char __wcerr[sizeof(__stdoutbuf<wchar_t>)];
 static mbstate_t mb_wcerr;
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI char clog[sizeof(ostream)]
 #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
@@ -88,14 +88,14 @@ alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI char clog[sizeof(ostream)]
 #endif
         ;
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI char wclog[sizeof(wostream)]
 #  if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
     __asm__("?wclog@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream at _WU?$char_traits at _W@" _LIBCPP_ABI_NAMESPACE_STR
             "@std@@@12 at A")
 #  endif
         ;
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // Pretend we're inside a system header so the compiler doesn't flag the use of the init_priority
 // attribute with a value that's reserved for the implementation (we're the implementation).
@@ -136,7 +136,7 @@ DoIOSInit::DoIOSInit() {
   std::unitbuf(*cerr_ptr);
   cerr_ptr->tie(cout_ptr);
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   wistream* wcin_ptr  = ::new (wcin) wistream(::new (__wcin) __stdinbuf<wchar_t>(stdin, &mb_wcin));
   wostream* wcout_ptr = ::new (wcout) wostream(::new (__wcout) __stdoutbuf<wchar_t>(stdout, &mb_wcout));
   wostream* wcerr_ptr = ::new (wcerr) wostream(::new (__wcerr) __stdoutbuf<wchar_t>(stderr, &mb_wcerr));
@@ -154,7 +154,7 @@ DoIOSInit::~DoIOSInit() {
   ostream* clog_ptr = reinterpret_cast<ostream*>(clog);
   clog_ptr->flush();
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   wostream* wcout_ptr = reinterpret_cast<wostream*>(wcout);
   wcout_ptr->flush();
   wostream* wclog_ptr = reinterpret_cast<wostream*>(wclog);
diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index 99a2d50f207ed1..12ebe283e65069 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -22,7 +22,7 @@
 #include <utility>
 #include <vector>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 #  include <cwctype>
 #endif
 
@@ -159,15 +159,15 @@ class _LIBCPP_HIDDEN locale::__imp : public facet {
 locale::__imp::__imp(size_t refs) : facet(refs), facets_(N), name_("C") {
   facets_.clear();
   install(&make<std::collate<char> >(1u));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   install(&make<std::collate<wchar_t> >(1u));
 #endif
   install(&make<std::ctype<char> >(nullptr, false, 1u));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   install(&make<std::ctype<wchar_t> >(1u));
 #endif
   install(&make<codecvt<char, char, mbstate_t> >(1u));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   install(&make<codecvt<wchar_t, char, mbstate_t> >(1u));
 #endif
   _LIBCPP_SUPPRESS_DEPRECATED_PUSH
@@ -179,41 +179,41 @@ locale::__imp::__imp(size_t refs) : facet(refs), facets_(N), name_("C") {
   install(&make<codecvt<char32_t, char8_t, mbstate_t> >(1u));
 #endif
   install(&make<numpunct<char> >(1u));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   install(&make<numpunct<wchar_t> >(1u));
 #endif
   install(&make<num_get<char> >(1u));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   install(&make<num_get<wchar_t> >(1u));
 #endif
   install(&make<num_put<char> >(1u));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   install(&make<num_put<wchar_t> >(1u));
 #endif
   install(&make<moneypunct<char, false> >(1u));
   install(&make<moneypunct<char, true> >(1u));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   install(&make<moneypunct<wchar_t, false> >(1u));
   install(&make<moneypunct<wchar_t, true> >(1u));
 #endif
   install(&make<money_get<char> >(1u));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   install(&make<money_get<wchar_t> >(1u));
 #endif
   install(&make<money_put<char> >(1u));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   install(&make<money_put<wchar_t> >(1u));
 #endif
   install(&make<time_get<char> >(1u));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   install(&make<time_get<wchar_t> >(1u));
 #endif
   install(&make<time_put<char> >(1u));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   install(&make<time_put<wchar_t> >(1u));
 #endif
   install(&make<std::messages<char> >(1u));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   install(&make<std::messages<wchar_t> >(1u));
 #endif
 }
@@ -227,15 +227,15 @@ locale::__imp::__imp(const string& name, size_t refs) : facet(refs), facets_(N),
       if (facets_[i])
         facets_[i]->__add_shared();
     install(new collate_byname<char>(name_));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
     install(new collate_byname<wchar_t>(name_));
 #endif
     install(new ctype_byname<char>(name_));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
     install(new ctype_byname<wchar_t>(name_));
 #endif
     install(new codecvt_byname<char, char, mbstate_t>(name_));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
     install(new codecvt_byname<wchar_t, char, mbstate_t>(name_));
 #endif
     _LIBCPP_SUPPRESS_DEPRECATED_PUSH
@@ -247,25 +247,25 @@ locale::__imp::__imp(const string& name, size_t refs) : facet(refs), facets_(N),
     install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name_));
 #endif
     install(new numpunct_byname<char>(name_));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
     install(new numpunct_byname<wchar_t>(name_));
 #endif
     install(new moneypunct_byname<char, false>(name_));
     install(new moneypunct_byname<char, true>(name_));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
     install(new moneypunct_byname<wchar_t, false>(name_));
     install(new moneypunct_byname<wchar_t, true>(name_));
 #endif
     install(new time_get_byname<char>(name_));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
     install(new time_get_byname<wchar_t>(name_));
 #endif
     install(new time_put_byname<char>(name_));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
     install(new time_put_byname<wchar_t>(name_));
 #endif
     install(new messages_byname<char>(name_));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
     install(new messages_byname<wchar_t>(name_));
 #endif
 #if _LIBCPP_HAS_EXCEPTIONS
@@ -296,17 +296,17 @@ locale::__imp::__imp(const __imp& other, const string& name, locale::category c)
 #endif // _LIBCPP_HAS_EXCEPTIONS
     if (c & locale::collate) {
       install(new collate_byname<char>(name));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install(new collate_byname<wchar_t>(name));
 #endif
     }
     if (c & locale::ctype) {
       install(new ctype_byname<char>(name));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install(new ctype_byname<wchar_t>(name));
 #endif
       install(new codecvt_byname<char, char, mbstate_t>(name));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install(new codecvt_byname<wchar_t, char, mbstate_t>(name));
 #endif
       _LIBCPP_SUPPRESS_DEPRECATED_PUSH
@@ -321,30 +321,30 @@ locale::__imp::__imp(const __imp& other, const string& name, locale::category c)
     if (c & locale::monetary) {
       install(new moneypunct_byname<char, false>(name));
       install(new moneypunct_byname<char, true>(name));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install(new moneypunct_byname<wchar_t, false>(name));
       install(new moneypunct_byname<wchar_t, true>(name));
 #endif
     }
     if (c & locale::numeric) {
       install(new numpunct_byname<char>(name));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install(new numpunct_byname<wchar_t>(name));
 #endif
     }
     if (c & locale::time) {
       install(new time_get_byname<char>(name));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install(new time_get_byname<wchar_t>(name));
 #endif
       install(new time_put_byname<char>(name));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install(new time_put_byname<wchar_t>(name));
 #endif
     }
     if (c & locale::messages) {
       install(new messages_byname<char>(name));
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install(new messages_byname<wchar_t>(name));
 #endif
     }
@@ -375,13 +375,13 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c)
 #endif // _LIBCPP_HAS_EXCEPTIONS
     if (c & locale::collate) {
       install_from<std::collate<char> >(one);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install_from<std::collate<wchar_t> >(one);
 #endif
     }
     if (c & locale::ctype) {
       install_from<std::ctype<char> >(one);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install_from<std::ctype<wchar_t> >(one);
 #endif
       install_from<std::codecvt<char, char, mbstate_t> >(one);
@@ -393,53 +393,53 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c)
       install_from<std::codecvt<char16_t, char8_t, mbstate_t> >(one);
       install_from<std::codecvt<char32_t, char8_t, mbstate_t> >(one);
 #endif
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install_from<std::codecvt<wchar_t, char, mbstate_t> >(one);
 #endif
     }
     if (c & locale::monetary) {
       install_from<moneypunct<char, false> >(one);
       install_from<moneypunct<char, true> >(one);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install_from<moneypunct<wchar_t, false> >(one);
       install_from<moneypunct<wchar_t, true> >(one);
 #endif
       install_from<money_get<char> >(one);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install_from<money_get<wchar_t> >(one);
 #endif
       install_from<money_put<char> >(one);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install_from<money_put<wchar_t> >(one);
 #endif
     }
     if (c & locale::numeric) {
       install_from<numpunct<char> >(one);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install_from<numpunct<wchar_t> >(one);
 #endif
       install_from<num_get<char> >(one);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install_from<num_get<wchar_t> >(one);
 #endif
       install_from<num_put<char> >(one);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install_from<num_put<wchar_t> >(one);
 #endif
     }
     if (c & locale::time) {
       install_from<time_get<char> >(one);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install_from<time_get<wchar_t> >(one);
 #endif
       install_from<time_put<char> >(one);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install_from<time_put<wchar_t> >(one);
 #endif
     }
     if (c & locale::messages) {
       install_from<std::messages<char> >(one);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
       install_from<std::messages<wchar_t> >(one);
 #endif
     }
@@ -642,7 +642,7 @@ collate_byname<char>::string_type collate_byname<char>::do_transform(const char_
 
 // template <> class collate_byname<wchar_t>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 collate_byname<wchar_t>::collate_byname(const char* n, size_t refs)
     : collate<wchar_t>(refs), __l_(newlocale(LC_ALL_MASK, n, 0)) {
   if (__l_ == 0)
@@ -684,7 +684,7 @@ collate_byname<wchar_t>::do_transform(const char_type* lo, const char_type* hi)
   wcsxfrm_l(const_cast<wchar_t*>(out.c_str()), in.c_str(), out.size() + 1, __l_);
   return out;
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 const ctype_base::mask ctype_base::space;
 const ctype_base::mask ctype_base::print;
@@ -701,7 +701,7 @@ const ctype_base::mask ctype_base::graph;
 
 // template <> class ctype<wchar_t>;
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 constinit locale::id ctype<wchar_t>::id;
 
 ctype<wchar_t>::~ctype() {}
@@ -796,7 +796,7 @@ const wchar_t* ctype<wchar_t>::do_narrow(const char_type* low, const char_type*
       *dest = dfault;
   return low;
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // template <> class ctype<char>;
 
@@ -1085,7 +1085,7 @@ const char* ctype_byname<char>::do_tolower(char_type* low, const char_type* high
 
 // template <> class ctype_byname<wchar_t>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 ctype_byname<wchar_t>::ctype_byname(const char* name, size_t refs)
     : ctype<wchar_t>(refs), __l_(newlocale(LC_ALL_MASK, name, 0)) {
   if (__l_ == 0)
@@ -1278,7 +1278,7 @@ ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, ch
   }
   return low;
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // template <> class codecvt<char, char, mbstate_t>
 
@@ -1331,7 +1331,7 @@ int codecvt<char, char, mbstate_t>::do_max_length() const noexcept { return 1; }
 
 // template <> class codecvt<wchar_t, char, mbstate_t>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 constinit locale::id codecvt<wchar_t, char, mbstate_t>::id;
 
 codecvt<wchar_t, char, mbstate_t>::codecvt(size_t refs) : locale::facet(refs), __l_(_LIBCPP_GET_C_LOCALE) {}
@@ -1524,7 +1524,7 @@ int codecvt<wchar_t, char, mbstate_t>::do_length(
 int codecvt<wchar_t, char, mbstate_t>::do_max_length() const noexcept {
   return __l_ == 0 ? 1 : static_cast<int>(__libcpp_mb_cur_max_l(__l_));
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 //                                     Valid UTF ranges
 //     UTF-32               UTF-16                          UTF-8               # of code points
@@ -3020,7 +3020,7 @@ int codecvt<char32_t, char8_t, mbstate_t>::do_max_length() const noexcept { retu
 
 // __codecvt_utf8<wchar_t>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 __codecvt_utf8<wchar_t>::result __codecvt_utf8<wchar_t>::do_out(
     state_type&,
     const intern_type* frm,
@@ -3111,7 +3111,7 @@ int __codecvt_utf8<wchar_t>::do_max_length() const noexcept {
   return 4;
 #  endif
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // __codecvt_utf8<char16_t>
 
@@ -3249,7 +3249,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
 
 // __codecvt_utf16<wchar_t, false>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 __codecvt_utf16<wchar_t, false>::result __codecvt_utf16<wchar_t, false>::do_out(
     state_type&,
     const intern_type* frm,
@@ -3431,7 +3431,7 @@ int __codecvt_utf16<wchar_t, true>::do_max_length() const noexcept {
   return 4;
 #  endif
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // __codecvt_utf16<char16_t, false>
 
@@ -3703,7 +3703,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
 
 // __codecvt_utf8_utf16<wchar_t>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 __codecvt_utf8_utf16<wchar_t>::result __codecvt_utf8_utf16<wchar_t>::do_out(
     state_type&,
     const intern_type* frm,
@@ -3778,7 +3778,7 @@ int __codecvt_utf8_utf16<wchar_t>::do_max_length() const noexcept {
     return 7;
   return 4;
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // __codecvt_utf8_utf16<char16_t>
 
@@ -3930,7 +3930,7 @@ __widen_from_utf8<16>::~__widen_from_utf8() {}
 
 __widen_from_utf8<32>::~__widen_from_utf8() {}
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 static bool checked_string_to_wchar_convert(wchar_t& dest, const char* ptr, locale_t loc) {
   if (*ptr == '\0')
     return false;
@@ -3943,9 +3943,9 @@ static bool checked_string_to_wchar_convert(wchar_t& dest, const char* ptr, loca
   dest = out;
   return true;
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
-#ifdef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if !_LIBCPP_HAS_WIDE_CHARACTERS
 static bool is_narrow_non_breaking_space(const char* ptr) {
   // https://www.fileformat.info/info/unicode/char/202f/index.htm
   return ptr[0] == '\xe2' && ptr[1] == '\x80' && ptr[2] == '\xaf';
@@ -3955,7 +3955,7 @@ static bool is_non_breaking_space(const char* ptr) {
   // https://www.fileformat.info/info/unicode/char/0a/index.htm
   return ptr[0] == '\xc2' && ptr[1] == '\xa0';
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 static bool checked_string_to_char_convert(char& dest, const char* ptr, locale_t __loc) {
   if (*ptr == '\0')
@@ -3965,7 +3965,7 @@ static bool checked_string_to_char_convert(char& dest, const char* ptr, locale_t
     return true;
   }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   // First convert the MBS into a wide char then attempt to narrow it using
   // wctob_l.
   wchar_t wout;
@@ -3986,7 +3986,7 @@ static bool checked_string_to_char_convert(char& dest, const char* ptr, locale_t
   default:
     return false;
   }
-#else  // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#else  // _LIBCPP_HAS_WIDE_CHARACTERS
   // FIXME: Work around specific multibyte sequences that we can reasonably
   // translate into a different single byte.
   if (is_narrow_non_breaking_space(ptr) || is_non_breaking_space(ptr)) {
@@ -3995,51 +3995,51 @@ static bool checked_string_to_char_convert(char& dest, const char* ptr, locale_t
   }
 
   return false;
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
   __libcpp_unreachable();
 }
 
 // numpunct<char> && numpunct<wchar_t>
 
 constinit locale::id numpunct<char>::id;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 constinit locale::id numpunct<wchar_t>::id;
 #endif
 
 numpunct<char>::numpunct(size_t refs) : locale::facet(refs), __decimal_point_('.'), __thousands_sep_(',') {}
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 numpunct<wchar_t>::numpunct(size_t refs) : locale::facet(refs), __decimal_point_(L'.'), __thousands_sep_(L',') {}
 #endif
 
 numpunct<char>::~numpunct() {}
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 numpunct<wchar_t>::~numpunct() {}
 #endif
 
 char numpunct< char >::do_decimal_point() const { return __decimal_point_; }
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 wchar_t numpunct<wchar_t>::do_decimal_point() const { return __decimal_point_; }
 #endif
 
 char numpunct< char >::do_thousands_sep() const { return __thousands_sep_; }
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 wchar_t numpunct<wchar_t>::do_thousands_sep() const { return __thousands_sep_; }
 #endif
 
 string numpunct< char >::do_grouping() const { return __grouping_; }
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 string numpunct<wchar_t>::do_grouping() const { return __grouping_; }
 #endif
 
 string numpunct< char >::do_truename() const { return "true"; }
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 wstring numpunct<wchar_t>::do_truename() const { return L"true"; }
 #endif
 
 string numpunct< char >::do_falsename() const { return "false"; }
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 wstring numpunct<wchar_t>::do_falsename() const { return L"false"; }
 #endif
 
@@ -4074,7 +4074,7 @@ void numpunct_byname<char>::__init(const char* nm) {
 
 // numpunct_byname<wchar_t>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 numpunct_byname<wchar_t>::numpunct_byname(const char* nm, size_t refs) : numpunct<wchar_t>(refs) { __init(nm); }
 
 numpunct_byname<wchar_t>::numpunct_byname(const string& nm, size_t refs) : numpunct<wchar_t>(refs) {
@@ -4100,7 +4100,7 @@ void numpunct_byname<wchar_t>::__init(const char* nm) {
     // localization for truename and falsename is not available
   }
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // num_get helpers
 
@@ -4240,7 +4240,7 @@ static string* init_weeks() {
   return weeks;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 static wstring* init_wweeks() {
   static wstring weeks[14];
   weeks[0]  = L"Sunday";
@@ -4267,7 +4267,7 @@ const string* __time_get_c_storage<char>::__weeks() const {
   return weeks;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 const wstring* __time_get_c_storage<wchar_t>::__weeks() const {
   static const wstring* weeks = init_wweeks();
@@ -4304,7 +4304,7 @@ static string* init_months() {
   return months;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 static wstring* init_wmonths() {
   static wstring months[24];
   months[0]  = L"January";
@@ -4341,7 +4341,7 @@ const string* __time_get_c_storage<char>::__months() const {
   return months;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 const wstring* __time_get_c_storage<wchar_t>::__months() const {
   static const wstring* months = init_wmonths();
@@ -4356,7 +4356,7 @@ static string* init_am_pm() {
   return am_pm;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 static wstring* init_wam_pm() {
   static wstring am_pm[2];
   am_pm[0] = L"AM";
@@ -4371,7 +4371,7 @@ const string* __time_get_c_storage<char>::__am_pm() const {
   return am_pm;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 const wstring* __time_get_c_storage<wchar_t>::__am_pm() const {
   static const wstring* am_pm = init_wam_pm();
@@ -4385,7 +4385,7 @@ const string& __time_get_c_storage<char>::__x() const {
   return s;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 const wstring& __time_get_c_storage<wchar_t>::__x() const {
   static wstring s(L"%m/%d/%y");
@@ -4399,7 +4399,7 @@ const string& __time_get_c_storage<char>::__X() const {
   return s;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 const wstring& __time_get_c_storage<wchar_t>::__X() const {
   static wstring s(L"%H:%M:%S");
@@ -4413,7 +4413,7 @@ const string& __time_get_c_storage<char>::__c() const {
   return s;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 const wstring& __time_get_c_storage<wchar_t>::__c() const {
   static wstring s(L"%a %b %d %H:%M:%S %Y");
@@ -4427,7 +4427,7 @@ const string& __time_get_c_storage<char>::__r() const {
   return s;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 const wstring& __time_get_c_storage<wchar_t>::__r() const {
   static wstring s(L"%I:%M:%S %p");
@@ -4581,7 +4581,7 @@ string __time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct) {
 
 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-braces")
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 wstring __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct) {
   tm t       = {0};
@@ -4715,7 +4715,7 @@ wstring __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& c
   }
   return result;
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 template <>
 void __time_get_storage<char>::init(const ctype<char>& ct) {
@@ -4750,7 +4750,7 @@ void __time_get_storage<char>::init(const ctype<char>& ct) {
   __X_        = __analyze('X', ct);
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 void __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) {
   tm t = {0};
@@ -4822,7 +4822,7 @@ void __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) {
   __x_ = __analyze('x', ct);
   __X_ = __analyze('X', ct);
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 template <class CharT>
 struct _LIBCPP_HIDDEN __time_get_temp : public ctype_byname<CharT> {
@@ -4842,7 +4842,7 @@ __time_get_storage<char>::__time_get_storage(const string& __nm) : __time_get(__
   init(ct);
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 __time_get_storage<wchar_t>::__time_get_storage(const char* __nm) : __time_get(__nm) {
   const __time_get_temp<wchar_t> ct(__nm);
@@ -4854,7 +4854,7 @@ __time_get_storage<wchar_t>::__time_get_storage(const string& __nm) : __time_get
   const __time_get_temp<wchar_t> ct(__nm);
   init(ct);
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 template <>
 time_base::dateorder __time_get_storage<char>::__do_date_order() const {
@@ -4937,7 +4937,7 @@ time_base::dateorder __time_get_storage<char>::__do_date_order() const {
   return time_base::no_order;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 time_base::dateorder __time_get_storage<wchar_t>::__do_date_order() const {
   unsigned i;
@@ -5018,7 +5018,7 @@ time_base::dateorder __time_get_storage<wchar_t>::__do_date_order() const {
   }
   return time_base::no_order;
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // time_put
 
@@ -5045,7 +5045,7 @@ void __time_put::__do_put(char* __nb, char*& __ne, const tm* __tm, char __fmt, c
   __ne     = __nb + n;
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 void __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, char __fmt, char __mod) const {
   char __nar[100];
   char* __ne = __nar + 100;
@@ -5057,7 +5057,7 @@ void __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, char __
     __throw_runtime_error("locale not supported");
   __we = __wb + j;
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // moneypunct_byname
 
@@ -5511,7 +5511,7 @@ void moneypunct_byname<char, true>::init(const char* nm) {
 #endif // !_LIBCPP_MSVCRT
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 void moneypunct_byname<wchar_t, false>::init(const char* nm) {
   typedef moneypunct<wchar_t, false> base;
@@ -5641,7 +5641,7 @@ void moneypunct_byname<wchar_t, true>::init(const char* nm) {
       __neg_format_, __curr_symbol_, true, lc->int_n_cs_precedes, lc->int_n_sep_by_space, lc->int_n_sign_posn, L' ');
 #  endif // !_LIBCPP_MSVCRT
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 void __do_nothing(void*) {}
 
diff --git a/libcxx/src/memory.cpp b/libcxx/src/memory.cpp
index 7a1c283d885eea..16190c242c1487 100644
--- a/libcxx/src/memory.cpp
+++ b/libcxx/src/memory.cpp
@@ -13,7 +13,7 @@
 
 #include <memory>
 
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
 #  include <mutex>
 #  include <thread>
 #  if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB)
@@ -96,7 +96,7 @@ __shared_weak_count* __shared_weak_count::lock() noexcept {
 
 const void* __shared_weak_count::__get_deleter(const type_info&) const noexcept { return nullptr; }
 
-#if !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_HAS_THREADS
 
 static constexpr std::size_t __sp_mut_count                = 32;
 static constinit __libcpp_mutex_t mut_back[__sp_mut_count] = {
@@ -128,7 +128,7 @@ __sp_mut& __get_sp_mut(const void* p) {
   return muts[hash<const void*>()(p) & (__sp_mut_count - 1)];
 }
 
-#endif // !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_HAS_THREADS
 
 void* align(size_t alignment, size_t size, void*& ptr, size_t& space) {
   void* r = nullptr;
diff --git a/libcxx/src/memory_resource.cpp b/libcxx/src/memory_resource.cpp
index 3d0d4ead1be74c..0cd575e995c0ff 100644
--- a/libcxx/src/memory_resource.cpp
+++ b/libcxx/src/memory_resource.cpp
@@ -12,7 +12,7 @@
 
 #if _LIBCPP_HAS_ATOMIC_HEADER
 #  include <atomic>
-#elif !defined(_LIBCPP_HAS_NO_THREADS)
+#elif _LIBCPP_HAS_THREADS
 #  include <mutex>
 #  if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB)
 #    pragma comment(lib, "pthread")
@@ -101,7 +101,7 @@ static memory_resource* __default_memory_resource(bool set = false, memory_resou
   } else {
     return std::atomic_load_explicit(&__res, memory_order_acquire);
   }
-#elif !defined(_LIBCPP_HAS_NO_THREADS)
+#elif _LIBCPP_HAS_THREADS
   static constinit memory_resource* res = &res_init.resources.new_delete_res;
   static mutex res_lock;
   if (set) {
diff --git a/libcxx/src/ostream.cpp b/libcxx/src/ostream.cpp
index f036aaf29dfb25..e0f14a8917927b 100644
--- a/libcxx/src/ostream.cpp
+++ b/libcxx/src/ostream.cpp
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include <__config>
-#ifndef _LIBCPP_HAS_NO_FILESYSTEM
+#if _LIBCPP_HAS_FILESYSTEM
 #  include <fstream>
 #endif
 #include <ostream>
@@ -26,7 +26,7 @@ _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os) {
   // importance on Windows.
 #if _LIBCPP_HAS_RTTI
   auto* __rdbuf = __os.rdbuf();
-#  ifndef _LIBCPP_HAS_NO_FILESYSTEM
+#  if _LIBCPP_HAS_FILESYSTEM
   if (auto* __buffer = dynamic_cast<filebuf*>(__rdbuf))
     return __buffer->__file_;
 #  endif
diff --git a/libcxx/src/print.cpp b/libcxx/src/print.cpp
index 8fa59fdd097bcd..37b1fc00cd7c38 100644
--- a/libcxx/src/print.cpp
+++ b/libcxx/src/print.cpp
@@ -42,7 +42,7 @@ _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream) {
   return GetConsoleMode(reinterpret_cast<void*>(__handle), &__mode);
 }
 
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 _LIBCPP_EXPORTED_FROM_ABI void
 __write_to_windows_console([[maybe_unused]] FILE* __stream, [[maybe_unused]] wstring_view __view) {
   // https://learn.microsoft.com/en-us/windows/console/writeconsole
@@ -54,7 +54,7 @@ __write_to_windows_console([[maybe_unused]] FILE* __stream, [[maybe_unused]] wst
     __throw_system_error(filesystem::detail::make_windows_error(GetLastError()), "failed to write formatted output");
   }
 }
-#  endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 #elif __has_include(<unistd.h>) // !_LIBCPP_WIN32API
 
diff --git a/libcxx/src/random_shuffle.cpp b/libcxx/src/random_shuffle.cpp
index 3aaf71d846433a..4f2669a6c7fa56 100644
--- a/libcxx/src/random_shuffle.cpp
+++ b/libcxx/src/random_shuffle.cpp
@@ -9,7 +9,7 @@
 #include <algorithm>
 #include <random>
 
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
 #  include <mutex>
 #  if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB)
 #    pragma comment(lib, "pthread")
@@ -18,13 +18,13 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
 static constinit __libcpp_mutex_t __rs_mut = _LIBCPP_MUTEX_INITIALIZER;
 #endif
 unsigned __rs_default::__c_ = 0;
 
 __rs_default::__rs_default() {
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
   __libcpp_mutex_lock(&__rs_mut);
 #endif
   __c_ = 1;
@@ -33,7 +33,7 @@ __rs_default::__rs_default() {
 __rs_default::__rs_default(const __rs_default&) { ++__c_; }
 
 __rs_default::~__rs_default() {
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
   if (--__c_ == 0)
     __libcpp_mutex_unlock(&__rs_mut);
 #else
diff --git a/libcxx/src/std_stream.h b/libcxx/src/std_stream.h
index e55cd0b6b77af9..1bbaee695a2260 100644
--- a/libcxx/src/std_stream.h
+++ b/libcxx/src/std_stream.h
@@ -106,7 +106,7 @@ inline bool __do_getc(FILE* __fp, char* __pbuf) {
   *__pbuf = static_cast<char>(__c);
   return true;
 }
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 inline bool __do_getc(FILE* __fp, wchar_t* __pbuf) {
   wint_t __c = getwc(__fp);
   if (__c == WEOF)
@@ -121,7 +121,7 @@ inline bool __do_ungetc(int __c, FILE* __fp, char __dummy) {
     return false;
   return true;
 }
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 inline bool __do_ungetc(std::wint_t __c, FILE* __fp, wchar_t __dummy) {
   if (ungetwc(__c, __fp) == WEOF)
     return false;
@@ -293,7 +293,7 @@ inline bool __do_fputc(char __c, FILE* __fp) {
     return false;
   return true;
 }
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 inline bool __do_fputc(wchar_t __c, FILE* __fp) {
   // fputwc works regardless of wide/narrow mode of stdout, while
   // fwrite of wchar_t only works if the stream actually has been set
diff --git a/libcxx/src/string.cpp b/libcxx/src/string.cpp
index 12db5381a7b1ba..dc16ce781f76b6 100644
--- a/libcxx/src/string.cpp
+++ b/libcxx/src/string.cpp
@@ -14,7 +14,7 @@
 #include <stdexcept>
 #include <string>
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 #  include <cwchar>
 #endif
 
@@ -40,12 +40,12 @@ void __basic_string_common<true>::__throw_out_of_range() const { std::__throw_ou
 #define _LIBCPP_EXTERN_TEMPLATE_DEFINE(...) template __VA_ARGS__;
 #ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
 _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char)
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t)
 #  endif
 #else
 _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char)
-#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
 _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t)
 #  endif
 #endif
@@ -115,7 +115,7 @@ inline unsigned long long as_integer(const string& func, const string& s, size_t
   return as_integer_helper<unsigned long long>(func, s, idx, base, strtoull);
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 // wstring
 template <>
 inline int as_integer(const string& func, const wstring& s, size_t* idx, int base) {
@@ -145,7 +145,7 @@ template <>
 inline unsigned long long as_integer(const string& func, const wstring& s, size_t* idx, int base) {
   return as_integer_helper<unsigned long long>(func, s, idx, base, wcstoull);
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // as_float
 
@@ -184,7 +184,7 @@ inline long double as_float(const string& func, const string& s, size_t* idx) {
   return as_float_helper<long double>(func, s, idx, strtold);
 }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 inline float as_float(const string& func, const wstring& s, size_t* idx) {
   return as_float_helper<float>(func, s, idx, wcstof);
@@ -199,7 +199,7 @@ template <>
 inline long double as_float(const string& func, const wstring& s, size_t* idx) {
   return as_float_helper<long double>(func, s, idx, wcstold);
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 } // unnamed namespace
 
@@ -223,7 +223,7 @@ double stod(const string& str, size_t* idx) { return as_float<double>("stod", st
 
 long double stold(const string& str, size_t* idx) { return as_float<long double>("stold", str, idx); }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 int stoi(const wstring& str, size_t* idx, int base) { return as_integer<int>("stoi", str, idx, base); }
 
 long stol(const wstring& str, size_t* idx, int base) { return as_integer<long>("stol", str, idx, base); }
@@ -243,7 +243,7 @@ float stof(const wstring& str, size_t* idx) { return as_float<float>("stof", str
 double stod(const wstring& str, size_t* idx) { return as_float<double>("stod", str, idx); }
 
 long double stold(const wstring& str, size_t* idx) { return as_float<long double>("stold", str, idx); }
-#endif // !_LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 // to_string
 
@@ -283,7 +283,7 @@ struct initial_string<string> {
   }
 };
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 template <>
 struct initial_string<wstring> {
   wstring operator()() const {
@@ -302,7 +302,7 @@ inline wide_printf get_swprintf() {
   return static_cast<int(__cdecl*)(wchar_t* __restrict, size_t, const wchar_t* __restrict, ...)>(_snwprintf);
 #  endif
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
 
 template <typename S, typename V>
 S i_to_string(V v) {
@@ -325,7 +325,7 @@ string to_string(unsigned val) { return i_to_string< string>(val); }
 string to_string(unsigned long val) { return i_to_string< string>(val); }
 string to_string(unsigned long long val) { return i_to_string< string>(val); }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 wstring to_wstring(int val) { return i_to_string<wstring>(val); }
 wstring to_wstring(long val) { return i_to_string<wstring>(val); }
 wstring to_wstring(long long val) { return i_to_string<wstring>(val); }
@@ -338,7 +338,7 @@ string to_string(float val) { return as_string(snprintf, initial_string< string>
 string to_string(double val) { return as_string(snprintf, initial_string< string>()(), "%f", val); }
 string to_string(long double val) { return as_string(snprintf, initial_string< string>()(), "%Lf", val); }
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
 wstring to_wstring(float val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%f", val); }
 wstring to_wstring(double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%f", val); }
 wstring to_wstring(long double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%Lf", val); }
diff --git a/libcxx/src/system_error.cpp b/libcxx/src/system_error.cpp
index 476729310d868b..53838c6c6d219b 100644
--- a/libcxx/src/system_error.cpp
+++ b/libcxx/src/system_error.cpp
@@ -26,7 +26,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 namespace {
-#if !defined(_LIBCPP_HAS_NO_THREADS)
+#if _LIBCPP_HAS_THREADS
 
 //  GLIBC also uses 1024 as the maximum buffer size internally.
 constexpr size_t strerror_buff_size = 1024;
@@ -92,7 +92,7 @@ string do_strerror_r(int ev) {
 }
 #  endif
 
-#endif // !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // _LIBCPP_HAS_THREADS
 
 string make_error_str(const error_code& ec, string what_arg) {
   if (ec) {
@@ -113,7 +113,7 @@ string make_error_str(const error_code& ec) {
 } // namespace
 
 string __do_message::message(int ev) const {
-#if defined(_LIBCPP_HAS_NO_THREADS)
+#if !_LIBCPP_HAS_THREADS
   return string(::strerror(ev));
 #else
   return do_strerror_r(ev);
diff --git a/libcxx/test/benchmarks/std_format_spec_string_unicode.bench.cpp b/libcxx/test/benchmarks/std_format_spec_string_unicode.bench.cpp
index e0e29cf285d0c1..85dddd7d05cde2 100644
--- a/libcxx/test/benchmarks/std_format_spec_string_unicode.bench.cpp
+++ b/libcxx/test/benchmarks/std_format_spec_string_unicode.bench.cpp
@@ -4,8 +4,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef _LIBCPP_HAS_NO_UNICODE
-
 #  include <format>
 #  include <string_view>
 
@@ -15,6 +13,8 @@
 
 #  define SV(S) MAKE_STRING_VIEW(CharT, S)
 
+#if _LIBCPP_HAS_UNICODE
+
 // generated with https://generator.lorem-ipsum.info/_latin
 
 template <class CharT>
diff --git a/libcxx/test/benchmarks/std_format_spec_string_unicode_escape.bench.cpp b/libcxx/test/benchmarks/std_format_spec_string_unicode_escape.bench.cpp
index c030ab652482f3..ea5a0d6cbf706c 100644
--- a/libcxx/test/benchmarks/std_format_spec_string_unicode_escape.bench.cpp
+++ b/libcxx/test/benchmarks/std_format_spec_string_unicode_escape.bench.cpp
@@ -10,8 +10,6 @@
 // datasets to give an impression how the amount of multibyte UTF-8 sequences
 // and larger grapheme clusters affect the performance.
 
-#ifndef _LIBCPP_HAS_NO_UNICODE
-
 #  include <format>
 #  include <string_view>
 
@@ -19,6 +17,8 @@
 
 #  include "make_string.h"
 
+#if _LIBCPP_HAS_UNICODE
+
 #  define SV(S) MAKE_STRING_VIEW(CharT, S)
 
 // generated with https://generator.lorem-ipsum.info/_latin
diff --git a/libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp b/libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp
index 63ca6643797132..d0ac71739d7e3a 100644
--- a/libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp
@@ -40,9 +40,9 @@ extern "C" {
 // tgmath.h is not supported in extern "C".
 #include <time.h>
 // FIXME: #include <uchar.h>
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-#   include <wchar.h>
-#   include <wctype.h>
+#if _LIBCPP_HAS_WIDE_CHARACTERS
+#  include <wchar.h>
+#  include <wctype.h>
 #endif
 }
 
diff --git a/libcxx/test/libcxx/feature_test_macro/ftm_metadata.sh.py b/libcxx/test/libcxx/feature_test_macro/ftm_metadata.sh.py
index 8c47448a800415..541447a5916c0c 100644
--- a/libcxx/test/libcxx/feature_test_macro/ftm_metadata.sh.py
+++ b/libcxx/test/libcxx/feature_test_macro/ftm_metadata.sh.py
@@ -29,8 +29,8 @@ def test(output, expected):
         },
         "__cpp_lib_barrier": {
             "headers": ["barrier"],
-            "test_suite_guard": "!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)",
-            "libcxx_guard": "!defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC",
+            "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
+            "libcxx_guard": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
         },
         "__cpp_lib_format": {
             "headers": ["format"],
diff --git a/libcxx/test/libcxx/feature_test_macro/test_data.json b/libcxx/test/libcxx/feature_test_macro/test_data.json
index f7ae74fb83286c..fd698c08b2daaa 100644
--- a/libcxx/test/libcxx/feature_test_macro/test_data.json
+++ b/libcxx/test/libcxx/feature_test_macro/test_data.json
@@ -35,9 +35,8 @@
     "headers": [
       "barrier"
     ],
-    "test_suite_guard":
-        "!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)",
-    "libcxx_guard": "!defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC"
+    "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
+    "libcxx_guard": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC"
   },
   {
     "name": "__cpp_lib_format",
diff --git a/libcxx/test/libcxx/feature_test_macro/version_header.sh.py b/libcxx/test/libcxx/feature_test_macro/version_header.sh.py
index 634f43b83cafaa..24d3981f81aebb 100644
--- a/libcxx/test/libcxx/feature_test_macro/version_header.sh.py
+++ b/libcxx/test/libcxx/feature_test_macro/version_header.sh.py
@@ -47,7 +47,7 @@ def test(output, expected):
 #endif // _LIBCPP_STD_VER >= 17
 
 #if _LIBCPP_STD_VER >= 20
-#  if !defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC
+#  if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
 #    define __cpp_lib_barrier 201907L
 #  endif
 // define __cpp_lib_format 202110L
@@ -60,7 +60,7 @@ def test(output, expected):
 #endif // _LIBCPP_STD_VER >= 23
 
 #if _LIBCPP_STD_VER >= 26
-#  if !defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC
+#  if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
 #    undef __cpp_lib_barrier
 #    define __cpp_lib_barrier 299900L
 #  endif
diff --git a/libcxx/test/libcxx/feature_test_macro/version_header_implementation.sh.py b/libcxx/test/libcxx/feature_test_macro/version_header_implementation.sh.py
index a2fc1c5682f63b..b9e087c2107672 100644
--- a/libcxx/test/libcxx/feature_test_macro/version_header_implementation.sh.py
+++ b/libcxx/test/libcxx/feature_test_macro/version_header_implementation.sh.py
@@ -65,7 +65,7 @@ def test_implementation(self):
                         "value": "201907L",
                         "implemented": True,
                         "need_undef": False,
-                        "condition": "!defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC",
+                        "condition": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
                     },
                 },
                 {
@@ -109,7 +109,7 @@ def test_implementation(self):
                         "value": "299900L",
                         "implemented": True,
                         "need_undef": True,
-                        "condition": "!defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC",
+                        "condition": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
                     },
                 },
                 {
diff --git a/libcxx/test/libcxx/include_as_c.sh.cpp b/libcxx/test/libcxx/include_as_c.sh.cpp
index 204b830462cf94..635c7e3aa4f5fd 100644
--- a/libcxx/test/libcxx/include_as_c.sh.cpp
+++ b/libcxx/test/libcxx/include_as_c.sh.cpp
@@ -29,8 +29,8 @@
 #include <float.h>
 #include <inttypes.h>
 #include <limits.h>
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-#   include <locale.h>
+#if _LIBCPP_HAS_LOCALIZATION
+#  include <locale.h>
 #endif
 #include <math.h>
 #include <setjmp.h>
@@ -45,14 +45,14 @@
 // The clang-shipped tgmath.h header doesn't work with MSVC/UCRT's complex
 // headers in C mode, see PR46207.
 #ifndef _MSC_VER
-#    include <tgmath.h>
+#  include <tgmath.h>
 #endif
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-#   include <wchar.h>
-#   include <wctype.h>
+#if _LIBCPP_HAS_WIDE_CHARACTERS
+#  include <wchar.h>
+#  include <wctype.h>
 #endif
 
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
   (void)argc;
   (void)argv;
   return 0;
diff --git a/libcxx/test/libcxx/vendor/apple/availability-with-pedantic-errors.compile.pass.cpp b/libcxx/test/libcxx/vendor/apple/availability-with-pedantic-errors.compile.pass.cpp
index 60723bf7b6e971..118e4e687e1155 100644
--- a/libcxx/test/libcxx/vendor/apple/availability-with-pedantic-errors.compile.pass.cpp
+++ b/libcxx/test/libcxx/vendor/apple/availability-with-pedantic-errors.compile.pass.cpp
@@ -17,6 +17,6 @@
 
 #include <__config>
 
-#if defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
+#if !_LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
 #  error Availability annotations should be enabled on Apple platforms in the system configuration!
 #endif
diff --git a/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.tests.h b/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.tests.h
index 54ab27887f463b..eb4b7a1d2e62f0 100644
--- a/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.tests.h
+++ b/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.tests.h
@@ -270,7 +270,7 @@ void test_char(TestFunction check, ExceptionTest check_exception) {
 // char -> wchar_t
 //
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
 template <class TestFunction, class ExceptionTest>
 void test_char_to_wchar(TestFunction check, ExceptionTest check_exception) {
   std::array input{'H', 'e', 'l', 'l', 'o'};
@@ -299,7 +299,7 @@ void test_char_to_wchar(TestFunction check, ExceptionTest check_exception) {
   check_exception(
       "Type ?s requires character type as formatting argument", SV("{:?s}"), std::stack{input.begin(), input.end()});
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // TEST_HAS_NO_WIDE_CHARACTERS
 
 //
 // Bool
@@ -966,7 +966,7 @@ void test_status(TestFunction check, ExceptionTest check_exception) {
 template <class CharT, class TestFunction, class ExceptionTest>
 void format_tests(TestFunction check, ExceptionTest check_exception) {
   test_char<CharT>(check, check_exception);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
   if (std::same_as<CharT, wchar_t>) // avoid testing twice
     test_char_to_wchar(check, check_exception);
 #endif
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.compile.pass.cpp
index dd76e7908e0af1..bf8c8fa802e15c 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.compile.pass.cpp
@@ -44,7 +44,7 @@
 
 #elif TEST_STD_VER == 20
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   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 the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER == 23
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_barrier
 #     error "__cpp_lib_barrier should be defined in c++23"
 #   endif
@@ -68,13 +68,13 @@
 #   endif
 # else
 #   ifdef __cpp_lib_barrier
-#     error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER > 23
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_barrier
 #     error "__cpp_lib_barrier should be defined in c++26"
 #   endif
@@ -83,7 +83,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_barrier
-#     error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.compile.pass.cpp
index 4aba33482f69c4..1a95acd3683d28 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.compile.pass.cpp
@@ -60,7 +60,7 @@
 #   error "__cpp_lib_char8_t should not be defined before c++20"
 # endif
 
-# if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
 #   ifndef __cpp_lib_filesystem
 #     error "__cpp_lib_filesystem should be defined in c++17"
 #   endif
@@ -69,7 +69,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_filesystem
-#     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
+#     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
 #   endif
 # endif
 
@@ -92,7 +92,7 @@
 #   endif
 # endif
 
-# if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
 #   ifndef __cpp_lib_filesystem
 #     error "__cpp_lib_filesystem should be defined in c++20"
 #   endif
@@ -101,7 +101,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_filesystem
-#     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
+#     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
 #   endif
 # endif
 
@@ -124,7 +124,7 @@
 #   endif
 # endif
 
-# if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
 #   ifndef __cpp_lib_filesystem
 #     error "__cpp_lib_filesystem should be defined in c++23"
 #   endif
@@ -133,7 +133,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_filesystem
-#     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
+#     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
 #   endif
 # endif
 
@@ -156,7 +156,7 @@
 #   endif
 # endif
 
-# if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
 #   ifndef __cpp_lib_filesystem
 #     error "__cpp_lib_filesystem should be defined in c++26"
 #   endif
@@ -165,7 +165,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_filesystem
-#     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
+#     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
 #   endif
 # endif
 
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/fstream.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/fstream.version.compile.pass.cpp
index f2c31b60a92f90..d75ea4c37c89f7 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/fstream.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/fstream.version.compile.pass.cpp
@@ -56,7 +56,7 @@
 
 #elif TEST_STD_VER > 23
 
-# if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && !defined(_LIBCPP_HAS_NO_LOCALIZATION))
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION)
 #   ifndef __cpp_lib_fstream_native_handle
 #     error "__cpp_lib_fstream_native_handle should be defined in c++26"
 #   endif
@@ -65,7 +65,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_fstream_native_handle
-#     error "__cpp_lib_fstream_native_handle should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && !defined(_LIBCPP_HAS_NO_LOCALIZATION))' is not met!"
+#     error "__cpp_lib_fstream_native_handle should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION)' is not met!"
 #   endif
 # endif
 
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/iomanip.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/iomanip.version.compile.pass.cpp
index da9970fd162787..f3ac7a0a572f0f 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/iomanip.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/iomanip.version.compile.pass.cpp
@@ -32,7 +32,7 @@
 
 #elif TEST_STD_VER == 14
 
-# if !defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION
 #   ifndef __cpp_lib_quoted_string_io
 #     error "__cpp_lib_quoted_string_io should be defined in c++14"
 #   endif
@@ -41,13 +41,13 @@
 #   endif
 # else
 #   ifdef __cpp_lib_quoted_string_io
-#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)' is not met!"
+#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER == 17
 
-# if !defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION
 #   ifndef __cpp_lib_quoted_string_io
 #     error "__cpp_lib_quoted_string_io should be defined in c++17"
 #   endif
@@ -56,13 +56,13 @@
 #   endif
 # else
 #   ifdef __cpp_lib_quoted_string_io
-#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)' is not met!"
+#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER == 20
 
-# if !defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION
 #   ifndef __cpp_lib_quoted_string_io
 #     error "__cpp_lib_quoted_string_io should be defined in c++20"
 #   endif
@@ -71,13 +71,13 @@
 #   endif
 # else
 #   ifdef __cpp_lib_quoted_string_io
-#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)' is not met!"
+#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER == 23
 
-# if !defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION
 #   ifndef __cpp_lib_quoted_string_io
 #     error "__cpp_lib_quoted_string_io should be defined in c++23"
 #   endif
@@ -86,13 +86,13 @@
 #   endif
 # else
 #   ifdef __cpp_lib_quoted_string_io
-#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)' is not met!"
+#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER > 23
 
-# if !defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION
 #   ifndef __cpp_lib_quoted_string_io
 #     error "__cpp_lib_quoted_string_io should be defined in c++26"
 #   endif
@@ -101,7 +101,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_quoted_string_io
-#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)' is not met!"
+#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION' is not met!"
 #   endif
 # endif
 
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.compile.pass.cpp
index c00ec6dc6845da..34521fdffa2217 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.compile.pass.cpp
@@ -44,7 +44,7 @@
 
 #elif TEST_STD_VER == 20
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   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 the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER == 23
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_latch
 #     error "__cpp_lib_latch should be defined in c++23"
 #   endif
@@ -68,13 +68,13 @@
 #   endif
 # else
 #   ifdef __cpp_lib_latch
-#     error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER > 23
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_latch
 #     error "__cpp_lib_latch should be defined in c++26"
 #   endif
@@ -83,7 +83,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_latch
-#     error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.compile.pass.cpp
index 0f279973dccd8a..49601e4d78ceac 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.compile.pass.cpp
@@ -38,7 +38,7 @@
 
 #elif TEST_STD_VER == 17
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_scoped_lock
 #     error "__cpp_lib_scoped_lock should be defined in c++17"
 #   endif
@@ -47,13 +47,13 @@
 #   endif
 # else
 #   ifdef __cpp_lib_scoped_lock
-#     error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER == 20
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_scoped_lock
 #     error "__cpp_lib_scoped_lock should be defined in c++20"
 #   endif
@@ -62,13 +62,13 @@
 #   endif
 # else
 #   ifdef __cpp_lib_scoped_lock
-#     error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER == 23
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_scoped_lock
 #     error "__cpp_lib_scoped_lock should be defined in c++23"
 #   endif
@@ -77,13 +77,13 @@
 #   endif
 # else
 #   ifdef __cpp_lib_scoped_lock
-#     error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER > 23
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_scoped_lock
 #     error "__cpp_lib_scoped_lock should be defined in c++26"
 #   endif
@@ -92,7 +92,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_scoped_lock
-#     error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.compile.pass.cpp
index dc79a1420f38a2..bdc818ce8d688a 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.compile.pass.cpp
@@ -44,7 +44,7 @@
 
 #elif TEST_STD_VER == 20
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   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 the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER == 23
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_semaphore
 #     error "__cpp_lib_semaphore should be defined in c++23"
 #   endif
@@ -68,13 +68,13 @@
 #   endif
 # else
 #   ifdef __cpp_lib_semaphore
-#     error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER > 23
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_semaphore
 #     error "__cpp_lib_semaphore should be defined in c++26"
 #   endif
@@ -83,7 +83,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_semaphore
-#     error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.compile.pass.cpp
index 6662de9c33f30e..7302d0b95ffc12 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.compile.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 _LIBCPP_HAS_THREADS
 #   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 the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER == 17
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   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 the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   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 the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER == 20
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   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 the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   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 the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER == 23
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_shared_mutex
 #     error "__cpp_lib_shared_mutex should be defined in c++23"
 #   endif
@@ -121,11 +121,11 @@
 #   endif
 # else
 #   ifdef __cpp_lib_shared_mutex
-#     error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_shared_timed_mutex
 #     error "__cpp_lib_shared_timed_mutex should be defined in c++23"
 #   endif
@@ -134,13 +134,13 @@
 #   endif
 # else
 #   ifdef __cpp_lib_shared_timed_mutex
-#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER > 23
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_shared_mutex
 #     error "__cpp_lib_shared_mutex should be defined in c++26"
 #   endif
@@ -149,11 +149,11 @@
 #   endif
 # else
 #   ifdef __cpp_lib_shared_mutex
-#     error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_shared_timed_mutex
 #     error "__cpp_lib_shared_timed_mutex should be defined in c++26"
 #   endif
@@ -162,7 +162,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_shared_timed_mutex
-#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/stop_token.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/stop_token.version.compile.pass.cpp
index 49233cda2bd9e1..c4fa735bf4e630 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/stop_token.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/stop_token.version.compile.pass.cpp
@@ -44,7 +44,7 @@
 
 #elif TEST_STD_VER == 20
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_jthread
 #     error "__cpp_lib_jthread should be defined in c++20"
 #   endif
@@ -53,13 +53,13 @@
 #   endif
 # else
 #   ifdef __cpp_lib_jthread
-#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER == 23
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_jthread
 #     error "__cpp_lib_jthread should be defined in c++23"
 #   endif
@@ -68,13 +68,13 @@
 #   endif
 # else
 #   ifdef __cpp_lib_jthread
-#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
 #elif TEST_STD_VER > 23
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_jthread
 #     error "__cpp_lib_jthread should be defined in c++26"
 #   endif
@@ -83,7 +83,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_jthread
-#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/thread.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/thread.version.compile.pass.cpp
index 97700235ca21ad..d1a9919afeb37a 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/thread.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/thread.version.compile.pass.cpp
@@ -61,7 +61,7 @@
 #   error "__cpp_lib_formatters should not be defined before c++23"
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_jthread
 #     error "__cpp_lib_jthread should be defined in c++20"
 #   endif
@@ -70,7 +70,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_jthread
-#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
@@ -89,7 +89,7 @@
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_jthread
 #     error "__cpp_lib_jthread should be defined in c++23"
 #   endif
@@ -98,7 +98,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_jthread
-#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
@@ -117,7 +117,7 @@
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_jthread
 #     error "__cpp_lib_jthread should be defined in c++26"
 #   endif
@@ -126,7 +126,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_jthread
-#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
index 5deaee16895f66..922a924d12adfc 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@@ -1722,7 +1722,7 @@
 #   error "__cpp_lib_print should not be defined before c++23"
 # endif
 
-# if !defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION
 #   ifndef __cpp_lib_quoted_string_io
 #     error "__cpp_lib_quoted_string_io should be defined in c++14"
 #   endif
@@ -1731,7 +1731,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_quoted_string_io
-#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)' is not met!"
+#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION' is not met!"
 #   endif
 # endif
 
@@ -1865,7 +1865,7 @@
 #   error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17"
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_shared_timed_mutex
 #     error "__cpp_lib_shared_timed_mutex should be defined in c++14"
 #   endif
@@ -1874,7 +1874,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_shared_timed_mutex
-#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
@@ -2376,7 +2376,7 @@
 #   error "__cpp_lib_expected should not be defined before c++23"
 # endif
 
-# if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
 #   ifndef __cpp_lib_filesystem
 #     error "__cpp_lib_filesystem should be defined in c++17"
 #   endif
@@ -2385,7 +2385,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_filesystem
-#     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
+#     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
 #   endif
 # endif
 
@@ -2797,7 +2797,7 @@
 #   error "__cpp_lib_print should not be defined before c++23"
 # endif
 
-# if !defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION
 #   ifndef __cpp_lib_quoted_string_io
 #     error "__cpp_lib_quoted_string_io should be defined in c++17"
 #   endif
@@ -2806,7 +2806,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_quoted_string_io
-#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)' is not met!"
+#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION' is not met!"
 #   endif
 # endif
 
@@ -2922,7 +2922,7 @@
 #   error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_scoped_lock
 #     error "__cpp_lib_scoped_lock should be defined in c++17"
 #   endif
@@ -2931,7 +2931,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_scoped_lock
-#     error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
@@ -2943,7 +2943,7 @@
 #   error "__cpp_lib_senders should not be defined before c++26"
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_shared_mutex
 #     error "__cpp_lib_shared_mutex should be defined in c++17"
 #   endif
@@ -2952,7 +2952,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_shared_mutex
-#     error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
@@ -2970,7 +2970,7 @@
 #   error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++17"
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_shared_timed_mutex
 #     error "__cpp_lib_shared_timed_mutex should be defined in c++17"
 #   endif
@@ -2979,7 +2979,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_shared_timed_mutex
-#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
@@ -3326,7 +3326,7 @@
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_barrier
 #     error "__cpp_lib_barrier should be defined in c++20"
 #   endif
@@ -3335,7 +3335,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_barrier
-#     error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
@@ -3637,7 +3637,7 @@
 #   error "__cpp_lib_expected should not be defined before c++23"
 # endif
 
-# if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
 #   ifndef __cpp_lib_filesystem
 #     error "__cpp_lib_filesystem should be defined in c++20"
 #   endif
@@ -3646,7 +3646,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_filesystem
-#     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
+#     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
 #   endif
 # endif
 
@@ -3928,7 +3928,7 @@
 #   error "__cpp_lib_is_within_lifetime should not be defined before c++26"
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_jthread
 #     error "__cpp_lib_jthread should be defined in c++20"
 #   endif
@@ -3937,11 +3937,11 @@
 #   endif
 # else
 #   ifdef __cpp_lib_jthread
-#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_latch
 #     error "__cpp_lib_latch should be defined in c++20"
 #   endif
@@ -3950,7 +3950,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_latch
-#     error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
@@ -4136,7 +4136,7 @@
 #   error "__cpp_lib_print should not be defined before c++23"
 # endif
 
-# if !defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION
 #   ifndef __cpp_lib_quoted_string_io
 #     error "__cpp_lib_quoted_string_io should be defined in c++20"
 #   endif
@@ -4145,7 +4145,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_quoted_string_io
-#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)' is not met!"
+#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION' is not met!"
 #   endif
 # endif
 
@@ -4267,7 +4267,7 @@
 #   error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_scoped_lock
 #     error "__cpp_lib_scoped_lock should be defined in c++20"
 #   endif
@@ -4276,11 +4276,11 @@
 #   endif
 # else
 #   ifdef __cpp_lib_scoped_lock
-#     error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_semaphore
 #     error "__cpp_lib_semaphore should be defined in c++20"
 #   endif
@@ -4289,7 +4289,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_semaphore
-#     error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
@@ -4297,7 +4297,7 @@
 #   error "__cpp_lib_senders should not be defined before c++26"
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_shared_mutex
 #     error "__cpp_lib_shared_mutex should be defined in c++20"
 #   endif
@@ -4306,7 +4306,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_shared_mutex
-#     error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
@@ -4324,7 +4324,7 @@
 #   error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++20"
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_shared_timed_mutex
 #     error "__cpp_lib_shared_timed_mutex should be defined in c++20"
 #   endif
@@ -4333,7 +4333,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_shared_timed_mutex
-#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
@@ -4743,7 +4743,7 @@
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_barrier
 #     error "__cpp_lib_barrier should be defined in c++23"
 #   endif
@@ -4752,7 +4752,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_barrier
-#     error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
@@ -5084,7 +5084,7 @@
 #   error "__cpp_lib_expected should have the value 202211L in c++23"
 # endif
 
-# if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
 #   ifndef __cpp_lib_filesystem
 #     error "__cpp_lib_filesystem should be defined in c++23"
 #   endif
@@ -5093,7 +5093,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_filesystem
-#     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
+#     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
 #   endif
 # endif
 
@@ -5408,7 +5408,7 @@
 #   error "__cpp_lib_is_within_lifetime should not be defined before c++26"
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_jthread
 #     error "__cpp_lib_jthread should be defined in c++23"
 #   endif
@@ -5417,11 +5417,11 @@
 #   endif
 # else
 #   ifdef __cpp_lib_jthread
-#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_latch
 #     error "__cpp_lib_latch should be defined in c++23"
 #   endif
@@ -5430,7 +5430,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_latch
-#     error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
@@ -5637,7 +5637,7 @@
 #   error "__cpp_lib_print should have the value 202207L in c++23"
 # endif
 
-# if !defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION
 #   ifndef __cpp_lib_quoted_string_io
 #     error "__cpp_lib_quoted_string_io should be defined in c++23"
 #   endif
@@ -5646,7 +5646,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_quoted_string_io
-#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)' is not met!"
+#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION' is not met!"
 #   endif
 # endif
 
@@ -5852,7 +5852,7 @@
 #   error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_scoped_lock
 #     error "__cpp_lib_scoped_lock should be defined in c++23"
 #   endif
@@ -5861,11 +5861,11 @@
 #   endif
 # else
 #   ifdef __cpp_lib_scoped_lock
-#     error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_semaphore
 #     error "__cpp_lib_semaphore should be defined in c++23"
 #   endif
@@ -5874,7 +5874,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_semaphore
-#     error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
@@ -5882,7 +5882,7 @@
 #   error "__cpp_lib_senders should not be defined before c++26"
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_shared_mutex
 #     error "__cpp_lib_shared_mutex should be defined in c++23"
 #   endif
@@ -5891,7 +5891,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_shared_mutex
-#     error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
@@ -5909,7 +5909,7 @@
 #   error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++23"
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_shared_timed_mutex
 #     error "__cpp_lib_shared_timed_mutex should be defined in c++23"
 #   endif
@@ -5918,7 +5918,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_shared_timed_mutex
-#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
@@ -6388,7 +6388,7 @@
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_barrier
 #     error "__cpp_lib_barrier should be defined in c++26"
 #   endif
@@ -6397,7 +6397,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_barrier
-#     error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
@@ -6777,7 +6777,7 @@
 #   error "__cpp_lib_expected should have the value 202211L in c++26"
 # endif
 
-# if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
 #   ifndef __cpp_lib_filesystem
 #     error "__cpp_lib_filesystem should be defined in c++26"
 #   endif
@@ -6786,7 +6786,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_filesystem
-#     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
+#     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
 #   endif
 # endif
 
@@ -6948,7 +6948,7 @@
 #   endif
 # endif
 
-# if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && !defined(_LIBCPP_HAS_NO_LOCALIZATION))
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION)
 #   ifndef __cpp_lib_fstream_native_handle
 #     error "__cpp_lib_fstream_native_handle should be defined in c++26"
 #   endif
@@ -6957,7 +6957,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_fstream_native_handle
-#     error "__cpp_lib_fstream_native_handle should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && !defined(_LIBCPP_HAS_NO_LOCALIZATION))' is not met!"
+#     error "__cpp_lib_fstream_native_handle should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION)' is not met!"
 #   endif
 # endif
 
@@ -7245,7 +7245,7 @@
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_jthread
 #     error "__cpp_lib_jthread should be defined in c++26"
 #   endif
@@ -7254,11 +7254,11 @@
 #   endif
 # else
 #   ifdef __cpp_lib_jthread
-#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_latch
 #     error "__cpp_lib_latch should be defined in c++26"
 #   endif
@@ -7267,7 +7267,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_latch
-#     error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
@@ -7501,7 +7501,7 @@
 #   error "__cpp_lib_print should have the value 202207L in c++26"
 # endif
 
-# if !defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION
 #   ifndef __cpp_lib_quoted_string_io
 #     error "__cpp_lib_quoted_string_io should be defined in c++26"
 #   endif
@@ -7510,7 +7510,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_quoted_string_io
-#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)' is not met!"
+#     error "__cpp_lib_quoted_string_io should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION' is not met!"
 #   endif
 # endif
 
@@ -7743,7 +7743,7 @@
 #   error "__cpp_lib_saturation_arithmetic should have the value 202311L in c++26"
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_scoped_lock
 #     error "__cpp_lib_scoped_lock should be defined in c++26"
 #   endif
@@ -7752,11 +7752,11 @@
 #   endif
 # else
 #   ifdef __cpp_lib_scoped_lock
-#     error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
 #   ifndef __cpp_lib_semaphore
 #     error "__cpp_lib_semaphore should be defined in c++26"
 #   endif
@@ -7765,7 +7765,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_semaphore
-#     error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+#     error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
 #   endif
 # endif
 
@@ -7782,7 +7782,7 @@
 #   endif
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_shared_mutex
 #     error "__cpp_lib_shared_mutex should be defined in c++26"
 #   endif
@@ -7791,7 +7791,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_shared_mutex
-#     error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
@@ -7809,7 +7809,7 @@
 #   error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++26"
 # endif
 
-# if !defined(_LIBCPP_HAS_NO_THREADS)
+# if _LIBCPP_HAS_THREADS
 #   ifndef __cpp_lib_shared_timed_mutex
 #     error "__cpp_lib_shared_timed_mutex should be defined in c++26"
 #   endif
@@ -7818,7 +7818,7 @@
 #   endif
 # else
 #   ifdef __cpp_lib_shared_timed_mutex
-#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
+#     error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
 #   endif
 # endif
 
diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.tests.h b/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.tests.h
index 11088796e53869..fc638da9c840dc 100644
--- a/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.tests.h
+++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.tests.h
@@ -131,7 +131,7 @@ void test_char(TestFunction check, ExceptionTest check_exception) {
 // char -> wchar_t
 //
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
 template <class TestFunction, class ExceptionTest>
 void test_char_to_wchar(TestFunction check, ExceptionTest check_exception) {
   std::map<char, char> input{{'a', 'A'}, {'c', 'C'}, {'b', 'B'}};
@@ -235,7 +235,7 @@ void test_char_to_wchar(TestFunction check, ExceptionTest check_exception) {
   check_exception(
       "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 44);
 }
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // TEST_HAS_NO_WIDE_CHARACTERS
 
 //
 // Bool
@@ -839,7 +839,7 @@ void test_adaptor(TestFunction check, ExceptionTest check_exception) {
 template <class CharT, class TestFunction, class ExceptionTest>
 void format_tests(TestFunction check, ExceptionTest check_exception) {
   test_char<CharT>(check, check_exception);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
   if (std::same_as<CharT, wchar_t>) // avoid testing twice
     test_char_to_wchar(check, check_exception);
 #endif
diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.tests.h b/libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.tests.h
index 258a6a1b8465da..09202084990062 100644
--- a/libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.tests.h
+++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.tests.h
@@ -260,7 +260,7 @@ void test_char(TestFunction check, ExceptionTest check_exception) {
 // char -> wchar_t
 //
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
 template <class TestFunction, class ExceptionTest>
 void test_char_to_wchar(TestFunction check, ExceptionTest check_exception) {
   std::set input{'a', 'c', 'b'}; // input not sorted.
@@ -379,7 +379,7 @@ void test_char_to_wchar(TestFunction check, ExceptionTest check_exception) {
   check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
   check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
 }
-#endif //  _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif //  TEST_HAS_NO_WIDE_CHARACTERS
 
 //
 // Bool
@@ -1502,7 +1502,7 @@ template <class CharT, class TestFunction, class ExceptionTest>
 void format_tests(TestFunction check, ExceptionTest check_exception) {
   test_char<CharT>(check, check_exception);
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
   if (std::same_as<CharT, wchar_t>) // avoid testing twice
     test_char_to_wchar(check, check_exception);
 #endif
diff --git a/libcxx/test/std/utilities/format/format.range/format.range.formatter/format.functions.tests.h b/libcxx/test/std/utilities/format/format.range/format.range.formatter/format.functions.tests.h
index d0469e11f3040a..b9e21516462458 100644
--- a/libcxx/test/std/utilities/format/format.range/format.range.formatter/format.functions.tests.h
+++ b/libcxx/test/std/utilities/format/format.range/format.range.formatter/format.functions.tests.h
@@ -274,7 +274,7 @@ void test_char(TestFunction check, ExceptionTest check_exception) {
 // char -> wchar_t
 //
 
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
 template <class TestFunction, class ExceptionTest>
 void test_char_to_wchar(TestFunction check, ExceptionTest check_exception) {
   test_char_default<wchar_t>(check, check_exception, std::array{'H', 'e', 'l', 'l', 'o'});
@@ -1368,7 +1368,7 @@ void test_adaptor(TestFunction check, ExceptionTest check_exception) {
 template <class CharT, class TestFunction, class ExceptionTest>
 void format_tests(TestFunction check, ExceptionTest check_exception) {
   test_char<CharT>(check, check_exception);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
   if (std::same_as<CharT, wchar_t>) // avoid testing twice
     test_char_to_wchar(check, check_exception);
 #endif
diff --git a/libcxx/test/support/filesystem_test_helper.h b/libcxx/test/support/filesystem_test_helper.h
index 932d14f45f8e5c..a63d645d1a01ae 100644
--- a/libcxx/test/support/filesystem_test_helper.h
+++ b/libcxx/test/support/filesystem_test_helper.h
@@ -530,7 +530,7 @@ inline bool ErrorIs(const std::error_code& ec, std::errc First, ErrcT... Rest) {
 // available in single-threaded mode.
 template <class Dur> void SleepFor(Dur dur) {
     using namespace std::chrono;
-#if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK)
+#if !_LIBCPP_HAS_MONOTONIC_CLOCK
     using Clock = system_clock;
 #else
     using Clock = steady_clock;
diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h
index 1b6473b623c53b..7f50282d627176 100644
--- a/libcxx/test/support/test_macros.h
+++ b/libcxx/test/support/test_macros.h
@@ -391,14 +391,14 @@ inline Tp const& DoNotOptimize(Tp const& value) {
 #endif
 
 // Support for carving out parts of the test suite, like removing wide characters, etc.
-#if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
-#   define TEST_HAS_NO_WIDE_CHARACTERS
+#if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_WIDE_CHARACTERS
+#  define TEST_HAS_NO_WIDE_CHARACTERS
 #endif
 
-#if defined(_LIBCPP_HAS_NO_UNICODE)
-#   define TEST_HAS_NO_UNICODE
+#if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_UNICODE
+#  define TEST_HAS_NO_UNICODE
 #elif defined(_MSVC_EXECUTION_CHARACTER_SET) && _MSVC_EXECUTION_CHARACTER_SET != 65001
-#   define TEST_HAS_NO_UNICODE
+#  define TEST_HAS_NO_UNICODE
 #endif
 
 #if defined(_LIBCPP_VERSION) && _LIBCPP_HAS_OPEN_WITH_WCHAR
@@ -409,7 +409,7 @@ inline Tp const& DoNotOptimize(Tp const& value) {
 #  define TEST_HAS_NO_INT128
 #endif
 
-#if defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_LOCALIZATION
 #  define TEST_HAS_NO_LOCALIZATION
 #endif
 
@@ -417,11 +417,11 @@ inline Tp const& DoNotOptimize(Tp const& value) {
 #  define TEST_HAS_NO_CHAR8_T
 #endif
 
-#if defined(_LIBCPP_HAS_NO_THREADS)
+#if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_THREADS
 #  define TEST_HAS_NO_THREADS
 #endif
 
-#if defined(_LIBCPP_HAS_NO_FILESYSTEM)
+#if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_FILESYSTEM
 #  define TEST_HAS_NO_FILESYSTEM
 #endif
 
@@ -429,7 +429,7 @@ inline Tp const& DoNotOptimize(Tp const& value) {
 #  define TEST_HAS_NO_C8RTOMB_MBRTOC8
 #endif
 
-#if defined(_LIBCPP_HAS_NO_RANDOM_DEVICE)
+#if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_RANDOM_DEVICE
 #  define TEST_HAS_NO_RANDOM_DEVICE
 #endif
 
@@ -437,7 +437,7 @@ inline Tp const& DoNotOptimize(Tp const& value) {
 #  define TEST_HAS_NO_EXPERIMENTAL_TZDB
 #endif
 
-#if defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE)
+#if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_TIME_ZONE_DATABASE
 #  define TEST_HAS_NO_TIME_ZONE_DATABASE
 #endif
 
diff --git a/libcxx/test/tools/clang_tidy_checks/internal_ftm_use.cpp b/libcxx/test/tools/clang_tidy_checks/internal_ftm_use.cpp
index b5e849e2a0cb90..173762e5602a71 100644
--- a/libcxx/test/tools/clang_tidy_checks/internal_ftm_use.cpp
+++ b/libcxx/test/tools/clang_tidy_checks/internal_ftm_use.cpp
@@ -29,30 +29,6 @@ std::array valid_macros{
     // TODO: Why does this macro even exist?
     "_LIBCPP_HAS_NO_TREE_BARRIER",
 
-    // Configuration macros
-    "_LIBCPP_HAS_NO_TIME_ZONE_DATABASE",
-    "_LIBCPP_HAS_NO_FILESYSTEM",
-    "_LIBCPP_HAS_NO_LOCALIZATION",
-    "_LIBCPP_HAS_NO_THREADS",
-    "_LIBCPP_HAS_NO_MONOTONIC_CLOCK",
-    "_LIBCPP_HAS_MUSL_LIBC",
-    "_LIBCPP_HAS_NO_WIDE_CHARACTERS",
-    "_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS",
-    "_LIBCPP_HAS_NO_RANDOM_DEVICE",
-    "_LIBCPP_HAS_NO_UNICODE",
-    "_LIBCPP_HAS_NO_TERMINAL",
-
-    // Atomic API macros
-    "_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP",
-    "_LIBCPP_HAS_GCC_ATOMIC_IMP",
-    "_LIBCPP_HAS_C_ATOMIC_IMP",
-
-    // Thread API macros
-    "_LIBCPP_HAS_THREAD_API_PTHREAD",
-    "_LIBCPP_HAS_THREAD_API_WIN32",
-    "_LIBCPP_HAS_THREAD_API_EXTERNAL",
-    "_LIBCPP_HAS_THREAD_API_C11",
-
     // Experimental features
     "_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB",
     "_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM",
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index 197d6bbc692226..740c6934880d3b 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -207,8 +207,8 @@ def add_version_header(tc):
             "name": "__cpp_lib_barrier",
             "values": {"c++20": 201907},
             "headers": ["barrier"],
-            "test_suite_guard": "!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)",
-            "libcxx_guard": "!defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC",
+            "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
+            "libcxx_guard": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
         },
         {
             "name": "__cpp_lib_bind_back",
@@ -502,8 +502,8 @@ def add_version_header(tc):
             "name": "__cpp_lib_filesystem",
             "values": {"c++17": 201703},
             "headers": ["filesystem"],
-            "test_suite_guard": "!defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)",
-            "libcxx_guard": "!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY",
+            "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)",
+            "libcxx_guard": "_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY",
         },
         {
             "name": "__cpp_lib_format",
@@ -619,8 +619,8 @@ def add_version_header(tc):
             "name": "__cpp_lib_fstream_native_handle",
             "values": {"c++26": 202306},  # P1759R6 Native handles and file streams
             "headers": ["fstream"],
-            "test_suite_guard": "!defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && !defined(_LIBCPP_HAS_NO_LOCALIZATION))",
-            "libcxx_guard": "!defined(_LIBCPP_HAS_NO_FILESYSTEM) && !defined(_LIBCPP_HAS_NO_LOCALIZATION)",
+            "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION)",
+            "libcxx_guard": "_LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION",
         },
         {
             "name": "__cpp_lib_function_ref",
@@ -809,15 +809,15 @@ def add_version_header(tc):
             "name": "__cpp_lib_jthread",
             "values": {"c++20": 201911},
             "headers": ["stop_token", "thread"],
-            "test_suite_guard": "!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)",
-            "libcxx_guard": "!defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC",
+            "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
+            "libcxx_guard": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
         },
         {
             "name": "__cpp_lib_latch",
             "values": {"c++20": 201907},
             "headers": ["latch"],
-            "test_suite_guard": "!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)",
-            "libcxx_guard": "!defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC",
+            "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
+            "libcxx_guard": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
         },
         {
             "name": "__cpp_lib_launder",
@@ -998,8 +998,8 @@ def add_version_header(tc):
             "name": "__cpp_lib_quoted_string_io",
             "values": {"c++14": 201304},
             "headers": ["iomanip"],
-            "test_suite_guard": "!defined(_LIBCPP_VERSION) || !defined(_LIBCPP_HAS_NO_LOCALIZATION)",
-            "libcxx_guard": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
+            "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_LOCALIZATION",
+            "libcxx_guard": "_LIBCPP_HAS_LOCALIZATION",
         },
         {
             "name": "__cpp_lib_ranges",
@@ -1147,15 +1147,15 @@ def add_version_header(tc):
             "name": "__cpp_lib_scoped_lock",
             "values": {"c++17": 201703},
             "headers": ["mutex"],
-            "test_suite_guard": "!defined(_LIBCPP_HAS_NO_THREADS)",
-            "libcxx_guard": "!defined(_LIBCPP_HAS_NO_THREADS)",
+            "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS",
+            "libcxx_guard": "_LIBCPP_HAS_THREADS",
         },
         {
             "name": "__cpp_lib_semaphore",
             "values": {"c++20": 201907},
             "headers": ["semaphore"],
-            "test_suite_guard": "!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)",
-            "libcxx_guard": "!defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC",
+            "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
+            "libcxx_guard": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
         },
         {
             "name": "__cpp_lib_senders",
@@ -1167,8 +1167,8 @@ def add_version_header(tc):
             "name": "__cpp_lib_shared_mutex",
             "values": {"c++17": 201505},
             "headers": ["shared_mutex"],
-            "test_suite_guard": "!defined(_LIBCPP_HAS_NO_THREADS)",
-            "libcxx_guard": "!defined(_LIBCPP_HAS_NO_THREADS)",
+            "test_suite_guard": "_LIBCPP_HAS_THREADS",
+            "libcxx_guard": "_LIBCPP_HAS_THREADS",
         },
         {
             "name": "__cpp_lib_shared_ptr_arrays",
@@ -1184,8 +1184,8 @@ def add_version_header(tc):
             "name": "__cpp_lib_shared_timed_mutex",
             "values": {"c++14": 201402},
             "headers": ["shared_mutex"],
-            "test_suite_guard": "!defined(_LIBCPP_HAS_NO_THREADS)",
-            "libcxx_guard": "!defined(_LIBCPP_HAS_NO_THREADS)",
+            "test_suite_guard": "_LIBCPP_HAS_THREADS",
+            "libcxx_guard": "_LIBCPP_HAS_THREADS",
         },
         {
             "name": "__cpp_lib_shift",
diff --git a/libcxx/utils/libcxx/header_information.py b/libcxx/utils/libcxx/header_information.py
index cac620e4f1fe77..7d88b73d0331bb 100644
--- a/libcxx/utils/libcxx/header_information.py
+++ b/libcxx/utils/libcxx/header_information.py
@@ -182,21 +182,21 @@ def __hash__(self) -> int:
     "stdatomic.h": "_LIBCPP_HAS_ATOMIC_HEADER",
 
     # headers with #error directives
-    "ios": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
+    "ios": "_LIBCPP_HAS_LOCALIZATION",
     # transitive includers of the above headers
-    "clocale": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
-    "codecvt": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
-    "fstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
-    "iomanip": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
-    "iostream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
-    "istream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
-    "locale": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
-    "ostream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
-    "regex": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
-    "sstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
-    "streambuf": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
-    "strstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
-    "syncstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
+    "clocale": "_LIBCPP_HAS_LOCALIZATION",
+    "codecvt": "_LIBCPP_HAS_LOCALIZATION",
+    "fstream": "_LIBCPP_HAS_LOCALIZATION",
+    "iomanip": "_LIBCPP_HAS_LOCALIZATION",
+    "iostream": "_LIBCPP_HAS_LOCALIZATION",
+    "istream": "_LIBCPP_HAS_LOCALIZATION",
+    "locale": "_LIBCPP_HAS_LOCALIZATION",
+    "ostream": "_LIBCPP_HAS_LOCALIZATION",
+    "regex": "_LIBCPP_HAS_LOCALIZATION",
+    "sstream": "_LIBCPP_HAS_LOCALIZATION",
+    "streambuf": "_LIBCPP_HAS_LOCALIZATION",
+    "strstream": "_LIBCPP_HAS_LOCALIZATION",
+    "syncstream": "_LIBCPP_HAS_LOCALIZATION",
 }
 
 lit_header_restrictions = {
diff --git a/libcxx/utils/libcxx/test/dsl.py b/libcxx/utils/libcxx/test/dsl.py
index 624a00d7e8ed33..7ff4be0ee7cf9a 100644
--- a/libcxx/utils/libcxx/test/dsl.py
+++ b/libcxx/utils/libcxx/test/dsl.py
@@ -276,7 +276,7 @@ def hasAnyLocale(config, locales):
     """
     program = """
     #include <stddef.h>
-    #if defined(_LIBCPP_HAS_NO_LOCALIZATION)
+    #if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_LOCALIZATION
       int main(int, char**) { return 1; }
     #else
       #include <locale.h>
diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index bc723ca9897a1d..1905d3603dc3d1 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -231,7 +231,8 @@ def _mingwSupportsModules(cfg):
     # https://developercommunity.visualstudio.com/t/utf-8-locales-break-ctype-functions-for-wchar-type/1653678
     Feature(
         name="win32-broken-utf8-wchar-ctype",
-        when=lambda cfg: not "_LIBCPP_HAS_NO_LOCALIZATION" in compilerMacros(cfg)
+        when=lambda cfg: not "_LIBCPP_HAS_LOCALIZATION" in compilerMacros(cfg)
+        or compilerMacros(cfg)["_LIBCPP_HAS_LOCALIZATION"] == "1"
         and "_WIN32" in compilerMacros(cfg)
         and not programSucceeds(
             cfg,
@@ -287,7 +288,8 @@ def _mingwSupportsModules(cfg):
     # mon_decimal_point == ".", which our tests don't handle.
     Feature(
         name="glibc-old-ru_RU-decimal-point",
-        when=lambda cfg: not "_LIBCPP_HAS_NO_LOCALIZATION" in compilerMacros(cfg)
+        when=lambda cfg: not "_LIBCPP_HAS_LOCALIZATION" in compilerMacros(cfg)
+        or compilerMacros(cfg)["_LIBCPP_HAS_LOCALIZATION"] == "1"
         and not programSucceeds(
             cfg,
             """
@@ -365,10 +367,6 @@ def _mingwSupportsModules(cfg):
 # Note that features that are more strongly tied to libc++ are named libcpp-foo,
 # while features that are more general in nature are not prefixed with 'libcpp-'.
 macros = {
-    "_LIBCPP_HAS_NO_MONOTONIC_CLOCK": "no-monotonic-clock",
-    "_LIBCPP_HAS_NO_THREADS": "no-threads",
-    "_LIBCPP_HAS_THREAD_API_EXTERNAL": "libcpp-has-thread-api-external",
-    "_LIBCPP_HAS_THREAD_API_PTHREAD": "libcpp-has-thread-api-pthread",
     "_LIBCPP_NO_VCRUNTIME": "libcpp-no-vcruntime",
     "_LIBCPP_ABI_VERSION": "libcpp-abi-version",
     "_LIBCPP_ABI_BOUNDED_ITERATORS": "libcpp-has-abi-bounded-iterators",
@@ -378,14 +376,6 @@ def _mingwSupportsModules(cfg):
     "_LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE": "libcpp-has-abi-fix-unordered-container-size-type",
     "_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR": "libcpp-deprecated-abi-disable-pair-trivial-copy-ctor",
     "_LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING": "libcpp-abi-no-compressed-pair-padding",
-    "_LIBCPP_HAS_NO_FILESYSTEM": "no-filesystem",
-    "_LIBCPP_HAS_NO_RANDOM_DEVICE": "no-random-device",
-    "_LIBCPP_HAS_NO_LOCALIZATION": "no-localization",
-    "_LIBCPP_HAS_NO_TERMINAL": "no-terminal",
-    "_LIBCPP_HAS_NO_WIDE_CHARACTERS": "no-wide-characters",
-    "_LIBCPP_HAS_NO_TIME_ZONE_DATABASE": "no-tzdb",
-    "_LIBCPP_HAS_NO_UNICODE": "libcpp-has-no-unicode",
-    "_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS": "libcpp-has-no-availability-markup",
     "_LIBCPP_PSTL_BACKEND_LIBDISPATCH": "libcpp-pstl-backend-libdispatch",
 }
 for macro, feature in macros.items():
@@ -396,6 +386,39 @@ def _mingwSupportsModules(cfg):
         )
     )
 
+true_false_macros = {
+    "_LIBCPP_HAS_THREAD_API_EXTERNAL": "libcpp-has-thread-api-external",
+    "_LIBCPP_HAS_THREAD_API_PTHREAD": "libcpp-has-thread-api-pthread",
+}
+for macro, feature in true_false_macros.items():
+    DEFAULT_FEATURES.append(
+        Feature(
+            name=feature,
+            when=lambda cfg, m=macro: m in compilerMacros(cfg)
+            and compilerMacros(cfg)[m] == "1"
+        )
+    )
+
+inverted_macros = {
+    "_LIBCPP_HAS_TIME_ZONE_DATABASE": "no-tzdb",
+    "_LIBCPP_HAS_FILESYSTEM": "no-filesystem",
+    "_LIBCPP_HAS_LOCALIZATION": "no-localization",
+    "_LIBCPP_HAS_THREADS": "no-threads",
+    "_LIBCPP_HAS_MONOTONIC_CLOCK": "no-monotonic-clock",
+    "_LIBCPP_HAS_WIDE_CHARACTERS": "no-wide-characters",
+    "_LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS": "libcpp-has-no-availability-markup",
+    "_LIBCPP_HAS_RANDOM_DEVICE": "no-random-device",
+    "_LIBCPP_HAS_UNICODE": "libcpp-has-no-unicode",
+    "_LIBCPP_HAS_TERMINAL": "no-terminal",
+}
+for macro, feature in inverted_macros.items():
+    DEFAULT_FEATURES.append(
+        Feature(
+            name=feature,
+            when=lambda cfg, m=macro: m in compilerMacros(cfg)
+            and compilerMacros(cfg)[m] == "0"
+        )
+    )
 
 # Mapping from canonical locale names (used in the tests) to possible locale
 # names on various systems. Each locale is considered supported if any of the
diff --git a/runtimes/cmake/Modules/HandleFlags.cmake b/runtimes/cmake/Modules/HandleFlags.cmake
index 4a62b67169e4d6..1c744a0aa0ae72 100644
--- a/runtimes/cmake/Modules/HandleFlags.cmake
+++ b/runtimes/cmake/Modules/HandleFlags.cmake
@@ -85,12 +85,6 @@ macro(config_define_if condition def)
   endif()
 endmacro()
 
-macro(config_define_if_not condition def)
-  if (NOT ${condition})
-    set(${def} ON)
-  endif()
-endmacro()
-
 macro(config_define value def)
   set(${def} ${value})
 endmacro()



More information about the libcxx-commits mailing list