Skip to content

Commit

Permalink
[libc++] Switch experimental library macros to 0/1 macros
Browse files Browse the repository at this point in the history
  • Loading branch information
philnik777 committed Jan 23, 2025
1 parent 6436089 commit 26bd507
Show file tree
Hide file tree
Showing 27 changed files with 81 additions and 80 deletions.
4 changes: 2 additions & 2 deletions libcxx/include/__algorithm/pstl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/convert_to_tm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>) {
Expand All @@ -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");

Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
28 changes: 14 additions & 14 deletions libcxx/include/__chrono/formatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down Expand Up @@ -227,15 +227,15 @@ 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
else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
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}};
}

Expand Down Expand Up @@ -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>)
Expand All @@ -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");
}
Expand Down Expand Up @@ -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>)
Expand All @@ -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");
}
Expand Down Expand Up @@ -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>)
Expand All @@ -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");
}
Expand Down Expand Up @@ -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>)
Expand All @@ -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");
}
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/leap_second.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/local_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/ostream.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>&
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/sys_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/time_zone.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/time_zone_link.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/tzdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/tzdb_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/zoned_time.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
12 changes: 8 additions & 4 deletions libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__numeric/pstl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/execution
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 <cstddef>
Expand Down
Loading

0 comments on commit 26bd507

Please sign in to comment.