From c44ba766fdae9d1269cd6f4661189d0573d9687f Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Sat, 12 Oct 2024 14:09:11 +0200 Subject: [PATCH] [libc++] Refactor the configuration macros to being always defined --- libcxx/CMakeLists.txt | 22 +- .../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/__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 | 25 +-- libcxx/include/__config_site.in | 22 +- 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 | 4 +- .../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 | 4 +- 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/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 | 4 +- 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 | 4 +- .../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 | 4 +- ...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 | 14 +- .../clang_tidy_checks/internal_ftm_use.cpp | 13 -- .../generate_feature_test_macro_components.py | 40 ++-- libcxx/utils/libcxx/header_information.py | 30 +-- libcxx/utils/libcxx/test/dsl.py | 2 +- libcxx/utils/libcxx/test/features.py | 33 +-- runtimes/cmake/Modules/HandleFlags.cmake | 6 - 210 files changed, 984 insertions(+), 1012 deletions(-) diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index 75c926f5432aea..bb03b443178861 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -741,24 +741,24 @@ 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_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_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) if (LIBCXX_ENABLE_ASSERTIONS) message(DEPRECATION "LIBCXX_ENABLE_ASSERTIONS is deprecated and will be removed in LLVM 20. Please use LIBCXX_HARDENING_MODE instead.") 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 -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS # include #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 #include <__type_traits/is_volatile.h> -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS # include #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 0b2137dee2f77e..5490d8049bf7c8 100644 --- a/libcxx/include/__algorithm/sort.h +++ b/libcxx/include/__algorithm/sort.h @@ -894,7 +894,7 @@ template void __sort(_RandomAccessIterator, _RandomAccessIterator, _Comp); extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less&, char*>(char*, char*, __less&); -#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*, __less&); #endif extern template _LIBCPP_EXPORTED_FROM_ABI void @@ -941,7 +941,7 @@ template 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 afc64eaaa69e7b..605c524a3fbc38 100644 --- a/libcxx/include/__atomic/aliases.h +++ b/libcxx/include/__atomic/aliases.h @@ -42,7 +42,7 @@ using atomic_char8_t = atomic; #endif using atomic_char16_t = atomic; using atomic_char32_t = atomic; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS using atomic_wchar_t = atomic; #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 _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 _LIBCPP_HIDE_FROM_ABI void __atomic_notify_all(const _AtomicWaitable&) {} -#endif // _LIBCPP_HAS_NO_THREADS +#endif // _LIBCPP_HAS_THREADS template _LIBCPP_HIDE_FROM_ABI bool __cxx_nonatomic_compare_equal(_Tp const& __lhs, _Tp const& __rhs) { 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{__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 _LIBCPP_HIDE_FROM_ABI void __format_sub_seconds(basic_stringstream<_CharT>& __sstr, const chrono::zoned_time<_Duration, _TimeZonePtr>& __value) { @@ -156,8 +155,7 @@ template consteval bool __use_fraction() { if constexpr (__is_time_point<_Tp>) return chrono::hh_mm_ss::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::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 : 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 @@ -977,13 +975,13 @@ struct formatter, _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) return _LIBCPP_STATICALLY_WIDEN(_CharT, "ns"); else if constexpr (same_as) -# 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 _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 dce97c3adfa1ba..c25e8be40407a2 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& __lk, chrono::time_point<_Clock, chrono::nanoseconds>) _NOEXCEPT; }; -#endif // !_LIBCPP_HAS_NO_THREADS +#endif // _LIBCPP_HAS_THREADS template ::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 void condition_variable::wait(unique_lock& __lk, _Predicate __pred) { while (!__pred()) @@ -235,7 +235,7 @@ inline void condition_variable::__do_timed_wait(unique_lock& __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 fcba56f7e3d5b1..859aec471a8953 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -816,7 +816,7 @@ typedef __char32_t char32_t; // Thread API // clang-format off -# if !defined(_LIBCPP_HAS_NO_THREADS) && \ +# if _LIBCPP_HAS_THREADS && \ !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \ !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \ !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) @@ -842,7 +842,7 @@ typedef __char32_t char32_t; # 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 defined(__ANDROID__) && __ANDROID_API__ >= 30 @@ -860,22 +860,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 && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) +# error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined 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 && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) +# error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined 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 @@ -914,7 +911,7 @@ typedef __char32_t char32_t; # 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 @@ -986,7 +983,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..5af559a10a2c6e 100644 --- a/libcxx/include/__config_site.in +++ b/libcxx/include/__config_site.in @@ -13,24 +13,24 @@ #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 +#cmakedefine01 _LIBCPP_HAS_THREADS +#cmakedefine01 _LIBCPP_HAS_MONOTONIC_CLOCK +#cmakedefine01 _LIBCPP_HAS_TERMINAL +#cmakedefine01 _LIBCPP_HAS_MUSL_LIBC #cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD #cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL #cmakedefine _LIBCPP_HAS_THREAD_API_WIN32 #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/availability.h b/libcxx/include/__configuration/availability.h index f42ff460db4544..65d252d4e3a357 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_19 1 # define _LIBCPP_INTRODUCED_IN_LLVM_19_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 e0246d8001e195..d78d38a8dc07d3 100644 --- a/libcxx/include/__filesystem/directory_iterator.h +++ b/libcxx/include/__filesystem/directory_iterator.h @@ -31,7 +31,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 @@ -144,7 +144,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 2eb60810af02b5..72ce0756419ecc 100644 --- a/libcxx/include/__filesystem/path.h +++ b/libcxx/include/__filesystem/path.h @@ -26,7 +26,7 @@ #include #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include // for quoted # include #endif @@ -200,7 +200,7 @@ _LIBCPP_EXPORTED_FROM_ABI size_t __char_to_wide(const string&, wchar_t*, size_t) template struct _PathCVT; -# if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# if _LIBCPP_HAS_LOCALIZATION template struct _PathCVT { static_assert(__can_convert_char<_ECharT>::value, "Char type not convertible"); @@ -259,7 +259,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> { @@ -421,7 +421,7 @@ class _LIBCPP_EXPORTED_FROM_ABI path { } /* - #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) + #if _LIBCPP_HAS_LOCALIZATION // TODO Implement locale conversions. template > path(const _Source& __src, const locale& __loc, format = format::auto_format); @@ -683,7 +683,7 @@ class _LIBCPP_EXPORTED_FROM_ABI path { return __s; } -# if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# if _LIBCPP_HAS_LOCALIZATION template , 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>; @@ -726,7 +726,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_; } @@ -736,7 +736,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 _Allocator = allocator<_ECharT> > _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator> string(const _Allocator& __a = _Allocator()) const { using _CVT = __widen_from_utf8; @@ -747,12 +747,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(); } # endif _LIBCPP_HIDE_FROM_ABI std::u16string u16string() const { return string(); } _LIBCPP_HIDE_FROM_ABI std::u32string u32string() const { return string(); } -# endif /* !_LIBCPP_HAS_NO_LOCALIZATION */ +# endif // _LIBCPP_HAS_LOCALIZATION // generic format observers _LIBCPP_HIDE_FROM_ABI std::string generic_string() const { return __pn_; } @@ -762,19 +762,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 _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(); } # endif _LIBCPP_HIDE_FROM_ABI std::u16string generic_u16string() const { return string(); } _LIBCPP_HIDE_FROM_ABI std::u32string generic_u32string() const { return string(); } -# endif /* !_LIBCPP_HAS_NO_LOCALIZATION */ +# endif // _LIBCPP_HAS_LOCALIZATION # endif /* !_LIBCPP_WIN32API */ private: @@ -867,7 +867,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, @@ -896,7 +896,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 caa1396eb301fc..d0668866360a79 100644 --- a/libcxx/include/__filesystem/recursive_directory_iterator.h +++ b/libcxx/include/__filesystem/recursive_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 @@ -157,7 +157,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 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 _Tp> consteval __arg_t __determine_arg_t() { return __arg_t::__char_type; } -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template requires(same_as && 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 && same_as<_Dp, char>) return basic_format_arg<_Context>{__arg, static_cast(static_cast(__value))}; else diff --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h index 019a71011a7140..52ac588d0d884e 100644 --- a/libcxx/include/__format/format_context.h +++ b/libcxx/include/__format/format_context.h @@ -25,7 +25,7 @@ #include <__variant/monostate.h> #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION +#if _LIBCPP_HAS_LOCALIZATION # include <__locale> # include #endif @@ -45,7 +45,7 @@ template 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. * @@ -67,7 +67,7 @@ __format_context_create(_OutIt __out_it, basic_format_args>, 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>; # endif @@ -89,7 +89,7 @@ class _LIBCPP_HIDE_FROM_ABI basic_format_arg 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{}; @@ -102,7 +102,7 @@ class private: iterator __out_it_; basic_format_args __args_; -# ifndef _LIBCPP_HAS_NO_LOCALIZATION +# if _LIBCPP_HAS_LOCALIZATION // The Standard doesn't specify how the locale is stored. // [format.context]/6 @@ -164,7 +164,7 @@ class _LIBCPP_TEMPLATE_VIS basic_format_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)), @@ -194,7 +194,7 @@ class _LIBCPP_TEMPLATE_VIS 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_); } @@ -203,7 +203,7 @@ class _LIBCPP_TEMPLATE_VIS basic_format_context #include -#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; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS using wformat_args = basic_format_args; # endif @@ -70,7 +70,7 @@ template return std::__format_arg_store<_Context, _Args...>(__args...); } -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template [[nodiscard]] _LIBCPP_HIDE_FROM_ABI __format_arg_store make_wformat_args(_Args&... __args) { return std::__format_arg_store(__args...); @@ -355,7 +355,7 @@ struct _LIBCPP_TEMPLATE_VIS __runtime_format_string { }; _LIBCPP_HIDE_FROM_ABI inline __runtime_format_string 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 runtime_format(wstring_view __fmt) noexcept { return __fmt; } @@ -397,7 +397,7 @@ struct _LIBCPP_TEMPLATE_VIS basic_format_string { template using format_string = basic_format_string...>; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template using wformat_string = basic_format_string...>; # 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 _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 _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 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 @@ -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 [[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(std::move(__out_it), __n, __fmt.get(), std::make_format_args(__args...)); } -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template _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 [[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 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 _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 _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 @@ -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 [[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 _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 [[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; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS using wformat_parse_context = basic_format_parse_context; # 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 : public __formatter_char {}; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template <> struct _LIBCPP_TEMPLATE_VIS formatter : public __formatter_char {}; template <> struct _LIBCPP_TEMPLATE_VIS formatter : public __formatter_char {}; -# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +# endif // _LIBCPP_HAS_WIDE_CHARACTERS # if _LIBCPP_STD_VER >= 23 template <> inline constexpr bool enable_nonlocking_formatter_optimization = true; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template <> inline constexpr bool enable_nonlocking_formatter_optimization = 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 fc95dd3f22bbe7..a2f6828d8e14e3 100644 --- a/libcxx/include/__format/formatter_floating_point.h +++ b/libcxx/include/__format/formatter_floating_point.h @@ -38,7 +38,7 @@ #include #include -#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 _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 _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 #include -#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>(__ctx.locale()); string __grouping = __np.grouping(); @@ -412,7 +412,7 @@ struct _LIBCPP_TEMPLATE_VIS __bool_strings { static constexpr string_view __false{"false"}; }; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template <> struct _LIBCPP_TEMPLATE_VIS __bool_strings { static constexpr wstring_view __true{L"true"}; @@ -423,7 +423,7 @@ struct _LIBCPP_TEMPLATE_VIS __bool_strings { template _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>(__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 34c4c87313a450..d5e20bcb246b0c 100644 --- a/libcxx/include/__format/formatter_output.h +++ b/libcxx/include/__format/formatter_output.h @@ -168,7 +168,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 _OutIt> requires(same_as<_CharT, char>) _LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) { @@ -182,7 +182,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 _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) { @@ -200,13 +200,13 @@ template <__fmt_char_type _CharT, output_iterator _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 _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. /// @@ -294,8 +294,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 _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 inline constexpr bool enable_nonlocking_formatter_optimization> = true; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template <> inline constexpr bool enable_nonlocking_formatter_optimization = true; template <> @@ -148,7 +148,7 @@ template inline constexpr bool enable_nonlocking_formatter_optimization> = true; template inline constexpr bool enable_nonlocking_formatter_optimization> = 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 __data[4] = {' '}; }; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template <> struct __code_point { wchar_t __data[4 / sizeof(wchar_t)] = {L' '}; @@ -321,7 +321,7 @@ struct __parsed_specifications { // value in formatting functions. static_assert(sizeof(__parsed_specifications) == 16); static_assert(is_trivially_copyable_v<__parsed_specifications>); -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS static_assert(sizeof(__parsed_specifications) == 16); static_assert(is_trivially_copyable_v<__parsed_specifications>); # 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 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 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 _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 _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) == 16); -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS static_assert(sizeof(__parser) == 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 @@ -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 _LIBCPP_HIDE_FROM_ABI constexpr __column_width_result::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 { _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 { _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 __extended_grapheme_cluster_view(_Iterator, _Iterator) -> __extended_grapheme_cluster_view>; -# 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 __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 _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 [[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 8abec99f729057..147e81868cdb79 100644 --- a/libcxx/include/__functional/hash.h +++ b/libcxx/include/__functional/hash.h @@ -373,12 +373,12 @@ struct _LIBCPP_TEMPLATE_VIS hash : public __unary_function(__v); } }; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> struct _LIBCPP_TEMPLATE_VIS hash : public __unary_function { _LIBCPP_HIDE_FROM_ABI size_t operator()(wchar_t __v) const _NOEXCEPT { return static_cast(__v); } }; -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS template <> struct _LIBCPP_TEMPLATE_VIS hash : public __unary_function { 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; using ofstream = basic_ofstream; using fstream = basic_fstream; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS using wfilebuf = basic_filebuf; using wifstream = basic_ifstream; using wofstream = basic_ofstream; 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 _LIBCPP_TEMPLATE_VIS basic_ios; using ios = basic_ios; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS using wios = basic_ios; #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; using iostream = basic_iostream; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS using wistream = basic_istream; using wiostream = basic_iostream; #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; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS using wostream = basic_ostream; #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; using ostringstream = basic_ostringstream; using stringstream = basic_stringstream; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS using wstringbuf = basic_stringbuf; using wistringstream = basic_istringstream; using wostringstream = basic_ostringstream; 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; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS using wstreambuf = basic_streambuf; #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; template <> struct char_traits; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> struct char_traits; #endif @@ -44,7 +44,7 @@ class _LIBCPP_TEMPLATE_VIS basic_string; using string = basic_string; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS using wstring = basic_string; #endif @@ -63,7 +63,7 @@ using basic_string _LIBCPP_AVAILABILITY_PMR = std::basic_string<_CharT, _Traits, using string _LIBCPP_AVAILABILITY_PMR = basic_string; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS using wstring _LIBCPP_AVAILABILITY_PMR = basic_string; # endif @@ -80,7 +80,7 @@ using u32string _LIBCPP_AVAILABILITY_PMR = basic_string; // clang-format off template 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 u8string_view; #endif typedef basic_string_view u16string_view; typedef basic_string_view u32string_view; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS typedef basic_string_view wstring_view; #endif // clang-format off template 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 #include -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS # include #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; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate; #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 : public collate { locale_t __l_; @@ -449,7 +449,7 @@ public: template class _LIBCPP_TEMPLATE_VIS ctype; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> class _LIBCPP_EXPORTED_FROM_ABI ctype : 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 : 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 : public ctype { 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 inline _LIBCPP_HIDE_FROM_ABI bool isspace(_CharT __c, const locale& __loc) { @@ -821,7 +821,7 @@ protected: // template <> class codecvt -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> class _LIBCPP_EXPORTED_FROM_ABI codecvt : 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 // 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; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname; #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 : 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 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 : public numpunct { 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 8c000c558c5279..357b2167af1f89 100644 --- a/libcxx/include/__locale_dir/locale_base_api.h +++ b/libcxx/include/__locale_dir/locale_base_api.h @@ -9,6 +9,8 @@ #ifndef _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_H #define _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_H +#include <__config> + #if defined(_LIBCPP_MSVCRT_LIKE) # include <__locale_dir/locale_base_api/win32.h> #elif defined(_AIX) || defined(__MVS__) @@ -23,7 +25,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__) || defined(__FreeBSD__) # include 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 76b94287cd6cc8..e340b8afd23586 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 @@ -18,7 +18,7 @@ #include #include -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS # include #endif @@ -33,7 +33,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) { __libcpp_locale_guard __current(__l); return btowc(__c); @@ -76,14 +76,14 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __libcpp_mbrlen_l(const char* __s, size_t __ __libcpp_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) { __libcpp_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) { __libcpp_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 # undef __NEED_mbstate_t @@ -43,7 +43,7 @@ # include // works on most Unixes #elif __has_include() # include // works on Darwin -#elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) && __has_include_next() +#elif _LIBCPP_HAS_WIDE_CHARACTERS && __has_include_next() # include_next // fall back to the C standard provider of mbstate_t #elif __has_include_next() # include_next // 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 65870ba574c25b..a3445dafda1457 100644 --- a/libcxx/include/__memory/shared_ptr.h +++ b/libcxx/include/__memory/shared_ptr.h @@ -80,7 +80,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template 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 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 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 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 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 50a673c2861d10..faa4a042e1d052 100644 --- a/libcxx/include/__memory_resource/synchronized_pool_resource.h +++ b/libcxx/include/__memory_resource/synchronized_pool_resource.h @@ -49,7 +49,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 __lk(__mut_); # endif __unsync_.release(); @@ -61,14 +61,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 __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 __lk(__mut_); # endif return __unsync_.deallocate(__p, __bytes, __align); @@ -77,7 +77,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::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 1b1c026706cdfd..c7d5bce9118054 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> @@ -802,7 +802,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 basic_ostream& operator<<(basic_ostream&, wchar_t) = delete; @@ -821,7 +821,7 @@ basic_ostream& operator<<(basic_ostream&, co template basic_ostream& operator<<(basic_ostream&, const char32_t*) = delete; -# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +# endif // _LIBCPP_HAS_WIDE_CHARACTERS # if _LIBCPP_HAS_CHAR8_T template @@ -852,7 +852,7 @@ basic_ostream& operator<<(basic_ostream&, const ch # endif // _LIBCPP_STD_VER >= 20 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream; # endif @@ -860,6 +860,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 // 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 // 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 _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 _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 // 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 cd7096d35c2c1f..a961658cfc829e 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 using istream_view = basic_istream_view<_Val, char>; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template 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 _LIBCPP_AVAILABILITY_SYNC stop_callback : private __stop_callback_base { @@ -93,7 +93,7 @@ class _LIBCPP_AVAILABILITY_SYNC stop_callback : private __stop_callback_base { template _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 107f0a96a02277..15aa34800ac028 100644 --- a/libcxx/include/__string/char_traits.h +++ b/libcxx/include/__string/char_traits.h @@ -29,7 +29,7 @@ #include #include -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS # include // for wmemcpy #endif @@ -234,7 +234,7 @@ struct __char_traits_base { // char_traits -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> struct _LIBCPP_TEMPLATE_VIS char_traits : __char_traits_base(WEOF)> { static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 int @@ -255,7 +255,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits : __char_traits_base #include -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS # include # include #endif @@ -51,7 +51,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 iswalnum_l(wint_t __c, locale_t) { return ::iswalnum(__c); } inline _LIBCPP_HIDE_FROM_ABI int iswalpha_l(wint_t __c, locale_t) { return ::iswalpha(__c); } @@ -79,7 +79,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); @@ -94,7 +94,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); } @@ -102,6 +102,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 -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS # include #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..d25bf87650fbc7 100644 --- a/libcxx/include/__thread/support.h +++ b/libcxx/include/__thread/support.h @@ -104,7 +104,7 @@ _LIBCPP_END_NAMESPACE_STD */ -#if !defined(_LIBCPP_HAS_NO_THREADS) +#if _LIBCPP_HAS_THREADS # if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) # include <__thread/support/external.h> @@ -118,6 +118,6 @@ _LIBCPP_END_NAMESPACE_STD # 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 #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION +#if _LIBCPP_HAS_LOCALIZATION # include # include #endif @@ -39,7 +39,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -#if !defined(_LIBCPP_HAS_NO_THREADS) +#if _LIBCPP_HAS_THREADS template 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 _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 { enum { va template <> struct __libcpp_is_integral { enum { value = 1 }; }; template <> struct __libcpp_is_integral { enum { value = 1 }; }; template <> struct __libcpp_is_integral { enum { value = 1 }; }; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> struct __libcpp_is_integral { enum { value = 1 }; }; #endif #if _LIBCPP_HAS_CHAR8_T diff --git a/libcxx/include/barrier b/libcxx/include/barrier index abc014e8aaf5c0..985ac1fa352de6 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 diff --git a/libcxx/include/chrono b/libcxx/include/chrono index 7bec5e5a26ef4a..cb96e441430574 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> @@ -1013,7 +1012,7 @@ constexpr chrono::year operator ""y(unsigned lo #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 20 # include -# if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# if _LIBCPP_HAS_LOCALIZATION # include # include # 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 __codecvt_utf8; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template <> class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8 : public codecvt { 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 __codecvt_utf16; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template <> class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16 : public codecvt { 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 __codecvt_utf8_utf16; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template <> class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16 : public codecvt { 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 4030d96b003d56..cc3ad9778cfc7e 100644 --- a/libcxx/include/complex +++ b/libcxx/include/complex @@ -266,7 +266,7 @@ template complex tanh (const complex&); #include #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include // 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 _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 fa67916ba11bca..14dbdfe8dd396f 100644 --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -2602,7 +2602,7 @@ erase_if(deque<_Tp, _Allocator>& __c, _Predicate __pred) { template <> inline constexpr bool __format::__enable_insertable> = true; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template <> inline constexpr bool __format::__enable_insertable> = 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 # include -# if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# if _LIBCPP_HAS_WIDE_CHARACTERS # include # 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; _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 dfa373d6593c79..914f4479a6b2f7 100644 --- a/libcxx/include/future +++ b/libcxx/include/future @@ -364,7 +364,7 @@ template struct uses_allocator, 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 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 #include <__config> -#ifndef _LIBCPP_HAS_NO_LOCALIZATION +#if _LIBCPP_HAS_LOCALIZATION # include <__ostream/basic_ostream.h> # include @@ -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..ac68e2bca64f6b 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 defined(_LIBCPP_HAS_C_ATOMIC_IMP) && _LIBCPP_HAS_THREADS static atomic __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; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios; # 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 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 _LIBCPP_TEMPLATE_VIS fpos; typedef fpos streampos; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS typedef fpos wstreampos; #endif #if _LIBCPP_HAS_CHAR8_T @@ -146,7 +146,7 @@ template , class _Allocator = class basic_syncbuf; using syncbuf = basic_syncbuf; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS using wsyncbuf = basic_syncbuf; # endif @@ -154,7 +154,7 @@ template , class _Allocator = class basic_osyncstream; using osyncstream = basic_osyncstream; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS using wosyncstream = basic_osyncstream; # 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 #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; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream; # endif extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream; _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 diff --git a/libcxx/include/latch b/libcxx/include/latch index b56e49bc768bf9..b18f0c610730b7 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 diff --git a/libcxx/include/list b/libcxx/include/list index ba21dbe3f74c08..acb7f40cfc77c7 100644 --- a/libcxx/include/list +++ b/libcxx/include/list @@ -1708,7 +1708,7 @@ erase(list<_Tp, _Allocator>& __c, const _Up& __v) { template <> inline constexpr bool __format::__enable_insertable> = true; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template <> inline constexpr bool __format::__enable_insertable> = true; # endif diff --git a/libcxx/include/locale b/libcxx/include/locale index 782475ea7e0eb8..80b2afa83a9d61 100644 --- a/libcxx/include/locale +++ b/libcxx/include/locale @@ -189,7 +189,7 @@ template class messages_byname; #include <__config> -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include <__algorithm/copy.h> # include <__algorithm/equal.h> @@ -590,7 +590,7 @@ int __num_get<_CharT>::__stage2_float_loop( } extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get; # endif @@ -1061,7 +1061,7 @@ _InputIterator num_get<_CharT, _InputIterator>::do_get( } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get; # endif @@ -1179,7 +1179,7 @@ void __num_put<_CharT>::__widen_and_group_float( } extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put; # endif @@ -1466,7 +1466,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; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put; # endif @@ -1533,7 +1533,7 @@ _LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage::__x() const; template <> _LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage::__X() const; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template <> _LIBCPP_EXPORTED_FROM_ABI const wstring* __time_get_c_storage::__weeks() const; template <> @@ -2002,7 +2002,7 @@ _InputIterator time_get<_CharT, _InputIterator>::do_get( } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get; # endif @@ -2062,7 +2062,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 @@ -2098,7 +2098,7 @@ private: }; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname; # endif @@ -2111,7 +2111,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 }; @@ -2187,7 +2187,7 @@ _OutputIterator time_put<_CharT, _OutputIterator>::do_put( } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put; # endif @@ -2205,7 +2205,7 @@ protected: }; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname; # endif @@ -2272,7 +2272,7 @@ const bool moneypunct<_CharT, _International>::intl; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct; # endif @@ -2330,7 +2330,7 @@ _LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname::init(const char*); extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template <> _LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname::init(const char*); template <> @@ -2398,7 +2398,7 @@ void __money_get<_CharT>::__gather_info( } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get; # endif @@ -2708,7 +2708,7 @@ _InputIterator money_get<_CharT, _InputIterator>::do_get( } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get; # endif @@ -2886,7 +2886,7 @@ void __money_put<_CharT>::__format( } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put; # endif @@ -3032,7 +3032,7 @@ _OutputIterator money_put<_CharT, _OutputIterator>::do_put( } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put; # endif @@ -3117,7 +3117,7 @@ void messages<_CharT>::do_close(catalog __c) const { } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages; # endif @@ -3136,7 +3136,7 @@ protected: }; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname; # endif @@ -3755,7 +3755,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 diff --git a/libcxx/include/mutex b/libcxx/include/mutex index 02c52dd72f02b0..ec27c71296a7f1 100644 --- a/libcxx/include/mutex +++ b/libcxx/include/mutex @@ -215,7 +215,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_; @@ -492,7 +492,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 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() _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 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 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 @@ -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 // 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 // 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 _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 @@ -344,7 +344,7 @@ _LIBCPP_HIDE_FROM_ABI void print(format_string<_Args...> __fmt, _Args&&... __arg template _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 // 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 // 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 // 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 string_type __transform_primary(_ForwardIterator __f, _ForwardIterator __l, char) const; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template string_type __transform_primary(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const; #endif template string_type __lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, char) const; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template string_type __lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const; #endif template 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 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(__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 template 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 template 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 template 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 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 inline int regex_traits<_CharT>::__regex_traits_value(wchar_t __ch, int __radix) const { return __regex_traits_value(static_cast(__ct_->narrow(__ch, char_type())), __radix); @@ -1938,7 +1938,7 @@ public: template <> _LIBCPP_EXPORTED_FROM_ABI void __match_any_but_newline::__exec(__state&) const; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> _LIBCPP_EXPORTED_FROM_ABI void __match_any_but_newline::__exec(__state&) const; #endif @@ -2262,7 +2262,7 @@ template > class _LIBCPP_TEMPLATE_VIS basic_regex; typedef basic_regex regex; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS typedef basic_regex wregex; #endif @@ -4181,7 +4181,7 @@ void basic_regex<_CharT, _Traits>::__push_lookahead(const basic_regex& __exp, bo typedef sub_match csub_match; typedef sub_match ssub_match; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS typedef sub_match wcsub_match; typedef sub_match wssub_match; #endif @@ -4526,7 +4526,7 @@ operator<<(basic_ostream<_CharT, _ST>& __os, const sub_match<_BiIter>& __m) { typedef match_results cmatch; typedef match_results smatch; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS typedef match_results wcmatch; typedef match_results wsmatch; #endif @@ -5321,7 +5321,7 @@ class _LIBCPP_TEMPLATE_VIS regex_iterator; typedef regex_iterator cregex_iterator; typedef regex_iterator sregex_iterator; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS typedef regex_iterator wcregex_iterator; typedef regex_iterator wsregex_iterator; #endif @@ -5451,7 +5451,7 @@ class _LIBCPP_TEMPLATE_VIS regex_token_iterator; typedef regex_token_iterator cregex_token_iterator; typedef regex_token_iterator sregex_token_iterator; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS typedef regex_token_iterator wcregex_token_iterator; typedef regex_token_iterator wsregex_token_iterator; #endif @@ -5810,7 +5810,7 @@ using match_results _LIBCPP_AVAILABILITY_PMR = using cmatch _LIBCPP_AVAILABILITY_PMR = match_results; using smatch _LIBCPP_AVAILABILITY_PMR = match_results; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS using wcmatch _LIBCPP_AVAILABILITY_PMR = match_results; using wsmatch _LIBCPP_AVAILABILITY_PMR = match_results; # endif diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore index bf6317c587e2f9..1008a087879652 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 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 #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 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 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 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 d4e651d9541f4e..4391e0265227e6 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 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; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf; # 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 diff --git a/libcxx/include/string b/libcxx/include/string index 4b5017f5e7753f..76d79b9324602e 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -648,7 +648,7 @@ basic_string operator""s( const char32_t *str, size_t len ); #include #include -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS # include #endif @@ -2263,12 +2263,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 @@ -4198,7 +4198,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); @@ -4218,7 +4218,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 _LIBCPP_TEMPLATE_DATA_VIS const typename basic_string<_CharT, _Traits, _Allocator>::size_type @@ -4246,7 +4246,7 @@ struct hash, _Allocator> > : __stri template struct hash, _Allocator> > : __string_hash {}; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template struct hash, _Allocator> > : __string_hash {}; #endif @@ -4302,7 +4302,7 @@ operator""s(const char* __str, size_t __len) { return basic_string(__str, __len); } -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator""s(const wchar_t* __str, size_t __len) { return basic_string(__str, __len); @@ -4330,7 +4330,7 @@ operator""s(const char32_t* __str, size_t __len) { # if _LIBCPP_STD_VER >= 20 template <> inline constexpr bool __format::__enable_insertable> = true; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template <> inline constexpr bool __format::__enable_insertable> = true; # endif diff --git a/libcxx/include/string_view b/libcxx/include/string_view index 5beac404fb5b54..e0e1a9817cb95f 100644 --- a/libcxx/include/string_view +++ b/libcxx/include/string_view @@ -912,7 +912,7 @@ struct hash > > : __string_vie template <> struct hash > > : __string_view_hash {}; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> struct hash > > : __string_view_hash {}; #endif @@ -924,7 +924,7 @@ inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view operator""sv(cons return basic_string_view(__str, __len); } -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view operator""sv(const wchar_t* __str, size_t __len) noexcept { return basic_string_view(__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 @@ -127,7 +127,7 @@ namespace std { # include # include -# ifndef _LIBCPP_HAS_NO_THREADS +# if _LIBCPP_HAS_THREADS # include # include # include @@ -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 __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& 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& rel_time); # pragma GCC system_header # endif -#endif // !defined(_LIBCPP_HAS_NO_THREADS) +#endif // _LIBCPP_HAS_THREADS #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) # include diff --git a/libcxx/include/vector b/libcxx/include/vector index 76de0ab0a81a04..8ce2c14fbba63a 100644 --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -2977,7 +2977,7 @@ erase_if(vector<_Tp, _Allocator>& __c, _Predicate __pred) { template <> inline constexpr bool __format::__enable_insertable> = true; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS template <> inline constexpr bool __format::__enable_insertable> = true; # endif @@ -3024,7 +3024,7 @@ _LIBCPP_POP_MACROS # include # include # include -# if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# if _LIBCPP_HAS_LOCALIZATION # include # endif # include diff --git a/libcxx/include/version b/libcxx/include/version index 5ab4f28a04d880..cf4716d6af08fd 100644 --- a/libcxx/include/version +++ b/libcxx/include/version @@ -286,12 +286,12 @@ __cpp_lib_void_t 201411L # 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 @@ -316,7 +316,7 @@ __cpp_lib_void_t 201411L # 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 @@ -345,10 +345,10 @@ __cpp_lib_void_t 201411L // # 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 @@ -377,7 +377,7 @@ __cpp_lib_void_t 201411L # 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 @@ -418,10 +418,10 @@ __cpp_lib_void_t 201411L // # 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 @@ -432,7 +432,7 @@ __cpp_lib_void_t 201411L # 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 @@ -533,7 +533,7 @@ __cpp_lib_void_t 201411L // # 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 797b413f68e272..0cdc292ab98a47 100644 --- a/libcxx/modules/std.compat.cppm.in +++ b/libcxx/modules/std.compat.cppm.in @@ -24,7 +24,7 @@ module; #include #include #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include #endif #include 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 64ed8d4088cc01..7fbbf1bae27bbd 100644 --- a/libcxx/modules/std.cppm.in +++ b/libcxx/modules/std.cppm.in @@ -35,11 +35,11 @@ module; #include #include #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include #endif #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include #endif #include @@ -66,30 +66,30 @@ module; #include #include #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include #endif #include #include #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include #endif -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include #endif #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include #endif -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include #endif #include #include #include #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include #endif #include @@ -101,7 +101,7 @@ module; #include #include #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include #endif #include @@ -109,7 +109,7 @@ module; #include #include #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include #endif #include @@ -118,21 +118,21 @@ module; #include #include #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include #endif #include #include #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include #endif #include #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include #endif -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if _LIBCPP_HAS_LOCALIZATION # include #endif #include 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..7ad2d3bdc2d7f8 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..7807318895fb89 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 af9d60a8e271e8..5b75f4aa9286a1 100644 --- a/libcxx/src/algorithm.cpp +++ b/libcxx/src/algorithm.cpp @@ -27,7 +27,7 @@ void __sort(RandomAccessIterator first, RandomAccessIterator last, Comp comp) { // clang-format off template void __sort<__less&, char*>(char*, char*, __less&); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template void __sort<__less&, wchar_t*>(wchar_t*, wchar_t*, __less&); #endif template void __sort<__less&, signed char*>(signed char*, signed char*, __less&); 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 #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_; 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 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..52d7d3bcf56626 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 defined(_LIBCPP_HAS_C_ATOMIC_IMP) && _LIBCPP_HAS_THREADS atomic 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; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_iostream; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream; @@ -37,7 +37,7 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_stringstream template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostringstream; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istringstream; -#ifndef _LIBCPP_HAS_NO_FILESYSTEM +#if _LIBCPP_HAS_FILESYSTEM template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ifstream; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ofstream; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_filebuf; diff --git a/libcxx/src/iostream.cpp b/libcxx/src/iostream.cpp index c5ad77a0191608..07341027eeed56 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) static char __cin[sizeof(__stdinbuf)]; 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@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR @@ -39,7 +39,7 @@ alignas(wistream) _LIBCPP_EXPORTED_FROM_ABI char wcin[sizeof(wistream)] ; alignas(__stdinbuf) static char __wcin[sizeof(__stdinbuf)]; 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) static char __cout[sizeof(__stdoutbuf)]; 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@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR @@ -59,7 +59,7 @@ alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI char wcout[sizeof(wostream)] ; alignas(__stdoutbuf) static char __wcout[sizeof(__stdoutbuf)]; 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) static char __cerr[sizeof(__stdoutbuf)]; 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@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR @@ -79,7 +79,7 @@ alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI char wcerr[sizeof(wostream)] ; alignas(__stdoutbuf) static char __wcerr[sizeof(__stdoutbuf)]; 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@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@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(stdin, &mb_wcin)); wostream* wcout_ptr = ::new (wcout) wostream(::new (__wcout) __stdoutbuf(stdout, &mb_wcout)); wostream* wcerr_ptr = ::new (wcerr) wostream(::new (__wcerr) __stdoutbuf(stderr, &mb_wcerr)); @@ -154,7 +154,7 @@ DoIOSInit::~DoIOSInit() { ostream* clog_ptr = reinterpret_cast(clog); clog_ptr->flush(); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS wostream* wcout_ptr = reinterpret_cast(wcout); wcout_ptr->flush(); wostream* wclog_ptr = reinterpret_cast(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 #include -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS # include #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 >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make >(1u)); #endif install(&make >(nullptr, false, 1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make >(1u)); #endif install(&make >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make >(1u)); #endif _LIBCPP_SUPPRESS_DEPRECATED_PUSH @@ -179,41 +179,41 @@ locale::__imp::__imp(size_t refs) : facet(refs), facets_(N), name_("C") { install(&make >(1u)); #endif install(&make >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make >(1u)); #endif install(&make >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make >(1u)); #endif install(&make >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make >(1u)); #endif install(&make >(1u)); install(&make >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make >(1u)); install(&make >(1u)); #endif install(&make >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make >(1u)); #endif install(&make >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make >(1u)); #endif install(&make >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make >(1u)); #endif install(&make >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make >(1u)); #endif install(&make >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make >(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(name_)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new collate_byname(name_)); #endif install(new ctype_byname(name_)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new ctype_byname(name_)); #endif install(new codecvt_byname(name_)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new codecvt_byname(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(name_)); #endif install(new numpunct_byname(name_)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new numpunct_byname(name_)); #endif install(new moneypunct_byname(name_)); install(new moneypunct_byname(name_)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new moneypunct_byname(name_)); install(new moneypunct_byname(name_)); #endif install(new time_get_byname(name_)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new time_get_byname(name_)); #endif install(new time_put_byname(name_)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new time_put_byname(name_)); #endif install(new messages_byname(name_)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new messages_byname(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(name)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new collate_byname(name)); #endif } if (c & locale::ctype) { install(new ctype_byname(name)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new ctype_byname(name)); #endif install(new codecvt_byname(name)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new codecvt_byname(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(name)); install(new moneypunct_byname(name)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new moneypunct_byname(name)); install(new moneypunct_byname(name)); #endif } if (c & locale::numeric) { install(new numpunct_byname(name)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new numpunct_byname(name)); #endif } if (c & locale::time) { install(new time_get_byname(name)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new time_get_byname(name)); #endif install(new time_put_byname(name)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new time_put_byname(name)); #endif } if (c & locale::messages) { install(new messages_byname(name)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new messages_byname(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 >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from >(one); #endif } if (c & locale::ctype) { install_from >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from >(one); #endif install_from >(one); @@ -393,53 +393,53 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c) install_from >(one); install_from >(one); #endif -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from >(one); #endif } if (c & locale::monetary) { install_from >(one); install_from >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from >(one); install_from >(one); #endif install_from >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from >(one); #endif install_from >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from >(one); #endif } if (c & locale::numeric) { install_from >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from >(one); #endif install_from >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from >(one); #endif install_from >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from >(one); #endif } if (c & locale::time) { install_from >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from >(one); #endif install_from >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from >(one); #endif } if (c & locale::messages) { install_from >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from >(one); #endif } @@ -642,7 +642,7 @@ collate_byname::string_type collate_byname::do_transform(const char_ // template <> class collate_byname -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS collate_byname::collate_byname(const char* n, size_t refs) : collate(refs), __l_(newlocale(LC_ALL_MASK, n, 0)) { if (__l_ == 0) @@ -684,7 +684,7 @@ collate_byname::do_transform(const char_type* lo, const char_type* hi) wcsxfrm_l(const_cast(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; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS constinit locale::id ctype::id; ctype::~ctype() {} @@ -796,7 +796,7 @@ const wchar_t* ctype::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; @@ -1085,7 +1085,7 @@ const char* ctype_byname::do_tolower(char_type* low, const char_type* high // template <> class ctype_byname -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS ctype_byname::ctype_byname(const char* name, size_t refs) : ctype(refs), __l_(newlocale(LC_ALL_MASK, name, 0)) { if (__l_ == 0) @@ -1278,7 +1278,7 @@ ctype_byname::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 @@ -1331,7 +1331,7 @@ int codecvt::do_max_length() const noexcept { return 1; } // template <> class codecvt -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS constinit locale::id codecvt::id; codecvt::codecvt(size_t refs) : locale::facet(refs), __l_(_LIBCPP_GET_C_LOCALE) {} @@ -1524,7 +1524,7 @@ int codecvt::do_length( int codecvt::do_max_length() const noexcept { return __l_ == 0 ? 1 : static_cast(__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::do_max_length() const noexcept { retu // __codecvt_utf8 -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS __codecvt_utf8::result __codecvt_utf8::do_out( state_type&, const intern_type* frm, @@ -3111,7 +3111,7 @@ int __codecvt_utf8::do_max_length() const noexcept { return 4; # endif } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // __codecvt_utf8 @@ -3249,7 +3249,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP // __codecvt_utf16 -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS __codecvt_utf16::result __codecvt_utf16::do_out( state_type&, const intern_type* frm, @@ -3431,7 +3431,7 @@ int __codecvt_utf16::do_max_length() const noexcept { return 4; # endif } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // __codecvt_utf16 @@ -3703,7 +3703,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP // __codecvt_utf8_utf16 -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS __codecvt_utf8_utf16::result __codecvt_utf8_utf16::do_out( state_type&, const intern_type* frm, @@ -3778,7 +3778,7 @@ int __codecvt_utf8_utf16::do_max_length() const noexcept { return 7; return 4; } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // __codecvt_utf8_utf16 @@ -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 && numpunct constinit locale::id numpunct::id; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS constinit locale::id numpunct::id; #endif numpunct::numpunct(size_t refs) : locale::facet(refs), __decimal_point_('.'), __thousands_sep_(',') {} -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS numpunct::numpunct(size_t refs) : locale::facet(refs), __decimal_point_(L'.'), __thousands_sep_(L',') {} #endif numpunct::~numpunct() {} -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS numpunct::~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::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::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::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::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::do_falsename() const { return L"false"; } #endif @@ -4074,7 +4074,7 @@ void numpunct_byname::__init(const char* nm) { // numpunct_byname -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS numpunct_byname::numpunct_byname(const char* nm, size_t refs) : numpunct(refs) { __init(nm); } numpunct_byname::numpunct_byname(const string& nm, size_t refs) : numpunct(refs) { @@ -4100,7 +4100,7 @@ void numpunct_byname::__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::__weeks() const { return weeks; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> const wstring* __time_get_c_storage::__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::__months() const { return months; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> const wstring* __time_get_c_storage::__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::__am_pm() const { return am_pm; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> const wstring* __time_get_c_storage::__am_pm() const { static const wstring* am_pm = init_wam_pm(); @@ -4385,7 +4385,7 @@ const string& __time_get_c_storage::__x() const { return s; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> const wstring& __time_get_c_storage::__x() const { static wstring s(L"%m/%d/%y"); @@ -4399,7 +4399,7 @@ const string& __time_get_c_storage::__X() const { return s; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> const wstring& __time_get_c_storage::__X() const { static wstring s(L"%H:%M:%S"); @@ -4413,7 +4413,7 @@ const string& __time_get_c_storage::__c() const { return s; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> const wstring& __time_get_c_storage::__c() const { static wstring s(L"%a %b %d %H:%M:%S %Y"); @@ -4427,7 +4427,7 @@ const string& __time_get_c_storage::__r() const { return s; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> const wstring& __time_get_c_storage::__r() const { static wstring s(L"%I:%M:%S %p"); @@ -4581,7 +4581,7 @@ string __time_get_storage::__analyze(char fmt, const ctype& ct) { _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-braces") -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> wstring __time_get_storage::__analyze(char fmt, const ctype& ct) { tm t = {0}; @@ -4715,7 +4715,7 @@ wstring __time_get_storage::__analyze(char fmt, const ctype& c } return result; } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS template <> void __time_get_storage::init(const ctype& ct) { @@ -4750,7 +4750,7 @@ void __time_get_storage::init(const ctype& ct) { __X_ = __analyze('X', ct); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> void __time_get_storage::init(const ctype& ct) { tm t = {0}; @@ -4822,7 +4822,7 @@ void __time_get_storage::init(const ctype& ct) { __x_ = __analyze('x', ct); __X_ = __analyze('X', ct); } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS template struct _LIBCPP_HIDDEN __time_get_temp : public ctype_byname { @@ -4842,7 +4842,7 @@ __time_get_storage::__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::__time_get_storage(const char* __nm) : __time_get(__nm) { const __time_get_temp ct(__nm); @@ -4854,7 +4854,7 @@ __time_get_storage::__time_get_storage(const string& __nm) : __time_get const __time_get_temp ct(__nm); init(ct); } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS template <> time_base::dateorder __time_get_storage::__do_date_order() const { @@ -4937,7 +4937,7 @@ time_base::dateorder __time_get_storage::__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::__do_date_order() const { unsigned i; @@ -5018,7 +5018,7 @@ time_base::dateorder __time_get_storage::__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::init(const char* nm) { #endif // !_LIBCPP_MSVCRT } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> void moneypunct_byname::init(const char* nm) { typedef moneypunct base; @@ -5641,7 +5641,7 @@ void moneypunct_byname::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 -#ifndef _LIBCPP_HAS_NO_THREADS +#if _LIBCPP_HAS_THREADS # include # include # 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()(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 299f810948fd14..6c709a0102e19a 100644 --- a/libcxx/src/memory_resource.cpp +++ b/libcxx/src/memory_resource.cpp @@ -11,7 +11,7 @@ #if _LIBCPP_HAS_ATOMIC_HEADER # include -#elif !defined(_LIBCPP_HAS_NO_THREADS) +#elif _LIBCPP_HAS_THREADS # include # if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB) # pragma comment(lib, "pthread") @@ -100,7 +100,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 #endif #include @@ -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(__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(__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() // !_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 #include -#ifndef _LIBCPP_HAS_NO_THREADS +#if _LIBCPP_HAS_THREADS # include # 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(__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 #include -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS # include #endif @@ -40,12 +40,12 @@ void __basic_string_common::__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(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(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(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(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(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("stod", st long double stold(const string& str, size_t* idx) { return as_float("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("stoi", str, idx, base); } long stol(const wstring& str, size_t* idx, int base) { return as_integer("stol", str, idx, base); } @@ -243,7 +243,7 @@ float stof(const wstring& str, size_t* idx) { return as_float("stof", str double stod(const wstring& str, size_t* idx) { return as_float("stod", str, idx); } long double stold(const wstring& str, size_t* idx) { return as_float("stold", str, idx); } -#endif // !_LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // to_string @@ -283,7 +283,7 @@ struct initial_string { } }; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> struct initial_string { wstring operator()() const { @@ -302,7 +302,7 @@ inline wide_printf get_swprintf() { return static_cast(_snwprintf); # endif } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS template 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(val); } wstring to_wstring(long val) { return i_to_string(val); } wstring to_wstring(long long val) { return i_to_string(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()(), L"%f", val); } wstring to_wstring(double val) { return as_string(get_swprintf(), initial_string()(), L"%f", val); } wstring to_wstring(long double val) { return as_string(get_swprintf(), initial_string()(), 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 # include @@ -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 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 # include @@ -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 9fa4021e5c1ead..e51b183a595338 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 @@ -26,7 +26,7 @@ extern "C" { #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION +#if _LIBCPP_HAS_LOCALIZATION # include #endif #include @@ -43,7 +43,7 @@ extern "C" { // tgmath.h is not supported in extern "C". #include // FIXME: #include -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS # include # include #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 c9f8dfd9a5a922..9b16d8953c3dde 100644 --- a/libcxx/test/libcxx/include_as_c.sh.cpp +++ b/libcxx/test/libcxx/include_as_c.sh.cpp @@ -29,7 +29,7 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION +#if _LIBCPP_HAS_LOCALIZATION # include #endif #include @@ -46,7 +46,7 @@ #ifndef _MSC_VER # include #endif -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS # include # include #endif 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 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 void format_tests(TestFunction check, ExceptionTest check_exception) { test_char(check, check_exception); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS if (std::same_as) // 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 0614f64a2ef04d..24e8a6d5d5441a 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 @@ -1719,7 +1719,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 @@ -1728,7 +1728,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 @@ -1862,7 +1862,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 @@ -1871,7 +1871,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 @@ -2373,7 +2373,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 @@ -2382,7 +2382,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 @@ -2794,7 +2794,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 @@ -2803,7 +2803,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 @@ -2919,7 +2919,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 @@ -2928,7 +2928,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 @@ -2940,7 +2940,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 @@ -2949,7 +2949,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 @@ -2967,7 +2967,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 @@ -2976,7 +2976,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 @@ -3323,7 +3323,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 @@ -3332,7 +3332,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 @@ -3634,7 +3634,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 @@ -3643,7 +3643,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 @@ -3925,7 +3925,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 @@ -3934,11 +3934,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 @@ -3947,7 +3947,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 @@ -4133,7 +4133,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 @@ -4142,7 +4142,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 @@ -4264,7 +4264,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 @@ -4273,11 +4273,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 @@ -4286,7 +4286,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 @@ -4294,7 +4294,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 @@ -4303,7 +4303,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 @@ -4321,7 +4321,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 @@ -4330,7 +4330,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 @@ -4740,7 +4740,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 @@ -4749,7 +4749,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 @@ -5081,7 +5081,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 @@ -5090,7 +5090,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 @@ -5405,7 +5405,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 @@ -5414,11 +5414,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 @@ -5427,7 +5427,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 @@ -5634,7 +5634,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 @@ -5643,7 +5643,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 @@ -5849,7 +5849,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 @@ -5858,11 +5858,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 @@ -5871,7 +5871,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 @@ -5879,7 +5879,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 @@ -5888,7 +5888,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 @@ -5906,7 +5906,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 @@ -5915,7 +5915,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 @@ -6385,7 +6385,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 @@ -6394,7 +6394,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 @@ -6774,7 +6774,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 @@ -6783,7 +6783,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 @@ -6945,7 +6945,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 @@ -6954,7 +6954,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 @@ -7242,7 +7242,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 @@ -7251,11 +7251,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 @@ -7264,7 +7264,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 @@ -7498,7 +7498,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 @@ -7507,7 +7507,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 @@ -7740,7 +7740,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 @@ -7749,11 +7749,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 @@ -7762,7 +7762,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 @@ -7779,7 +7779,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 @@ -7788,7 +7788,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 @@ -7806,7 +7806,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 @@ -7815,7 +7815,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 void test_char_to_wchar(TestFunction check, ExceptionTest check_exception) { std::map 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 void format_tests(TestFunction check, ExceptionTest check_exception) { test_char(check, check_exception); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#ifndef TEST_HAS_NO_WIDE_CHARACTERS if (std::same_as) // 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 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 void format_tests(TestFunction check, ExceptionTest check_exception) { test_char(check, check_exception); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#ifndef TEST_HAS_NO_WIDE_CHARACTERS if (std::same_as) // 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 void test_char_to_wchar(TestFunction check, ExceptionTest check_exception) { test_char_default(check, check_exception, std::array{'H', 'e', 'l', 'l', 'o'}); @@ -1368,7 +1368,7 @@ void test_adaptor(TestFunction check, ExceptionTest check_exception) { template void format_tests(TestFunction check, ExceptionTest check_exception) { test_char(check, check_exception); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#ifndef TEST_HAS_NO_WIDE_CHARACTERS if (std::same_as) // 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 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 5dcd775e8641e1..03a55b1c391907 100644 --- a/libcxx/test/support/test_macros.h +++ b/libcxx/test/support/test_macros.h @@ -387,11 +387,11 @@ 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) +#if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_WIDE_CHARACTERS # define TEST_HAS_NO_WIDE_CHARACTERS #endif -#if defined(_LIBCPP_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 @@ -405,7 +405,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 @@ -413,11 +413,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 @@ -425,7 +425,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 @@ -433,7 +433,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..65eb6fab510dfe 100644 --- a/libcxx/test/tools/clang_tidy_checks/internal_ftm_use.cpp +++ b/libcxx/test/tools/clang_tidy_checks/internal_ftm_use.cpp @@ -29,19 +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", diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py index 7ab1af93d17740..e8882f9d26d642 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", @@ -994,8 +994,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", @@ -1143,15 +1143,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", @@ -1163,8 +1163,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", @@ -1180,8 +1180,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 6bebf3302ffae9..955aeaa6a1e318 100644 --- a/libcxx/utils/libcxx/header_information.py +++ b/libcxx/utils/libcxx/header_information.py @@ -14,22 +14,22 @@ "stdatomic.h": "_LIBCPP_HAS_ATOMIC_HEADER", # headers with #error directives - "ios": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", - "locale.h": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "ios": "_LIBCPP_HAS_LOCALIZATION", + "locale.h": "_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 - #if defined(_LIBCPP_HAS_NO_LOCALIZATION) + #if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_LOCALIZATION int main(int, char**) { return 1; } #else #include diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py index 735eb5ac949dc0..9f2fe1a6e83c9f 100644 --- a/libcxx/utils/libcxx/test/features.py +++ b/libcxx/utils/libcxx/test/features.py @@ -231,7 +231,7 @@ 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"] and "_WIN32" in compilerMacros(cfg) and not programSucceeds( cfg, @@ -287,7 +287,7 @@ 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"] and not programSucceeds( cfg, """ @@ -365,8 +365,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", @@ -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,25 @@ def _mingwSupportsModules(cfg): ) ) +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 not compilerMacros(cfg)[m] + ) + ) # 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()