summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2022-08-11 11:48:35 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-08-11 19:13:23 +0000
commit85414ac6c0141c278d4f0213441fb7475cbe2ac8 (patch)
tree270929500cc03471136671f7f3d3b3d6f4630bf7 /src/corelib/global
parentdf1db826cb93132c05215be8f1451327d0323b4b (diff)
Move Qt 6/7 specific macros to qtversionchecks.h
Task-number: QTBUG-99313 Change-Id: I57032bf5d0edcb7345267512e12837b1d90d1485 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qglobal.h52
-rw-r--r--src/corelib/global/qtversionchecks.h59
2 files changed, 59 insertions, 52 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 54ce2ff6fa..9e5a16093e 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -33,58 +33,6 @@
#include <QtCore/qtconfigmacros.h>
#include <QtCore/qtcoreexports.h>
-/*
- helper macros to make some simple code work active in Qt 6 or Qt 7 only,
- like:
- struct QT6_ONLY(Q_CORE_EXPORT) QTrivialClass
- {
- void QT7_ONLY(Q_CORE_EXPORT) void operate();
- }
-*/
-#if QT_VERSION_MAJOR == 7
-# define QT7_ONLY(...) __VA_ARGS__
-# define QT6_ONLY(...)
-#elif QT_VERSION_MAJOR == 6
-# define QT7_ONLY(...)
-# define QT6_ONLY(...) __VA_ARGS__
-#else
-# error Qt major version not 6 or 7
-#endif
-
-/* Macro and tag type to help overload resolution on functions
- that are, e.g., QT_REMOVED_SINCE'ed. Example use:
-
- #if QT_CORE_REMOVED_SINCE(6, 4)
- int size() const;
- #endif
- qsizetype size(QT6_DECL_NEW_OVERLOAD) const;
-
- in the normal cpp file:
-
- qsizetype size(QT6_IMPL_NEW_OVERLOAD) const {
- ~~~
- }
-
- in removed_api.cpp:
-
- int size() const { return int(size(QT6_CALL_NEW_OVERLOAD)); }
-*/
-#ifdef Q_CLANG_QDOC
-# define QT6_DECL_NEW_OVERLOAD
-# define QT6_DECL_NEW_OVERLOAD_TAIL
-# define QT6_IMPL_NEW_OVERLOAD
-# define QT6_IMPL_NEW_OVERLOAD_TAIL
-# define QT6_CALL_NEW_OVERLOAD
-# define QT6_CALL_NEW_OVERLOAD_TAIL
-#else
-# define QT6_DECL_NEW_OVERLOAD QT6_ONLY(Qt::Disambiguated_t = Qt::Disambiguated)
-# define QT6_DECL_NEW_OVERLOAD_TAIL QT6_ONLY(, QT6_DECL_NEW_OVERLOAD)
-# define QT6_IMPL_NEW_OVERLOAD QT6_ONLY(Qt::Disambiguated_t)
-# define QT6_IMPL_NEW_OVERLOAD_TAIL QT6_ONLY(, QT6_IMPL_NEW_OVERLOAD)
-# define QT6_CALL_NEW_OVERLOAD QT6_ONLY(Qt::Disambiguated)
-# define QT6_CALL_NEW_OVERLOAD_TAIL QT6_ONLY(, QT6_CALL_NEW_OVERLOAD)
-#endif
-
/* These two macros makes it possible to turn the builtin line expander into a
* string literal. */
#define QT_STRINGIFY2(x) #x
diff --git a/src/corelib/global/qtversionchecks.h b/src/corelib/global/qtversionchecks.h
index b02849e96d..d6fad1ed6c 100644
--- a/src/corelib/global/qtversionchecks.h
+++ b/src/corelib/global/qtversionchecks.h
@@ -9,6 +9,13 @@
#pragma qt_sync_stop_processing
#endif
+#ifdef QT_BOOTSTRAPPED
+#include <QtCore/qconfig-bootstrapped.h>
+#else
+#include <QtCore/qconfig.h>
+#include <QtCore/qtcore-config.h>
+#endif
+
/*
QT_VERSION is (major << 16) | (minor << 8) | patch.
*/
@@ -18,4 +25,56 @@
*/
#define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
+/*
+ Helper macros to make some simple code active in Qt 6 or Qt 7 only,
+ like:
+ struct QT6_ONLY(Q_CORE_EXPORT) QTrivialClass
+ {
+ void QT7_ONLY(Q_CORE_EXPORT) void operate();
+ }
+*/
+#if QT_VERSION_MAJOR == 7
+# define QT7_ONLY(...) __VA_ARGS__
+# define QT6_ONLY(...)
+#elif QT_VERSION_MAJOR == 6
+# define QT7_ONLY(...)
+# define QT6_ONLY(...) __VA_ARGS__
+#else
+# error Qt major version not 6 or 7
+#endif
+
+/* Macro and tag type to help overload resolution on functions
+ that are, e.g., QT_REMOVED_SINCE'ed. Example use:
+
+ #if QT_CORE_REMOVED_SINCE(6, 4)
+ int size() const;
+ #endif
+ qsizetype size(QT6_DECL_NEW_OVERLOAD) const;
+
+ in the normal cpp file:
+
+ qsizetype size(QT6_IMPL_NEW_OVERLOAD) const {
+ ~~~
+ }
+
+ in removed_api.cpp:
+
+ int size() const { return int(size(QT6_CALL_NEW_OVERLOAD)); }
+*/
+#ifdef Q_CLANG_QDOC
+# define QT6_DECL_NEW_OVERLOAD
+# define QT6_DECL_NEW_OVERLOAD_TAIL
+# define QT6_IMPL_NEW_OVERLOAD
+# define QT6_IMPL_NEW_OVERLOAD_TAIL
+# define QT6_CALL_NEW_OVERLOAD
+# define QT6_CALL_NEW_OVERLOAD_TAIL
+#else
+# define QT6_DECL_NEW_OVERLOAD QT6_ONLY(Qt::Disambiguated_t = Qt::Disambiguated)
+# define QT6_DECL_NEW_OVERLOAD_TAIL QT6_ONLY(, QT6_DECL_NEW_OVERLOAD)
+# define QT6_IMPL_NEW_OVERLOAD QT6_ONLY(Qt::Disambiguated_t)
+# define QT6_IMPL_NEW_OVERLOAD_TAIL QT6_ONLY(, QT6_IMPL_NEW_OVERLOAD)
+# define QT6_CALL_NEW_OVERLOAD QT6_ONLY(Qt::Disambiguated)
+# define QT6_CALL_NEW_OVERLOAD_TAIL QT6_ONLY(, QT6_CALL_NEW_OVERLOAD)
+#endif
+
#endif /* QTVERSIONCHECKS_H */