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>
This commit is contained in:
Ulf Hermann 2016-12-19 10:34:32 +01:00
parent f31dbeb4c7
commit d6330a19b2
52 changed files with 143 additions and 158 deletions

View File

@ -43,7 +43,6 @@ QT_REQUIRE_CONFIG(iconv);
#include "qiconvcodec_p.h"
#include "qtextcodec_p.h"
#include <qlibrary.h>
#include <qdebug.h>
#include <qthreadstorage.h>

View File

@ -71,7 +71,6 @@
#define QT_FEATURE_iconv -1
#define QT_FEATURE_icu -1
#define QT_FEATURE_journald -1
#define QT_NO_LIBRARY
#define QT_FEATURE_library -1
#define QT_NO_QOBJECT
#define QT_FEATURE_process -1

View File

@ -158,14 +158,15 @@ Q_CORE_EXPORT int qt_ntfs_permission_lookup = 0;
#if defined(Q_OS_WINRT)
static QString qfsPrivateCurrentDir = QLatin1String("");
// As none of the functions we try to resolve do exist on WinRT
// we use QT_NO_LIBRARY to shorten everything up a little bit.
# ifndef QT_NO_LIBRARY
# define QT_NO_LIBRARY 1
# endif
// As none of the functions we try to resolve do exist on WinRT we
// avoid library loading on WinRT in general to shorten everything
// up a little bit.
# define QT_FEATURE_fslibs -1
#else
# define QT_FEATURE_fslibs QT_FEATURE_library
#endif // Q_OS_WINRT
#if !defined(QT_NO_LIBRARY)
#if QT_CONFIG(fslibs)
QT_BEGIN_INCLUDE_NAMESPACE
typedef DWORD (WINAPI *PtrGetNamedSecurityInfoW)(LPWSTR, SE_OBJECT_TYPE, SECURITY_INFORMATION, PSID*, PSID*, PACL*, PACL*, PSECURITY_DESCRIPTOR*);
static PtrGetNamedSecurityInfoW ptrGetNamedSecurityInfoW = 0;
@ -273,7 +274,7 @@ static void resolveLibs()
ptrGetUserProfileDirectoryW = (PtrGetUserProfileDirectoryW)GetProcAddress(userenvHnd, "GetUserProfileDirectoryW");
}
}
#endif // QT_NO_LIBRARY
#endif // QT_CONFIG(fslibs)
typedef DWORD (WINAPI *PtrNetShareEnum)(LPWSTR, DWORD, LPBYTE*, DWORD, LPDWORD, LPDWORD, LPDWORD);
static PtrNetShareEnum ptrNetShareEnum = 0;
@ -343,7 +344,7 @@ static QString readSymLink(const QFileSystemEntry &link)
free(rdb);
CloseHandle(handle);
#if !defined(QT_NO_LIBRARY)
#if QT_CONFIG(fslibs)
resolveLibs();
QRegExp matchVolName(QLatin1String("^Volume\\{([a-z]|[0-9]|-)+\\}\\\\"), Qt::CaseInsensitive);
if (matchVolName.indexIn(result) == 0) {
@ -353,7 +354,7 @@ static QString readSymLink(const QFileSystemEntry &link)
if (GetVolumePathNamesForVolumeName(reinterpret_cast<LPCWSTR>(volumeName.utf16()), buffer, MAX_PATH, &len) != 0)
result.replace(0,matchVolName.matchedLength(), QString::fromWCharArray(buffer));
}
#endif // !Q_OS_WINRT
#endif // QT_CONFIG(fslibs)
}
#else
Q_UNUSED(link);
@ -363,7 +364,7 @@ static QString readSymLink(const QFileSystemEntry &link)
static QString readLink(const QFileSystemEntry &link)
{
#if !defined(QT_NO_LIBRARY)
#if QT_CONFIG(fslibs)
QString ret;
bool neededCoInit = false;
@ -402,7 +403,7 @@ static QString readLink(const QFileSystemEntry &link)
#else
Q_UNUSED(link);
return QString();
#endif // QT_NO_LIBRARY
#endif // QT_CONFIG(fslibs)
}
static bool uncShareExists(const QString &server)
@ -648,7 +649,7 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
QString QFileSystemEngine::owner(const QFileSystemEntry &entry, QAbstractFileEngine::FileOwner own)
{
QString name;
#if !defined(QT_NO_LIBRARY)
#if QT_CONFIG(fslibs)
extern int qt_ntfs_permission_lookup;
if((qt_ntfs_permission_lookup > 0) && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) {
resolveLibs();
@ -698,7 +699,7 @@ QString QFileSystemEngine::owner(const QFileSystemEntry &entry, QAbstractFileEng
bool QFileSystemEngine::fillPermissions(const QFileSystemEntry &entry, QFileSystemMetaData &data,
QFileSystemMetaData::MetaDataFlags what)
{
#if !defined(QT_NO_LIBRARY)
#if QT_CONFIG(fslibs)
if((qt_ntfs_permission_lookup > 0) && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) {
resolveLibs();
if(ptrGetNamedSecurityInfoW && ptrBuildTrusteeWithSidW && ptrGetEffectiveRightsFromAclW) {
@ -1162,7 +1163,7 @@ QString QFileSystemEngine::rootPath()
QString QFileSystemEngine::homePath()
{
QString ret;
#if !defined(QT_NO_LIBRARY)
#if QT_CONFIG(fslibs)
resolveLibs();
if (ptrGetUserProfileDirectoryW) {
HANDLE hnd = ::GetCurrentProcess();

View File

@ -589,7 +589,7 @@ bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) cons
bool QFSFileEngine::link(const QString &newName)
{
#if !defined(Q_OS_WINRT)
# if !defined(QT_NO_LIBRARY)
# if QT_CONFIG(library)
bool ret = false;
QString linkName = newName;
@ -630,10 +630,10 @@ bool QFSFileEngine::link(const QString &newName)
CoUninitialize();
return ret;
# else // QT_NO_LIBRARY
# else // QT_CONFIG(library)
Q_UNUSED(newName);
return false;
# endif // QT_NO_LIBRARY
# endif // QT_CONFIG(library)
#else // !Q_OS_WINRT
Q_UNUSED(newName);
Q_UNIMPLEMENTED();

View File

@ -339,7 +339,7 @@ struct QCoreApplicationData {
QString applicationVersion;
bool applicationNameSet; // true if setApplicationName was called
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
QScopedPointer<QStringList> app_libpaths;
QScopedPointer<QStringList> manual_libpaths;
#endif
@ -534,7 +534,7 @@ void QCoreApplicationPrivate::checkReceiverThread(QObject *receiver)
void QCoreApplicationPrivate::appendApplicationPathToLibraryPaths()
{
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
QStringList *app_libpaths = coreappdata()->app_libpaths.data();
if (!app_libpaths)
coreappdata()->app_libpaths.reset(app_libpaths = new QStringList);
@ -735,7 +735,7 @@ void QCoreApplicationPrivate::init()
QLoggingRegistry::instance()->init();
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
// Reset the lib paths, so that they will be recomputed, taking the availability of argv[0]
// into account. If necessary, recompute right away and replay the manual changes on top of the
// new lib paths.
@ -834,7 +834,7 @@ QCoreApplication::~QCoreApplication()
QCoreApplicationPrivate::eventDispatcher = 0;
#endif
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
coreappdata()->app_libpaths.reset();
coreappdata()->manual_libpaths.reset();
#endif
@ -2414,7 +2414,7 @@ QString QCoreApplication::applicationVersion()
return coreappdata()->applicationVersion;
}
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QMutex, libraryPathMutex, (QMutex::Recursive))
@ -2626,7 +2626,7 @@ void QCoreApplication::removeLibraryPath(const QString &path)
QFactoryLoader::refreshAll();
}
#endif //QT_NO_LIBRARY
#endif // QT_CONFIG(library)
#ifndef QT_NO_QOBJECT

View File

@ -141,12 +141,12 @@ public:
static QString applicationFilePath();
static qint64 applicationPid();
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
static void setLibraryPaths(const QStringList &);
static QStringList libraryPaths();
static void addLibraryPath(const QString &);
static void removeLibraryPath(const QString &);
#endif // QT_NO_LIBRARY
#endif // QT_CONFIG(library)
#ifndef QT_NO_TRANSLATION
static bool installTranslator(QTranslator * messageFile);

View File

@ -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/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
win32 {
HEADERS += plugin/qsystemlibrary_p.h
SOURCES += plugin/qsystemlibrary.cpp
}
qtConfig(library) {
HEADERS += \
plugin/qlibrary.h \
plugin/qlibrary_p.h \
plugin/qelfparser_p.h \
plugin/qmachparser_p.h
SOURCES += \
plugin/qfactoryinterface.cpp \
plugin/qpluginloader.cpp \
plugin/qfactoryloader.cpp \
plugin/quuid.cpp \
plugin/qlibrary.cpp \
SOURCES += \
plugin/qlibrary.cpp \
plugin/qelfparser_p.cpp \
plugin/qmachparser.cpp
win32 {
SOURCES += \
plugin/qlibrary_win.cpp \
plugin/qsystemlibrary.cpp
}
unix: SOURCES += plugin/qlibrary_unix.cpp
else: SOURCES += plugin/qlibrary_win.cpp
unix {
SOURCES += plugin/qlibrary_unix.cpp
qtConfig(dlopen): QMAKE_USE_PRIVATE += libdl
}
integrity {
SOURCES += plugin/qlibrary_unix.cpp
}
qtConfig(dlopen): QMAKE_USE_PRIVATE += libdl

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -62,11 +62,10 @@
# include "QtCore/qt_windows.h"
#endif
QT_REQUIRE_CONFIG(library);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_LIBRARY
bool qt_debug_component();
class QLibraryStore;
@ -130,8 +129,6 @@ private:
friend class QLibraryStore;
};
#endif // QT_NO_LIBRARY
QT_END_NAMESPACE
#endif // QLIBRARY_P_H

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -40,7 +40,9 @@
#include "qharfbuzz_p.h"
#include "qunicodetables_p.h"
#if QT_CONFIG(library)
#include "qlibrary.h"
#endif
QT_USE_NAMESPACE
@ -70,7 +72,7 @@ HB_UChar16 HB_GetMirroredChar(HB_UChar16 ch)
void (*HB_Library_Resolve(const char *library, int version, const char *symbol))()
{
#ifdef QT_NO_LIBRARY
#if !QT_CONFIG(library)
Q_UNUSED(library);
Q_UNUSED(version);
Q_UNUSED(symbol);

View File

@ -38,7 +38,6 @@
****************************************************************************/
#include "qglobal.h"
#include "qlibrary.h"
#include "qdebug.h"
#include "qlocale_p.h"
#include "qmutex.h"

View File

@ -39,7 +39,7 @@
****************************************************************************/
#include <QtCore/qglobal.h>
#ifndef QT_BOOTSTRAPPED
#if QT_CONFIG(library)
#include <QtCore/qlibrary.h>
#endif
#include <QtCore/qmutex.h>
@ -54,7 +54,7 @@ void (*qdbus_resolve_me(const char *name))();
#if !defined QT_LINKED_LIBDBUS
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
static QLibrary *qdbus_libdbus = 0;
void qdbus_unloadLibDBus()
@ -71,7 +71,7 @@ void qdbus_unloadLibDBus()
bool qdbus_loadLibDBus()
{
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
#ifdef QT_BUILD_INTERNAL
// this is to simulate a library load failure for our autotest suite.
if (!qEnvironmentVariableIsEmpty("QT_SIMULATE_DBUS_LIBFAIL"))
@ -126,7 +126,7 @@ bool qdbus_loadLibDBus()
#endif
}
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
void (*qdbus_resolve_conditionally(const char *name))()
{
if (qdbus_loadLibDBus())
@ -137,7 +137,7 @@ void (*qdbus_resolve_conditionally(const char *name))()
void (*qdbus_resolve_me(const char *name))()
{
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
if (Q_UNLIKELY(!qdbus_loadLibDBus()))
qFatal("Cannot find libdbus-1 in your system to resolve symbol '%s'.", name);
@ -161,7 +161,7 @@ static void qdbus_unloadLibDBus()
#endif // !QT_LINKED_LIBDBUS
#if defined(QT_LINKED_LIBDBUS) || !defined(QT_NO_LIBRARY)
#if defined(QT_LINKED_LIBDBUS) || QT_CONFIG(library)
Q_DESTRUCTOR_FUNCTION(qdbus_unloadLibDBus)
#endif

View File

@ -1772,7 +1772,7 @@ static QDBusConnection::ConnectionCapabilities connectionCapabilies(DBusConnecti
# if DBUS_VERSION-0 >= 0x010400
can_send_type = dbus_connection_can_send_type;
# endif
#elif !defined(QT_NO_LIBRARY)
#elif QT_CONFIG(library)
// run-time check if the next functions are available
can_send_type = (can_send_type_t)qdbus_resolve_conditionally("dbus_connection_can_send_type");
#endif

View File

@ -98,7 +98,7 @@
#include <QtGui/QClipboard>
#endif
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
#include <QtCore/QLibrary>
#endif
@ -1449,7 +1449,7 @@ void QGuiApplicationPrivate::init()
session_manager = new QSessionManager(q, session_id, session_key);
#endif
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
if (qEnvironmentVariableIntValue("QT_LOAD_TESTABILITY") > 0)
loadTestability = true;
@ -1469,7 +1469,7 @@ void QGuiApplicationPrivate::init()
}
#else
Q_UNUSED(loadTestability);
#endif // QT_NO_LIBRARY
#endif // QT_CONFIG(library)
if (layout_direction == Qt::LayoutDirectionAuto || force_reverse)
QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight);

View File

@ -51,14 +51,14 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QPlatformIntegrationFactoryInterface_iid, QLatin1String("/platforms"), Qt::CaseInsensitive))
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
(QPlatformIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
#endif // !QT_NO_LIBRARY
#endif // QT_CONFIG(library)
QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platform, const QStringList &paramList, int &argc, char **argv, const QString &platformPluginPath)
{
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
// Try loading the plugin from platformPluginPath first:
if (!platformPluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(platformPluginPath);
@ -81,7 +81,7 @@ QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platfor
QStringList QPlatformIntegrationFactory::keys(const QString &platformPluginPath)
{
QStringList list;
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
if (!platformPluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(platformPluginPath);
list = directLoader()->keyMap().values();

View File

@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QPlatformThemeFactoryInterface_iid, QLatin1String("/platformthemes"), Qt::CaseInsensitive))
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
(QPlatformThemeFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
#endif
@ -60,7 +60,7 @@ QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString
{
QStringList paramList = key.split(QLatin1Char(':'));
const QString platform = paramList.takeFirst().toLower();
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
// Try loading the plugin from platformPluginPath first:
if (!platformPluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(platformPluginPath);
@ -83,7 +83,7 @@ QStringList QPlatformThemeFactory::keys(const QString &platformPluginPath)
{
QStringList list;
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
if (!platformPluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(platformPluginPath);
list += directLoader()->keyMap().values();

View File

@ -47,7 +47,6 @@
#include <private/qfont_p.h>
#include <qwindow.h>
#include <qlibrary.h>
#include <qimage.h>
#include <QtCore/qbytearray.h>

View File

@ -39,7 +39,9 @@
#include "qdnslookup_p.h"
#if QT_CONFIG(library)
#include <qlibrary.h>
#endif
#include <qscopedpointer.h>
#include <qurl.h>
#include <private/qnativesocketengine_p.h>
@ -58,7 +60,7 @@
QT_BEGIN_NAMESPACE
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
#if defined(Q_OS_OPENBSD)
typedef struct __res_state* res_state;
@ -382,6 +384,6 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
return;
}
#endif /* ifndef QT_NO_LIBRARY */
#endif /* QT_CONFIG(library) */
QT_END_NAMESPACE

View File

@ -45,7 +45,9 @@
#include "private/qnativesocketengine_p.h"
#include "qiodevice.h"
#include <qbytearray.h>
#if QT_CONFIG(library)
#include <qlibrary.h>
#endif
#include <qbasicatomic.h>
#include <qurl.h>
#include <qfile.h>
@ -93,7 +95,7 @@ static res_state_ptr local_res = 0;
static bool resolveLibraryInternal()
{
#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_QNX)
#if QT_CONFIG(library) && !defined(Q_OS_QNX)
QLibrary lib;
#ifdef LIBRESOLV_SO
lib.setFileName(QStringLiteral(LIBRESOLV_SO));

View File

@ -78,7 +78,6 @@
#include <QtCore/qthread.h>
#include <QtCore/qurl.h>
#include <QtCore/qvarlengtharray.h>
#include <QLibrary> // for loading the security lib for the CA store
#include <string.h>
@ -530,7 +529,7 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded()
resetDefaultCiphers();
resetDefaultEllipticCurves();
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
//load symbols needed to receive certificates from system store
#if defined(Q_OS_WIN)
HINSTANCE hLib = LoadLibraryW(L"Crypt32");
@ -558,7 +557,7 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded()
}
}
#endif
#endif //QT_NO_LIBRARY
#endif // QT_CONFIG(library)
// if on-demand loading was not enabled, load the certs now
if (!s_loadRootCertsOnDemand)
setDefaultCaCertificates(systemCaCertificates());

View File

@ -58,7 +58,7 @@
#ifdef Q_OS_WIN
# include <private/qsystemlibrary_p.h>
#else
#elif QT_CONFIG(library)
# include <QtCore/qlibrary.h>
#endif
#include <QtCore/qmutex.h>
@ -125,7 +125,7 @@ void qsslSocketUnresolvedSymbolWarning(const char *functionName)
qCWarning(lcSsl, "QSslSocket: cannot call unresolved function %s", functionName);
}
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
void qsslSocketCannotResolveSymbolWarning(const char *functionName)
{
qCWarning(lcSsl, "QSslSocket: cannot resolve %s", functionName);
@ -468,12 +468,11 @@ DEFINEFUNC(void, PKCS12_free, PKCS12 *pkcs12, pkcs12, return, DUMMYARG)
#if !defined QT_LINKED_OPENSSL
#ifdef QT_NO_LIBRARY
#if !QT_CONFIG(library)
bool q_resolveOpenSslSymbols()
{
qCWarning(lcSsl, "QSslSocket: unable to resolve symbols. "
"QT_NO_LIBRARY is defined which means runtime resolving of "
"libraries won't work.");
qCWarning(lcSsl, "QSslSocket: unable to resolve symbols. Qt is configured without the "
"'library' feature, which means runtime resolving of libraries won't work.");
qCWarning(lcSsl, "Either compile Qt statically or with support for runtime resolving "
"of libraries.");
return false;
@ -1034,7 +1033,7 @@ bool q_resolveOpenSslSymbols()
delete libs.second;
return true;
}
#endif // QT_NO_LIBRARY
#endif // QT_CONFIG(library)
#else // !defined QT_LINKED_OPENSSL

View File

@ -65,7 +65,6 @@
#include <private/qimagepixmapcleanuphooks_p.h>
#include "qcolormap.h"
#include "qfile.h"
#include "qlibrary.h"
#include <qmutex.h>
#include "qsurfaceformat.h"

View File

@ -45,7 +45,6 @@
#include <private/qfont_p.h>
#include "gl2paintengineex/qpaintengineex_opengl2_p.h"
#include <qlibrary.h>
#include <qimage.h>
#include <qwindow.h>

View File

@ -69,16 +69,16 @@ Q_LOGGING_CATEGORY(qLcEglDevDebug, "qt.qpa.egldeviceintegration")
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QEglFSDeviceIntegrationFactoryInterface_iid, QLatin1String("/egldeviceintegrations"), Qt::CaseInsensitive))
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
(QEglFSDeviceIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
#endif // QT_NO_LIBRARY
#endif // QT_CONFIG(library)
QStringList QEglFSDeviceIntegrationFactory::keys(const QString &pluginPath)
{
QStringList list;
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
list = directLoader()->keyMap().values();
@ -102,7 +102,7 @@ QStringList QEglFSDeviceIntegrationFactory::keys(const QString &pluginPath)
QEglFSDeviceIntegration *QEglFSDeviceIntegrationFactory::create(const QString &key, const QString &pluginPath)
{
QEglFSDeviceIntegration *integration = Q_NULLPTR;
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
integration = qLoadPlugin<QEglFSDeviceIntegration, QEglFSDeviceIntegrationPlugin>(directLoader(), key);

View File

@ -50,14 +50,14 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QXcbGlIntegrationFactoryInterface_iid, QLatin1String("/xcbglintegrations"), Qt::CaseInsensitive))
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
(QXcbGlIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
#endif // !QT_NO_LIBRARY
#endif // QT_CONFIG(library)
QXcbGlIntegration *QXcbGlIntegrationFactory::create(const QString &platform, const QString &pluginPath)
{
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
// Try loading the plugin from pluginPath first:
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);

View File

@ -38,7 +38,9 @@
****************************************************************************/
#include <QDebug>
#if QT_CONFIG(library)
#include <QLibrary>
#endif
#include "qxcbwindow.h"
#include "qxcbscreen.h"
@ -573,7 +575,7 @@ QFunctionPointer QGLXContext::getProcAddress(const char *procName)
if (!glXGetProcAddressARB)
#endif
{
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
extern const QString qt_gl_library_name();
// QLibrary lib(qt_gl_library_name());
QLibrary lib(QLatin1String("GL"));

View File

@ -43,7 +43,9 @@
#include "qxcbimage.h"
#include "qxcbxsettings.h"
#if QT_CONFIG(library)
#include <QtCore/QLibrary>
#endif
#include <QtGui/QWindow>
#include <QtGui/QBitmap>
#include <QtGui/private/qguiapplication_p.h>
@ -58,7 +60,7 @@ typedef char *(*PtrXcursorLibraryGetTheme)(void *);
typedef int (*PtrXcursorLibrarySetTheme)(void *, const char *);
typedef int (*PtrXcursorLibraryGetDefaultSize)(void *);
#if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
#include <X11/Xlib.h>
enum {
XCursorShape = CursorShape
@ -306,7 +308,7 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)
const char *cursorStr = "cursor";
xcb_open_font(xcb_connection(), cursorFont, strlen(cursorStr), cursorStr);
#if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
static bool function_ptrs_not_initialized = true;
if (function_ptrs_not_initialized) {
QLibrary xcursorLib(QLatin1String("Xcursor"), 1);
@ -507,7 +509,7 @@ xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape)
return cursor;
}
#if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
bool updateCursorTheme(void *dpy, const QByteArray &theme) {
if (!ptrXcursorLibraryGetTheme
|| !ptrXcursorLibrarySetTheme)
@ -551,7 +553,7 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape)
}
return cursor;
}
#endif //XCB_USE_XLIB / QT_NO_LIBRARY
#endif // XCB_USE_XLIB / QT_CONFIG(library)
xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
{
@ -560,7 +562,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
xcb_cursor_t cursor = XCB_NONE;
// Try Xcursor first
#if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
if (cshape >= 0 && cshape <= Qt::LastCursor) {
void *dpy = connection()->xlib_display();
// special case for non-standard dnd-* cursors

View File

@ -101,7 +101,7 @@ private:
#ifndef QT_NO_CURSOR
CursorHash m_cursorHash;
#endif
#if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
static void cursorThemePropertyChanged(QXcbVirtualDesktop *screen,
const QByteArray &name,
const QVariant &property,

View File

@ -59,7 +59,6 @@
#include <qsplitter.h>
#include <qprogressbar.h>
#include <qwizard.h>
#include <qlibrary.h>
#include <qdrawutil.h>
#include <private/qstylehelper_p.h>
#include <private/qdrawhelper_p.h>

View File

@ -89,7 +89,6 @@
#include <qtableview.h>
#include <qwizard.h>
#include <qdebug.h>
#include <qlibrary.h>
#include <qdatetimeedit.h>
#include <qmath.h>
#include <qpair.h>

View File

@ -58,7 +58,6 @@
#include <private/qwindowsxpstyle_p_p.h>
#include <private/qstyleanimation_p.h>
#include <private/qpaintengine_raster_p.h>
#include <qlibrary.h>
#include <qpaintengine.h>
#include <qwidget.h>
#include <qapplication.h>

View File

@ -65,7 +65,6 @@
#include <private/qt_cocoa_helpers_mac_p.h>
#endif
#ifdef Q_OS_WIN
# include <qlibrary.h>
# include <qt_windows.h>
#endif

View File

@ -31,7 +31,6 @@
#include <qfile.h>
#include <qdir.h>
#include <qcoreapplication.h>
#include <qlibrary.h>
#include <qtemporaryfile.h>
#include <qtemporarydir.h>
#include <qdir.h>

View File

@ -893,7 +893,7 @@ void tst_QCoreApplication::threadedEventDelivery()
QCOMPARE(receiver.recordedEvents.contains(QEvent::User + 1), eventsReceived);
}
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
void tst_QCoreApplication::addRemoveLibPaths()
{
QStringList paths = QCoreApplication::libraryPaths();

View File

@ -58,7 +58,7 @@ private slots:
void applicationEventFilters_auxThread();
void threadedEventDelivery_data();
void threadedEventDelivery();
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
void addRemoveLibPaths();
#endif
};

View File

@ -29,11 +29,12 @@
#include <QtTest/qtest.h>
#include <QtCore/qdir.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qplugin.h>
#include <private/qfactoryloader_p.h>
#include "plugin1/plugininterface1.h"
#include "plugin2/plugininterface2.h"
#ifdef QT_NO_LIBRARY
#if !QT_CONFIG(library)
Q_IMPORT_PLUGIN(Plugin1)
Q_IMPORT_PLUGIN(Plugin2)
#endif
@ -54,7 +55,7 @@ void tst_QFactoryLoader::initTestCase()
{
const QString binFolder = QFINDTESTDATA(binFolderC);
QVERIFY2(!binFolder.isEmpty(), "Unable to locate 'bin' folder");
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
QCoreApplication::setLibraryPaths(QStringList(QFileInfo(binFolder).absolutePath()));
#endif
}

View File

@ -751,7 +751,9 @@ void tst_QTextBoundaryFinder::isAtSoftHyphen()
doTestData(testString, expectedSoftHyphenPositions, QTextBoundaryFinder::Line, QTextBoundaryFinder::SoftHyphen);
}
#if QT_CONFIG(library)
#include <qlibrary.h>
#endif
#define LIBTHAI_MAJOR 0
typedef int (*th_brk_def) (const unsigned char*, int*, size_t);
@ -759,7 +761,7 @@ static th_brk_def th_brk = 0;
static bool init_libthai()
{
#if !defined(QT_NO_LIBRARY)
#if QT_CONFIG(library)
static bool triedResolve = false;
if (!triedResolve) {
th_brk = (th_brk_def) QLibrary::resolve("thai", (int)LIBTHAI_MAJOR, "th_brk");

View File

@ -1084,7 +1084,7 @@ static bool canSendUnixFd(DBusConnection *connection)
# if DBUS_VERSION-0 >= 0x010400
can_send_type = dbus_connection_can_send_type;
# endif
#elif !defined(QT_NO_LIBRARY)
#elif QT_CONFIG(library)
// run-time check if the next functions are available
can_send_type = (can_send_type_t)qdbus_resolve_conditionally("dbus_connection_can_send_type");
#endif

View File

@ -90,7 +90,7 @@ static void addFixedTypes()
// the library recognizes this as valid type first.
// The following function was added for Unix FD support, so if it is
// present, so is support for Unix FDs.
# ifndef QT_NO_LIBRARY
# if QT_CONFIG(library)
bool supportsUnixFds = qdbus_resolve_conditionally("dbus_connection_can_send_type");
# else
bool supportsUnixFds = false;

View File

@ -54,7 +54,6 @@
#endif
#include <time.h>
#include <qlibrary.h>
#if defined(Q_OS_WIN)
#include <windows.h>
#else

View File

@ -121,7 +121,7 @@ private slots:
void testDeleteLater();
void testDeleteLaterProcessEvents();
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
void libraryPaths();
void libraryPaths_qt_plugin_path();
void libraryPaths_qt_plugin_path_2();
@ -885,7 +885,7 @@ bool isPathListIncluded(const QStringList &l, const QStringList &r)
return j == r.count();
}
#ifndef QT_NO_LIBRARY
#if QT_CONFIG(library)
#define QT_TST_QAPP_DEBUG
void tst_QApplication::libraryPaths()
{