Skip to content

Commit 24e70e3

Browse files
authored
[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`.
1 parent 97df741 commit 24e70e3

27 files changed

+83
-80
lines changed

libcxx/include/__algorithm/pstl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
_LIBCPP_PUSH_MACROS
1919
#include <__undef_macros>
2020

21-
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
21+
#if _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17
2222

2323
# include <__functional/operations.h>
2424
# include <__iterator/cpp17_iterator_concepts.h>
@@ -656,7 +656,7 @@ _LIBCPP_HIDE_FROM_ABI _ForwardOutIterator transform(
656656

657657
_LIBCPP_END_NAMESPACE_STD
658658

659-
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
659+
#endif // _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17
660660

661661
_LIBCPP_POP_MACROS
662662

libcxx/include/__chrono/convert_to_tm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _ChronoT& __value) {
175175
if (__value.hours().count() > std::numeric_limits<decltype(__result.tm_hour)>::max())
176176
std::__throw_format_error("Formatting hh_mm_ss, encountered an hour overflow");
177177
__result.tm_hour = __value.hours().count();
178-
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
178+
# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
179179
} else if constexpr (same_as<_ChronoT, chrono::sys_info>) {
180180
// Has no time information.
181181
} else if constexpr (same_as<_ChronoT, chrono::local_info>) {
@@ -185,7 +185,7 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _ChronoT& __value) {
185185
return std::__convert_to_tm<_Tm>(
186186
chrono::sys_time<typename _ChronoT::duration>{__value.get_local_time().time_since_epoch()});
187187
# endif
188-
# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
188+
# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
189189
} else
190190
static_assert(sizeof(_ChronoT) == 0, "Add the missing type specialization");
191191

libcxx/include/__chrono/exception.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include <version>
1616
// Enable the contents of the header only when libc++ was built with experimental features enabled.
17-
#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
17+
#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
1818

1919
# include <__chrono/calendar.h>
2020
# include <__chrono/local_info.h>
@@ -130,6 +130,6 @@ template <class _Duration>
130130

131131
_LIBCPP_END_NAMESPACE_STD
132132

133-
#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
133+
#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
134134

135135
#endif // _LIBCPP___CHRONO_EXCEPTION_H

libcxx/include/__chrono/formatter.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ __format_sub_seconds(basic_stringstream<_CharT>& __sstr, const chrono::hh_mm_ss<
143143
__value.fractional_width);
144144
}
145145

146-
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
146+
# if _LIBCPP_HAS_EXPERIMENTAL_TZDB && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
147147
template <class _CharT, class _Duration, class _TimeZonePtr>
148148
_LIBCPP_HIDE_FROM_ABI void
149149
__format_sub_seconds(basic_stringstream<_CharT>& __sstr, const chrono::zoned_time<_Duration, _TimeZonePtr>& __value) {
@@ -155,7 +155,7 @@ template <class _Tp>
155155
consteval bool __use_fraction() {
156156
if constexpr (__is_time_point<_Tp>)
157157
return chrono::hh_mm_ss<typename _Tp::duration>::fractional_width;
158-
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
158+
# if _LIBCPP_HAS_EXPERIMENTAL_TZDB && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
159159
else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
160160
return chrono::hh_mm_ss<typename _Tp::duration>::fractional_width;
161161
# endif
@@ -227,15 +227,15 @@ struct _LIBCPP_HIDE_FROM_ABI __time_zone {
227227

228228
template <class _Tp>
229229
_LIBCPP_HIDE_FROM_ABI __time_zone __convert_to_time_zone([[maybe_unused]] const _Tp& __value) {
230-
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
230+
# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
231231
if constexpr (same_as<_Tp, chrono::sys_info>)
232232
return {__value.abbrev, __value.offset};
233233
# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
234234
else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
235235
return __formatter::__convert_to_time_zone(__value.get_info());
236236
# endif
237237
else
238-
# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
238+
# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
239239
return {"UTC", chrono::seconds{0}};
240240
}
241241

@@ -443,7 +443,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_ok(const _Tp& __value) {
443443
return __value.weekday().ok();
444444
else if constexpr (__is_hh_mm_ss<_Tp>)
445445
return true;
446-
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
446+
# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
447447
else if constexpr (same_as<_Tp, chrono::sys_info>)
448448
return true;
449449
else if constexpr (same_as<_Tp, chrono::local_info>)
@@ -452,7 +452,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_ok(const _Tp& __value) {
452452
else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
453453
return true;
454454
# endif
455-
# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
455+
# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
456456
else
457457
static_assert(sizeof(_Tp) == 0, "Add the missing type specialization");
458458
}
@@ -493,7 +493,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_name_ok(const _Tp& __value) {
493493
return __value.weekday().ok();
494494
else if constexpr (__is_hh_mm_ss<_Tp>)
495495
return true;
496-
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
496+
# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
497497
else if constexpr (same_as<_Tp, chrono::sys_info>)
498498
return true;
499499
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) {
502502
else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
503503
return true;
504504
# endif
505-
# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
505+
# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
506506
else
507507
static_assert(sizeof(_Tp) == 0, "Add the missing type specialization");
508508
}
@@ -543,7 +543,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __date_ok(const _Tp& __value) {
543543
return __value.ok();
544544
else if constexpr (__is_hh_mm_ss<_Tp>)
545545
return true;
546-
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
546+
# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
547547
else if constexpr (same_as<_Tp, chrono::sys_info>)
548548
return true;
549549
else if constexpr (same_as<_Tp, chrono::local_info>)
@@ -552,7 +552,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __date_ok(const _Tp& __value) {
552552
else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
553553
return true;
554554
# endif
555-
# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
555+
# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
556556
else
557557
static_assert(sizeof(_Tp) == 0, "Add the missing type specialization");
558558
}
@@ -593,7 +593,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __month_name_ok(const _Tp& __value) {
593593
return __value.month().ok();
594594
else if constexpr (__is_hh_mm_ss<_Tp>)
595595
return true;
596-
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
596+
# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
597597
else if constexpr (same_as<_Tp, chrono::sys_info>)
598598
return true;
599599
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) {
602602
else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
603603
return true;
604604
# endif
605-
# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
605+
# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
606606
else
607607
static_assert(sizeof(_Tp) == 0, "Add the missing type specialization");
608608
}
@@ -940,7 +940,7 @@ struct formatter<chrono::hh_mm_ss<_Duration>, _CharT> : public __formatter_chron
940940
}
941941
};
942942

943-
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
943+
# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
944944
template <__fmt_char_type _CharT>
945945
struct formatter<chrono::sys_info, _CharT> : public __formatter_chrono<_CharT> {
946946
public:
@@ -976,7 +976,7 @@ struct formatter<chrono::zoned_time<_Duration, _TimeZonePtr>, _CharT> : public _
976976
}
977977
};
978978
# endif // _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
979-
# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
979+
# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
980980

981981
# endif // if _LIBCPP_STD_VER >= 20
982982

libcxx/include/__chrono/leap_second.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include <version>
1616
// Enable the contents of the header only when libc++ was built with experimental features enabled.
17-
#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
17+
#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
1818

1919
# include <__chrono/duration.h>
2020
# include <__chrono/system_clock.h>
@@ -126,6 +126,6 @@ class leap_second {
126126

127127
_LIBCPP_END_NAMESPACE_STD
128128

129-
#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
129+
#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
130130

131131
#endif // _LIBCPP___CHRONO_LEAP_SECOND_H

libcxx/include/__chrono/local_info.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include <version>
1616
// Enable the contents of the header only when libc++ was built with experimental features enabled.
17-
#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
17+
#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
1818

1919
# include <__chrono/sys_info.h>
2020
# include <__config>
@@ -45,6 +45,6 @@ struct local_info {
4545

4646
_LIBCPP_END_NAMESPACE_STD
4747

48-
#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
48+
#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
4949

5050
#endif // _LIBCPP___CHRONO_LOCAL_INFO_H

libcxx/include/__chrono/ostream.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const hh_mm_ss<_Duration> __hms
269269
return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%T}"), __hms);
270270
}
271271

272-
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
272+
# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
273273

274274
template <class _CharT, class _Traits>
275275
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
@@ -314,7 +314,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const zoned_time<_Duration, _Ti
314314
return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%F %T %Z}"), __tp);
315315
}
316316
# endif
317-
# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
317+
# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
318318

319319
} // namespace chrono
320320

libcxx/include/__chrono/sys_info.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include <version>
1616
// Enable the contents of the header only when libc++ was built with experimental features enabled.
17-
#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
17+
#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
1818

1919
# include <__chrono/duration.h>
2020
# include <__chrono/system_clock.h>
@@ -46,6 +46,6 @@ struct sys_info {
4646

4747
_LIBCPP_END_NAMESPACE_STD
4848

49-
#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
49+
#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
5050

5151
#endif // _LIBCPP___CHRONO_SYS_INFO_H

libcxx/include/__chrono/time_zone.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include <version>
1616
// Enable the contents of the header only when libc++ was built with experimental features enabled.
17-
#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
17+
#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
1818

1919
# include <__chrono/calendar.h>
2020
# include <__chrono/duration.h>
@@ -176,6 +176,6 @@ _LIBCPP_END_NAMESPACE_STD
176176

177177
_LIBCPP_POP_MACROS
178178

179-
#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
179+
#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
180180

181181
#endif // _LIBCPP___CHRONO_TIME_ZONE_H

libcxx/include/__chrono/time_zone_link.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include <version>
1616
// Enable the contents of the header only when libc++ was built with experimental features enabled.
17-
#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
17+
#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
1818

1919
# include <__compare/strong_order.h>
2020
# include <__config>
@@ -74,6 +74,6 @@ _LIBCPP_END_NAMESPACE_STD
7474

7575
_LIBCPP_POP_MACROS
7676

77-
#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
77+
#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
7878

7979
#endif // _LIBCPP___CHRONO_TIME_ZONE_LINK_H

0 commit comments

Comments
 (0)