diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-06-19 12:27:09 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2014-06-20 21:21:43 +0200 |
commit | 443f06a2ec1b1ba7da3d64151c6e92a3c77deadf (patch) | |
tree | c1497b87a6bdaeb3e9a06748182d2420d12b2181 /src | |
parent | 173412f047c32a623388a7466ab42e2d5bce0a17 (diff) |
Remove the use of QT_STATIC_CONST in QtSql
There doesn't seem to be any reason why the macro is actually
necessary. My guess is that someone wrote the code on Windows without
"const", then it failed to compile everywhere else. Instead of fixing
the code by adding the "const", the developer must have added this
macro.
Microsoft Visual Studio mangles the constness of the variable, so we
can't remove it now from existing compilers. But we can for the new
version.
This is also required to compile QtSql with the MSVC option
/Zc:strictStrings, which is enabled in Qt 5.4.
Change-Id: Ibf2c2cb7287a4332d69aa81080a37aab4327677d
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Diffstat (limited to 'src')
-rw-r--r-- | src/sql/kernel/qsqldatabase.cpp | 6 | ||||
-rw-r--r-- | src/sql/kernel/qsqldatabase.h | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index f8ecabee8f..84e01fce49 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -107,7 +107,11 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, QLatin1String("/sqldrivers"))) #endif -QT_STATIC_CONST_IMPL char *QSqlDatabase::defaultConnection = "qt_sql_default_connection"; +#if !defined(Q_CC_MSVC) || _MSC_VER >= 1900 +// ### Qt6: remove the #ifdef +const +#endif +char *QSqlDatabase::defaultConnection = const_cast<char *>("qt_sql_default_connection"); typedef QHash<QString, QSqlDriverCreatorBase*> DriverDict; diff --git a/src/sql/kernel/qsqldatabase.h b/src/sql/kernel/qsqldatabase.h index 7249e223a5..ffc10cdd30 100644 --- a/src/sql/kernel/qsqldatabase.h +++ b/src/sql/kernel/qsqldatabase.h @@ -113,7 +113,12 @@ public: QSqlDriver* driver() const; - QT_STATIC_CONST char *defaultConnection; + static +#if !defined(Q_CC_MSVC) || _MSC_VER >= 1900 + // ### Qt6: remove the #ifdef + const +#endif + char *defaultConnection; static QSqlDatabase addDatabase(const QString& type, const QString& connectionName = QLatin1String(defaultConnection)); |