Skip to content

Commit a9b419b

Browse files
committed
[libc++][RFC] Always define internal feature test macros
1 parent 93e69ab commit a9b419b

File tree

120 files changed

+742
-718
lines changed

Some content is hidden

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

120 files changed

+742
-718
lines changed

libcxx/include/__atomic/aliases.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ using atomic_long = atomic<long>;
3737
using atomic_ulong = atomic<unsigned long>;
3838
using atomic_llong = atomic<long long>;
3939
using atomic_ullong = atomic<unsigned long long>;
40-
#ifndef _LIBCPP_HAS_NO_CHAR8_T
40+
#if _LIBCPP_HAS_CHAR8_T
4141
using atomic_char8_t = atomic<char8_t>;
4242
#endif
4343
using atomic_char16_t = atomic<char16_t>;

libcxx/include/__atomic/atomic_lock_free.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE)
1919
# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE
2020
# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE
21-
# ifndef _LIBCPP_HAS_NO_CHAR8_T
21+
# if _LIBCPP_HAS_CHAR8_T
2222
# define ATOMIC_CHAR8_T_LOCK_FREE __CLANG_ATOMIC_CHAR8_T_LOCK_FREE
2323
# endif
2424
# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE
@@ -32,7 +32,7 @@
3232
#elif defined(__GCC_ATOMIC_BOOL_LOCK_FREE)
3333
# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
3434
# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
35-
# ifndef _LIBCPP_HAS_NO_CHAR8_T
35+
# if _LIBCPP_HAS_CHAR8_T
3636
# define ATOMIC_CHAR8_T_LOCK_FREE __GCC_ATOMIC_CHAR8_T_LOCK_FREE
3737
# endif
3838
# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE

libcxx/include/__availability

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,10 @@
352352
# define _LIBCPP_AVAILABILITY_HAS_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19
353353
# define _LIBCPP_AVAILABILITY_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_MARKUP
354354

355-
// Define availability attributes that depend on _LIBCPP_HAS_NO_EXCEPTIONS.
355+
// Define availability attributes that depend on _LIBCPP_HAS_EXCEPTIONS.
356356
// Those are defined in terms of the availability attributes above, and
357357
// should not be vendor-specific.
358-
#if defined(_LIBCPP_HAS_NO_EXCEPTIONS)
358+
#if !_LIBCPP_HAS_EXCEPTIONS
359359
# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
360360
# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
361361
# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
@@ -366,8 +366,8 @@
366366
#endif
367367

368368
// Define availability attributes that depend on both
369-
// _LIBCPP_HAS_NO_EXCEPTIONS and _LIBCPP_HAS_NO_RTTI.
370-
#if defined(_LIBCPP_HAS_NO_EXCEPTIONS) || defined(_LIBCPP_HAS_NO_RTTI)
369+
// _LIBCPP_HAS_EXCEPTIONS and _LIBCPP_HAS_RTTI.
370+
#if !_LIBCPP_HAS_EXCEPTIONS || !_LIBCPP_HAS_RTTI
371371
# undef _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
372372
# undef _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
373373
# define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 0

libcxx/include/__bit/byteswap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ template <integral _Tp>
3232
return __builtin_bswap32(__val);
3333
} else if constexpr (sizeof(_Tp) == 8) {
3434
return __builtin_bswap64(__val);
35-
# ifndef _LIBCPP_HAS_NO_INT128
35+
# if _LIBCPP_HAS_INT128
3636
} else if constexpr (sizeof(_Tp) == 16) {
3737
# if __has_builtin(__builtin_bswap128)
3838
return __builtin_bswap128(__val);
3939
# else
4040
return static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val))) << 64 |
4141
static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val >> 64)));
4242
# endif // __has_builtin(__builtin_bswap128)
43-
# endif // _LIBCPP_HAS_NO_INT128
43+
# endif // _LIBCPP_HAS_INT128
4444
} else {
4545
static_assert(sizeof(_Tp) == 0, "byteswap is unimplemented for integral types of this size");
4646
}

libcxx/include/__bit/countl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_cl
3939
return __builtin_clzll(__x);
4040
}
4141

42-
#ifndef _LIBCPP_HAS_NO_INT128
42+
#if _LIBCPP_HAS_INT128
4343
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(__uint128_t __x) _NOEXCEPT {
4444
# if __has_builtin(__builtin_clzg)
4545
return __builtin_clzg(__x);
@@ -57,7 +57,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(__uint128_t __x)
5757
: __builtin_clzll(static_cast<unsigned long long>(__x >> 64));
5858
# endif
5959
}
60-
#endif // _LIBCPP_HAS_NO_INT128
60+
#endif // _LIBCPP_HAS_INT128
6161

6262
template <class _Tp>
6363
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countl_zero(_Tp __t) _NOEXCEPT {

libcxx/include/__charconv/tables.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ inline constexpr uint64_t __pow10_64[20] = {
9595
UINT64_C(1000000000000000000),
9696
UINT64_C(10000000000000000000)};
9797

98-
# ifndef _LIBCPP_HAS_NO_INT128
98+
# if _LIBCPP_HAS_INT128
9999
inline constexpr int __pow10_128_offset = 0;
100100
inline constexpr __uint128_t __pow10_128[40] = {
101101
UINT64_C(0),

libcxx/include/__charconv/to_chars_base_10.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ __base_10_u64(char* __buffer, uint64_t __value) noexcept {
124124
return __itoa::__append10(__buffer, __value);
125125
}
126126

127-
# ifndef _LIBCPP_HAS_NO_INT128
127+
# if _LIBCPP_HAS_INT128
128128
/// \returns 10^\a exp
129129
///
130130
/// \pre \a exp [19, 39]

libcxx/include/__charconv/to_chars_integral.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ __to_chars_itoa(char* __first, char* __last, _Tp __value, false_type) {
7070
return {__last, errc::value_too_large};
7171
}
7272

73-
# ifndef _LIBCPP_HAS_NO_INT128
73+
# if _LIBCPP_HAS_INT128
7474
template <>
7575
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
7676
__to_chars_itoa(char* __first, char* __last, __uint128_t __value, false_type) {

libcxx/include/__charconv/traits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(uin
8888
}
8989
};
9090

91-
# ifndef _LIBCPP_HAS_NO_INT128
91+
# if _LIBCPP_HAS_INT128
9292
template <typename _Tp>
9393
struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(__uint128_t)> > {
9494
using type = __uint128_t;

libcxx/include/__chrono/file_clock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ _LIBCPP_END_NAMESPACE_STD
4848
#ifndef _LIBCPP_CXX03_LANG
4949
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
5050
struct _FilesystemClock {
51-
# if !defined(_LIBCPP_HAS_NO_INT128)
51+
# if _LIBCPP_HAS_INT128
5252
typedef __int128_t rep;
5353
typedef nano period;
5454
# else

libcxx/include/__config

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -533,14 +533,15 @@ _LIBCPP_HARDENING_MODE_DEBUG
533533
# define _NOEXCEPT noexcept
534534
# define _NOEXCEPT_(...) noexcept(__VA_ARGS__)
535535
# define _LIBCPP_CONSTEXPR constexpr
536+
# define _LIBCPP_HAS_NOEXCEPT 1
536537

537538
# else
538539

539540
# define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp)
540541
# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x))))
541542
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
542543
# define _LIBCPP_NORETURN __attribute__((__noreturn__))
543-
# define _LIBCPP_HAS_NO_NOEXCEPT
544+
# define _LIBCPP_HAS_NOEXCEPT 0
544545
# define nullptr __nullptr
545546
# define _NOEXCEPT throw()
546547
# define _NOEXCEPT_(...)
@@ -554,7 +555,9 @@ typedef __char32_t char32_t;
554555
# endif
555556

556557
# if !defined(__cpp_exceptions) || __cpp_exceptions < 199711L
557-
# define _LIBCPP_HAS_NO_EXCEPTIONS
558+
# define _LIBCPP_HAS_EXCEPTIONS 0
559+
# else
560+
# define _LIBCPP_HAS_EXCEPTIONS 1
558561
# endif
559562

560563
# define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp)
@@ -591,8 +594,10 @@ typedef __char32_t char32_t;
591594
# define _LIBCPP_HAS_BLOCKS_RUNTIME
592595
# endif
593596

594-
# if !__has_feature(address_sanitizer)
595-
# define _LIBCPP_HAS_NO_ASAN
597+
# if __has_feature(address_sanitizer)
598+
# define _LIBCPP_HAS_ASAN 1
599+
# else
600+
# define _LIBCPP_HAS_ASAN 0
596601
# endif
597602

598603
# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
@@ -601,8 +606,10 @@ typedef __char32_t char32_t;
601606

602607
# elif defined(_LIBCPP_COMPILER_GCC)
603608

604-
# if !defined(__SANITIZE_ADDRESS__)
605-
# define _LIBCPP_HAS_NO_ASAN
609+
# if defined(__SANITIZE_ADDRESS__)
610+
# define _LIBCPP_HAS_ASAN 1
611+
# else
612+
# define _LIBCPP_HAS_ASAN 0
606613
# endif
607614

608615
# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
@@ -727,7 +734,7 @@ typedef __char32_t char32_t;
727734
# define _LIBCPP_HARDENING_SIG n // "none"
728735
# endif
729736

730-
# ifdef _LIBCPP_HAS_NO_EXCEPTIONS
737+
# if !_LIBCPP_HAS_EXCEPTIONS
731738
# define _LIBCPP_EXCEPTIONS_SIG n
732739
# else
733740
# define _LIBCPP_EXCEPTIONS_SIG e
@@ -856,7 +863,9 @@ typedef __char32_t char32_t;
856863
# endif
857864

858865
# if !defined(__SIZEOF_INT128__) || defined(_MSC_VER)
859-
# define _LIBCPP_HAS_NO_INT128
866+
# define _LIBCPP_HAS_INT128 0
867+
# else
868+
# define _LIBCPP_HAS_INT128 1
860869
# endif
861870

862871
# ifdef _LIBCPP_CXX03_LANG
@@ -888,29 +897,37 @@ typedef __char32_t char32_t;
888897
// If we are getting operator new from the MSVC CRT, then allocation overloads
889898
// for align_val_t were added in 19.12, aka VS 2017 version 15.3.
890899
# if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
891-
# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
900+
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
892901
# elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new)
893902
// We're deferring to Microsoft's STL to provide aligned new et al. We don't
894903
// have it unless the language feature test macro is defined.
895-
# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
904+
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
896905
# elif defined(__MVS__)
897-
# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
906+
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
907+
# else
908+
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 1
898909
# endif
899910

900-
# if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) || (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)
901-
# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
911+
# if !_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION || (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)
912+
# define _LIBCPP_HAS_ALIGNED_ALLOCATION 0
913+
# else
914+
# define _LIBCPP_HAS_ALIGNED_ALLOCATION 1
902915
# endif
903916

904917
// It is not yet possible to use aligned_alloc() on all Apple platforms since
905918
// 10.15 was the first version to ship an implementation of aligned_alloc().
906919
# if defined(__APPLE__)
907920
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
908921
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500)
909-
# define _LIBCPP_HAS_NO_C11_ALIGNED_ALLOC
922+
# define _LIBCPP_HAS_C11_ALIGNED_ALLOC 0
923+
# else
924+
# define _LIBCPP_HAS_C11_ALIGNED_ALLOC 1
910925
# endif
911926
# elif defined(__ANDROID__) && __ANDROID_API__ < 28
912927
// Android only provides aligned_alloc when targeting API 28 or higher.
913-
# define _LIBCPP_HAS_NO_C11_ALIGNED_ALLOC
928+
# define _LIBCPP_HAS_C11_ALIGNED_ALLOC 0
929+
# else
930+
# define _LIBCPP_HAS_C11_ALIGNED_ALLOC 1
914931
# endif
915932

916933
# if defined(__APPLE__) || defined(__FreeBSD__)
@@ -922,7 +939,9 @@ typedef __char32_t char32_t;
922939
# endif
923940

924941
# if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t)
925-
# define _LIBCPP_HAS_NO_CHAR8_T
942+
# define _LIBCPP_HAS_CHAR8_T 0
943+
# else
944+
# define _LIBCPP_HAS_CHAR8_T 1
926945
# endif
927946

928947
// Deprecation macros.
@@ -989,7 +1008,7 @@ typedef __char32_t char32_t;
9891008
# define _LIBCPP_DEPRECATED_IN_CXX26
9901009
# endif
9911010

992-
# if !defined(_LIBCPP_HAS_NO_CHAR8_T)
1011+
# if _LIBCPP_HAS_CHAR8_T
9931012
# define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED
9941013
# else
9951014
# define _LIBCPP_DEPRECATED_WITH_CHAR8_T
@@ -1044,7 +1063,9 @@ typedef __char32_t char32_t;
10441063

10451064
// Try to find out if RTTI is disabled.
10461065
# if !defined(__cpp_rtti) || __cpp_rtti < 199711L
1047-
# define _LIBCPP_HAS_NO_RTTI
1066+
# define _LIBCPP_HAS_RTTI 0
1067+
# else
1068+
# define _LIBCPP_HAS_RTTI 1
10481069
# endif
10491070

10501071
# ifndef _LIBCPP_WEAK
@@ -1153,8 +1174,9 @@ typedef __char32_t char32_t;
11531174

11541175
# if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) && \
11551176
!defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP)
1156-
# define _LIBCPP_HAS_NO_ATOMIC_HEADER
1177+
# define _LIBCPP_HAS_ATOMIC_HEADER 0
11571178
# else
1179+
# define _LIBCPP_HAS_ATOMIC_HEADER 1
11581180
# ifndef _LIBCPP_ATOMIC_FLAG_TYPE
11591181
# define _LIBCPP_ATOMIC_FLAG_TYPE bool
11601182
# endif
@@ -1271,16 +1293,20 @@ typedef __char32_t char32_t;
12711293
// functions is gradually being added to existing C libraries. The conditions
12721294
// below check for known C library versions and conditions under which these
12731295
// functions are declared by the C library.
1274-
# define _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8
1296+
12751297
// GNU libc 2.36 and newer declare c8rtomb() and mbrtoc8() in C++ modes if
12761298
// __cpp_char8_t is defined or if C2X extensions are enabled. Determining
12771299
// the latter depends on internal GNU libc details that are not appropriate
12781300
// to depend on here, so any declarations present when __cpp_char8_t is not
12791301
// defined are ignored.
12801302
# if defined(_LIBCPP_GLIBC_PREREQ)
12811303
# if _LIBCPP_GLIBC_PREREQ(2, 36) && defined(__cpp_char8_t)
1282-
# undef _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8
1304+
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 1
1305+
# else
1306+
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 0
12831307
# endif
1308+
# else
1309+
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 0
12841310
# endif
12851311

12861312
// There are a handful of public standard library types that are intended to

libcxx/include/__debug_utils/sanitizers.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# pragma GCC system_header
1818
#endif
1919

20-
#ifndef _LIBCPP_HAS_NO_ASAN
20+
#if _LIBCPP_HAS_ASAN
2121

2222
extern "C" {
2323
_LIBCPP_EXPORTED_FROM_ABI void
@@ -28,12 +28,12 @@ _LIBCPP_EXPORTED_FROM_ABI int
2828
__sanitizer_verify_double_ended_contiguous_container(const void*, const void*, const void*, const void*);
2929
}
3030

31-
#endif // _LIBCPP_HAS_NO_ASAN
31+
#endif // _LIBCPP_HAS_ASAN
3232

3333
_LIBCPP_BEGIN_NAMESPACE_STD
3434

3535
// ASan choices
36-
#ifndef _LIBCPP_HAS_NO_ASAN
36+
#if _LIBCPP_HAS_ASAN
3737
# define _LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS 1
3838
#endif
3939

@@ -57,7 +57,7 @@ _LIBCPP_HIDE_FROM_ABI void __annotate_double_ended_contiguous_container(
5757
const void* __last_old_contained,
5858
const void* __first_new_contained,
5959
const void* __last_new_contained) {
60-
#ifdef _LIBCPP_HAS_NO_ASAN
60+
#if !_LIBCPP_HAS_ASAN
6161
(void)__first_storage;
6262
(void)__last_storage;
6363
(void)__first_old_contained;
@@ -86,7 +86,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __annotate_contiguous_c
8686
const void* __last_storage,
8787
const void* __old_last_contained,
8888
const void* __new_last_contained) {
89-
#ifdef _LIBCPP_HAS_NO_ASAN
89+
#if !_LIBCPP_HAS_ASAN
9090
(void)__first_storage;
9191
(void)__last_storage;
9292
(void)__old_last_contained;

libcxx/include/__exception/exception_ptr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class _LIBCPP_EXPORTED_FROM_ABI exception_ptr {
8787

8888
template <class _Ep>
8989
_LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT {
90-
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
90+
# if _LIBCPP_HAS_EXCEPTIONS
9191
# if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION && __cplusplus >= 201103L
9292
using _Ep2 = __decay_t<_Ep>;
9393

libcxx/include/__exception/nested_exception.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct __nested : public _Tp, public nested_exception {
4747
_LIBCPP_HIDE_FROM_ABI explicit __nested(const _Tp& __t) : _Tp(__t) {}
4848
};
4949

50-
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
50+
#if _LIBCPP_HAS_EXCEPTIONS
5151
template <class _Tp, class _Up, bool>
5252
struct __throw_with_nested;
5353

@@ -66,7 +66,7 @@ struct __throw_with_nested<_Tp, _Up, false> {
6666

6767
template <class _Tp>
6868
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void throw_with_nested(_Tp&& __t) {
69-
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
69+
#if _LIBCPP_HAS_EXCEPTIONS
7070
using _Up = __decay_t<_Tp>;
7171
static_assert(is_copy_constructible<_Up>::value, "type thrown must be CopyConstructible");
7272
__throw_with_nested<_Tp,

libcxx/include/__expected/expected.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct __expected_construct_unexpected_from_invoke_tag {};
7070

7171
template <class _Err, class _Arg>
7272
_LIBCPP_HIDE_FROM_ABI void __throw_bad_expected_access(_Arg&& __arg) {
73-
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
73+
# if _LIBCPP_HAS_EXCEPTIONS
7474
throw bad_expected_access<_Err>(std::forward<_Arg>(__arg));
7575
# else
7676
(void)__arg;

0 commit comments

Comments
 (0)