Skip to content

[libc++][numeric][NFC] Cleanup *Saturation arithmetic* tests #101826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
// REQUIRES: std-at-least-c++26

// <numeric>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
// REQUIRES: std-at-least-c++26

// The test uses "Placeholder variables with no name"
// UNSUPPORTED: apple-clang-15, apple-clang-16

// <numeric>

Expand All @@ -25,8 +28,7 @@ constexpr bool test_signed() {
constexpr auto minVal = std::numeric_limits<IntegerT>::min();
constexpr auto maxVal = std::numeric_limits<IntegerT>::max();

// TODO(LLVM-20) remove [[maybe_unused]] since all supported compilers support "Placeholder variables with no name"
[[maybe_unused]] std::same_as<IntegerT> decltype(auto) _ = std::add_sat(minVal, maxVal);
std::same_as<IntegerT> decltype(auto) _ = std::add_sat(minVal, maxVal);

static_assert(noexcept(std::add_sat(minVal, maxVal)));

Expand Down Expand Up @@ -97,8 +99,7 @@ constexpr bool test_unsigned() {
constexpr auto minVal = std::numeric_limits<IntegerT>::min();
constexpr auto maxVal = std::numeric_limits<IntegerT>::max();

// TODO(LLVM-20) remove [[maybe_unused]] since all supported compilers support "Placeholder variables with no name"
[[maybe_unused]] std::same_as<IntegerT> decltype(auto) _ = std::add_sat(minVal, maxVal);
std::same_as<IntegerT> decltype(auto) _ = std::add_sat(minVal, maxVal);

static_assert(noexcept(std::add_sat(minVal, maxVal)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
// REQUIRES: std-at-least-c++26

// REQUIRES: has-unix-headers
// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
// REQUIRES: std-at-least-c++26

// <numeric>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
// REQUIRES: std-at-least-c++26

// The test uses "Placeholder variables with no name"
// UNSUPPORTED: apple-clang-15, apple-clang-16

// <numeric>

Expand All @@ -26,8 +28,7 @@ constexpr bool test_signed() {
constexpr auto minVal = std::numeric_limits<IntegerT>::min();
constexpr auto maxVal = std::numeric_limits<IntegerT>::max();

// TODO(LLVM-20) remove [[maybe_unused]] and `{}` scope since all supported compilers support "Placeholder variables with no name"
[[maybe_unused]] std::same_as<IntegerT> decltype(auto) _ = std::div_sat(minVal, maxVal);
std::same_as<IntegerT> decltype(auto) _ = std::div_sat(minVal, maxVal);

static_assert(noexcept(std::div_sat(minVal, maxVal)));

Expand Down Expand Up @@ -89,8 +90,7 @@ constexpr bool test_unsigned() {
constexpr auto minVal = std::numeric_limits<IntegerT>::min();
constexpr auto maxVal = std::numeric_limits<IntegerT>::max();

// TODO(LLVM-20) remove [[maybe_unused]] since all supported compilers support "Placeholder variables with no name"
[[maybe_unused]] std::same_as<IntegerT> decltype(auto) _ = std::div_sat(minVal, maxVal);
std::same_as<IntegerT> decltype(auto) _ = std::div_sat(minVal, maxVal);
static_assert(noexcept(std::div_sat(minVal, maxVal)));

// clang-format off
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
// REQUIRES: std-at-least-c++26

// <numeric>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
// REQUIRES: std-at-least-c++26

// The test uses "Placeholder variables with no name"
// UNSUPPORTED: apple-clang-15, apple-clang-16

// <numeric>

Expand All @@ -26,8 +28,7 @@ constexpr bool test_signed() {
constexpr auto minVal = std::numeric_limits<IntegerT>::min();
constexpr auto maxVal = std::numeric_limits<IntegerT>::max();

// TODO(LLVM-20) remove [[maybe_unused]] since all supported compilers support "Placeholder variables with no name"
[[maybe_unused]] std::same_as<IntegerT> decltype(auto) _ = std::mul_sat(minVal, maxVal);
std::same_as<IntegerT> decltype(auto) _ = std::mul_sat(minVal, maxVal);

static_assert(noexcept(std::mul_sat(minVal, maxVal)));

Expand Down Expand Up @@ -103,8 +104,7 @@ constexpr bool test_unsigned() {
constexpr auto minVal = std::numeric_limits<IntegerT>::min();
constexpr auto maxVal = std::numeric_limits<IntegerT>::max();

// TODO(LLVM-20) remove [[maybe_unused]] since all supported compilers support "Placeholder variables with no name"
[[maybe_unused]] std::same_as<IntegerT> decltype(auto) _ = std::mul_sat(minVal, maxVal);
std::same_as<IntegerT> decltype(auto) _ = std::mul_sat(minVal, maxVal);

static_assert(noexcept(std::mul_sat(minVal, maxVal)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
// REQUIRES: std-at-least-c++26

// <numeric>

Expand Down
Loading