clock_cast and utc_time aren't supported by incoming GHS compiler
- The incoming GHS compiler version claims to support C++20, but doesn't support the clock_cast and utc_time. Also there is no concrete date or plan to add it. For future smooth switch to C++20 on INTEGRITY, disable the __cpp_lib_chrono >= 201907L usage there. Change-Id: I52dd5ac71bce2714d66f25ccd73e1703cd705267 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
7d7be38d95
commit
d7969320de
@ -38,7 +38,8 @@ using IntRep = int64_t;
|
|||||||
using IntRep = int;
|
using IntRep = int;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __cpp_lib_chrono >= 201907L
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
|
#if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
|
||||||
using std::chrono::days;
|
using std::chrono::days;
|
||||||
using std::chrono::weeks;
|
using std::chrono::weeks;
|
||||||
using std::chrono::years;
|
using std::chrono::years;
|
||||||
|
@ -32,7 +32,8 @@ public:
|
|||||||
constexpr QDate() : jd(nullJd()) {}
|
constexpr QDate() : jd(nullJd()) {}
|
||||||
QDate(int y, int m, int d);
|
QDate(int y, int m, int d);
|
||||||
QDate(int y, int m, int d, QCalendar cal);
|
QDate(int y, int m, int d, QCalendar cal);
|
||||||
#if __cpp_lib_chrono >= 201907L || defined(Q_QDOC)
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
|
#if (__cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)) || defined(Q_QDOC)
|
||||||
QT_POST_CXX17_API_IN_EXPORTED_CLASS
|
QT_POST_CXX17_API_IN_EXPORTED_CLASS
|
||||||
Q_IMPLICIT constexpr QDate(std::chrono::year_month_day date) noexcept
|
Q_IMPLICIT constexpr QDate(std::chrono::year_month_day date) noexcept
|
||||||
: jd(date.ok() ? stdSysDaysToJulianDay(date QT6_CALL_NEW_OVERLOAD_TAIL) : nullJd())
|
: jd(date.ok() ? stdSysDaysToJulianDay(date QT6_CALL_NEW_OVERLOAD_TAIL) : nullJd())
|
||||||
@ -114,7 +115,8 @@ public:
|
|||||||
void getDate(int *year, int *month, int *day) const;
|
void getDate(int *year, int *month, int *day) const;
|
||||||
|
|
||||||
[[nodiscard]] QDate addDays(qint64 days) const;
|
[[nodiscard]] QDate addDays(qint64 days) const;
|
||||||
#if __cpp_lib_chrono >= 201907L || defined(Q_QDOC)
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
|
#if (__cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)) || defined(Q_QDOC)
|
||||||
QT_POST_CXX17_API_IN_EXPORTED_CLASS
|
QT_POST_CXX17_API_IN_EXPORTED_CLASS
|
||||||
[[nodiscard]] QDate addDuration(std::chrono::days days) const
|
[[nodiscard]] QDate addDuration(std::chrono::days days) const
|
||||||
{
|
{
|
||||||
@ -176,7 +178,8 @@ private:
|
|||||||
static constexpr inline qint64 maxJd() { return Q_INT64_C( 784354017364); }
|
static constexpr inline qint64 maxJd() { return Q_INT64_C( 784354017364); }
|
||||||
static constexpr inline qint64 unixEpochJd() { return Q_INT64_C(2440588); }
|
static constexpr inline qint64 unixEpochJd() { return Q_INT64_C(2440588); }
|
||||||
|
|
||||||
#if __cpp_lib_chrono >= 201907L
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
|
#if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
|
||||||
QT_POST_CXX17_API_IN_EXPORTED_CLASS
|
QT_POST_CXX17_API_IN_EXPORTED_CLASS
|
||||||
static constexpr qint64
|
static constexpr qint64
|
||||||
stdSysDaysToJulianDay(const std::chrono::sys_days &days QT6_DECL_NEW_OVERLOAD_TAIL) noexcept
|
stdSysDaysToJulianDay(const std::chrono::sys_days &days QT6_DECL_NEW_OVERLOAD_TAIL) noexcept
|
||||||
@ -515,7 +518,8 @@ public:
|
|||||||
> time
|
> time
|
||||||
);
|
);
|
||||||
|
|
||||||
#if __cpp_lib_chrono >= 201907L || defined(Q_QDOC)
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
|
#if (__cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)) || defined(Q_QDOC)
|
||||||
#if __cpp_concepts >= 201907L || defined(Q_QDOC)
|
#if __cpp_concepts >= 201907L || defined(Q_QDOC)
|
||||||
private:
|
private:
|
||||||
// The duration type of the result of a clock_cast<system_clock>.
|
// The duration type of the result of a clock_cast<system_clock>.
|
||||||
@ -585,7 +589,7 @@ public:
|
|||||||
const std::chrono::seconds duration(toSecsSinceEpoch());
|
const std::chrono::seconds duration(toSecsSinceEpoch());
|
||||||
return std::chrono::sys_seconds(duration);
|
return std::chrono::sys_seconds(duration);
|
||||||
}
|
}
|
||||||
#endif // __cpp_lib_chrono >= 201907L
|
#endif // __cpp_lib_chrono >= 201907L && !Q_OS_INTEGRITY
|
||||||
|
|
||||||
friend std::chrono::milliseconds operator-(const QDateTime &lhs, const QDateTime &rhs)
|
friend std::chrono::milliseconds operator-(const QDateTime &lhs, const QDateTime &rhs)
|
||||||
{
|
{
|
||||||
|
@ -192,7 +192,8 @@ void tst_QDate::isValid_data()
|
|||||||
QTest::newRow("jd latest formula") << 1400000 << 12 << 31 << qint64(513060925) << true;
|
QTest::newRow("jd latest formula") << 1400000 << 12 << 31 << qint64(513060925) << true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cpp_lib_chrono >= 201907L
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
|
#if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
|
||||||
// QDate has a bigger range than year_month_date. The tests use this bigger
|
// QDate has a bigger range than year_month_date. The tests use this bigger
|
||||||
// range. However building a year_month_time with "out of range" data has
|
// range. However building a year_month_time with "out of range" data has
|
||||||
// unspecified results, so don't do that. See [time.cal.year],
|
// unspecified results, so don't do that. See [time.cal.year],
|
||||||
@ -237,7 +238,8 @@ void tst_QDate::isValid()
|
|||||||
QCOMPARE(d.year(), year);
|
QCOMPARE(d.year(), year);
|
||||||
QCOMPARE(d.month(), month);
|
QCOMPARE(d.month(), month);
|
||||||
QCOMPARE(d.day(), day);
|
QCOMPARE(d.day(), day);
|
||||||
#if __cpp_lib_chrono >= 201907L
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
|
#if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
|
||||||
std::optional<std::chrono::year_month_day> ymd = convertToStdYearMonthDay(year, month, day);
|
std::optional<std::chrono::year_month_day> ymd = convertToStdYearMonthDay(year, month, day);
|
||||||
if (ymd) {
|
if (ymd) {
|
||||||
QDate d = *ymd;
|
QDate d = *ymd;
|
||||||
@ -820,8 +822,8 @@ void tst_QDate::addDays()
|
|||||||
QCOMPARE( dt2.year(), expectedYear );
|
QCOMPARE( dt2.year(), expectedYear );
|
||||||
QCOMPARE( dt2.month(), expectedMonth );
|
QCOMPARE( dt2.month(), expectedMonth );
|
||||||
QCOMPARE( dt2.day(), expectedDay );
|
QCOMPARE( dt2.day(), expectedDay );
|
||||||
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
#if __cpp_lib_chrono >= 201907L
|
#if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
|
||||||
QDate dt3 = dt.addDuration( std::chrono::days( amountToAdd ) );
|
QDate dt3 = dt.addDuration( std::chrono::days( amountToAdd ) );
|
||||||
|
|
||||||
QCOMPARE( dt3.year(), expectedYear );
|
QCOMPARE( dt3.year(), expectedYear );
|
||||||
@ -997,7 +999,8 @@ void tst_QDate::daysTo()
|
|||||||
void tst_QDate::orderingCompiles()
|
void tst_QDate::orderingCompiles()
|
||||||
{
|
{
|
||||||
QTestPrivate::testAllComparisonOperatorsCompile<QDate>();
|
QTestPrivate::testAllComparisonOperatorsCompile<QDate>();
|
||||||
#if __cpp_lib_chrono >= 201907L
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
|
#if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
|
||||||
QTestPrivate::testAllComparisonOperatorsCompile<QDate, std::chrono::year_month_day>();
|
QTestPrivate::testAllComparisonOperatorsCompile<QDate, std::chrono::year_month_day>();
|
||||||
QTestPrivate::testAllComparisonOperatorsCompile<QDate, std::chrono::year_month_day_last>();
|
QTestPrivate::testAllComparisonOperatorsCompile<QDate, std::chrono::year_month_day_last>();
|
||||||
QTestPrivate::testAllComparisonOperatorsCompile<QDate, std::chrono::year_month_weekday>();
|
QTestPrivate::testAllComparisonOperatorsCompile<QDate, std::chrono::year_month_weekday>();
|
||||||
@ -1080,7 +1083,8 @@ void tst_QDate::ordering()
|
|||||||
|
|
||||||
void tst_QDate::ordering_chrono_types()
|
void tst_QDate::ordering_chrono_types()
|
||||||
{
|
{
|
||||||
#if __cpp_lib_chrono >= 201907L
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
|
#if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
QDate friday(2001, 11, 30); // the 5th Friday of November 2001
|
QDate friday(2001, 11, 30); // the 5th Friday of November 2001
|
||||||
// std::chrono::year_month_day
|
// std::chrono::year_month_day
|
||||||
@ -1713,8 +1717,8 @@ void tst_QDate::roundtrip() const
|
|||||||
QCOMPARE(loopDate.toJulianDay(), testDate.toJulianDay());
|
QCOMPARE(loopDate.toJulianDay(), testDate.toJulianDay());
|
||||||
loopDate = loopDate.addDays(1);
|
loopDate = loopDate.addDays(1);
|
||||||
}
|
}
|
||||||
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
#if __cpp_lib_chrono >= 201907L
|
#if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
|
||||||
// Test roundtrip for from/to std::chrono conversions.
|
// Test roundtrip for from/to std::chrono conversions.
|
||||||
// Compile-time test, to verify it's all constexpr.
|
// Compile-time test, to verify it's all constexpr.
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
|
@ -4618,15 +4618,16 @@ void tst_QDateTime::macTypes()
|
|||||||
tst_QDateTime_macTypes();
|
tst_QDateTime_macTypes();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
#if __cpp_lib_chrono >= 201907L
|
#if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
|
||||||
using StdSysMillis = std::chrono::sys_time<std::chrono::milliseconds>;
|
using StdSysMillis = std::chrono::sys_time<std::chrono::milliseconds>;
|
||||||
Q_DECLARE_METATYPE(StdSysMillis);
|
Q_DECLARE_METATYPE(StdSysMillis);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void tst_QDateTime::stdCompatibilitySysTime_data()
|
void tst_QDateTime::stdCompatibilitySysTime_data()
|
||||||
{
|
{
|
||||||
#if __cpp_lib_chrono >= 201907L
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
|
#if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
|
||||||
QTest::addColumn<StdSysMillis>("sysTime");
|
QTest::addColumn<StdSysMillis>("sysTime");
|
||||||
QTest::addColumn<QDateTime>("expected");
|
QTest::addColumn<QDateTime>("expected");
|
||||||
|
|
||||||
@ -4676,7 +4677,8 @@ void tst_QDateTime::stdCompatibilitySysTime_data()
|
|||||||
|
|
||||||
void tst_QDateTime::stdCompatibilitySysTime()
|
void tst_QDateTime::stdCompatibilitySysTime()
|
||||||
{
|
{
|
||||||
#if __cpp_lib_chrono >= 201907L
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
|
#if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
|
||||||
QFETCH(StdSysMillis, sysTime);
|
QFETCH(StdSysMillis, sysTime);
|
||||||
QFETCH(QDateTime, expected);
|
QFETCH(QDateTime, expected);
|
||||||
|
|
||||||
@ -4715,15 +4717,16 @@ void tst_QDateTime::stdCompatibilitySysTime()
|
|||||||
QSKIP("This test requires C++20's <chrono>.");
|
QSKIP("This test requires C++20's <chrono>.");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
#if __cpp_lib_chrono >= 201907L
|
#if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
|
||||||
using StdLocalMillis = std::chrono::local_time<std::chrono::milliseconds>;
|
using StdLocalMillis = std::chrono::local_time<std::chrono::milliseconds>;
|
||||||
Q_DECLARE_METATYPE(StdLocalMillis);
|
Q_DECLARE_METATYPE(StdLocalMillis);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void tst_QDateTime::stdCompatibilityLocalTime_data()
|
void tst_QDateTime::stdCompatibilityLocalTime_data()
|
||||||
{
|
{
|
||||||
#if __cpp_lib_chrono >= 201907L
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
|
#if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
|
||||||
QTest::addColumn<StdLocalMillis>("localTime");
|
QTest::addColumn<StdLocalMillis>("localTime");
|
||||||
QTest::addColumn<QDateTime>("expected");
|
QTest::addColumn<QDateTime>("expected");
|
||||||
|
|
||||||
@ -4762,7 +4765,8 @@ void tst_QDateTime::stdCompatibilityLocalTime_data()
|
|||||||
|
|
||||||
void tst_QDateTime::stdCompatibilityLocalTime()
|
void tst_QDateTime::stdCompatibilityLocalTime()
|
||||||
{
|
{
|
||||||
#if __cpp_lib_chrono >= 201907L
|
// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
|
||||||
|
#if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
|
||||||
QFETCH(StdLocalMillis, localTime);
|
QFETCH(StdLocalMillis, localTime);
|
||||||
QFETCH(QDateTime, expected);
|
QFETCH(QDateTime, expected);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user