[libcxx-commits] [libcxx] [libc++][test] Small fixes for time tests (PR #132532)
Stephan T. Lavavej via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Mar 22 00:25:19 PDT 2025
https://github.com/StephanTLavavej created https://github.com/llvm/llvm-project/pull/132532
* Fix copy-paste damage in `formatter.tai_time.pass.cpp`.
+ Comparing the `#if` to the `#else` case, it's clear that this half-copied check should be removed.
* Mark `is_steady` as `[[maybe_unused]]`.
+ It's only used within `LIBCPP_STATIC_ASSERT`.
>From ca6e2250d0442e2078a937426408cacb71b807ac Mon Sep 17 00:00:00 2001
From: "Stephan T. Lavavej" <stl at nuwen.net>
Date: Sat, 22 Mar 2025 00:13:58 -0700
Subject: [PATCH 1/2] Fix copy-paste damage in formatter.tai_time.pass.cpp.
Comparing the `#if` to the `#else` case, it's clear that this half-copied check should be removed.
---
libcxx/test/std/time/time.syn/formatter.tai_time.pass.cpp | 3 ---
1 file changed, 3 deletions(-)
diff --git a/libcxx/test/std/time/time.syn/formatter.tai_time.pass.cpp b/libcxx/test/std/time/time.syn/formatter.tai_time.pass.cpp
index 7ca088cc6e8f4..6a1d5bde44d35 100644
--- a/libcxx/test/std/time/time.syn/formatter.tai_time.pass.cpp
+++ b/libcxx/test/std/time/time.syn/formatter.tai_time.pass.cpp
@@ -268,9 +268,6 @@ static void test_valid_values_day() {
lfmt,
cr::tai_seconds(1'613'259'090s)); // 23:31:30 TAI Friday, 13 February 2009
- // Use the global locale (fr_FR)
- check(SV("%d='01'\t%Od='01'\t%e=' 1'\t%Oe=' 1'\n"),
- lfmt,
#else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
check(loc,
SV("%d='01'\t%Od='一'\t%e=' 1'\t%Oe='一'\n"),
>From 15c4baf2eee9f2842a61d827b28095ae3f91673d Mon Sep 17 00:00:00 2001
From: "Stephan T. Lavavej" <stl at nuwen.net>
Date: Sat, 22 Mar 2025 00:17:21 -0700
Subject: [PATCH 2/2] Mark `is_steady` as `[[maybe_unused]]`.
It's only used within `LIBCPP_STATIC_ASSERT`.
---
.../time.clock/time.clock.gps/types.compile.pass.cpp | 10 +++++-----
.../time.clock/time.clock.tai/types.compile.pass.cpp | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/libcxx/test/std/time/time.clock/time.clock.gps/types.compile.pass.cpp b/libcxx/test/std/time/time.clock/time.clock.gps/types.compile.pass.cpp
index af95c5fe73402..006ad9a2d243e 100644
--- a/libcxx/test/std/time/time.clock/time.clock.gps/types.compile.pass.cpp
+++ b/libcxx/test/std/time/time.clock/time.clock.gps/types.compile.pass.cpp
@@ -36,11 +36,11 @@
#include "test_macros.h"
// class gps_clock
-using rep = std::chrono::gps_clock::rep;
-using period = std::chrono::gps_clock::period;
-using duration = std::chrono::gps_clock::duration;
-using time_point = std::chrono::gps_clock::time_point;
-constexpr bool is_steady = std::chrono::gps_clock::is_steady;
+using rep = std::chrono::gps_clock::rep;
+using period = std::chrono::gps_clock::period;
+using duration = std::chrono::gps_clock::duration;
+using time_point = std::chrono::gps_clock::time_point;
+[[maybe_unused]] constexpr bool is_steady = std::chrono::gps_clock::is_steady;
// Tests the values. part of them are implementation defined.
LIBCPP_STATIC_ASSERT(std::same_as<rep, std::chrono::utc_clock::rep>);
diff --git a/libcxx/test/std/time/time.clock/time.clock.tai/types.compile.pass.cpp b/libcxx/test/std/time/time.clock/time.clock.tai/types.compile.pass.cpp
index ddb057333f49a..a7123bc3e0b5c 100644
--- a/libcxx/test/std/time/time.clock/time.clock.tai/types.compile.pass.cpp
+++ b/libcxx/test/std/time/time.clock/time.clock.tai/types.compile.pass.cpp
@@ -36,11 +36,11 @@
#include "test_macros.h"
// class tai_clock
-using rep = std::chrono::tai_clock::rep;
-using period = std::chrono::tai_clock::period;
-using duration = std::chrono::tai_clock::duration;
-using time_point = std::chrono::tai_clock::time_point;
-constexpr bool is_steady = std::chrono::tai_clock::is_steady;
+using rep = std::chrono::tai_clock::rep;
+using period = std::chrono::tai_clock::period;
+using duration = std::chrono::tai_clock::duration;
+using time_point = std::chrono::tai_clock::time_point;
+[[maybe_unused]] constexpr bool is_steady = std::chrono::tai_clock::is_steady;
// Tests the values. part of them are implementation defined.
LIBCPP_STATIC_ASSERT(std::same_as<rep, std::chrono::utc_clock::rep>);
More information about the libcxx-commits
mailing list