Skip to content

Commit d80d1d9

Browse files
committed
[libc++] Refactor the configuration macros to being always defined
1 parent c949500 commit d80d1d9

File tree

215 files changed

+1064
-1082
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+1064
-1082
lines changed

libcxx/CMakeLists.txt

+18-16
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,8 @@ target_compile_options(cxx-sanitizer-flags INTERFACE ${SANITIZER_FLAGS})
641641
string(FIND "${LLVM_USE_SANITIZER}" "Address" building_with_asan)
642642
if (NOT "${building_with_asan}" STREQUAL "-1")
643643
config_define(ON _LIBCPP_INSTRUMENTED_WITH_ASAN)
644+
else()
645+
config_define(OFF _LIBCPP_INSTRUMENTED_WITH_ASAN)
644646
endif()
645647

646648
# Link system libraries =======================================================
@@ -734,26 +736,26 @@ endfunction()
734736
# Configuration file flags =====================================================
735737
config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION)
736738
config_define(${LIBCXX_ABI_NAMESPACE} _LIBCPP_ABI_NAMESPACE)
737-
config_define_if(LIBCXX_ABI_FORCE_ITANIUM _LIBCPP_ABI_FORCE_ITANIUM)
738-
config_define_if(LIBCXX_ABI_FORCE_MICROSOFT _LIBCPP_ABI_FORCE_MICROSOFT)
739-
config_define_if_not(LIBCXX_ENABLE_THREADS _LIBCPP_HAS_NO_THREADS)
740-
config_define_if_not(LIBCXX_ENABLE_MONOTONIC_CLOCK _LIBCPP_HAS_NO_MONOTONIC_CLOCK)
741-
config_define_if_not(LIBCXX_HAS_TERMINAL_AVAILABLE _LIBCPP_HAS_NO_TERMINAL)
739+
config_define(${LIBCXX_ABI_FORCE_ITANIUM} _LIBCPP_ABI_FORCE_ITANIUM)
740+
config_define(${LIBCXX_ABI_FORCE_MICROSOFT} _LIBCPP_ABI_FORCE_MICROSOFT)
741+
config_define(${LIBCXX_ENABLE_THREADS} _LIBCPP_HAS_THREADS)
742+
config_define(${LIBCXX_ENABLE_MONOTONIC_CLOCK} _LIBCPP_HAS_MONOTONIC_CLOCK)
743+
config_define(${LIBCXX_HAS_TERMINAL_AVAILABLE} _LIBCPP_HAS_TERMINAL)
742744
if (NOT LIBCXX_TYPEINFO_COMPARISON_IMPLEMENTATION STREQUAL "default")
743745
config_define("${LIBCXX_TYPEINFO_COMPARISON_IMPLEMENTATION}" _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION)
744746
endif()
745-
config_define_if(LIBCXX_HAS_PTHREAD_API _LIBCPP_HAS_THREAD_API_PTHREAD)
746-
config_define_if(LIBCXX_HAS_EXTERNAL_THREAD_API _LIBCPP_HAS_THREAD_API_EXTERNAL)
747-
config_define_if(LIBCXX_HAS_WIN32_THREAD_API _LIBCPP_HAS_THREAD_API_WIN32)
748-
config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC)
747+
config_define(${LIBCXX_HAS_PTHREAD_API} _LIBCPP_HAS_THREAD_API_PTHREAD)
748+
config_define(${LIBCXX_HAS_EXTERNAL_THREAD_API} _LIBCPP_HAS_THREAD_API_EXTERNAL)
749+
config_define(${LIBCXX_HAS_WIN32_THREAD_API} _LIBCPP_HAS_THREAD_API_WIN32)
750+
config_define(${LIBCXX_HAS_MUSL_LIBC} _LIBCPP_HAS_MUSL_LIBC)
749751
config_define_if(LIBCXX_NO_VCRUNTIME _LIBCPP_NO_VCRUNTIME)
750-
config_define_if_not(LIBCXX_ENABLE_FILESYSTEM _LIBCPP_HAS_NO_FILESYSTEM)
751-
config_define_if_not(LIBCXX_ENABLE_RANDOM_DEVICE _LIBCPP_HAS_NO_RANDOM_DEVICE)
752-
config_define_if_not(LIBCXX_ENABLE_LOCALIZATION _LIBCPP_HAS_NO_LOCALIZATION)
753-
config_define_if_not(LIBCXX_ENABLE_UNICODE _LIBCPP_HAS_NO_UNICODE)
754-
config_define_if_not(LIBCXX_ENABLE_WIDE_CHARACTERS _LIBCPP_HAS_NO_WIDE_CHARACTERS)
755-
config_define_if_not(LIBCXX_ENABLE_TIME_ZONE_DATABASE _LIBCPP_HAS_NO_TIME_ZONE_DATABASE)
756-
config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
752+
config_define(${LIBCXX_ENABLE_FILESYSTEM} _LIBCPP_HAS_FILESYSTEM)
753+
config_define(${LIBCXX_ENABLE_RANDOM_DEVICE} _LIBCPP_HAS_RANDOM_DEVICE)
754+
config_define(${LIBCXX_ENABLE_LOCALIZATION} _LIBCPP_HAS_LOCALIZATION)
755+
config_define(${LIBCXX_ENABLE_UNICODE} _LIBCPP_HAS_UNICODE)
756+
config_define(${LIBCXX_ENABLE_WIDE_CHARACTERS} _LIBCPP_HAS_WIDE_CHARACTERS)
757+
config_define(${LIBCXX_ENABLE_TIME_ZONE_DATABASE} _LIBCPP_HAS_TIME_ZONE_DATABASE)
758+
config_define(${LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS} _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS)
757759

758760
# TODO: Remove in LLVM 21. We're leaving an error to make this fail explicitly.
759761
if (LIBCXX_ENABLE_ASSERTIONS)

libcxx/docs/DesignDocs/ThreadingSupportAPI.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ API but leaves out the implementation.
4545
Threading Configuration Macros
4646
==============================
4747

48-
**_LIBCPP_HAS_NO_THREADS**
49-
This macro is defined when libc++ is built without threading support. It
50-
should not be manually defined by the user.
48+
**_LIBCPP_HAS_THREADS**
49+
This macro is set to 1 when libc++ is built with threading support. Otherwise
50+
it is set to 0. It should not be manually defined by the user.
5151

5252
**_LIBCPP_HAS_THREAD_API_EXTERNAL**
5353
This macro is defined when libc++ should use the ``<__external_threading>``

libcxx/include/__algorithm/find.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <__utility/move.h>
3030
#include <limits>
3131

32-
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
32+
#if _LIBCPP_HAS_WIDE_CHARACTERS
3333
# include <cwchar>
3434
#endif
3535

@@ -65,7 +65,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find(_Tp* __first, _T
6565
return __last;
6666
}
6767

68-
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
68+
#if _LIBCPP_HAS_WIDE_CHARACTERS
6969
template <class _Tp,
7070
class _Up,
7171
class _Proj,
@@ -77,7 +77,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find(_Tp* __first, _T
7777
return __ret;
7878
return __last;
7979
}
80-
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
80+
#endif // _LIBCPP_HAS_WIDE_CHARACTERS
8181

8282
// TODO: This should also be possible to get right with different signedness
8383
// cast integral types to allow vectorization

libcxx/include/__algorithm/lexicographical_compare.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <__type_traits/is_trivially_lexicographically_comparable.h>
2727
#include <__type_traits/is_volatile.h>
2828

29-
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
29+
#if _LIBCPP_HAS_WIDE_CHARACTERS
3030
# include <cwchar>
3131
#endif
3232

@@ -78,14 +78,14 @@ __lexicographical_compare(_Tp* __first1, _Tp* __last1, _Tp* __first2, _Tp* __las
7878
return __last1 - __first1 < __last2 - __first2;
7979
return __res < 0;
8080
}
81-
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
81+
# if _LIBCPP_HAS_WIDE_CHARACTERS
8282
else if constexpr (is_same<__remove_cv_t<_Tp>, wchar_t>::value) {
8383
auto __res = std::__constexpr_wmemcmp(__first1, __first2, std::min(__last1 - __first1, __last2 - __first2));
8484
if (__res == 0)
8585
return __last1 - __first1 < __last2 - __first2;
8686
return __res < 0;
8787
}
88-
# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
88+
# endif // _LIBCPP_HAS_WIDE_CHARACTERS
8989
else {
9090
auto __res = std::mismatch(__first1, __last1, __first2, __last2);
9191
if (__res.second == __last2)

libcxx/include/__algorithm/sort.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ template <class _Comp, class _RandomAccessIterator>
851851
void __sort(_RandomAccessIterator, _RandomAccessIterator, _Comp);
852852

853853
extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<char>&, char*>(char*, char*, __less<char>&);
854-
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
854+
#if _LIBCPP_HAS_WIDE_CHARACTERS
855855
extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
856856
#endif
857857
extern template _LIBCPP_EXPORTED_FROM_ABI void
@@ -896,7 +896,7 @@ template <class _Type>
896896
using __sort_is_specialized_in_library = __is_any_of<
897897
_Type,
898898
char,
899-
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
899+
#if _LIBCPP_HAS_WIDE_CHARACTERS
900900
wchar_t,
901901
#endif
902902
signed char,

libcxx/include/__atomic/aliases.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ using atomic_char8_t = atomic<char8_t>;
4343
#endif
4444
using atomic_char16_t = atomic<char16_t>;
4545
using atomic_char32_t = atomic<char32_t>;
46-
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
46+
#if _LIBCPP_HAS_WIDE_CHARACTERS
4747
using atomic_wchar_t = atomic<wchar_t>;
4848
#endif
4949

libcxx/include/__atomic/atomic_sync.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct __atomic_wait_poll_impl {
6969
}
7070
};
7171

72-
#ifndef _LIBCPP_HAS_NO_THREADS
72+
#if _LIBCPP_HAS_THREADS
7373

7474
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile*) _NOEXCEPT;
7575
_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 _
163163
std::__cxx_atomic_notify_all(__atomic_waitable_traits<__decay_t<_AtomicWaitable> >::__atomic_contention_address(__a));
164164
}
165165

166-
#else // _LIBCPP_HAS_NO_THREADS
166+
#else // _LIBCPP_HAS_THREADS
167167

168168
template <class _AtomicWaitable, class _Poll>
169169
_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&) {}
177177
template <class _AtomicWaitable>
178178
_LIBCPP_HIDE_FROM_ABI void __atomic_notify_all(const _AtomicWaitable&) {}
179179

180-
#endif // _LIBCPP_HAS_NO_THREADS
180+
#endif // _LIBCPP_HAS_THREADS
181181

182182
template <typename _Tp>
183183
_LIBCPP_HIDE_FROM_ABI bool __cxx_nonatomic_compare_equal(_Tp const& __lhs, _Tp const& __rhs) {

libcxx/include/__atomic/cxx_atomic_impl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
_LIBCPP_BEGIN_NAMESPACE_STD
2727

28-
#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
28+
#if _LIBCPP_HAS_GCC_ATOMIC_IMP
2929

3030
// [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because
3131
// the default operator= in an object is not volatile, a byte-by-byte copy
@@ -260,7 +260,7 @@ __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_o
260260

261261
# define __cxx_atomic_is_lock_free(__s) __atomic_is_lock_free(__s, 0)
262262

263-
#elif defined(_LIBCPP_HAS_C_ATOMIC_IMP)
263+
#elif _LIBCPP_HAS_C_ATOMIC_IMP
264264

265265
template <typename _Tp>
266266
struct __cxx_atomic_base_impl {

libcxx/include/__chrono/convert_to_tm.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _ChronoT& __value) {
180180
// Has no time information.
181181
} else if constexpr (same_as<_ChronoT, chrono::local_info>) {
182182
// Has no time information.
183-
# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
184-
!defined(_LIBCPP_HAS_NO_LOCALIZATION)
183+
# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
185184
} else if constexpr (__is_specialization_v<_ChronoT, chrono::zoned_time>) {
186185
return std::__convert_to_tm<_Tm>(
187186
chrono::sys_time<typename _ChronoT::duration>{__value.get_local_time().time_since_epoch()});

libcxx/include/__chrono/formatter.h

+11-13
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include <__config>
1414

15-
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
15+
#if _LIBCPP_HAS_LOCALIZATION
1616

1717
# include <__algorithm/ranges_copy.h>
1818
# include <__chrono/calendar.h>
@@ -143,8 +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) && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && \
147-
!defined(_LIBCPP_HAS_NO_FILESYSTEM)
146+
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
148147
template <class _CharT, class _Duration, class _TimeZonePtr>
149148
_LIBCPP_HIDE_FROM_ABI void
150149
__format_sub_seconds(basic_stringstream<_CharT>& __sstr, const chrono::zoned_time<_Duration, _TimeZonePtr>& __value) {
@@ -156,8 +155,7 @@ template <class _Tp>
156155
consteval bool __use_fraction() {
157156
if constexpr (__is_time_point<_Tp>)
158157
return chrono::hh_mm_ss<typename _Tp::duration>::fractional_width;
159-
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && \
160-
!defined(_LIBCPP_HAS_NO_FILESYSTEM)
158+
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
161159
else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
162160
return chrono::hh_mm_ss<typename _Tp::duration>::fractional_width;
163161
# endif
@@ -232,7 +230,7 @@ _LIBCPP_HIDE_FROM_ABI __time_zone __convert_to_time_zone([[maybe_unused]] const
232230
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
233231
if constexpr (same_as<_Tp, chrono::sys_info>)
234232
return {__value.abbrev, __value.offset};
235-
# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
233+
# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
236234
else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
237235
return __formatter::__convert_to_time_zone(__value.get_info());
238236
# endif
@@ -450,7 +448,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_ok(const _Tp& __value) {
450448
return true;
451449
else if constexpr (same_as<_Tp, chrono::local_info>)
452450
return true;
453-
# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
451+
# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
454452
else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
455453
return true;
456454
# endif
@@ -500,7 +498,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_name_ok(const _Tp& __value) {
500498
return true;
501499
else if constexpr (same_as<_Tp, chrono::local_info>)
502500
return true;
503-
# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
501+
# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
504502
else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
505503
return true;
506504
# endif
@@ -550,7 +548,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __date_ok(const _Tp& __value) {
550548
return true;
551549
else if constexpr (same_as<_Tp, chrono::local_info>)
552550
return true;
553-
# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
551+
# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
554552
else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
555553
return true;
556554
# endif
@@ -600,7 +598,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __month_name_ok(const _Tp& __value) {
600598
return true;
601599
else if constexpr (same_as<_Tp, chrono::local_info>)
602600
return true;
603-
# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
601+
# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
604602
else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
605603
return true;
606604
# endif
@@ -964,7 +962,7 @@ struct formatter<chrono::local_info, _CharT> : public __formatter_chrono<_CharT>
964962
return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags{});
965963
}
966964
};
967-
# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
965+
# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
968966
// Note due to how libc++'s formatters are implemented there is no need to add
969967
// the exposition only local-time-format-t abstraction.
970968
template <class _Duration, class _TimeZonePtr, __fmt_char_type _CharT>
@@ -977,13 +975,13 @@ struct formatter<chrono::zoned_time<_Duration, _TimeZonePtr>, _CharT> : public _
977975
return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__clock);
978976
}
979977
};
980-
# endif // !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
978+
# endif // _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
981979
# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
982980

983981
# endif // if _LIBCPP_STD_VER >= 20
984982

985983
_LIBCPP_END_NAMESPACE_STD
986984

987-
#endif // !_LIBCPP_HAS_NO_LOCALIZATION
985+
#endif // _LIBCPP_HAS_LOCALIZATION
988986

989987
#endif // _LIBCPP___CHRONO_FORMATTER_H

libcxx/include/__chrono/high_resolution_clock.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2222

2323
namespace chrono {
2424

25-
#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
25+
#if _LIBCPP_HAS_MONOTONIC_CLOCK
2626
typedef steady_clock high_resolution_clock;
2727
#else
2828
typedef system_clock high_resolution_clock;

libcxx/include/__chrono/ostream.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include <__config>
1414

15-
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
15+
#if _LIBCPP_HAS_LOCALIZATION
1616

1717
# include <__chrono/calendar.h>
1818
# include <__chrono/day.h>
@@ -86,7 +86,7 @@ _LIBCPP_HIDE_FROM_ABI auto __units_suffix() {
8686
else if constexpr (same_as<typename _Period::type, nano>)
8787
return _LIBCPP_STATICALLY_WIDEN(_CharT, "ns");
8888
else if constexpr (same_as<typename _Period::type, micro>)
89-
# ifndef _LIBCPP_HAS_NO_UNICODE
89+
# if _LIBCPP_HAS_UNICODE
9090
return _LIBCPP_STATICALLY_WIDEN(_CharT, "\u00b5s");
9191
# else
9292
return _LIBCPP_STATICALLY_WIDEN(_CharT, "us");
@@ -307,7 +307,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const local_info& __info) {
307307
_LIBCPP_STATICALLY_WIDEN(_CharT, "{}: {{{}, {}}}"), __result(), __info.first, __info.second);
308308
}
309309

310-
# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
310+
# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
311311
template <class _CharT, class _Traits, class _Duration, class _TimeZonePtr>
312312
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
313313
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
322322

323323
_LIBCPP_END_NAMESPACE_STD
324324

325-
#endif // !_LIBCPP_HAS_NO_LOCALIZATION
325+
#endif // _LIBCPP_HAS_LOCALIZATION
326326

327327
#endif // _LIBCPP___CHRONO_OSTREAM_H

libcxx/include/__chrono/parser_std_format_spec.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include <__config>
1414

15-
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
15+
#if _LIBCPP_HAS_LOCALIZATION
1616

1717
# include <__format/concepts.h>
1818
# include <__format/format_error.h>
@@ -416,6 +416,6 @@ class _LIBCPP_TEMPLATE_VIS __parser_chrono {
416416

417417
_LIBCPP_END_NAMESPACE_STD
418418

419-
#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION)
419+
#endif // _LIBCPP_HAS_LOCALIZATION
420420

421421
#endif // _LIBCPP___CHRONO_PARSER_STD_FORMAT_SPEC_H

libcxx/include/__chrono/statically_widen.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2424

2525
#if _LIBCPP_STD_VER >= 20
2626

27-
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
27+
# if _LIBCPP_HAS_WIDE_CHARACTERS
2828
template <__fmt_char_type _CharT>
2929
_LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __str, const wchar_t* __wstr) {
3030
if constexpr (same_as<_CharT, char>)
@@ -33,7 +33,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __s
3333
return __wstr;
3434
}
3535
# define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str, L##__str)
36-
# else // _LIBCPP_HAS_NO_WIDE_CHARACTERS
36+
# else // _LIBCPP_HAS_WIDE_CHARACTERS
3737

3838
// Without this indirection the unit test test/libcxx/modules_include.sh.cpp
3939
// 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
4343
return __str;
4444
}
4545
# define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str)
46-
# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
46+
# endif // _LIBCPP_HAS_WIDE_CHARACTERS
4747

4848
#endif // _LIBCPP_STD_VER >= 20
4949

libcxx/include/__chrono/steady_clock.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2222

2323
namespace chrono {
2424

25-
#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
25+
#if _LIBCPP_HAS_MONOTONIC_CLOCK
2626
class _LIBCPP_EXPORTED_FROM_ABI steady_clock {
2727
public:
2828
typedef nanoseconds duration;

0 commit comments

Comments
 (0)