From 6b355d1aa87072143e09ea5269e8cf465318a64f Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sat, 18 Jun 2022 21:26:43 +0200 Subject: Drop pre-Qt 5.15 code --- lib/logging.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'lib/logging.h') diff --git a/lib/logging.h b/lib/logging.h index fc0a4c99..c8d17210 100644 --- a/lib/logging.h +++ b/lib/logging.h @@ -44,12 +44,7 @@ inline QDebug formatJson(QDebug debug_object) //! Suppress full qualification of enums/QFlags when logging inline QDebug terse(QDebug dbg) { - return -#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) - dbg.setVerbosity(0), dbg; -#else - dbg.verbosity(QDebug::MinimumVerbosity); -#endif + return dbg.verbosity(QDebug::MinimumVerbosity); } inline qint64 profilerMinNsecs() -- cgit v1.2.3 From 24a206f6429f6fa29b9aa1ce39b7e4694e39b046 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 15 Jul 2022 10:32:27 +0200 Subject: operator<<(QDebug, QElapsedTimer): always use ms That switch between micro- and milliseconds was pure visual sugaring, in a potentially time-sensitive context. Also: there's no sense in using const-ref for a small parameter in a function that is, to top it off, almost always inlined. --- lib/logging.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib/logging.h') diff --git a/lib/logging.h b/lib/logging.h index c8d17210..2599efbf 100644 --- a/lib/logging.h +++ b/lib/logging.h @@ -72,12 +72,9 @@ inline QDebug operator<<(QDebug debug_object, Quotient::QDebugManip qdm) return qdm(debug_object); } -inline QDebug operator<<(QDebug debug_object, const QElapsedTimer& et) +inline QDebug operator<<(QDebug debug_object, QElapsedTimer et) { - auto val = et.nsecsElapsed() / 1000; - if (val < 1000) - debug_object << val << "µs"; - else - debug_object << val / 1000 << "ms"; + // Keep 3 decimal digits (the first division is int, the second is float) + debug_object << et.nsecsElapsed() / 1000 / 1000.0 << "ms"; return debug_object; } -- cgit v1.2.3 From 2cc19e66c0bed3065cf7274dbc908bcb90b7502e Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sat, 16 Jul 2022 20:30:56 +0200 Subject: logging.h: suppress clang-tidy warnings --- lib/logging.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/logging.h') diff --git a/lib/logging.h b/lib/logging.h index 2599efbf..1fafa04b 100644 --- a/lib/logging.h +++ b/lib/logging.h @@ -69,12 +69,13 @@ inline qint64 profilerMinNsecs() */ inline QDebug operator<<(QDebug debug_object, Quotient::QDebugManip qdm) { - return qdm(debug_object); + return qdm(debug_object); // NOLINT(performance-unnecessary-value-param) } inline QDebug operator<<(QDebug debug_object, QElapsedTimer et) { - // Keep 3 decimal digits (the first division is int, the second is float) - debug_object << et.nsecsElapsed() / 1000 / 1000.0 << "ms"; + // NOLINTNEXTLINE(bugprone-integer-division) + debug_object << static_cast(et.nsecsElapsed() / 1000) / 1000 + << "ms"; // Show in ms with 3 decimal digits precision return debug_object; } -- cgit v1.2.3