Skip to content

Commit 739f14a

Browse files
committed
Qt 6.7 introduced macros to define comparison operators
that might use the "spaceship" operator for C++20 and onwards. The generator had trouble to parse these. Simply replace the definitions with something that works for the generator.
1 parent 2e9251f commit 739f14a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

generator/qtscript_masterinclude.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,36 @@
7373
# undef Q_CLANG_QDOC
7474
#endif
7575

76+
77+
#if QT_VERSION >= 0x060700
78+
// override Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE et al to return something the parser understands:
79+
#include <QtCore/qcomparehelpers.h>
80+
#define Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(TYPE) \
81+
friend bool operator==(const TYPE& lhs, const TYPE& rhs); \
82+
friend bool operator!=(const TYPE& lhs, const TYPE& rhs); \
83+
friend bool operator< (const TYPE& lhs, const TYPE& rhs); \
84+
friend bool operator<=(const TYPE& lhs, const TYPE& rhs); \
85+
friend bool operator> (const TYPE& lhs, const TYPE& rhs); \
86+
friend bool operator>=(const TYPE& lhs, const TYPE& rhs);
87+
88+
#define Q_DECLARE_WEAKLY_ORDERED_LITERAL_TYPE(TYPE) Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(TYPE)
89+
#define Q_DECLARE_PARTIALLY_ORDERED_LITERAL_TYPE(TYPE) Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(TYPE)
90+
91+
#define Q_DECLARE_STRONGLY_ORDERED(TYPE) Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(TYPE)
92+
#define Q_DECLARE_WEAKLY_ORDERED(TYPE) Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(TYPE)
93+
#define Q_DECLARE_PARTIALLY_ORDERED Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(TYPE)
94+
95+
#define Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(TYPE) \
96+
public: \
97+
bool operator==(const TYPE& rhs) const; \
98+
bool operator!=(const TYPE& rhs) const; \
99+
private:
100+
101+
#define Q_DECLARE_EQUALITY_COMPARABLE(TYPE) Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(TYPE)
102+
103+
#endif
104+
105+
76106
// it seems this can be safely ignored (otherwise generator currently stumbles over use of noexcept):
77107
#define Q_DECLARE_SHARED(TYPE)
78108
#define Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(TYPE)

0 commit comments

Comments
 (0)