[libcxx-commits] [libcxx] 24e70e3 - [libc++] Switch experimental library macros to 0/1 macros (#124030)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jan 24 00:34:47 PST 2025
Author: Nikolas Klauser
Date: 2025-01-24T09:34:42+01:00
New Revision: 24e70e3930724ce499ad05d669bfbc4423c542e0
URL: https://github.com/llvm/llvm-project/commit/24e70e3930724ce499ad05d669bfbc4423c542e0
DIFF: https://github.com/llvm/llvm-project/commit/24e70e3930724ce499ad05d669bfbc4423c542e0.diff
LOG: [libc++] Switch experimental library macros to 0/1 macros (#124030)
This is a continuation of what's been started in #89178.
As a drive-by, this also changes the PSTL macro to say `EXPERIMENTAL`
instead of `INCOMPLETE`.
Added:
Modified:
libcxx/include/__algorithm/pstl.h
libcxx/include/__chrono/convert_to_tm.h
libcxx/include/__chrono/exception.h
libcxx/include/__chrono/formatter.h
libcxx/include/__chrono/leap_second.h
libcxx/include/__chrono/local_info.h
libcxx/include/__chrono/ostream.h
libcxx/include/__chrono/sys_info.h
libcxx/include/__chrono/time_zone.h
libcxx/include/__chrono/time_zone_link.h
libcxx/include/__chrono/tzdb.h
libcxx/include/__chrono/tzdb_list.h
libcxx/include/__chrono/zoned_time.h
libcxx/include/__config
libcxx/include/__numeric/pstl.h
libcxx/include/execution
libcxx/include/iosfwd
libcxx/include/syncstream
libcxx/include/version
libcxx/modules/std/iosfwd.inc
libcxx/modules/std/syncstream.inc
libcxx/test/libcxx/experimental/fexperimental-library.compile.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/syncstream.version.compile.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
libcxx/test/support/test_macros.h
libcxx/test/tools/clang_tidy_checks/internal_ftm_use.cpp
libcxx/utils/generate_feature_test_macro_components.py
Removed:
################################################################################
diff --git a/libcxx/include/__algorithm/pstl.h b/libcxx/include/__algorithm/pstl.h
index 71e7f28476e4bf..aa7b49de933c3a 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 46e3650e390ea6..8a16c4f996a860 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<decltype(__result.tm_hour)>::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<typename _ChronoT::duration>{__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 64484fb551b77d..1eb5b1b62d92c5 100644
--- a/libcxx/include/__chrono/exception.h
+++ b/libcxx/include/__chrono/exception.h
@@ -14,7 +14,7 @@
#include <version>
// 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 <class _Duration>
_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 1086dde3819559..400eb8c7fdcd23 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 <class _CharT, class _Duration, class _TimeZonePtr>
_LIBCPP_HIDE_FROM_ABI void
__format_sub_seconds(basic_stringstream<_CharT>& __sstr, const chrono::zoned_time<_Duration, _TimeZonePtr>& __value) {
@@ -155,7 +155,7 @@ template <class _Tp>
consteval bool __use_fraction() {
if constexpr (__is_time_point<_Tp>)
return chrono::hh_mm_ss<typename _Tp::duration>::fractional_width;
-# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) && _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<typename _Tp::duration>::fractional_width;
# endif
@@ -227,7 +227,7 @@ struct _LIBCPP_HIDE_FROM_ABI __time_zone {
template <class _Tp>
_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<chrono::hh_mm_ss<_Duration>, _CharT> : public __formatter_chron
}
};
-# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
+# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
template <__fmt_char_type _CharT>
struct formatter<chrono::sys_info, _CharT> : public __formatter_chrono<_CharT> {
public:
@@ -976,7 +976,7 @@ struct formatter<chrono::zoned_time<_Duration, _TimeZonePtr>, _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 b01d9fbca8c2f1..1857bef80376ea 100644
--- a/libcxx/include/__chrono/leap_second.h
+++ b/libcxx/include/__chrono/leap_second.h
@@ -14,7 +14,7 @@
#include <version>
// 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 cfe1448904d3f7..31cf77761d6ae8 100644
--- a/libcxx/include/__chrono/local_info.h
+++ b/libcxx/include/__chrono/local_info.h
@@ -14,7 +14,7 @@
#include <version>
// 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 ca6d1605d0f87e..41884647f927d4 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 <class _CharT, class _Traits>
_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 11536cbde3a37c..81e37f2b803f24 100644
--- a/libcxx/include/__chrono/sys_info.h
+++ b/libcxx/include/__chrono/sys_info.h
@@ -14,7 +14,7 @@
#include <version>
// 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 3bfe482a146244..ab5c22eceaaf1a 100644
--- a/libcxx/include/__chrono/time_zone.h
+++ b/libcxx/include/__chrono/time_zone.h
@@ -14,7 +14,7 @@
#include <version>
// 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 a408bff5decc1f..cae40b07c2ca67 100644
--- a/libcxx/include/__chrono/time_zone_link.h
+++ b/libcxx/include/__chrono/time_zone_link.h
@@ -14,7 +14,7 @@
#include <version>
// 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 8052043e647655..fb85f66b019680 100644
--- a/libcxx/include/__chrono/tzdb.h
+++ b/libcxx/include/__chrono/tzdb.h
@@ -14,7 +14,7 @@
#include <version>
// 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 9c507764c97a7a..2b83a6df1daf80 100644
--- a/libcxx/include/__chrono/tzdb_list.h
+++ b/libcxx/include/__chrono/tzdb_list.h
@@ -14,7 +14,7 @@
#include <version>
// 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 1deba10d96ae82..8db687a422ab1a 100644
--- a/libcxx/include/__chrono/zoned_time.h
+++ b/libcxx/include/__chrono/zoned_time.h
@@ -14,7 +14,7 @@
#include <version>
// 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 5a0d22588d6dac..30b2d147dc5634 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 <features.h> // for __NATIVE_ASCII_F
# endif
diff --git a/libcxx/include/__numeric/pstl.h b/libcxx/include/__numeric/pstl.h
index 7557686a3663db..22d971ac3b483a 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 5b1915a998732b..88fca9af6e33c8 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
@@ -153,7 +153,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 <cstddef>
diff --git a/libcxx/include/iosfwd b/libcxx/include/iosfwd
index 708134daf98c9d..80f3e2d5cf2bcd 100644
--- a/libcxx/include/iosfwd
+++ b/libcxx/include/iosfwd
@@ -143,7 +143,7 @@ typedef fpos<mbstate_t> u8streampos;
typedef fpos<mbstate_t> u16streampos;
typedef fpos<mbstate_t> u32streampos;
-# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
+# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>>
class basic_syncbuf;
@@ -161,7 +161,7 @@ using osyncstream = basic_osyncstream<char>;
using wosyncstream = basic_osyncstream<wchar_t>;
# endif
-# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
+# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM
template <class _CharT, class _Traits>
class __save_flags {
diff --git a/libcxx/include/syncstream b/libcxx/include/syncstream
index 82761be765420c..089d461450b37b 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 f5b5e7a906f504..57d6ec629d27c8 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -454,7 +454,7 @@ __cpp_lib_void_t 201411L <type_traits>
# 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 81bdddec8afef4..61ed3af6e86aea 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 ed4cae04d1b8b7..0c3c6404334445 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 fd06886bf2e532..3cf497da233fb4 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 <version>
-#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 88769d2770b1bd..9cf763701ffc00 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 7c03955df681d5..605788f559d3c2 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 676c865914b403..858bbaa2d6d830 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 ade82b6ac9f77d..2b18654864bbb2 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 dae827f5de50c2..c4065cdc1afef8 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",
More information about the libcxx-commits
mailing list