summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-07-24 11:45:50 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-07-24 13:10:57 +0200
commit9a189a096f134e80e0c11523db14c8580275b4ad (patch)
tree154a408d7607a9aa9cf10f66ed552dfbcfe18292 /src/corelib/plugin
parent999f62531a784b8f0f1f6d3cb7aaaa5455485d17 (diff)
Remove non-Qt6 compile time switches from QtCore
We already manage to compile without this code, and none of it are full classes or separate functions suitable for qt5compat. Change-Id: I47facac7ec621cfc4b0b26214b7de37897443519 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp16
-rw-r--r--src/corelib/plugin/qlibrary.cpp7
-rw-r--r--src/corelib/plugin/qplugin.h39
-rw-r--r--src/corelib/plugin/qpluginloader.cpp6
4 files changed, 0 insertions, 68 deletions
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index edadf7180a..259673b7d0 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -133,22 +133,6 @@ QJsonDocument qJsonFromRawLibraryMetaData(const char *raw, qsizetype sectionSize
raw += metaDataSignatureLength();
sectionSize -= metaDataSignatureLength();
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- if (Q_UNLIKELY(raw[-1] == ' ')) {
- // the size of the embedded JSON object can be found 8 bytes into the data (see qjson_p.h)
- uint size = qFromLittleEndian<uint>(raw + 8);
- // but the maximum size of binary JSON is 128 MB
- size = qMin(size, 128U * 1024 * 1024);
- // and it doesn't include the size of the header (8 bytes)
- size += 8;
- // finally, it can't be bigger than the file or section size
- size = qMin(sectionSize, qsizetype(size));
-
- QByteArray json(raw, size);
- return QJsonDocument::fromBinaryData(json);
- }
-#endif
-
return jsonFromCborMetaData(raw, sectionSize, errMsg);
}
QT_WARNING_POP
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index 9ea8e2793c..cd9f9e2546 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -714,17 +714,10 @@ bool QLibrary::isLibrary(const QString &fileName)
static bool qt_get_metadata(QLibraryPrivate *priv, QString *errMsg)
{
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- auto getMetaData = [](QFunctionPointer fptr) {
- auto f = reinterpret_cast<const char * (*)()>(fptr);
- return qMakePair<const char *, size_t>(f(), INT_MAX);
- };
-#else
auto getMetaData = [](QFunctionPointer fptr) {
auto f = reinterpret_cast<QPluginMetaData (*)()>(fptr);
return f();
};
-#endif
QFunctionPointer pfn = priv->resolve("qt_plugin_query_metadata");
if (!pfn)
diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h
index 1b121f35e9..c03eb57f1d 100644
--- a/src/corelib/plugin/qplugin.h
+++ b/src/corelib/plugin/qplugin.h
@@ -72,21 +72,16 @@ inline constexpr unsigned char qPluginArchRequirements()
}
typedef QObject *(*QtPluginInstanceFunction)();
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-typedef const char *(*QtPluginMetaDataFunction)();
-#else
struct QPluginMetaData
{
const uchar *data;
size_t size;
};
typedef QPluginMetaData (*QtPluginMetaDataFunction)();
-#endif
struct Q_CORE_EXPORT QStaticPlugin
{
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
public:
constexpr QStaticPlugin(QtPluginInstanceFunction i, QtPluginMetaDataFunction m)
: instance(i), rawMetaData(m().data), rawMetaDataSize(m().size)
@@ -97,17 +92,6 @@ private:
const void *rawMetaData;
qsizetype rawMetaDataSize;
public:
-#elif !defined(Q_QDOC)
- // Note: This struct is initialized using an initializer list.
- // As such, it cannot have any new constructors or variables.
- QtPluginInstanceFunction instance;
- QtPluginMetaDataFunction rawMetaData;
-#else
- // Since qdoc gets confused by the use of function
- // pointers, we add these dummes for it to parse instead:
- QObject *instance();
- const char *rawMetaData();
-#endif
QJsonObject metaData() const;
};
Q_DECLARE_TYPEINFO(QStaticPlugin, Q_PRIMITIVE_TYPE);
@@ -161,7 +145,6 @@ void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin);
#if defined(QT_STATICPLUGIN)
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
# define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS, PLUGINCLASSNAME) \
static QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance_##PLUGINCLASSNAME() \
Q_PLUGIN_INSTANCE(PLUGINCLASS) \
@@ -170,19 +153,8 @@ void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin);
const QT_PREPEND_NAMESPACE(QStaticPlugin) qt_static_plugin_##PLUGINCLASSNAME() { \
return { qt_plugin_instance_##PLUGINCLASSNAME, qt_plugin_query_metadata_##PLUGINCLASSNAME}; \
}
-#else
-# define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS, PLUGINCLASSNAME) \
- static QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance_##PLUGINCLASSNAME() \
- Q_PLUGIN_INSTANCE(PLUGINCLASS) \
- static const char *qt_plugin_query_metadata_##PLUGINCLASSNAME() { return reinterpret_cast<const char *>(qt_pluginMetaData_##PLUGINCLASSNAME); } \
- const QT_PREPEND_NAMESPACE(QStaticPlugin) qt_static_plugin_##PLUGINCLASSNAME() { \
- QT_PREPEND_NAMESPACE(QStaticPlugin) plugin = { qt_plugin_instance_##PLUGINCLASSNAME, qt_plugin_query_metadata_##PLUGINCLASSNAME}; \
- return plugin; \
- }
-#endif
#else
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
# define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS, PLUGINCLASSNAME) \
Q_EXTERN_C Q_DECL_EXPORT \
@@ -191,17 +163,6 @@ void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin);
Q_EXTERN_C Q_DECL_EXPORT QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance() \
Q_PLUGIN_INSTANCE(PLUGINCLASS)
-#else
-
-# define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS, PLUGINCLASSNAME) \
- Q_EXTERN_C Q_DECL_EXPORT \
- const char *qt_plugin_query_metadata() \
- { return reinterpret_cast<const char *>(qt_pluginMetaData_##PLUGINCLASSNAME); } \
- Q_EXTERN_C Q_DECL_EXPORT QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance() \
- Q_PLUGIN_INSTANCE(PLUGINCLASS)
-
-#endif
-
#endif
#define Q_EXPORT_PLUGIN(PLUGIN) \
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index b8de3690d9..ef8ad108cb 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -482,13 +482,7 @@ QList<QStaticPlugin> QPluginLoader::staticPlugins()
*/
QJsonObject QStaticPlugin::metaData() const
{
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- // the data is already loaded, so this doesn't matter
- qsizetype rawMetaDataSize = INT_MAX;
- const char *ptr = rawMetaData();
-#else
auto ptr = static_cast<const char *>(rawMetaData);
-#endif
QString errMsg;
QJsonDocument doc = qJsonFromRawLibraryMetaData(ptr, rawMetaDataSize, &errMsg);