diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-08-19 19:11:37 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-09-06 18:31:43 +0200 |
commit | 68198de4dbe71ae97dc733606871f51bde804c1e (patch) | |
tree | df68d428265f876367c7cd54d5e2c14f007c1964 /src/corelib/global/qglobal.h | |
parent | d3ff95dcb84861e8f42b480910d822b4ca8715b1 (diff) |
Use C++17 [[maybe_unused]]
In some places needs to be ordered before const/constexpr though.
Change-Id: I57a521ac0ad22b5a018761c4d52befbef69d64c0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global/qglobal.h')
-rw-r--r-- | src/corelib/global/qglobal.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 642ea2b1f3..d32f1b420c 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -380,7 +380,7 @@ typedef double qreal; // A tag to help mark stuff deprecated (cf. QStringViewLiteral) namespace QtPrivate { enum class Deprecated_t {}; -constexpr Q_DECL_UNUSED Deprecated_t Deprecated = {}; +Q_DECL_UNUSED constexpr Deprecated_t Deprecated = {}; } #endif @@ -868,22 +868,22 @@ typedef void (*QFunctionPointer)(); # define Q_UNIMPLEMENTED() qWarning("Unimplemented code.") #endif -Q_REQUIRED_RESULT constexpr static inline Q_DECL_UNUSED bool qFuzzyCompare(double p1, double p2) +Q_REQUIRED_RESULT Q_DECL_UNUSED constexpr static inline bool qFuzzyCompare(double p1, double p2) { return (qAbs(p1 - p2) * 1000000000000. <= qMin(qAbs(p1), qAbs(p2))); } -Q_REQUIRED_RESULT constexpr static inline Q_DECL_UNUSED bool qFuzzyCompare(float p1, float p2) +Q_REQUIRED_RESULT Q_DECL_UNUSED constexpr static inline bool qFuzzyCompare(float p1, float p2) { return (qAbs(p1 - p2) * 100000.f <= qMin(qAbs(p1), qAbs(p2))); } -Q_REQUIRED_RESULT constexpr static inline Q_DECL_UNUSED bool qFuzzyIsNull(double d) +Q_REQUIRED_RESULT Q_DECL_UNUSED constexpr static inline bool qFuzzyIsNull(double d) { return qAbs(d) <= 0.000000000001; } -Q_REQUIRED_RESULT constexpr static inline Q_DECL_UNUSED bool qFuzzyIsNull(float f) +Q_REQUIRED_RESULT Q_DECL_UNUSED constexpr static inline bool qFuzzyIsNull(float f) { return qAbs(f) <= 0.00001f; } @@ -891,12 +891,12 @@ Q_REQUIRED_RESULT constexpr static inline Q_DECL_UNUSED bool qFuzzyIsNull(float QT_WARNING_PUSH QT_WARNING_DISABLE_FLOAT_COMPARE -Q_REQUIRED_RESULT constexpr static inline Q_DECL_UNUSED bool qIsNull(double d) noexcept +Q_REQUIRED_RESULT Q_DECL_UNUSED constexpr static inline bool qIsNull(double d) noexcept { return d == 0.0; } -Q_REQUIRED_RESULT constexpr static inline Q_DECL_UNUSED bool qIsNull(float f) noexcept +Q_REQUIRED_RESULT Q_DECL_UNUSED constexpr static inline bool qIsNull(float f) noexcept { return f == 0.0f; } @@ -1219,9 +1219,9 @@ struct QOverload : QConstOverload<Args...>, QNonConstOverload<Args...> }; #if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304 // C++14 -template <typename... Args> constexpr Q_DECL_UNUSED QOverload<Args...> qOverload = {}; -template <typename... Args> constexpr Q_DECL_UNUSED QConstOverload<Args...> qConstOverload = {}; -template <typename... Args> constexpr Q_DECL_UNUSED QNonConstOverload<Args...> qNonConstOverload = {}; +template <typename... Args> Q_DECL_UNUSED constexpr QOverload<Args...> qOverload = {}; +template <typename... Args> Q_DECL_UNUSED constexpr QConstOverload<Args...> qConstOverload = {}; +template <typename... Args> Q_DECL_UNUSED constexpr QNonConstOverload<Args...> qNonConstOverload = {}; #endif #endif |