[flang-commits] [flang] [flang] Re-enable date_and_time intrinsic test (NFC) (PR #104967)

Kelvin Li via flang-commits flang-commits at lists.llvm.org
Tue Aug 20 07:45:34 PDT 2024


https://github.com/kkwli created https://github.com/llvm/llvm-project/pull/104967

`<charconv>` is no longer used. We should re-enable the test. In addition, `errno` needs to be reset in `TEST(TimeIntrinsics, DateAndTime)`.

>From aa789fb1e2d59f2e7da453b038a6d03ad1772681 Mon Sep 17 00:00:00 2001
From: Kelvin Li <kli at ca.ibm.com>
Date: Mon, 19 Aug 2024 16:30:11 -0400
Subject: [PATCH] [flang] Re-enable date_and_time intrinsic test (NFC)

---
 flang/unittests/Runtime/Time.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/flang/unittests/Runtime/Time.cpp b/flang/unittests/Runtime/Time.cpp
index 5c93282bca6115..9309d7b1ceffa0 100644
--- a/flang/unittests/Runtime/Time.cpp
+++ b/flang/unittests/Runtime/Time.cpp
@@ -6,8 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __clang__ // 16.0.3 lacks <charconv>
-
 #include "gtest/gtest.h"
 #include "flang/Runtime/time-intrinsic.h"
 #include <algorithm>
@@ -89,6 +87,7 @@ TEST(TimeIntrinsics, SystemClock) {
 }
 
 TEST(TimeIntrinsics, DateAndTime) {
+  errno = 0;
   constexpr std::size_t bufferSize{16};
   std::string date(bufferSize, 'Z'), time(bufferSize, 'Z'),
       zone(bufferSize, 'Z');
@@ -163,4 +162,3 @@ TEST(TimeIntrinsics, DateAndTime) {
     EXPECT_LE(minutes, 59);
   }
 }
-#endif // __clang__



More information about the flang-commits mailing list