diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-05-16 09:03:15 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-05-16 17:55:49 +0200 |
commit | 3cee2f195039420180ec0d5fafd560385802052c (patch) | |
tree | 8cc15c7bf0eceed37e50d6472d4fbe2fed6be788 | |
parent | 8e94af2ed0577936cabaffab336014c1be9002af (diff) | |
download | qtbase-3cee2f195039420180ec0d5fafd560385802052c.tar.gz |
q20chrono: Fix feature test macro check
While the comment behind the else already had the correct value, the
actual check and the comment behind the endif had the wrong one. This
would cause build /headers clean check failures when using older
compilers in C++20/2a mode.
Also, remove the check for __cplusplus: A sufficiently high enough value
of __cpp_lib_chrono already implies __cplusplus > 201703L; the only
thing the check did was to hide the issue on more modern compilers.
Fixes compilation with e.g. gcc 9.3.
Amends bde5eeecaf35f7b7a94b7878289a8e7fcd057afa
Change-Id: I74e761d9dc4048e9abf9cea9ea7e63260ea1111e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
-rw-r--r-- | src/corelib/global/q20chrono.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/global/q20chrono.h b/src/corelib/global/q20chrono.h index 177d307e21..b296b4e966 100644 --- a/src/corelib/global/q20chrono.h +++ b/src/corelib/global/q20chrono.h @@ -38,7 +38,7 @@ using IntRep = int64_t; using IntRep = int; #endif -#if __cpp_lib_chrono >= 201611L && __cplusplus > 201703L +#if __cpp_lib_chrono >= 201907L using std::chrono::days; using std::chrono::weeks; using std::chrono::years; @@ -53,7 +53,7 @@ using days = std::chrono::duration<IntRep, std::ratio<86400>>; using weeks = std::chrono::duration<IntRep, std::ratio_multiply<std::ratio<7>, days::period>>; using years = std::chrono::duration<IntRep, std::ratio_multiply<std::ratio<146097, 400>, days::period>>; using months = std::chrono::duration<IntRep, std::ratio_divide<years::period, std::ratio<12>>>; -#endif // __cpp_lib_chrono >= 201611L +#endif // __cpp_lib_chrono >= 201907L } // namespace chrono } // namespace q20 |