File indexing completed on 2025-01-18 10:07:42
0001
0002
0003
0004 #if !defined(QVERSIONTAGGING_H)
0005 #define QVERSIONTAGGING_H
0006
0007 #include <QtCore/qcompilerdetection.h>
0008 #include <QtCore/qtconfigmacros.h>
0009 #include <QtCore/qtversionchecks.h>
0010 #include <QtCore/qtypes.h>
0011
0012 QT_BEGIN_NAMESPACE
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067 namespace QtPrivate {
0068 struct QVersionTag
0069 {
0070 const void *symbol;
0071 quintptr version;
0072 constexpr QVersionTag(const void *sym, int currentVersion = QT_VERSION)
0073 : symbol(sym), version(currentVersion)
0074 {}
0075 };
0076 }
0077
0078 #if !defined(QT_NO_VERSION_TAGGING) && (defined(QT_BUILD_CORE_LIB) || defined(QT_BOOTSTRAPPED) || defined(QT_STATIC))
0079
0080 # define QT_NO_VERSION_TAGGING
0081 #endif
0082
0083 #if defined(Q_OS_WIN)
0084 # ifdef Q_PROCESSOR_X86_32
0085
0086 # define QT_MANGLE_IMPORT_PREFIX _imp__
0087 # else
0088
0089 # define QT_MANGLE_IMPORT_PREFIX __imp_
0090 # endif
0091 # if defined(Q_CC_MSVC_ONLY)
0092 # pragma section(".qtversion",read,shared)
0093 # define QT_VERSION_TAG_SECTION __declspec(allocate(".qtversion"))
0094 # define QT_VERSION_TAG_ATTRIBUTE __declspec(selectany) extern const
0095 # else
0096 # define QT_VERSION_TAG_ATTRIBUTE __attribute__((used)) constexpr inline
0097 # endif
0098 # define QT_VERSION_TAG2(sym, imp) \
0099 extern "C" const char * const imp; \
0100 QT_VERSION_TAG_ATTRIBUTE QT_VERSION_TAG_SECTION QtPrivate::QVersionTag sym ## _used(&imp)
0101 # define QT_VERSION_TAG(sym, imp) QT_VERSION_TAG2(sym, imp)
0102 #elif defined(Q_CC_GNU) && __has_attribute(used)
0103 # ifdef Q_OS_DARWIN
0104 # define QT_VERSION_TAG_SECTION __attribute__((section("__DATA,.qtversion")))
0105 # endif
0106 # define QT_VERSION_TAG_ATTRIBUTE __attribute__((visibility("hidden"), used))
0107 # define QT_VERSION_TAG2(sym, imp) \
0108 extern "C" Q_DECL_IMPORT const char sym; \
0109 QT_VERSION_TAG_ATTRIBUTE QT_VERSION_TAG_SECTION constexpr inline QtPrivate::QVersionTag sym ## _use(&sym)
0110 # define QT_VERSION_TAG(sym, imp) QT_VERSION_TAG2(sym, imp)
0111 #endif
0112
0113 #ifdef Q_OF_ELF
0114 # define QT_VERSION_TAG_SYMBOL(prefix, sym, m, n) sym
0115 #else
0116 # define QT_VERSION_TAG_SYMBOL2(prefix, sym, m, n) prefix ## sym ## _ ## m ## _ ## n
0117 # define QT_VERSION_TAG_SYMBOL(prefix, sym, m, n) QT_VERSION_TAG_SYMBOL2(prefix, sym, m, n)
0118 #endif
0119
0120 #if defined(QT_VERSION_TAG) && !defined(QT_NO_VERSION_TAGGING)
0121 # ifndef QT_VERSION_TAG_SECTION
0122 # define QT_VERSION_TAG_SECTION __attribute__((section(".qtversion")))
0123 # endif
0124 # define QT_MANGLED_VERSION_TAG_IMPORT QT_VERSION_TAG_SYMBOL(QT_MANGLE_IMPORT_PREFIX, QT_MANGLE_NAMESPACE(qt_version_tag), QT_VERSION_MAJOR, QT_VERSION_MINOR)
0125 # define QT_MANGLED_VERSION_TAG QT_VERSION_TAG_SYMBOL(, QT_MANGLE_NAMESPACE(qt_version_tag), QT_VERSION_MAJOR, QT_VERSION_MINOR)
0126
0127 QT_VERSION_TAG(QT_MANGLED_VERSION_TAG, QT_MANGLED_VERSION_TAG_IMPORT);
0128
0129 # undef QT_MANGLED_VERSION_TAG
0130 # undef QT_MANGLED_VERSION_TAG_IMPORT
0131 # undef QT_VERSION_TAG_SECTION
0132 #endif
0133
0134 QT_END_NAMESPACE
0135
0136 #endif