[libc++][nfc] Add TEST_HAS_NO_INT128.

Avoid using the libc++ internal `_LIBCPP_HAS_NO_INT128` in our tests.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D117992
This commit is contained in:
Mark de Wever 2022-01-23 18:23:41 +01:00
parent 5d3ab6a2bb
commit 8f972cb0fd
81 changed files with 128 additions and 127 deletions

View File

@ -36,9 +36,9 @@ int main(int, char**)
assert(test<long>());
assert((test<UserDefinedIntegral<int>, int>()));
assert(test<size_t>());
#if !defined(_LIBCPP_HAS_NO_INT128)
#if !defined(TEST_HAS_NO_INT128)
assert(test<__int128_t>());
#endif // !defined(_LIBCPP_HAS_NO_INT128)
#endif // !defined(TEST_HAS_NO_INT128)
}
#if TEST_STD_VER >= 11
@ -47,9 +47,9 @@ int main(int, char**)
static_assert(test<int>(), "");
static_assert(test<long>(), "");
static_assert(test<size_t>(), "");
#if !defined(_LIBCPP_HAS_NO_INT128)
#if !defined(TEST_HAS_NO_INT128)
static_assert(test<__int128_t>(), "");
#endif // !defined(_LIBCPP_HAS_NO_INT128)
#endif // !defined(TEST_HAS_NO_INT128)
}
#endif // TEST_STD_VER >= 11

View File

@ -53,7 +53,7 @@ int main(int, char**)
test<uint32_t>();
test<uint64_t>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t>();
test<__uint128_t>();
#endif

View File

@ -107,7 +107,7 @@ int main(int, char**)
check_integral_types<unsigned long, unsigned long>();
check_integral_types<long long, long long>();
check_integral_types<unsigned long long, unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
check_integral_types<__int128_t, __int128_t>();
check_integral_types<__uint128_t, __uint128_t>();
#endif

View File

@ -181,7 +181,7 @@ void test() {
test<Context, long long, long long>(std::numeric_limits<long>::max());
test<Context, long long, long long>(std::numeric_limits<long long>::max());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<Context, __int128_t, __int128_t>(std::numeric_limits<__int128_t>::min());
test<Context, __int128_t, __int128_t>(std::numeric_limits<long long>::min());
test<Context, __int128_t, __int128_t>(std::numeric_limits<long>::min());
@ -242,7 +242,7 @@ void test() {
test<Context, unsigned long long, unsigned long long>(
std::numeric_limits<unsigned long long>::max());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<Context, __uint128_t, __uint128_t>(0);
test<Context, __uint128_t, __uint128_t>(
std::numeric_limits<unsigned char>::max());

View File

@ -172,7 +172,7 @@ void test() {
test<Context, long long, long long>(std::numeric_limits<long>::max());
test<Context, long long, long long>(std::numeric_limits<long long>::max());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<Context, __int128_t, __int128_t>(std::numeric_limits<__int128_t>::min());
test<Context, __int128_t, __int128_t>(std::numeric_limits<long long>::min());
test<Context, __int128_t, __int128_t>(std::numeric_limits<long>::min());
@ -233,7 +233,7 @@ void test() {
test<Context, unsigned long long, unsigned long long>(
std::numeric_limits<unsigned long long>::max());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<Context, __uint128_t, __uint128_t>(0);
test<Context, __uint128_t, __uint128_t>(
std::numeric_limits<unsigned char>::max());

View File

@ -60,7 +60,7 @@ static_assert(std::common_with<void, void>);
static_assert(CheckCommonWith<int, int>());
static_assert(CheckCommonWith<int, long>());
static_assert(CheckCommonWith<int, unsigned char>());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(CheckCommonWith<int, __int128_t>());
#endif
static_assert(CheckCommonWith<int, double>());

View File

@ -54,7 +54,7 @@ static_assert(std::common_reference_with<void, void>);
static_assert(CheckCommonReferenceWith<int, int>());
static_assert(CheckCommonReferenceWith<int, long>());
static_assert(CheckCommonReferenceWith<int, unsigned char>());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(CheckCommonReferenceWith<int, __int128_t>());
#endif
static_assert(CheckCommonReferenceWith<int, double>());

View File

@ -60,7 +60,7 @@ static_assert(CheckIntegralQualifiers<long long>());
static_assert(CheckIntegralQualifiers<unsigned long long>());
// extended integers
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(CheckIntegralQualifiers<__int128_t>());
static_assert(CheckIntegralQualifiers<__uint128_t>());
#endif

View File

@ -74,7 +74,7 @@ static_assert(!CheckSignedIntegralQualifiers<unsigned long>());
static_assert(!CheckSignedIntegralQualifiers<unsigned long long>());
// extended integers
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(CheckSignedIntegralQualifiers<__int128_t>());
static_assert(!CheckSignedIntegralQualifiers<__uint128_t>());
#endif

View File

@ -69,7 +69,7 @@ static_assert(CheckUnsignedIntegralQualifiers<char32_t>() ==
!std::is_signed_v<char32_t>);
// extended integers
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(CheckUnsignedIntegralQualifiers<__uint128_t>());
static_assert(!CheckUnsignedIntegralQualifiers<__int128_t>());
#endif

View File

@ -34,7 +34,7 @@ static_assert(std::three_way_comparable<char8_t const&>);
static_assert(std::three_way_comparable<char16_t volatile&>);
static_assert(std::three_way_comparable<char32_t const volatile&>);
#endif
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(std::three_way_comparable<__int128_t const&>);
static_assert(std::three_way_comparable<__uint128_t const&>);
#endif

View File

@ -63,7 +63,7 @@ int main(int, char**)
test<unsigned long>();
test<signed long long>();
test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t>();
test<__uint128_t>();
#endif

View File

@ -138,7 +138,7 @@ int main(int, char**)
TEST_NUMERIC_LIMITS(volatile long)
TEST_NUMERIC_LIMITS(const volatile long)
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
TEST_NUMERIC_LIMITS(__int128_t)
TEST_NUMERIC_LIMITS(const __int128_t)
TEST_NUMERIC_LIMITS(volatile __int128_t)
@ -175,7 +175,7 @@ int main(int, char**)
TEST_NUMERIC_LIMITS(volatile unsigned long long)
TEST_NUMERIC_LIMITS(const volatile unsigned long long)
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
TEST_NUMERIC_LIMITS(__uint128_t)
TEST_NUMERIC_LIMITS(const __uint128_t)
TEST_NUMERIC_LIMITS(volatile __uint128_t)

View File

@ -48,7 +48,7 @@ int main(int, char**)
test<unsigned long>(0);
test<long long>(0);
test<unsigned long long>(0);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t>(0);
test<__uint128_t>(0);
#endif

View File

@ -47,7 +47,7 @@ int main(int, char**)
test<unsigned long, sizeof(long) == 4 ? 32 : 64>();
test<long long, 63>();
test<unsigned long long, 64>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, 127>();
test<__uint128_t, 128>();
#endif

View File

@ -51,7 +51,7 @@ int main(int, char**)
test<unsigned long, sizeof(long) == 4 ? 9 : 19>();
test<long long, 18>();
test<unsigned long long, 19>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, 38>();
test<__uint128_t, 38>();
#endif

View File

@ -48,7 +48,7 @@ int main(int, char**)
test<unsigned long>(0);
test<long long>(0);
test<unsigned long long>(0);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t>(0);
test<__uint128_t>(0);
#endif

View File

@ -46,7 +46,7 @@ int main(int, char**)
test<unsigned long, std::denorm_absent>();
test<long long, std::denorm_absent>();
test<unsigned long long, std::denorm_absent>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, std::denorm_absent>();
test<__uint128_t, std::denorm_absent>();
#endif

View File

@ -46,7 +46,7 @@ int main(int, char**)
test<unsigned long, false>();
test<long long, false>();
test<unsigned long long, false>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, false>();
test<__uint128_t, false>();
#endif

View File

@ -46,7 +46,7 @@ int main(int, char**)
test<unsigned long, false>();
test<long long, false>();
test<unsigned long long, false>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, false>();
test<__uint128_t, false>();
#endif

View File

@ -46,7 +46,7 @@ int main(int, char**)
test<unsigned long, false>();
test<long long, false>();
test<unsigned long long, false>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, false>();
test<__uint128_t, false>();
#endif

View File

@ -46,7 +46,7 @@ int main(int, char**)
test<unsigned long, false>();
test<long long, false>();
test<unsigned long long, false>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, false>();
test<__uint128_t, false>();
#endif

View File

@ -50,7 +50,7 @@ int main(int, char**)
test<unsigned long>(0);
test<long long>(0);
test<unsigned long long>(0);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t>(0);
test<__uint128_t>(0);
#endif

View File

@ -46,7 +46,7 @@ int main(int, char**)
test<unsigned long, true>();
test<long long, true>();
test<unsigned long long, true>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, true>();
test<__uint128_t, true>();
#endif

View File

@ -46,7 +46,7 @@ int main(int, char**)
test<unsigned long, true>();
test<long long, true>();
test<unsigned long long, true>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, true>();
test<__uint128_t, true>();
#endif

View File

@ -46,7 +46,7 @@ int main(int, char**)
test<unsigned long, false>();
test<long long, false>();
test<unsigned long long, false>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, false>();
test<__uint128_t, false>();
#endif

View File

@ -46,7 +46,7 @@ int main(int, char**)
test<unsigned long, true>();
test<long long, true>();
test<unsigned long long, true>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, true>();
test<__uint128_t, true>();
#endif

View File

@ -46,7 +46,7 @@ int main(int, char**)
test<unsigned long, true>();
test<long long, false>();
test<unsigned long long, true>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, false>();
test<__uint128_t, true>();
#endif

View File

@ -46,7 +46,7 @@ int main(int, char**)
test<unsigned long, false>();
test<long long, true>();
test<unsigned long long, false>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, true>();
test<__uint128_t, false>();
#endif

View File

@ -59,7 +59,7 @@ int main(int, char**)
test<unsigned long>(0);
test<long long>(LLONG_MIN);
test<unsigned long long>(0);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t>(-__int128_t(__uint128_t(-1)/2) - 1);
test<__uint128_t>(0);
#endif

View File

@ -59,7 +59,7 @@ int main(int, char**)
test<unsigned long>(ULONG_MAX);
test<long long>(LLONG_MAX);
test<unsigned long long>(ULLONG_MAX);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t>(__int128_t(__uint128_t(-1)/2));
test<__uint128_t>(__uint128_t(-1));
#endif

View File

@ -47,7 +47,7 @@ int main(int, char**)
test<unsigned long, 0>();
test<long long, 0>();
test<unsigned long long, 0>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, 0>();
test<__uint128_t, 0>();
#endif

View File

@ -47,7 +47,7 @@ int main(int, char**)
test<unsigned long, 0>();
test<long long, 0>();
test<unsigned long long, 0>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, 0>();
test<__uint128_t, 0>();
#endif

View File

@ -47,7 +47,7 @@ int main(int, char**)
test<unsigned long, 0>();
test<long long, 0>();
test<unsigned long long, 0>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, 0>();
test<__uint128_t, 0>();
#endif

View File

@ -59,7 +59,7 @@ int main(int, char**)
test<unsigned long>(0);
test<long long>(LLONG_MIN);
test<unsigned long long>(0);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t>(-__int128_t(__uint128_t(-1)/2) - 1);
test<__uint128_t>(0);
#endif

View File

@ -47,7 +47,7 @@ int main(int, char**)
test<unsigned long, 0>();
test<long long, 0>();
test<unsigned long long, 0>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, 0>();
test<__uint128_t, 0>();
#endif

View File

@ -47,7 +47,7 @@ int main(int, char**)
test<unsigned long, 0>();
test<long long, 0>();
test<unsigned long long, 0>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, 0>();
test<__uint128_t, 0>();
#endif

View File

@ -67,7 +67,7 @@ int main(int, char**)
test<unsigned long>();
test<long long>();
test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t>();
test<__uint128_t>();
#endif

View File

@ -47,7 +47,7 @@ int main(int, char**)
test<unsigned long, 2>();
test<long long, 2>();
test<unsigned long long, 2>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, 2>();
test<__uint128_t, 2>();
#endif

View File

@ -48,7 +48,7 @@ int main(int, char**)
test<unsigned long>(0);
test<long long>(0);
test<unsigned long long>(0);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t>(0);
test<__uint128_t>(0);
#endif

View File

@ -46,7 +46,7 @@ int main(int, char**)
test<unsigned long, std::round_toward_zero>();
test<long long, std::round_toward_zero>();
test<unsigned long long, std::round_toward_zero>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, std::round_toward_zero>();
test<__uint128_t, std::round_toward_zero>();
#endif

View File

@ -67,7 +67,7 @@ int main(int, char**)
test<unsigned long>();
test<long long>();
test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t>();
test<__uint128_t>();
#endif

View File

@ -46,7 +46,7 @@ int main(int, char**)
test<unsigned long, false>();
test<long long, false>();
test<unsigned long long, false>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, false>();
test<__uint128_t, false>();
#endif

View File

@ -53,7 +53,7 @@ int main(int, char**)
test<unsigned long, integral_types_trap>();
test<long long, integral_types_trap>();
test<unsigned long long, integral_types_trap>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t, integral_types_trap>();
test<__uint128_t, integral_types_trap>();
#endif

View File

@ -53,7 +53,7 @@ constexpr bool test()
assert(std::bit_ceil(T(68)) == T(128));
assert(std::bit_ceil(T(69)) == T(128));
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
if constexpr (std::is_same_v<T, __uint128_t>) {
T val = 168;
T ceil = 256;
@ -80,7 +80,7 @@ int main(int, char**)
static_assert(!std::is_invocable_v<L, int>);
static_assert(!std::is_invocable_v<L, long>);
static_assert(!std::is_invocable_v<L, long long>);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(!std::is_invocable_v<L, __int128_t>);
#endif
@ -112,7 +112,7 @@ int main(int, char**)
static_assert(test<unsigned int>());
static_assert(test<unsigned long>());
static_assert(test<unsigned long long>());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(test<__uint128_t>());
#endif
static_assert(test<uint8_t>());
@ -128,7 +128,7 @@ int main(int, char**)
test<unsigned int>();
test<unsigned long>();
test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__uint128_t>();
#endif
test<uint8_t>();

View File

@ -49,7 +49,7 @@ constexpr bool test()
assert(std::bit_floor(T(129)) == T(128));
assert(std::bit_floor(max) == T(max - (max >> 1)));
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
if constexpr (std::is_same_v<T, __uint128_t>) {
T val = T(128) << 32;
assert(std::bit_floor(val-1) == val/2);
@ -76,7 +76,7 @@ int main(int, char**)
static_assert(!std::is_invocable_v<L, int>);
static_assert(!std::is_invocable_v<L, long>);
static_assert(!std::is_invocable_v<L, long long>);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(!std::is_invocable_v<L, __int128_t>);
#endif
@ -108,7 +108,7 @@ int main(int, char**)
static_assert(test<unsigned int>());
static_assert(test<unsigned long>());
static_assert(test<unsigned long long>());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(test<__uint128_t>());
#endif
@ -125,7 +125,7 @@ int main(int, char**)
test<unsigned int>();
test<unsigned long>();
test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__uint128_t>();
#endif

View File

@ -52,7 +52,7 @@ constexpr bool test()
assert(std::bit_width(T(max - 1)) == T(std::numeric_limits<T>::digits));
assert(std::bit_width(max) == T(std::numeric_limits<T>::digits));
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
if constexpr (std::is_same_v<T, __uint128_t>) {
T val = 128;
val <<= 32;
@ -81,7 +81,7 @@ int main(int, char**)
static_assert(!std::is_invocable_v<L, int>);
static_assert(!std::is_invocable_v<L, long>);
static_assert(!std::is_invocable_v<L, long long>);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(!std::is_invocable_v<L, __int128_t>);
#endif
@ -113,7 +113,7 @@ int main(int, char**)
static_assert(test<unsigned int>());
static_assert(test<unsigned long>());
static_assert(test<unsigned long long>());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(test<__uint128_t>());
#endif
static_assert(test<uint8_t>());
@ -129,7 +129,7 @@ int main(int, char**)
test<unsigned int>();
test<unsigned long>();
test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__uint128_t>();
#endif
test<uint8_t>();

View File

@ -46,7 +46,7 @@ constexpr bool test()
assert(!std::has_single_bit(T(129)));
assert(!std::has_single_bit(max));
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
if constexpr (std::is_same_v<T, __uint128_t>) {
T val = T(1) << 32;
assert(!std::has_single_bit(val-1));
@ -79,7 +79,7 @@ int main(int, char**)
static_assert(!std::is_invocable_v<L, int>);
static_assert(!std::is_invocable_v<L, long>);
static_assert(!std::is_invocable_v<L, long long>);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(!std::is_invocable_v<L, __int128_t>);
#endif
@ -111,7 +111,7 @@ int main(int, char**)
static_assert(test<unsigned int>());
static_assert(test<unsigned long>());
static_assert(test<unsigned long long>());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(test<__uint128_t>());
#endif
static_assert(test<uint8_t>());
@ -127,7 +127,7 @@ int main(int, char**)
test<unsigned int>();
test<unsigned long>();
test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__uint128_t>();
#endif
test<uint8_t>();

View File

@ -51,7 +51,7 @@ constexpr bool test()
assert(std::countl_one(T(max - 127)) == std::numeric_limits<T>::digits - 7);
assert(std::countl_one(T(max - 128)) == std::numeric_limits<T>::digits - 8);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
if constexpr (std::is_same_v<T, __uint128_t>) {
T val = 128;
assert(std::countl_one(~val) == 120);
@ -76,7 +76,7 @@ int main(int, char**)
static_assert(!std::is_invocable_v<L, int>);
static_assert(!std::is_invocable_v<L, long>);
static_assert(!std::is_invocable_v<L, long long>);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(!std::is_invocable_v<L, __int128_t>);
#endif
@ -108,7 +108,7 @@ int main(int, char**)
static_assert(test<unsigned int>());
static_assert(test<unsigned long>());
static_assert(test<unsigned long long>());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(test<__uint128_t>());
#endif
static_assert(test<uint8_t>());
@ -124,7 +124,7 @@ int main(int, char**)
test<unsigned int>();
test<unsigned long>();
test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__uint128_t>();
#endif
test<uint8_t>();

View File

@ -48,7 +48,7 @@ constexpr bool test()
assert(std::countl_zero(T(128)) == dig - 8);
assert(std::countl_zero(max) == 0);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
if constexpr (std::is_same_v<T, __uint128_t>) {
T val = T(128) << 32;
assert(std::countl_zero(val-1) == 89);
@ -75,7 +75,7 @@ int main(int, char**)
static_assert(!std::is_invocable_v<L, int>);
static_assert(!std::is_invocable_v<L, long>);
static_assert(!std::is_invocable_v<L, long long>);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(!std::is_invocable_v<L, __int128_t>);
#endif
@ -107,7 +107,7 @@ int main(int, char**)
static_assert(test<unsigned int>());
static_assert(test<unsigned long>());
static_assert(test<unsigned long long>());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(test<__uint128_t>());
#endif
static_assert(test<uint8_t>());
@ -123,7 +123,7 @@ int main(int, char**)
test<unsigned int>();
test<unsigned long>();
test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__uint128_t>();
#endif
test<uint8_t>();

View File

@ -49,7 +49,7 @@ constexpr bool test()
assert(std::countr_one(T(max - 1)) == 0);
assert(std::countr_one(max) == std::numeric_limits<T>::digits);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
if constexpr (std::is_same_v<T, __uint128_t>) {
T val = 128;
assert(std::countr_one(val-1) == 7);
@ -80,7 +80,7 @@ int main(int, char**)
static_assert(!std::is_invocable_v<L, int>);
static_assert(!std::is_invocable_v<L, long>);
static_assert(!std::is_invocable_v<L, long long>);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(!std::is_invocable_v<L, __int128_t>);
#endif
@ -112,7 +112,7 @@ int main(int, char**)
static_assert(test<unsigned int>());
static_assert(test<unsigned long>());
static_assert(test<unsigned long long>());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(test<__uint128_t>());
#endif
static_assert(test<uint8_t>());
@ -128,7 +128,7 @@ int main(int, char**)
test<unsigned int>();
test<unsigned long>();
test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__uint128_t>();
#endif
test<uint8_t>();

View File

@ -50,7 +50,7 @@ constexpr bool test()
assert(std::countr_zero(T(130)) == 1);
assert(std::countr_zero(max) == 0);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
if constexpr (std::is_same_v<T, __uint128_t>) {
T val = T(128) << 32;
assert(std::countr_zero(val-1) == 0);
@ -77,7 +77,7 @@ int main(int, char**)
static_assert(!std::is_invocable_v<L, int>);
static_assert(!std::is_invocable_v<L, long>);
static_assert(!std::is_invocable_v<L, long long>);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(!std::is_invocable_v<L, __int128_t>);
#endif
@ -109,7 +109,7 @@ int main(int, char**)
static_assert(test<unsigned int>());
static_assert(test<unsigned long>());
static_assert(test<unsigned long long>());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(test<__uint128_t>());
#endif
static_assert(test<uint8_t>());
@ -125,7 +125,7 @@ int main(int, char**)
test<unsigned int>();
test<unsigned long>();
test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__uint128_t>();
#endif
test<uint8_t>();

View File

@ -50,7 +50,7 @@ constexpr bool test()
assert(std::popcount(T(max - 1)) == std::numeric_limits<T>::digits - 1);
assert(std::popcount(max) == std::numeric_limits<T>::digits);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
if constexpr (std::is_same_v<T, __uint128_t>) {
T val = 128;
assert(std::popcount(val-1) == 7);
@ -87,7 +87,7 @@ int main(int, char**)
static_assert(!std::is_invocable_v<L, int>);
static_assert(!std::is_invocable_v<L, long>);
static_assert(!std::is_invocable_v<L, long long>);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(!std::is_invocable_v<L, __int128_t>);
#endif
@ -119,7 +119,7 @@ int main(int, char**)
static_assert(test<unsigned int>());
static_assert(test<unsigned long>());
static_assert(test<unsigned long long>());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(test<__uint128_t>());
#endif
static_assert(test<uint8_t>());
@ -135,7 +135,7 @@ int main(int, char**)
test<unsigned int>();
test<unsigned long>();
test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__uint128_t>();
#endif
test<uint8_t>();

View File

@ -49,7 +49,7 @@ constexpr bool test()
assert(std::rotl(T(1), 6) == T(64));
assert(std::rotl(T(1), 7) == T(128));
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
if constexpr (std::is_same_v<T, __uint128_t>) {
T val = (T(1) << 63) | (T(1) << 64);
assert(std::rotl(val, 0) == val);
@ -75,7 +75,7 @@ int main(int, char**)
static_assert(!std::is_invocable_v<L, int>);
static_assert(!std::is_invocable_v<L, long>);
static_assert(!std::is_invocable_v<L, long long>);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(!std::is_invocable_v<L, __int128_t>);
#endif
@ -107,7 +107,7 @@ int main(int, char**)
static_assert(test<unsigned int>());
static_assert(test<unsigned long>());
static_assert(test<unsigned long long>());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(test<__uint128_t>());
#endif
@ -124,7 +124,7 @@ int main(int, char**)
test<unsigned int>();
test<unsigned long>();
test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__uint128_t>();
#endif

View File

@ -50,7 +50,7 @@ constexpr bool test()
assert(std::rotr(T(128), 6) == T(2));
assert(std::rotr(T(128), 7) == T(1));
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
if constexpr (std::is_same_v<T, __uint128_t>) {
T val = (T(1) << 63) | (T(1) << 64);
assert(std::rotr(val, 0) == val);
@ -76,7 +76,7 @@ int main(int, char**)
static_assert(!std::is_invocable_v<L, int>);
static_assert(!std::is_invocable_v<L, long>);
static_assert(!std::is_invocable_v<L, long long>);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(!std::is_invocable_v<L, __int128_t>);
#endif
@ -108,7 +108,7 @@ int main(int, char**)
static_assert(test<unsigned int>());
static_assert(test<unsigned long>());
static_assert(test<unsigned long long>());
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(test<__uint128_t>());
#endif
@ -125,7 +125,7 @@ int main(int, char**)
test<unsigned int>();
test<unsigned long>();
test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__uint128_t>();
#endif

View File

@ -64,7 +64,7 @@ constexpr bool test() {
test_num<int32_t>(0x01234567, 0x67452301);
test_num<int64_t>(0x0123456789ABCDEF, 0xEFCDAB8967452301);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
const auto in = static_cast<__uint128_t>(0x0123456789ABCDEF) << 64 | 0x13579BDF02468ACE;
const auto expected = static_cast<__uint128_t>(0xCE8A4602DF9B5713) << 64 | 0xEFCDAB8967452301;
test_num<__uint128_t>(in, expected);

View File

@ -129,7 +129,7 @@ int main(int, char**)
unsigned_test<uint32_t>();
unsigned_test<uint64_t>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
unsigned_test<__uint128_t>();
signed_test<__int128_t>();
#endif

View File

@ -133,7 +133,7 @@ int main(int, char**)
// or unsigned long long.
// (We support __int128 as an extension.)
#if !defined(_LIBCPP_HAS_NO_INT128) && !defined(TEST_BUGGY_I128_FP)
#if !defined(TEST_HAS_NO_INT128) && !defined(TEST_BUGGY_I128_FP)
test_statistics<__int128_t, std::minstd_rand0>();
test_statistics<__uint128_t, std::minstd_rand0>();

View File

@ -22,7 +22,7 @@
int main(int, char**) {
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
// Test that values outside of the 64-bit range can be produced.
{
@ -80,7 +80,7 @@ int main(int, char**) {
}
}
#endif // _LIBCPP_HAS_NO_INT128
#endif // TEST_HAS_NO_INT128
return 0;
}

View File

@ -19,7 +19,7 @@
static_assert(std::uniform_random_bit_generator<
std::linear_congruential_engine<unsigned int, 0U, 1U, 2U> >);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(std::uniform_random_bit_generator<
std::subtract_with_carry_engine<__uint128_t, 1U, 2U, 3U> >);
#endif

View File

@ -110,7 +110,7 @@ void test_all_signed_integral_types() {
test_signed_integral_type<int, CharT>();
test_signed_integral_type<long, CharT>();
test_signed_integral_type<long long, CharT>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test_signed_integral_type<__int128_t, CharT>();
#endif
}

View File

@ -98,7 +98,7 @@ void test_all_unsigned_integral_types() {
test_unsigned_integral_type<unsigned, CharT>();
test_unsigned_integral_type<unsigned long, CharT>();
test_unsigned_integral_type<unsigned long long, CharT>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test_unsigned_integral_type<__uint128_t, CharT>();
#endif
}

View File

@ -61,7 +61,7 @@ constexpr void test() {
std::is_same_v<typename std::basic_format_context<OutIt, CharT>::
template formatter_type<unsigned long long>,
std::formatter<unsigned long long, CharT>>);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
static_assert(
std::is_same_v<typename std::basic_format_context<
OutIt, CharT>::template formatter_type<__int128_t>,

View File

@ -733,7 +733,7 @@ void format_test_signed_integer(TestFunction check, ExceptionTest check_exceptio
format_test_integer<int, CharT>(check, check_exception);
format_test_integer<long, CharT>(check, check_exception);
format_test_integer<long long, CharT>(check, check_exception);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
format_test_integer<__int128_t, CharT>(check, check_exception);
#endif
// *** check the minma and maxima ***
@ -790,7 +790,7 @@ void format_test_unsigned_integer(TestFunction check, ExceptionTest check_except
format_test_integer<unsigned, CharT>(check, check_exception);
format_test_integer<unsigned long, CharT>(check, check_exception);
format_test_integer<unsigned long long, CharT>(check, check_exception);
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
format_test_integer<__uint128_t, CharT>(check, check_exception);
#endif
// *** test the maxima ***
@ -2564,7 +2564,7 @@ void format_tests(TestFunction check, ExceptionTest check_exception) {
check(STR("hello 42"), STR("hello {}"), static_cast<int>(42));
check(STR("hello 42"), STR("hello {}"), static_cast<long>(42));
check(STR("hello 42"), STR("hello {}"), static_cast<long long>(42));
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
check(STR("hello 42"), STR("hello {}"), static_cast<__int128_t>(42));
{
// Note 128-bit support is only partly implemented test the range
@ -2587,7 +2587,7 @@ void format_tests(TestFunction check, ExceptionTest check_exception) {
check(STR("hello 42"), STR("hello {}"), static_cast<unsigned>(42));
check(STR("hello 42"), STR("hello {}"), static_cast<unsigned long>(42));
check(STR("hello 42"), STR("hello {}"), static_cast<unsigned long long>(42));
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
check(STR("hello 42"), STR("hello {}"), static_cast<__uint128_t>(42));
{
// Note 128-bit support is only partly implemented test the range

View File

@ -110,7 +110,7 @@ int main(int, char**)
test<uintmax_t>();
test<uintptr_t>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test<__int128_t>();
test<__uint128_t>();
#endif

View File

@ -26,7 +26,7 @@ enum BigEnum
big = 0xFFFFFFFFFFFFFFFFULL
};
#if !defined(_LIBCPP_HAS_NO_INT128) && !defined(_LIBCPP_HAS_NO_STRONG_ENUMS)
#if !defined(TEST_HAS_NO_INT128) && !defined(_LIBCPP_HAS_NO_STRONG_ENUMS)
enum HugeEnum : __uint128_t
{
hugezero
@ -59,7 +59,7 @@ int main(int, char**)
test_make_signed< const wchar_t, std::conditional<sizeof(wchar_t) == 4, const int, const short>::type >();
test_make_signed< const Enum, std::conditional<sizeof(Enum) == sizeof(int), const int, const signed char>::type >();
test_make_signed< BigEnum, std::conditional<sizeof(long) == 4, long long, long>::type >();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test_make_signed< __int128_t, __int128_t >();
test_make_signed< __uint128_t, __int128_t >();
# ifndef _LIBCPP_HAS_NO_STRONG_ENUMS

View File

@ -26,7 +26,7 @@ enum BigEnum
big = 0xFFFFFFFFFFFFFFFFULL
};
#if !defined(_LIBCPP_HAS_NO_INT128) && !defined(_LIBCPP_HAS_NO_STRONG_ENUMS)
#if !defined(TEST_HAS_NO_INT128) && !defined(_LIBCPP_HAS_NO_STRONG_ENUMS)
enum HugeEnum : __int128_t
{
hugezero
@ -60,7 +60,7 @@ int main(int, char**)
test_make_unsigned<const Enum, std::conditional<sizeof(Enum) == sizeof(int), const unsigned int, const unsigned char>::type >();
test_make_unsigned<BigEnum,
std::conditional<sizeof(long) == 4, unsigned long long, unsigned long>::type> ();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test_make_unsigned<__int128_t, __uint128_t>();
test_make_unsigned<__uint128_t, __uint128_t>();
# ifndef _LIBCPP_HAS_NO_STRONG_ENUMS

View File

@ -60,7 +60,7 @@ int main(int, char**)
test_integral<unsigned long>();
test_integral<long long>();
test_integral<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test_integral<__int128_t>();
test_integral<__uint128_t>();
#endif

View File

@ -50,7 +50,7 @@ int main(int, char**)
test_integral<unsigned long>();
test_integral<long long>();
test_integral<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test_integral<__int128_t>();
test_integral<__uint128_t>();
#endif

View File

@ -119,7 +119,7 @@ int main(int, char**)
test_is_not_signed<bool>();
test_is_not_signed<unsigned>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test_is_signed<__int128_t>();
test_is_not_signed<__uint128_t>();
#endif

View File

@ -119,7 +119,7 @@ int main(int, char**)
test_is_unsigned<bool>();
test_is_unsigned<unsigned>();
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
test_is_unsigned<__uint128_t>();
test_is_not_unsigned<__int128_t>();
#endif

View File

@ -89,7 +89,7 @@ constexpr void test2(const std::tuple<Ts...>&, const UTuple& utuple) {
constexpr bool test() {
std::tuple<
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
__int128_t, __uint128_t,
#endif
unsigned long long, long long, unsigned long, long, unsigned int, int,

View File

@ -80,7 +80,7 @@ constexpr void test2(const std::tuple<Ts...>&, const UTuple& utuple) {
constexpr bool test() {
std::tuple<
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
__int128_t, __uint128_t,
#endif
unsigned long long, long long, unsigned long, long, unsigned int, int,

View File

@ -82,7 +82,7 @@ constexpr void test2(const std::tuple<Ts...>&, const UTuple& utuple) {
constexpr bool test() {
std::tuple<
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
__int128_t, __uint128_t,
#endif
unsigned long long, long long, unsigned long, long, unsigned int, int,

View File

@ -81,7 +81,7 @@ constexpr void test2(const std::tuple<Ts...>&, const UTuple& utuple) {
constexpr bool test() {
std::tuple<
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
__int128_t, __uint128_t,
#endif
unsigned long long, long long, unsigned long, long, unsigned int, int,

View File

@ -81,7 +81,7 @@ constexpr void test2(const std::tuple<Ts...>&, const UTuple& utuple) {
constexpr bool test() {
std::tuple<
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
__int128_t, __uint128_t,
#endif
unsigned long long, long long, unsigned long, long, unsigned int, int,

View File

@ -88,7 +88,7 @@ constexpr void test2(const std::tuple<Ts...>&, const UTuple& utuple) {
constexpr bool test() {
std::tuple<
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
__int128_t, __uint128_t,
#endif
unsigned long long, long long, unsigned long, long, unsigned int, int,

View File

@ -64,7 +64,7 @@ constexpr void test1(const std::tuple<Ts...>&) {
constexpr bool test() {
std::tuple<
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
__int128_t, __uint128_t,
#endif
unsigned long long, long long, unsigned long, long, unsigned int, int,

View File

@ -62,9 +62,6 @@ const AssertionDialogAvoider assertion_dialog_avoider{};
#pragma warning(disable: 28251) // Inconsistent annotation for 'new': this instance has no annotations.
#endif // !defined(__clang__)
// MSVC doesn't have __int128_t.
#define _LIBCPP_HAS_NO_INT128
#ifndef _LIBCXX_IN_DEVCRT
// atomic_is_lock_free.pass.cpp needs this VS 2015 Update 2 fix.
#define _ENABLE_ATOMIC_ALIGNMENT_FIX

View File

@ -72,7 +72,7 @@ using LibraryHashTypes = TypeList<
unsigned long,
long long,
unsigned long long,
#ifndef _LIBCPP_HAS_NO_INT128
#ifndef TEST_HAS_NO_INT128
__int128_t,
__uint128_t,
#endif

View File

@ -368,6 +368,10 @@ inline void DoNotOptimize(Tp const& value) {
# define TEST_HAS_NO_UNICODE
#endif
#if defined(_LIBCPP_HAS_NO_INT128) || defined(TEST_COMPILER_MSVC)
# define TEST_HAS_NO_INT128
#endif
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif