From 19a9a7e21c45be7b68ec11ed91324618a317017b Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Thu, 23 Jan 2025 01:01:48 +0100 Subject: [PATCH] [libc++] Switch experimental library macros to 0/1 macros --- libcxx/include/__algorithm/pstl.h | 4 +-- libcxx/include/__chrono/convert_to_tm.h | 4 +-- libcxx/include/__chrono/exception.h | 4 +-- libcxx/include/__chrono/formatter.h | 28 +++++++++---------- libcxx/include/__chrono/leap_second.h | 4 +-- libcxx/include/__chrono/local_info.h | 4 +-- libcxx/include/__chrono/ostream.h | 4 +-- libcxx/include/__chrono/sys_info.h | 4 +-- libcxx/include/__chrono/time_zone.h | 4 +-- libcxx/include/__chrono/time_zone_link.h | 4 +-- libcxx/include/__chrono/tzdb.h | 4 +-- libcxx/include/__chrono/tzdb_list.h | 4 +-- libcxx/include/__chrono/zoned_time.h | 4 +-- libcxx/include/__config | 12 +++++--- libcxx/include/__numeric/pstl.h | 4 +-- libcxx/include/execution | 4 +-- libcxx/include/iosfwd | 4 +-- libcxx/include/syncstream | 4 +-- libcxx/include/version | 2 +- libcxx/modules/std/iosfwd.inc | 6 ++-- libcxx/modules/std/syncstream.inc | 4 +-- .../fexperimental-library.compile.pass.cpp | 8 ++++-- .../syncstream.version.compile.pass.cpp | 12 ++++---- .../version.version.compile.pass.cpp | 12 ++++---- libcxx/test/support/test_macros.h | 5 +++- .../clang_tidy_checks/internal_ftm_use.cpp | 6 ---- .../generate_feature_test_macro_components.py | 4 +-- 27 files changed, 83 insertions(+), 80 deletions(-) diff --git a/libcxx/include/__algorithm/pstl.h b/libcxx/include/__algorithm/pstl.h index 71e7f28476e4b..aa7b49de933c3 100644 --- a/libcxx/include/__algorithm/pstl.h +++ b/libcxx/include/__algorithm/pstl.h @@ -18,7 +18,7 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> -#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +#if _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17 # include <__functional/operations.h> # include <__iterator/cpp17_iterator_concepts.h> @@ -656,7 +656,7 @@ _LIBCPP_HIDE_FROM_ABI _ForwardOutIterator transform( _LIBCPP_END_NAMESPACE_STD -#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +#endif // _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17 _LIBCPP_POP_MACROS diff --git a/libcxx/include/__chrono/convert_to_tm.h b/libcxx/include/__chrono/convert_to_tm.h index 46e3650e390ea..8a16c4f996a86 100644 --- a/libcxx/include/__chrono/convert_to_tm.h +++ b/libcxx/include/__chrono/convert_to_tm.h @@ -175,7 +175,7 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _ChronoT& __value) { if (__value.hours().count() > std::numeric_limits::max()) std::__throw_format_error("Formatting hh_mm_ss, encountered an hour overflow"); __result.tm_hour = __value.hours().count(); -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if _LIBCPP_HAS_EXPERIMENTAL_TZDB } else if constexpr (same_as<_ChronoT, chrono::sys_info>) { // Has no time information. } else if constexpr (same_as<_ChronoT, chrono::local_info>) { @@ -185,7 +185,7 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _ChronoT& __value) { return std::__convert_to_tm<_Tm>( chrono::sys_time{__value.get_local_time().time_since_epoch()}); # endif -# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB } else static_assert(sizeof(_ChronoT) == 0, "Add the missing type specialization"); diff --git a/libcxx/include/__chrono/exception.h b/libcxx/include/__chrono/exception.h index 64484fb551b77..1eb5b1b62d92c 100644 --- a/libcxx/include/__chrono/exception.h +++ b/libcxx/include/__chrono/exception.h @@ -14,7 +14,7 @@ #include // Enable the contents of the header only when libc++ was built with experimental features enabled. -#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#if _LIBCPP_HAS_EXPERIMENTAL_TZDB # include <__chrono/calendar.h> # include <__chrono/local_info.h> @@ -130,6 +130,6 @@ template _LIBCPP_END_NAMESPACE_STD -#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB #endif // _LIBCPP___CHRONO_EXCEPTION_H diff --git a/libcxx/include/__chrono/formatter.h b/libcxx/include/__chrono/formatter.h index 1086dde381955..400eb8c7fdcd2 100644 --- a/libcxx/include/__chrono/formatter.h +++ b/libcxx/include/__chrono/formatter.h @@ -143,7 +143,7 @@ __format_sub_seconds(basic_stringstream<_CharT>& __sstr, const chrono::hh_mm_ss< __value.fractional_width); } -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM +# if _LIBCPP_HAS_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) { @@ -155,7 +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) && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM +# if _LIBCPP_HAS_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 @@ -227,7 +227,7 @@ struct _LIBCPP_HIDE_FROM_ABI __time_zone { template _LIBCPP_HIDE_FROM_ABI __time_zone __convert_to_time_zone([[maybe_unused]] const _Tp& __value) { -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if _LIBCPP_HAS_EXPERIMENTAL_TZDB if constexpr (same_as<_Tp, chrono::sys_info>) return {__value.abbrev, __value.offset}; # if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM @@ -235,7 +235,7 @@ _LIBCPP_HIDE_FROM_ABI __time_zone __convert_to_time_zone([[maybe_unused]] const return __formatter::__convert_to_time_zone(__value.get_info()); # endif else -# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB return {"UTC", chrono::seconds{0}}; } @@ -443,7 +443,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_ok(const _Tp& __value) { return __value.weekday().ok(); else if constexpr (__is_hh_mm_ss<_Tp>) return true; -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if _LIBCPP_HAS_EXPERIMENTAL_TZDB else if constexpr (same_as<_Tp, chrono::sys_info>) return true; else if constexpr (same_as<_Tp, chrono::local_info>) @@ -452,7 +452,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_ok(const _Tp& __value) { else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>) return true; # endif -# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB else static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); } @@ -493,7 +493,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_name_ok(const _Tp& __value) { return __value.weekday().ok(); else if constexpr (__is_hh_mm_ss<_Tp>) return true; -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if _LIBCPP_HAS_EXPERIMENTAL_TZDB else if constexpr (same_as<_Tp, chrono::sys_info>) return true; else if constexpr (same_as<_Tp, chrono::local_info>) @@ -502,7 +502,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_name_ok(const _Tp& __value) { else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>) return true; # endif -# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB else static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); } @@ -543,7 +543,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __date_ok(const _Tp& __value) { return __value.ok(); else if constexpr (__is_hh_mm_ss<_Tp>) return true; -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if _LIBCPP_HAS_EXPERIMENTAL_TZDB else if constexpr (same_as<_Tp, chrono::sys_info>) return true; else if constexpr (same_as<_Tp, chrono::local_info>) @@ -552,7 +552,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __date_ok(const _Tp& __value) { else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>) return true; # endif -# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB else static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); } @@ -593,7 +593,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __month_name_ok(const _Tp& __value) { return __value.month().ok(); else if constexpr (__is_hh_mm_ss<_Tp>) return true; -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if _LIBCPP_HAS_EXPERIMENTAL_TZDB else if constexpr (same_as<_Tp, chrono::sys_info>) return true; else if constexpr (same_as<_Tp, chrono::local_info>) @@ -602,7 +602,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __month_name_ok(const _Tp& __value) { else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>) return true; # endif -# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB else static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); } @@ -940,7 +940,7 @@ struct formatter, _CharT> : public __formatter_chron } }; -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if _LIBCPP_HAS_EXPERIMENTAL_TZDB template <__fmt_char_type _CharT> struct formatter : public __formatter_chrono<_CharT> { public: @@ -976,7 +976,7 @@ struct formatter, _CharT> : public _ } }; # endif // _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM -# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB # endif // if _LIBCPP_STD_VER >= 20 diff --git a/libcxx/include/__chrono/leap_second.h b/libcxx/include/__chrono/leap_second.h index b01d9fbca8c2f..1857bef80376e 100644 --- a/libcxx/include/__chrono/leap_second.h +++ b/libcxx/include/__chrono/leap_second.h @@ -14,7 +14,7 @@ #include // Enable the contents of the header only when libc++ was built with experimental features enabled. -#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#if _LIBCPP_HAS_EXPERIMENTAL_TZDB # include <__chrono/duration.h> # include <__chrono/system_clock.h> @@ -126,6 +126,6 @@ class leap_second { _LIBCPP_END_NAMESPACE_STD -#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB #endif // _LIBCPP___CHRONO_LEAP_SECOND_H diff --git a/libcxx/include/__chrono/local_info.h b/libcxx/include/__chrono/local_info.h index cfe1448904d3f..31cf77761d6ae 100644 --- a/libcxx/include/__chrono/local_info.h +++ b/libcxx/include/__chrono/local_info.h @@ -14,7 +14,7 @@ #include // Enable the contents of the header only when libc++ was built with experimental features enabled. -#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#if _LIBCPP_HAS_EXPERIMENTAL_TZDB # include <__chrono/sys_info.h> # include <__config> @@ -45,6 +45,6 @@ struct local_info { _LIBCPP_END_NAMESPACE_STD -#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB #endif // _LIBCPP___CHRONO_LOCAL_INFO_H diff --git a/libcxx/include/__chrono/ostream.h b/libcxx/include/__chrono/ostream.h index ca6d1605d0f87..41884647f927d 100644 --- a/libcxx/include/__chrono/ostream.h +++ b/libcxx/include/__chrono/ostream.h @@ -269,7 +269,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const hh_mm_ss<_Duration> __hms return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%T}"), __hms); } -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if _LIBCPP_HAS_EXPERIMENTAL_TZDB template _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& @@ -314,7 +314,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const zoned_time<_Duration, _Ti return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%F %T %Z}"), __tp); } # endif -# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB } // namespace chrono diff --git a/libcxx/include/__chrono/sys_info.h b/libcxx/include/__chrono/sys_info.h index 11536cbde3a37..81e37f2b803f2 100644 --- a/libcxx/include/__chrono/sys_info.h +++ b/libcxx/include/__chrono/sys_info.h @@ -14,7 +14,7 @@ #include // Enable the contents of the header only when libc++ was built with experimental features enabled. -#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#if _LIBCPP_HAS_EXPERIMENTAL_TZDB # include <__chrono/duration.h> # include <__chrono/system_clock.h> @@ -46,6 +46,6 @@ struct sys_info { _LIBCPP_END_NAMESPACE_STD -#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB #endif // _LIBCPP___CHRONO_SYS_INFO_H diff --git a/libcxx/include/__chrono/time_zone.h b/libcxx/include/__chrono/time_zone.h index 3bfe482a14624..ab5c22eceaaf1 100644 --- a/libcxx/include/__chrono/time_zone.h +++ b/libcxx/include/__chrono/time_zone.h @@ -14,7 +14,7 @@ #include // Enable the contents of the header only when libc++ was built with experimental features enabled. -#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#if _LIBCPP_HAS_EXPERIMENTAL_TZDB # include <__chrono/calendar.h> # include <__chrono/duration.h> @@ -176,6 +176,6 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS -#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB #endif // _LIBCPP___CHRONO_TIME_ZONE_H diff --git a/libcxx/include/__chrono/time_zone_link.h b/libcxx/include/__chrono/time_zone_link.h index a408bff5decc1..cae40b07c2ca6 100644 --- a/libcxx/include/__chrono/time_zone_link.h +++ b/libcxx/include/__chrono/time_zone_link.h @@ -14,7 +14,7 @@ #include // Enable the contents of the header only when libc++ was built with experimental features enabled. -#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#if _LIBCPP_HAS_EXPERIMENTAL_TZDB # include <__compare/strong_order.h> # include <__config> @@ -74,6 +74,6 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS -#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB #endif // _LIBCPP___CHRONO_TIME_ZONE_LINK_H diff --git a/libcxx/include/__chrono/tzdb.h b/libcxx/include/__chrono/tzdb.h index 8052043e64765..fb85f66b01968 100644 --- a/libcxx/include/__chrono/tzdb.h +++ b/libcxx/include/__chrono/tzdb.h @@ -14,7 +14,7 @@ #include // Enable the contents of the header only when libc++ was built with experimental features enabled. -#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#if _LIBCPP_HAS_EXPERIMENTAL_TZDB # include <__algorithm/ranges_lower_bound.h> # include <__chrono/leap_second.h> @@ -91,6 +91,6 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS -#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB #endif // _LIBCPP___CHRONO_TZDB_H diff --git a/libcxx/include/__chrono/tzdb_list.h b/libcxx/include/__chrono/tzdb_list.h index 9c507764c97a7..2b83a6df1daf8 100644 --- a/libcxx/include/__chrono/tzdb_list.h +++ b/libcxx/include/__chrono/tzdb_list.h @@ -14,7 +14,7 @@ #include // Enable the contents of the header only when libc++ was built with experimental features enabled. -#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#if _LIBCPP_HAS_EXPERIMENTAL_TZDB # include <__chrono/time_zone.h> # include <__chrono/tzdb.h> @@ -103,6 +103,6 @@ _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const tzdb& reload_tzdb(); _LIBCPP_END_NAMESPACE_STD -#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB #endif // _LIBCPP___CHRONO_TZDB_LIST_H diff --git a/libcxx/include/__chrono/zoned_time.h b/libcxx/include/__chrono/zoned_time.h index 1deba10d96ae8..8db687a422ab1 100644 --- a/libcxx/include/__chrono/zoned_time.h +++ b/libcxx/include/__chrono/zoned_time.h @@ -14,7 +14,7 @@ #include // Enable the contents of the header only when libc++ was built with experimental features enabled. -#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#if _LIBCPP_HAS_EXPERIMENTAL_TZDB # include <__chrono/calendar.h> # include <__chrono/duration.h> @@ -223,6 +223,6 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS -#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB #endif // _LIBCPP___CHRONO_ZONED_TIME_H diff --git a/libcxx/include/__config b/libcxx/include/__config index 5d5c90d7b87a7..461edd8c54e97 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -198,12 +198,16 @@ _LIBCPP_HARDENING_MODE_DEBUG // Incomplete features get their own specific disabling flags. This makes it // easier to grep for target specific flags once the feature is complete. -# if !defined(_LIBCPP_ENABLE_EXPERIMENTAL) && !defined(_LIBCPP_BUILDING_LIBRARY) -# define _LIBCPP_HAS_NO_INCOMPLETE_PSTL -# define _LIBCPP_HAS_NO_EXPERIMENTAL_TZDB -# define _LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM +# if defined(_LIBCPP_ENABLE_EXPERIMENTAL) || defined(_LIBCPP_BUILDING_LIBRARY) +# define _LIBCPP_HAS_EXPERIMENTAL_LIBRARY 1 +# else +# define _LIBCPP_HAS_EXPERIMENTAL_LIBRARY 0 # endif +# define _LIBCPP_HAS_EXPERIMENTAL_PSTL _LIBCPP_HAS_EXPERIMENTAL_LIBRARY +# define _LIBCPP_HAS_EXPERIMENTAL_TZDB _LIBCPP_HAS_EXPERIMENTAL_LIBRARY +# define _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM _LIBCPP_HAS_EXPERIMENTAL_LIBRARY + # if defined(__MVS__) # include // for __NATIVE_ASCII_F # endif diff --git a/libcxx/include/__numeric/pstl.h b/libcxx/include/__numeric/pstl.h index 7557686a3663d..22d971ac3b483 100644 --- a/libcxx/include/__numeric/pstl.h +++ b/libcxx/include/__numeric/pstl.h @@ -18,7 +18,7 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> -#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +#if _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17 # include <__functional/identity.h> # include <__functional/operations.h> @@ -167,7 +167,7 @@ _LIBCPP_HIDE_FROM_ABI _Tp transform_reduce( _LIBCPP_END_NAMESPACE_STD -#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +#endif // _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17 _LIBCPP_POP_MACROS diff --git a/libcxx/include/execution b/libcxx/include/execution index 7c695997cd047..298a6f3d38a9c 100644 --- a/libcxx/include/execution +++ b/libcxx/include/execution @@ -45,7 +45,7 @@ namespace std { # pragma GCC system_header # endif -# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +# if _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -143,7 +143,7 @@ _LIBCPP_HIDE_FROM_ABI auto __remove_parallel_policy(const _ExecutionPolicy&) { _LIBCPP_END_NAMESPACE_STD -# endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 +# endif // _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17 # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include diff --git a/libcxx/include/iosfwd b/libcxx/include/iosfwd index 708134daf98c9..80f3e2d5cf2bc 100644 --- a/libcxx/include/iosfwd +++ b/libcxx/include/iosfwd @@ -143,7 +143,7 @@ typedef fpos u8streampos; typedef fpos u16streampos; typedef fpos u32streampos; -# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) +# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM template , class _Allocator = allocator<_CharT>> class basic_syncbuf; @@ -161,7 +161,7 @@ using osyncstream = basic_osyncstream; using wosyncstream = basic_osyncstream; # endif -# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) +# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM template class __save_flags { diff --git a/libcxx/include/syncstream b/libcxx/include/syncstream index 82761be765420..089d461450b37 100644 --- a/libcxx/include/syncstream +++ b/libcxx/include/syncstream @@ -150,7 +150,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) +# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM // [syncstream.syncbuf.overview]/1 // Class template basic_syncbuf stores character data written to it, @@ -512,7 +512,7 @@ using std::osyncstream; using std::wosyncstream; # endif -# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) +# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/version b/libcxx/include/version index f5b5e7a906f50..57d6ec629d27c 100644 --- a/libcxx/include/version +++ b/libcxx/include/version @@ -454,7 +454,7 @@ __cpp_lib_void_t 201411L # define __cpp_lib_starts_ends_with 201711L # undef __cpp_lib_string_view # define __cpp_lib_string_view 201803L -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) +# if _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM # define __cpp_lib_syncbuf 201803L # endif # define __cpp_lib_three_way_comparison 201907L diff --git a/libcxx/modules/std/iosfwd.inc b/libcxx/modules/std/iosfwd.inc index 81bdddec8afef..61ed3af6e86ae 100644 --- a/libcxx/modules/std/iosfwd.inc +++ b/libcxx/modules/std/iosfwd.inc @@ -18,7 +18,7 @@ export namespace std { using std::u8streampos; #endif -#ifndef _LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM +#if _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM using std::basic_osyncstream; using std::basic_syncbuf; #endif @@ -26,7 +26,7 @@ export namespace std { using std::istreambuf_iterator; using std::ostreambuf_iterator; -#ifndef _LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM +#if _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM using std::osyncstream; using std::syncbuf; @@ -34,7 +34,7 @@ export namespace std { using std::wosyncstream; using std::wsyncbuf; # endif -#endif // _LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM +#endif // _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM using std::fpos; } // namespace std diff --git a/libcxx/modules/std/syncstream.inc b/libcxx/modules/std/syncstream.inc index ed4cae04d1b8b..0c3c640433444 100644 --- a/libcxx/modules/std/syncstream.inc +++ b/libcxx/modules/std/syncstream.inc @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// export namespace std { -#if _LIBCPP_HAS_LOCALIZATION && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) +#if _LIBCPP_HAS_LOCALIZATION && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM using std::basic_syncbuf; // [syncstream.syncbuf.special], specialized algorithms @@ -24,5 +24,5 @@ export namespace std { # if _LIBCPP_HAS_WIDE_CHARACTERS using std::wosyncstream; # endif -#endif // _LIBCPP_HAS_LOCALIZATION && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) +#endif // _LIBCPP_HAS_LOCALIZATION && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM } // namespace std diff --git a/libcxx/test/libcxx/experimental/fexperimental-library.compile.pass.cpp b/libcxx/test/libcxx/experimental/fexperimental-library.compile.pass.cpp index fd06886bf2e53..3cf497da233fb 100644 --- a/libcxx/test/libcxx/experimental/fexperimental-library.compile.pass.cpp +++ b/libcxx/test/libcxx/experimental/fexperimental-library.compile.pass.cpp @@ -14,16 +14,18 @@ // ADDITIONAL_COMPILE_FLAGS: -fexperimental-library +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include -#ifdef _LIBCPP_HAS_NO_INCOMPLETE_PSTL +#if !_LIBCPP_HAS_EXPERIMENTAL_PSTL # error "-fexperimental-library should enable the PSTL" #endif -#ifdef _LIBCPP_HAS_NO_EXPERIMENTAL_TZDB +#if !_LIBCPP_HAS_EXPERIMENTAL_TZDB # error "-fexperimental-library should enable the chrono TZDB" #endif -#ifdef _LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM +#if !_LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM # error "-fexperimental-library should enable the syncstream header" #endif diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/syncstream.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/syncstream.version.compile.pass.cpp index 88769d2770b1b..9cf763701ffc0 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/syncstream.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/syncstream.version.compile.pass.cpp @@ -44,7 +44,7 @@ #elif TEST_STD_VER == 20 -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) +# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM # ifndef __cpp_lib_syncbuf # error "__cpp_lib_syncbuf should be defined in c++20" # endif @@ -53,13 +53,13 @@ # endif # else # ifdef __cpp_lib_syncbuf -# error "__cpp_lib_syncbuf should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)' is not met!" +# error "__cpp_lib_syncbuf should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM' is not met!" # endif # endif #elif TEST_STD_VER == 23 -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) +# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM # ifndef __cpp_lib_syncbuf # error "__cpp_lib_syncbuf should be defined in c++23" # endif @@ -68,13 +68,13 @@ # endif # else # ifdef __cpp_lib_syncbuf -# error "__cpp_lib_syncbuf should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)' is not met!" +# error "__cpp_lib_syncbuf should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM' is not met!" # endif # endif #elif TEST_STD_VER > 23 -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) +# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM # ifndef __cpp_lib_syncbuf # error "__cpp_lib_syncbuf should be defined in c++26" # endif @@ -83,7 +83,7 @@ # endif # else # ifdef __cpp_lib_syncbuf -# error "__cpp_lib_syncbuf should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)' is not met!" +# error "__cpp_lib_syncbuf should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM' 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 7c03955df681d..605788f559d3c 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 @@ -4434,7 +4434,7 @@ # error "__cpp_lib_submdspan should not be defined before c++26" # endif -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) +# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM # ifndef __cpp_lib_syncbuf # error "__cpp_lib_syncbuf should be defined in c++20" # endif @@ -4443,7 +4443,7 @@ # endif # else # ifdef __cpp_lib_syncbuf -# error "__cpp_lib_syncbuf should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)' is not met!" +# error "__cpp_lib_syncbuf should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM' is not met!" # endif # endif @@ -6040,7 +6040,7 @@ # error "__cpp_lib_submdspan should not be defined before c++26" # endif -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) +# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM # ifndef __cpp_lib_syncbuf # error "__cpp_lib_syncbuf should be defined in c++23" # endif @@ -6049,7 +6049,7 @@ # endif # else # ifdef __cpp_lib_syncbuf -# error "__cpp_lib_syncbuf should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)' is not met!" +# error "__cpp_lib_syncbuf should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM' is not met!" # endif # endif @@ -7961,7 +7961,7 @@ # endif # endif -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) +# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM # ifndef __cpp_lib_syncbuf # error "__cpp_lib_syncbuf should be defined in c++26" # endif @@ -7970,7 +7970,7 @@ # endif # else # ifdef __cpp_lib_syncbuf -# error "__cpp_lib_syncbuf should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)' is not met!" +# error "__cpp_lib_syncbuf should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM' is not met!" # endif # endif diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h index 676c865914b40..858bbaa2d6d83 100644 --- a/libcxx/test/support/test_macros.h +++ b/libcxx/test/support/test_macros.h @@ -451,7 +451,10 @@ inline Tp const& DoNotOptimize(Tp const& value) { # define TEST_HAS_NO_RANDOM_DEVICE #endif -#if defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +#ifdef _LIBCPP_USE_FROZEN_CXX03_HEADERS +// This is a C++20 feature, so it's never available anyways +# define TEST_HAS_NO_EXPERIMENTAL_TZDB +#elif defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_EXPERIMENTAL_TZDB # define TEST_HAS_NO_EXPERIMENTAL_TZDB #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 ade82b6ac9f77..2b18654864bbb 100644 --- a/libcxx/test/tools/clang_tidy_checks/internal_ftm_use.cpp +++ b/libcxx/test/tools/clang_tidy_checks/internal_ftm_use.cpp @@ -25,12 +25,6 @@ std::array valid_macros{ // Testing macros "_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER", - - // Experimental features - "_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB", - "_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM", - "_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN", - "_LIBCPP_HAS_NO_INCOMPLETE_PSTL", }; class internal_ftm_use_callbacks : public clang::PPCallbacks { diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py index dae827f5de50c..c4065cdc1afef 100755 --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -1300,8 +1300,8 @@ def add_version_header(tc): "name": "__cpp_lib_syncbuf", "values": {"c++20": 201803}, "headers": ["syncstream"], - "test_suite_guard": "!defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)", - "libcxx_guard": "!defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)", + "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM", + "libcxx_guard": "_LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM", }, { "name": "__cpp_lib_text_encoding",