corelib/time: fix (easy) -Wunused-const-variable warnings in _p.h's
Make the constexpr variables inline to silence Clang. There's another batch of such warnings for the _data_p.h files, and they are actually pointing to a real problem: If two TUs include these headers, the static constexpr tables actually get duplicated. Created QTBUG-128930 to track the issue. Amends 6d97cf0e573f11ae1fae11441e6fa747c34be21c and fa9244700e016403b162932211023c65f4bb0d6b. Pick-to: 6.7 6.5 Task-number: QTBUG-126219 Change-Id: Idb0cd55e424a870be6127fdf8399d01e9f3e9ac8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 5064cb6feff6178cf3c307790ba028514c3d3040) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
53c1852cb6
commit
339d339e9d
@ -108,10 +108,10 @@ template <unsigned b, typename Int> constexpr Int qMod(Int a) { return qDivMod<b
|
||||
|
||||
namespace QRomanCalendrical {
|
||||
// Julian Day number of Gregorian 1 BCE, February 29th:
|
||||
constexpr qint64 LeapDayGregorian1Bce = 1721119;
|
||||
inline constexpr qint64 LeapDayGregorian1Bce = 1721119;
|
||||
// Aside from (maybe) some turns of centuries, one year in four is leap:
|
||||
constexpr unsigned FourYears = 4 * 365 + 1;
|
||||
constexpr unsigned FiveMonths = 31 + 30 + 31 + 30 + 31; // Mar-Jul or Aug-Dec.
|
||||
inline constexpr unsigned FourYears = 4 * 365 + 1;
|
||||
inline constexpr unsigned FiveMonths = 31 + 30 + 31 + 30 + 31; // Mar-Jul or Aug-Dec.
|
||||
|
||||
constexpr auto yearMonthToYearDays(int year, int month)
|
||||
{
|
||||
|
@ -129,20 +129,31 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimePrivate::TransitionOptions)
|
||||
namespace QtPrivate {
|
||||
namespace DateTimeConstants {
|
||||
using namespace std::chrono;
|
||||
inline
|
||||
constexpr qint64 SECS_PER_MIN = minutes::period::num;
|
||||
inline
|
||||
constexpr qint64 SECS_PER_HOUR = hours::period::num;
|
||||
inline
|
||||
constexpr qint64 SECS_PER_DAY = SECS_PER_HOUR * 24; // std::chrono::days is C++20
|
||||
|
||||
inline
|
||||
constexpr qint64 MINS_PER_HOUR = std::ratio_divide<hours::period, minutes::period>::num;
|
||||
|
||||
inline
|
||||
constexpr qint64 MSECS_PER_SEC = milliseconds::period::den;
|
||||
inline
|
||||
constexpr qint64 MSECS_PER_MIN = SECS_PER_MIN * MSECS_PER_SEC;
|
||||
inline
|
||||
constexpr qint64 MSECS_PER_HOUR = SECS_PER_HOUR * MSECS_PER_SEC;
|
||||
inline
|
||||
constexpr qint64 MSECS_PER_DAY = SECS_PER_DAY * MSECS_PER_SEC;
|
||||
|
||||
inline
|
||||
constexpr qint64 JULIAN_DAY_FOR_EPOCH = 2440588; // result of QDate(1970, 1, 1).toJulianDay()
|
||||
|
||||
inline
|
||||
constexpr qint64 JulianDayMax = Q_INT64_C( 784354017364);
|
||||
inline
|
||||
constexpr qint64 JulianDayMin = Q_INT64_C(-784350574879);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user