diff options
author | Liang Qi <liang.qi@qt.io> | 2016-12-16 15:21:35 +0100 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2016-12-16 16:38:33 +0100 |
commit | b13150336174083962d90922761fd96f07e173b4 (patch) | |
tree | 1655e9009efba21b008d7d2f810aacbde3e2c2d8 /src/corelib/global | |
parent | ff19ebcc2d9c9668af24fe8add9f70c160776367 (diff) | |
parent | 9bfe3ab71e5291445e66be96d6cd1f63934a2d83 (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
configure
configure.pri
examples/widgets/painting/fontsampler/mainwindow.cpp
examples/widgets/painting/fontsampler/mainwindow.h
mkspecs/features/moc.prf
src/corelib/global/qglobal.h
src/gui/text/qtextdocument.cpp
Change-Id: Ica65512e00871695190a14ccea5c275b0165f787
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 4 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 6 | ||||
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 116 | ||||
-rw-r--r-- | src/corelib/global/qlibraryinfo.h | 2 | ||||
-rw-r--r-- | src/corelib/global/qlogging.cpp | 4 | ||||
-rw-r--r-- | src/corelib/global/qnumeric_p.h | 12 |
6 files changed, 122 insertions, 22 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index d978c141a4..4142c17b42 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1273,7 +1273,7 @@ # define QT_WARNING_DISABLE_INTEL(number) __pragma(warning(disable: number)) # define QT_WARNING_DISABLE_CLANG(text) # define QT_WARNING_DISABLE_GCC(text) -# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_INTEL(1786) +# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_INTEL(1478 1786) #elif defined(Q_CC_INTEL) /* icc: Intel compiler on Linux or OS X */ # define QT_WARNING_PUSH QT_DO_PRAGMA(warning(push)) @@ -1282,7 +1282,7 @@ # define QT_WARNING_DISABLE_MSVC(number) # define QT_WARNING_DISABLE_CLANG(text) # define QT_WARNING_DISABLE_GCC(text) -# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_INTEL(1786) +# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_INTEL(1478 1786) #elif defined(Q_CC_MSVC) && _MSC_VER >= 1500 && !defined(Q_CC_CLANG) # undef QT_DO_PRAGMA /* not needed */ # define QT_WARNING_PUSH __pragma(warning(push)) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 4354c85bfe..7a0804d436 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -925,8 +925,8 @@ template <typename T> class QForeachContainer { QForeachContainer &operator=(const QForeachContainer &) Q_DECL_EQ_DELETE; public: - QForeachContainer(const T &t) : c(t) {} - QForeachContainer(T &&t) : c(std::move(t)) {} + QForeachContainer(const T &t) : c(t), i(c.begin()), e(c.end()) {} + QForeachContainer(T &&t) : c(std::move(t)), i(c.begin()), e(c.end()) {} QForeachContainer(const QForeachContainer &other) : c(other.c), i(c.begin()), @@ -936,7 +936,7 @@ public: } const T c; - typename T::const_iterator i = c.begin(), e = c.end(); + typename T::const_iterator i, e; int control = 1; }; diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 27fe10a79e..87ee75fa45 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -41,15 +41,18 @@ #include "qdir.h" #include "qstringlist.h" #include "qfile.h" +#include "qtemporaryfile.h" #include "qsettings.h" #include "qlibraryinfo.h" #include "qscopedpointer.h" #ifdef QT_BUILD_QMAKE QT_BEGIN_NAMESPACE +extern QString qmake_absoluteLocation(); extern QString qmake_libraryInfoFile(); QT_END_NAMESPACE #else +# include "qconfig.cpp" # include "qcoreapplication.h" #endif @@ -57,7 +60,6 @@ QT_END_NAMESPACE # include "private/qcore_mac_p.h" #endif -#include "qconfig.cpp" #include "archdetect.cpp" QT_BEGIN_NAMESPACE @@ -70,9 +72,16 @@ struct QLibrarySettings { QLibrarySettings(); void load(); +#ifdef QT_BUILD_QMAKE + void loadBuiltinValues(QSettings *config); +#endif QScopedPointer<QSettings> settings; #ifdef QT_BUILD_QMAKE + QString builtinValues[QLibraryInfo::LastHostPath + 1]; +# ifndef Q_OS_WIN + QString builtinSettingsPath; +# endif bool haveDevicePaths; bool haveEffectiveSourcePaths; bool haveEffectivePaths; @@ -88,6 +97,11 @@ class QLibraryInfoPrivate public: static QSettings *findConfiguration(); #ifdef QT_BUILD_QMAKE + static void reload() + { + if (qt_library_settings.exists()) + qt_library_settings->load(); + } static bool haveGroup(QLibraryInfo::PathGroup group) { QLibrarySettings *ls = qt_library_settings(); @@ -99,6 +113,25 @@ public: ? ls->haveDevicePaths : ls->havePaths) : false; } + static bool sysrootify() + { + // This is actually bogus, as it does not consider post-configure settings. + QLibrarySettings *ls = qt_library_settings(); + return ls ? (!ls->builtinValues[QLibraryInfo::SysrootPath].isEmpty() + && ls->builtinValues[QLibraryInfo::ExtPrefixPath].isEmpty()) : false; + } + static QString builtinValue(int loc) + { + QLibrarySettings *ls = qt_library_settings(); + return ls ? ls->builtinValues[loc] : QString(); + } +# ifndef Q_OS_WIN + static QString builtinSettingsPath() + { + QLibrarySettings *ls = qt_library_settings(); + return ls ? ls->builtinSettingsPath : QString(); + } +# endif #endif static QSettings *configuration() { @@ -122,6 +155,20 @@ QLibrarySettings::QLibrarySettings() load(); } +#ifdef QT_BUILD_QMAKE +static QByteArray qtconfSeparator() +{ +# ifdef Q_OS_WIN + QByteArray header = QByteArrayLiteral("\r\n===========================================================\r\n"); +# else + QByteArray header = QByteArrayLiteral("\n===========================================================\n"); +# endif + QByteArray content = QByteArrayLiteral("==================== qt.conf beginning ===================="); + // Assemble from pieces to avoid that the string appears in a raw executable + return header + content + header; +} +#endif + void QLibrarySettings::load() { // If we get any settings here, those won't change when the application shows up. @@ -159,6 +206,27 @@ void QLibrarySettings::load() havePaths = false; #endif } + +#ifdef QT_BUILD_QMAKE + // Try to use an embedded qt.conf appended to the QMake executable. + QFile qmakeFile(qmake_absoluteLocation()); + if (!qmakeFile.open(QIODevice::ReadOnly)) + return; + qmakeFile.seek(qmakeFile.size() - 10000); + QByteArray tail = qmakeFile.read(10000); + QByteArray separator = qtconfSeparator(); + int qtconfOffset = tail.lastIndexOf(separator); + if (qtconfOffset < 0) + return; + tail.remove(0, qtconfOffset + separator.size()); + // If QSettings had a c'tor taking a QIODevice, we'd pass a QBuffer ... + QTemporaryFile tmpFile; + tmpFile.open(); + tmpFile.write(tail); + tmpFile.close(); + QSettings builtinSettings(tmpFile.fileName(), QSettings::IniFormat); + loadBuiltinValues(&builtinSettings); +#endif } QSettings *QLibraryInfoPrivate::findConfiguration() @@ -420,10 +488,30 @@ static const struct { { "HostData", "." }, { "TargetSpec", "" }, { "HostSpec", "" }, + { "ExtPrefix", "" }, { "HostPrefix", "" }, #endif }; +#ifdef QT_BUILD_QMAKE +void QLibrarySettings::loadBuiltinValues(QSettings *config) +{ + config->beginGroup(QLatin1String("Paths")); + for (int i = 0; i <= QLibraryInfo::LastHostPath; i++) + builtinValues[i] = config->value(QLatin1String(qtConfEntries[i].key), + QLatin1String(qtConfEntries[i].value)).toString(); +# ifndef Q_OS_WIN + builtinSettingsPath = config->value(QLatin1String("Settings")).toString(); +# endif + config->endGroup(); +} + +void QLibraryInfo::reload() +{ + QLibraryInfoPrivate::reload(); +} +#endif + /*! Returns the location specified by \a loc. */ @@ -434,7 +522,7 @@ QLibraryInfo::location(LibraryLocation loc) QString ret = rawLocation(loc, FinalPaths); // Automatically prepend the sysroot to target paths - if ((loc < SysrootPath || loc > LastHostPath) && QT_CONFIGURE_SYSROOTIFY_PREFIX) { + if ((loc < SysrootPath || loc > LastHostPath) && QLibraryInfoPrivate::sysrootify()) { QString sysroot = rawLocation(SysrootPath, FinalPaths); if (!sysroot.isEmpty() && ret.length() > 2 && ret.at(1) == QLatin1Char(':') && (ret.at(2) == QLatin1Char('/') || ret.at(2) == QLatin1Char('\\'))) @@ -528,28 +616,32 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) #endif // QT_NO_SETTINGS if (!fromConf) { +#ifdef QT_BUILD_QMAKE + if ((unsigned)loc <= (unsigned)LastHostPath) { + if (loc == PrefixPath && group != DevicePaths) + ret = QLibraryInfoPrivate::builtinValue(ExtPrefixPath); + else + ret = QLibraryInfoPrivate::builtinValue(loc); +# ifndef Q_OS_WIN // On Windows we use the registry + } else if (loc == SettingsPath) { + ret = QLibraryInfoPrivate::builtinSettingsPath(); +# endif + } +#else // QT_BUILD_QMAKE const char * volatile path = 0; if (loc == PrefixPath) { - path = -#ifdef QT_BUILD_QMAKE - (group != DevicePaths) ? - QT_CONFIGURE_EXT_PREFIX_PATH : -#endif - QT_CONFIGURE_PREFIX_PATH; + path = QT_CONFIGURE_PREFIX_PATH; } else if (unsigned(loc) <= sizeof(qt_configure_str_offsets)/sizeof(qt_configure_str_offsets[0])) { path = qt_configure_strs + qt_configure_str_offsets[loc - 1]; #ifndef Q_OS_WIN // On Windows we use the registry } else if (loc == SettingsPath) { path = QT_CONFIGURE_SETTINGS_PATH; #endif -#ifdef QT_BUILD_QMAKE - } else if (loc == HostPrefixPath) { - path = QT_CONFIGURE_HOST_PREFIX_PATH; -#endif } if (path) ret = QString::fromLocal8Bit(path); +#endif } #ifdef QT_BUILD_QMAKE diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index 55be706382..9d794ce1da 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -96,6 +96,7 @@ public: HostDataPath, TargetSpecPath, HostSpecPath, + ExtPrefixPath, HostPrefixPath, LastHostPath = HostPrefixPath, #endif @@ -105,6 +106,7 @@ public: #ifdef QT_BUILD_QMAKE enum PathGroup { FinalPaths, EffectivePaths, EffectiveSourcePaths, DevicePaths }; static QString rawLocation(LibraryLocation, PathGroup); + static void reload(); #endif static QStringList platformPluginArguments(const QString &platformName); diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 0506d372b6..6b90a47388 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1042,6 +1042,10 @@ void QMessagePattern::setPattern(const QString &pattern) delete [] literals; } delete [] tokens; + timeArgs.clear(); +#ifdef QLOGGING_HAVE_BACKTRACE + backtraceArgs.clear(); +#endif // scanner QList<QString> lexemes; diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index 23fcf340f1..01b8772ee1 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -68,7 +68,8 @@ #if !defined(Q_CC_MSVC) && (defined(Q_OS_QNX) || defined(Q_CC_INTEL) || !defined(__cplusplus)) # include <math.h> -# define QT_MATH_H_DEFINES_MACROS +# ifdef isnan +# define QT_MATH_H_DEFINES_MACROS QT_BEGIN_NAMESPACE namespace qnumeric_std_wrapper { // the 'using namespace std' below is cases where the stdlib already put the math.h functions in the std namespace and undefined the macros. @@ -81,10 +82,11 @@ static inline bool math_h_isfinite(float f) { using namespace std; return isfini } QT_END_NAMESPACE // These macros from math.h conflict with the real functions in the std namespace. -#undef signbit -#undef isnan -#undef isinf -#undef isfinite +# undef signbit +# undef isnan +# undef isinf +# undef isfinite +# endif // defined(isnan) #endif QT_BEGIN_NAMESPACE |