summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2016-12-19 10:34:32 +0100
committerUlf Hermann <ulf.hermann@qt.io>2017-03-06 11:27:20 +0000
commitd6330a19b29ebff359a6746250c78437dbcaf77d (patch)
tree3ab0e390f0bfd30bb235ed5a0128bfd33e9cd4b7 /src/corelib/plugin
parentf31dbeb4c7cd0d7559a8d7f523a3feea7d376186 (diff)
Use QT_CONFIG(library) instead of QT_NO_LIBRARY
For the windows file system engine, we add an extra macro to use library loading if configured to do so, but avoid it on WinRT, as none of the symbols would be found. We also QT_REQUIRE_CONFIG(library) in the library headers and exclude the sources from the build if library loading is disabled. This, in turn, makes it necessary to clean up some header inclusions. Change-Id: I2b152cb5b47a2658996b6f4702b038536a5704ec Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/plugin.pri53
-rw-r--r--src/corelib/plugin/qelfparser_p.cpp2
-rw-r--r--src/corelib/plugin/qelfparser_p.h4
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp12
-rw-r--r--src/corelib/plugin/qfactoryloader_p.h6
-rw-r--r--src/corelib/plugin/qlibrary.cpp4
-rw-r--r--src/corelib/plugin/qlibrary.h6
-rw-r--r--src/corelib/plugin/qlibrary_p.h7
-rw-r--r--src/corelib/plugin/qlibrary_unix.cpp4
-rw-r--r--src/corelib/plugin/qlibrary_win.cpp4
-rw-r--r--src/corelib/plugin/qmachparser.cpp2
-rw-r--r--src/corelib/plugin/qmachparser_p.h4
-rw-r--r--src/corelib/plugin/qpluginloader.cpp4
-rw-r--r--src/corelib/plugin/qpluginloader.h7
14 files changed, 52 insertions, 67 deletions
diff --git a/src/corelib/plugin/plugin.pri b/src/corelib/plugin/plugin.pri
index bb3843cc36..a0e0d76044 100644
--- a/src/corelib/plugin/plugin.pri
+++ b/src/corelib/plugin/plugin.pri
@@ -1,38 +1,37 @@
# Qt core library plugin module
HEADERS += \
- plugin/qfactoryinterface.h \
- plugin/qpluginloader.h \
- plugin/qlibrary.h \
- plugin/qlibrary_p.h \
- plugin/qplugin.h \
- plugin/quuid.h \
- plugin/qfactoryloader_p.h \
- plugin/qsystemlibrary_p.h \
- plugin/qelfparser_p.h \
- plugin/qmachparser_p.h
+ plugin/qfactoryinterface.h \
+ plugin/qpluginloader.h \
+ plugin/qplugin.h \
+ plugin/quuid.h \
+ plugin/qfactoryloader_p.h
SOURCES += \
- plugin/qfactoryinterface.cpp \
- plugin/qpluginloader.cpp \
- plugin/qfactoryloader.cpp \
- plugin/quuid.cpp \
- plugin/qlibrary.cpp \
- plugin/qelfparser_p.cpp \
- plugin/qmachparser.cpp
+ plugin/qfactoryinterface.cpp \
+ plugin/qpluginloader.cpp \
+ plugin/qfactoryloader.cpp \
+ plugin/quuid.cpp
win32 {
- SOURCES += \
- plugin/qlibrary_win.cpp \
- plugin/qsystemlibrary.cpp
+ HEADERS += plugin/qsystemlibrary_p.h
+ SOURCES += plugin/qsystemlibrary.cpp
}
-unix {
- SOURCES += plugin/qlibrary_unix.cpp
-}
+qtConfig(library) {
+ HEADERS += \
+ plugin/qlibrary.h \
+ plugin/qlibrary_p.h \
+ plugin/qelfparser_p.h \
+ plugin/qmachparser_p.h
-integrity {
- SOURCES += plugin/qlibrary_unix.cpp
-}
+ SOURCES += \
+ plugin/qlibrary.cpp \
+ plugin/qelfparser_p.cpp \
+ plugin/qmachparser.cpp
+
+ unix: SOURCES += plugin/qlibrary_unix.cpp
+ else: SOURCES += plugin/qlibrary_win.cpp
-qtConfig(dlopen): QMAKE_USE_PRIVATE += libdl
+ qtConfig(dlopen): QMAKE_USE_PRIVATE += libdl
+}
diff --git a/src/corelib/plugin/qelfparser_p.cpp b/src/corelib/plugin/qelfparser_p.cpp
index ef1fc4ded3..85478e376e 100644
--- a/src/corelib/plugin/qelfparser_p.cpp
+++ b/src/corelib/plugin/qelfparser_p.cpp
@@ -39,7 +39,6 @@
#include "qelfparser_p.h"
-#ifndef QT_NO_LIBRARY
#if defined (Q_OF_ELF) && defined(Q_CC_GNU)
#include "qlibrary_p.h"
@@ -235,4 +234,3 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library
QT_END_NAMESPACE
#endif // defined(Q_OF_ELF) && defined(Q_CC_GNU)
-#endif // QT_NO_LIBRARY
diff --git a/src/corelib/plugin/qelfparser_p.h b/src/corelib/plugin/qelfparser_p.h
index bcda19e8b5..3e73c5d149 100644
--- a/src/corelib/plugin/qelfparser_p.h
+++ b/src/corelib/plugin/qelfparser_p.h
@@ -54,7 +54,8 @@
#include <qendian.h>
#include <private/qglobal_p.h>
-#ifndef QT_NO_LIBRARY
+QT_REQUIRE_CONFIG(library);
+
#if defined (Q_OF_ELF) && defined(Q_CC_GNU)
QT_BEGIN_NAMESPACE
@@ -101,6 +102,5 @@ public:
QT_END_NAMESPACE
#endif // defined(Q_OF_ELF) && defined(Q_CC_GNU)
-#endif // QT_NO_LIBRARY
#endif // QELFPARSER_P_H
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index b8e18cc9a8..21f1007d5b 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -62,7 +62,7 @@ class QFactoryLoaderPrivate : public QObjectPrivate
public:
QFactoryLoaderPrivate(){}
QByteArray iid;
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
~QFactoryLoaderPrivate();
mutable QMutex mutex;
QList<QLibraryPrivate*> libraryList;
@@ -73,7 +73,7 @@ public:
#endif
};
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
Q_GLOBAL_STATIC(QList<QFactoryLoader *>, qt_factory_loaders)
@@ -232,7 +232,7 @@ void QFactoryLoader::refreshAll()
}
}
-#endif // QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
QFactoryLoader::QFactoryLoader(const char *iid,
const QString &suffix,
@@ -242,7 +242,7 @@ QFactoryLoader::QFactoryLoader(const char *iid,
moveToThread(QCoreApplicationPrivate::mainThread());
Q_D(QFactoryLoader);
d->iid = iid;
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
d->cs = cs;
d->suffix = suffix;
@@ -259,7 +259,7 @@ QList<QJsonObject> QFactoryLoader::metaData() const
{
Q_D(const QFactoryLoader);
QList<QJsonObject> metaData;
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
QMutexLocker locker(&d->mutex);
for (int i = 0; i < d->libraryList.size(); ++i)
metaData.append(d->libraryList.at(i)->metaData);
@@ -281,7 +281,7 @@ QObject *QFactoryLoader::instance(int index) const
if (index < 0)
return 0;
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
QMutexLocker lock(&d->mutex);
if (index < d->libraryList.size()) {
QLibraryPrivate *library = d->libraryList.at(index);
diff --git a/src/corelib/plugin/qfactoryloader_p.h b/src/corelib/plugin/qfactoryloader_p.h
index 70a934c976..7be18942ae 100644
--- a/src/corelib/plugin/qfactoryloader_p.h
+++ b/src/corelib/plugin/qfactoryloader_p.h
@@ -60,7 +60,9 @@
#include "QtCore/qjsondocument.h"
#include "QtCore/qmap.h"
#include "QtCore/qendian.h"
+#if QT_CONFIG(library)
#include "private/qlibrary_p.h"
+#endif
QT_BEGIN_NAMESPACE
@@ -84,7 +86,7 @@ public:
const QString &suffix = QString(),
Qt::CaseSensitivity = Qt::CaseSensitive);
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
~QFactoryLoader();
void update();
@@ -93,7 +95,7 @@ public:
#if defined(Q_OS_UNIX) && !defined (Q_OS_MAC)
QLibraryPrivate *library(const QString &key) const;
#endif // Q_OS_UNIX && !Q_OS_MAC
-#endif // !QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
QMultiMap<int, QString> keyMap() const;
int indexOf(const QString &needle) const;
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index a4a654cd88..6421e7c5d8 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -40,8 +40,6 @@
#include "qplatformdefs.h"
#include "qlibrary.h"
-#ifndef QT_NO_LIBRARY
-
#include "qfactoryloader_p.h"
#include "qlibrary_p.h"
#include <qstringlist.h>
@@ -1131,5 +1129,3 @@ bool qt_debug_component()
}
QT_END_NAMESPACE
-
-#endif // QT_NO_LIBRARY
diff --git a/src/corelib/plugin/qlibrary.h b/src/corelib/plugin/qlibrary.h
index 2b91fa4007..89be52aac3 100644
--- a/src/corelib/plugin/qlibrary.h
+++ b/src/corelib/plugin/qlibrary.h
@@ -42,9 +42,9 @@
#include <QtCore/qobject.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(library);
-#ifndef QT_NO_LIBRARY
+QT_BEGIN_NAMESPACE
class QLibraryPrivate;
@@ -99,8 +99,6 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QLibrary::LoadHints)
-#endif //QT_NO_LIBRARY
-
QT_END_NAMESPACE
#endif //QLIBRARY_H
diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h
index 7147ff6ca2..3f650501c8 100644
--- a/src/corelib/plugin/qlibrary_p.h
+++ b/src/corelib/plugin/qlibrary_p.h
@@ -62,10 +62,9 @@
# include "QtCore/qt_windows.h"
#endif
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_LIBRARY
+QT_REQUIRE_CONFIG(library);
+QT_BEGIN_NAMESPACE
bool qt_debug_component();
@@ -130,8 +129,6 @@ private:
friend class QLibraryStore;
};
-#endif // QT_NO_LIBRARY
-
QT_END_NAMESPACE
#endif // QLIBRARY_P_H
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
index 8b16021303..6c1253ea08 100644
--- a/src/corelib/plugin/qlibrary_unix.cpp
+++ b/src/corelib/plugin/qlibrary_unix.cpp
@@ -44,8 +44,6 @@
#include <qcoreapplication.h>
#include <private/qfilesystementry_p.h>
-#ifndef QT_NO_LIBRARY
-
#ifdef Q_OS_MAC
# include <private/qcore_mac_p.h>
#endif
@@ -308,5 +306,3 @@ QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
}
QT_END_NAMESPACE
-
-#endif // QT_NO_LIBRARY
diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp
index 48aa0cdbb6..a4d3f67c27 100644
--- a/src/corelib/plugin/qlibrary_win.cpp
+++ b/src/corelib/plugin/qlibrary_win.cpp
@@ -44,8 +44,6 @@
#include "qfileinfo.h"
#include <private/qfilesystementry_p.h>
-#ifndef QT_NO_LIBRARY
-
#include <qt_windows.h>
QT_BEGIN_NAMESPACE
@@ -174,5 +172,3 @@ QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
return QFunctionPointer(address);
}
QT_END_NAMESPACE
-
-#endif // QT_NO_LIBRARY
diff --git a/src/corelib/plugin/qmachparser.cpp b/src/corelib/plugin/qmachparser.cpp
index a599fbcb23..f506a6a6b1 100644
--- a/src/corelib/plugin/qmachparser.cpp
+++ b/src/corelib/plugin/qmachparser.cpp
@@ -39,7 +39,7 @@
#include "qmachparser_p.h"
-#if defined(Q_OF_MACH_O) && !defined(QT_NO_LIBRARY)
+#if defined(Q_OF_MACH_O)
#include <qendian.h>
#include "qlibrary_p.h"
diff --git a/src/corelib/plugin/qmachparser_p.h b/src/corelib/plugin/qmachparser_p.h
index ff7eaadb70..3884c92797 100644
--- a/src/corelib/plugin/qmachparser_p.h
+++ b/src/corelib/plugin/qmachparser_p.h
@@ -54,7 +54,8 @@
#include <qendian.h>
#include <private/qglobal_p.h>
-#ifndef QT_NO_LIBRARY
+QT_REQUIRE_CONFIG(library);
+
#if defined(Q_OF_MACH_O)
QT_BEGIN_NAMESPACE
@@ -72,6 +73,5 @@ public:
QT_END_NAMESPACE
#endif // defined(Q_OF_ELF) && defined(Q_CC_GNU)
-#endif // QT_NO_LIBRARY
#endif // QMACHPARSER_P_H
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index 6723877ad5..dbd3bee556 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -49,7 +49,7 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
/*!
\class QPluginLoader
@@ -417,7 +417,7 @@ QLibrary::LoadHints QPluginLoader::loadHints() const
return d ? d->loadHints() : QLibrary::LoadHints();
}
-#endif // QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
typedef QVector<QStaticPlugin> StaticPluginList;
Q_GLOBAL_STATIC(StaticPluginList, staticPluginList)
diff --git a/src/corelib/plugin/qpluginloader.h b/src/corelib/plugin/qpluginloader.h
index 5dca59c271..80b10f76bf 100644
--- a/src/corelib/plugin/qpluginloader.h
+++ b/src/corelib/plugin/qpluginloader.h
@@ -40,12 +40,15 @@
#ifndef QPLUGINLOADER_H
#define QPLUGINLOADER_H
+#include <QtCore/qglobal.h>
+#if QT_CONFIG(library)
#include <QtCore/qlibrary.h>
+#endif
#include <QtCore/qplugin.h>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
class QLibraryPrivate;
class QJsonObject;
@@ -93,7 +96,7 @@ public:
static QVector<QStaticPlugin> staticPlugins();
};
-#endif // QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
QT_END_NAMESPACE