summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2011-08-31 14:23:42 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-02 14:11:41 +0200
commit7493ee1c44a16dc3b155a5bf3ed7ca966a71072a (patch)
tree035bd70088df3f23f8a689fb92097a70b7759b04 /src
parente8192883b2d00b7a1b68fb7c7154a1e75bab0b26 (diff)
Remove the build-key from the plugin verification data
The build-key is an old mechanism to work around binary incompatibilities in GCC 3.x versions. Modern GCC has not broken binary compatibility since 3.4, making this mechanism obsolete. The cache value stored now only includes Qt version, the debug/release boolean, and the last modified time for the plugin. Old 4-value keys will be replaced with new keys as the plugins are reloaded the first time. This also removes QLibraryInfo::buildKey(), which is a source-incompatible change. The UNIX and Windows configure tools have been updated to stop outputting the QT_BUILD_KEY preprocessor directive. See also: http://lists.qt.nokia.com/pipermail/qt5-feedback/2011-August/000892.html Change-Id: I7d06969a370d3d2c6de413c1230d9d6789cbf195 Reviewed-on: http://codereview.qt.nokia.com/3977 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qglobal.h7
-rw-r--r--src/corelib/global/qlibraryinfo.cpp27
-rw-r--r--src/corelib/global/qlibraryinfo.h1
-rw-r--r--src/corelib/plugin/qlibrary.cpp56
-rw-r--r--src/corelib/plugin/qplugin.h3
5 files changed, 11 insertions, 83 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 56022a7e6e..901f4e50ee 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -301,9 +301,6 @@ namespace QT_NAMESPACE {}
#ifdef QT_AUTODETECT_COCOA
# ifdef Q_OS_MAC64
# define QT_MAC_USE_COCOA 1
-# define QT_BUILD_KEY QT_BUILD_KEY_COCOA
-# else
-# define QT_BUILD_KEY QT_BUILD_KEY_CARBON
# endif
#endif
@@ -1197,10 +1194,6 @@ Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max
class QDataStream;
-#ifndef QT_BUILD_KEY
-#define QT_BUILD_KEY "unspecified"
-#endif
-
#if defined(Q_WS_MAC)
# ifndef QMAC_QMENUBAR_NO_EVENT
# define QMAC_QMENUBAR_NO_EVENT
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 88f12ab1f7..d70c77afae 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -203,21 +203,6 @@ QLibraryInfo::licensedProducts()
}
/*!
- Returns a unique key identifying this build of Qt and its
- configurations. This key is not globally unique, rather only useful
- for establishing of two configurations are compatible. This can be
- used to compare with the \c QT_BUILD_KEY preprocessor symbol.
-
- \sa location()
-*/
-
-QString
-QLibraryInfo::buildKey()
-{
- return QString::fromLatin1(QT_BUILD_KEY);
-}
-
-/*!
\since 4.6
Returns the installation date for this build of Qt. The install date will
usually be the last time that Qt sources were configured.
@@ -514,18 +499,6 @@ void qt_core_boilerplate()
"Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).\n"
"Contact: Nokia Corporation (qt-info@nokia.com)\n"
"\n"
- "Build key: " QT_BUILD_KEY "\n"
- "Compat build key: "
-#ifdef QT_BUILD_KEY_COMPAT
- "| " QT_BUILD_KEY_COMPAT " "
-#endif
-#ifdef QT_BUILD_KEY_COMPAT2
- "| " QT_BUILD_KEY_COMPAT2 " "
-#endif
-#ifdef QT_BUILD_KEY_COMPAT3
- "| " QT_BUILD_KEY_COMPAT3 " "
-#endif
- "|\n"
"Build date: %s\n"
"Installation prefix: %s\n"
"Library path: %s\n"
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index a8fb90968c..4dcd8e1e5e 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -59,7 +59,6 @@ public:
static QString licensee();
static QString licensedProducts();
- static QString buildKey();
#ifndef QT_NO_DATESTRING
static QDate buildDate();
#endif //QT_NO_DATESTRING
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index 45515f32e1..0a4ab77189 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -250,7 +250,7 @@ static int qt_tokenize(const char *s, ulong s_len, ulong *advance,
/*
returns true if the string s was correctly parsed, false otherwise.
*/
-static bool qt_parse_pattern(const char *s, uint *version, bool *debug, QByteArray *key)
+static bool qt_parse_pattern(const char *s, uint *version, bool *debug)
{
bool ret = true;
@@ -282,10 +282,6 @@ static bool qt_parse_pattern(const char *s, uint *version, bool *debug, QByteArr
}
} else if (qstrncmp("debug", pinfo.results[0], pinfo.lengths[0]) == 0) {
*debug = qstrncmp("true", pinfo.results[1], pinfo.lengths[1]) == 0;
- } else if (qstrncmp("buildkey", pinfo.results[0],
- pinfo.lengths[0]) == 0){
- // save buildkey
- *key = QByteArray(pinfo.results[1], pinfo.lengths[1]);
}
} while (parse == 1 && parselen > 0);
@@ -337,11 +333,11 @@ static long qt_find_pattern(const char *s, ulong s_len,
we can get the verification data without have to actually load the library.
This lets us detect mismatches more safely.
- Returns false if version/key information is not present, or if the
+ Returns false if version information is not present, or if the
information could not be read.
- Returns true if version/key information is present and successfully read.
+ Returns true if version information is present and successfully read.
*/
-static bool qt_unix_query(const QString &library, uint *version, bool *debug, QByteArray *key, QLibraryPrivate *lib = 0)
+static bool qt_unix_query(const QString &library, uint *version, bool *debug, QLibraryPrivate *lib = 0)
{
QFile file(library);
if (!file.open(QIODevice::ReadOnly)) {
@@ -396,7 +392,7 @@ static bool qt_unix_query(const QString &library, uint *version, bool *debug, QB
#endif // defined(Q_OF_ELF) && defined(Q_CC_GNU)
bool ret = false;
if (pos >= 0)
- ret = qt_parse_pattern(filedata + pos, version, debug, key);
+ ret = qt_parse_pattern(filedata + pos, version, debug);
if (!ret && lib)
lib->errorString = QLibrary::tr("Plugin verification data mismatch in '%1'").arg(library);
@@ -636,7 +632,7 @@ typedef const char * __stdcall (*QtPluginQueryVerificationDataFunction)();
typedef const char * (*QtPluginQueryVerificationDataFunction)();
#endif
-bool qt_get_verificationdata(QtPluginQueryVerificationDataFunction pfn, uint *qt_version, bool *debug, QByteArray *key, bool *exceptionThrown)
+bool qt_get_verificationdata(QtPluginQueryVerificationDataFunction pfn, uint *qt_version, bool *debug, bool *exceptionThrown)
{
*exceptionThrown = false;
const char *szData = 0;
@@ -649,7 +645,7 @@ bool qt_get_verificationdata(QtPluginQueryVerificationDataFunction pfn, uint *qt
#else
szData = pfn();
#endif
- return qt_parse_pattern(szData, qt_version, debug, key);
+ return qt_parse_pattern(szData, qt_version, debug);
}
bool QLibraryPrivate::isPlugin(QSettings *settings)
@@ -660,7 +656,6 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
#ifndef QT_NO_PLUGIN_CHECK
bool debug = !QLIBRARY_AS_DEBUG;
- QByteArray key;
bool success = false;
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
@@ -710,16 +705,15 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
}
reg = settings->value(regkey).toStringList();
#endif
- if (reg.count() == 4 && lastModified == reg.at(3)) {
+ if (reg.count() == 3 && lastModified == reg.at(2)) {
qt_version = reg.at(0).toUInt(0, 16);
debug = bool(reg.at(1).toInt());
- key = reg.at(2).toLatin1();
success = qt_version != 0;
} else {
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_SYMBIAN)
if (!pHnd) {
// use unix shortcut to avoid loading the library
- success = qt_unix_query(fileName, &qt_version, &debug, &key, this);
+ success = qt_unix_query(fileName, &qt_version, &debug, this);
} else
#endif
{
@@ -767,11 +761,10 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
#endif
bool exceptionThrown = false;
bool ret = qt_get_verificationdata(qtPluginQueryVerificationDataFunction,
- &qt_version, &debug, &key, &exceptionThrown);
+ &qt_version, &debug, &exceptionThrown);
if (!exceptionThrown) {
if (!ret) {
qt_version = 0;
- key = "unknown";
if (temporary_load)
unload_sys();
} else {
@@ -801,14 +794,10 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
// exception is thrown(will happen only when using a MS compiler)
}
- // Qt 4.5 compatibility: stl doesn't affect binary compatibility
- key.replace(" no-stl", "");
-
#ifndef QT_NO_SETTINGS
QStringList queried;
queried << QString::number(qt_version,16)
<< QString::number((int)debug)
- << QLatin1String(key)
<< lastModified;
settings->setValue(regkey, queried);
#endif
@@ -840,31 +829,6 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
.arg((qt_version&0xff00) >> 8)
.arg(qt_version&0xff)
.arg(debug ? QLatin1String("debug") : QLatin1String("release"));
- } else if (key != QT_BUILD_KEY
- // we may have some compatibility keys, try them too:
-#ifdef QT_BUILD_KEY_COMPAT
- && key != QT_BUILD_KEY_COMPAT
-#endif
-#ifdef QT_BUILD_KEY_COMPAT2
- && key != QT_BUILD_KEY_COMPAT2
-#endif
-#ifdef QT_BUILD_KEY_COMPAT3
- && key != QT_BUILD_KEY_COMPAT3
-#endif
- ) {
- if (qt_debug_component()) {
- qWarning("In %s:\n"
- " Plugin uses incompatible Qt library\n"
- " expected build key \"%s\", got \"%s\"",
- (const char*) QFile::encodeName(fileName),
- QT_BUILD_KEY,
- key.isEmpty() ? "<null>" : (const char *) key);
- }
- errorString = QLibrary::tr("The plugin '%1' uses incompatible Qt library."
- " Expected build key \"%2\", got \"%3\"")
- .arg(fileName)
- .arg(QLatin1String(QT_BUILD_KEY))
- .arg(key.isEmpty() ? QLatin1String("<null>") : QLatin1String((const char *) key));
#ifndef QT_NO_DEBUG_PLUGIN_CHECK
} else if(debug != QLIBRARY_AS_DEBUG) {
//don't issue a qWarning since we will hopefully find a non-debug? --Sam
diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h
index 40e6e66de3..52661671b5 100644
--- a/src/corelib/plugin/qplugin.h
+++ b/src/corelib/plugin/qplugin.h
@@ -117,8 +117,7 @@ void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunctio
static const char qt_plugin_verification_data[] = \
"pattern=""QT_PLUGIN_VERIFICATION_DATA""\n" \
"version="QT_VERSION_STR"\n" \
- "debug="QPLUGIN_DEBUG_STR"\n" \
- "buildkey="QT_BUILD_KEY;
+ "debug="QPLUGIN_DEBUG_STR;
# if defined (Q_OF_ELF) && defined (Q_CC_GNU)
# define Q_PLUGIN_VERIFICATION_SECTION \