summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2021-04-28 19:43:47 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2021-05-02 20:25:41 +0200
commit7507afccee63057269a76f39a6d9bde7cf4427f4 (patch)
tree54e2a185da52d2918f5e569ca24d64400b16dbe9 /src/corelib/global
parent99e95a2cc6ddec5ebd7f69489811be2e9aef98b9 (diff)
QFlags: streamline some macros
There's little point at keeping the separate Q_DECLARE_INCOMPATIBLE_FLAGS macro, only to invoke it exactly once (from the expansion of Q_DECLARE_OPERATORS_FOR_FLAGS). Besides, Q_DECLARE_OPERATORS_FOR_FLAGS already had some "incompatible" operators in its expansion (the deleted arithmetic ones), so adding the "incompatible" ones in there is consistent. Change-Id: I591d57af8eec5b03ecaa7a3b0de23a967b13f7a5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qflags.h16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h
index 772d97a964..34e2c5bc86 100644
--- a/src/corelib/global/qflags.h
+++ b/src/corelib/global/qflags.h
@@ -162,14 +162,6 @@ private:
typedef QFlags<Enum> Flags;
#endif
-#define Q_DECLARE_INCOMPATIBLE_FLAGS(Flags) \
-constexpr inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) noexcept \
-{ return QIncompatibleFlag(int(f1) | f2); } \
-constexpr inline void operator+(int f1, Flags::enum_type f2) noexcept = delete; \
-constexpr inline void operator+(Flags::enum_type f1, int f2) noexcept = delete; \
-constexpr inline void operator-(int f1, Flags::enum_type f2) noexcept = delete; \
-constexpr inline void operator-(Flags::enum_type f1, int f2) noexcept = delete;
-
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \
constexpr inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) noexcept \
{ return QFlags<Flags::enum_type>(f1) | f2; } \
@@ -181,8 +173,12 @@ constexpr inline void operator+(int f1, QFlags<Flags::enum_type> f2) noexcept =
constexpr inline void operator-(Flags::enum_type f1, Flags::enum_type f2) noexcept = delete; \
constexpr inline void operator-(Flags::enum_type f1, QFlags<Flags::enum_type> f2) noexcept = delete; \
constexpr inline void operator-(int f1, QFlags<Flags::enum_type> f2) noexcept = delete; \
-Q_DECLARE_INCOMPATIBLE_FLAGS(Flags)
-
+constexpr inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) noexcept \
+{ return QIncompatibleFlag(int(f1) | f2); } \
+constexpr inline void operator+(int f1, Flags::enum_type f2) noexcept = delete; \
+constexpr inline void operator+(Flags::enum_type f1, int f2) noexcept = delete; \
+constexpr inline void operator-(int f1, Flags::enum_type f2) noexcept = delete; \
+constexpr inline void operator-(Flags::enum_type f1, int f2) noexcept = delete;
QT_END_NAMESPACE