Skip to content

Commit f7cab64

Browse files
H-G-HristovZingam
andauthored
[libc++][numeric][NFC] Cleanup *Saturation arithmetic* tests (#101826)
This simplifies the tests a little bit: Fixed -> TODO(LLVM20): remove [[maybe_unused]] and `{}` scope since all supported compilers support "Placeholder variables with no name" *IMPORTANT: Requires Apple Clang with [P2169R4: A nice placeholder with no name](https://wg21.link/P2169R4)* --------- Co-authored-by: Hristo Hristov <[email protected]>
1 parent e30a5d6 commit f7cab64

11 files changed

+96
-95
lines changed

libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.compile.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

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

1111
// <numeric>
1212

libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.pass.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
9+
// REQUIRES: std-at-least-c++26
10+
11+
// The test uses "Placeholder variables with no name"
12+
// UNSUPPORTED: apple-clang-15, apple-clang-16
1013

1114
// <numeric>
1215

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

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

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

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

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

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

libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.assert.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

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

1111
// REQUIRES: has-unix-headers
1212
// REQUIRES: libcpp-hardening-mode={{extensive|debug}}

libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.compile.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

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

1111
// <numeric>
1212

libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.pass.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
9+
// REQUIRES: std-at-least-c++26
10+
1011
// The test uses "Placeholder variables with no name"
12+
// UNSUPPORTED: apple-clang-15, apple-clang-16
1113

1214
// <numeric>
1315

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

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

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

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

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

9696
// clang-format off

libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.compile.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

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

1111
// <numeric>
1212

libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.pass.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
9+
// REQUIRES: std-at-least-c++26
10+
1011
// The test uses "Placeholder variables with no name"
12+
// UNSUPPORTED: apple-clang-15, apple-clang-16
1113

1214
// <numeric>
1315

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

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

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

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

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

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

libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.compile.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

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

1111
// <numeric>
1212

0 commit comments

Comments
 (0)