summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2020-08-12 16:53:06 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-08-19 12:46:44 +0000
commit0f98cab80ae1cd7350d01a911cba433df44f1dee (patch)
tree3d778586ccc9766261d9d75c261d3825e566b957 /src
parent5d1da325afb099487bff0fbfc0df33f791ec6b8e (diff)
downloadqtbase-0f98cab80ae1cd7350d01a911cba433df44f1dee.tar.gz
MSVC: Fix C4996 warnings when building Qt
Task-number: QTBUG-85227 Change-Id: I22ca672d993d77164c91939d1b8fad0c0332b57a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 0243951e0aba20a010577f09d6486f21d621d575) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/libjpeg.pri2
-rw-r--r--src/tools/moc/moc.pro3
-rw-r--r--src/xml/dom/qdom.cpp2
-rw-r--r--src/xml/dom/qdomhelpers.cpp4
-rw-r--r--src/xml/sax/qxml.cpp5
5 files changed, 14 insertions, 2 deletions
diff --git a/src/3rdparty/libjpeg.pri b/src/3rdparty/libjpeg.pri
index 5effbe9d26..92ce25690c 100644
--- a/src/3rdparty/libjpeg.pri
+++ b/src/3rdparty/libjpeg.pri
@@ -3,6 +3,8 @@ winrt: DEFINES += NO_GETENV
# Disable warnings in 3rdparty code due to unused arguments
gcc: QMAKE_CFLAGS_WARN_ON += -Wno-unused-parameter -Wno-main
+# Do not warn about sprintf, getenv, sscanf ... use
+msvc: DEFINES += _CRT_SECURE_NO_WARNINGS
INCLUDEPATH += \
$$PWD/libjpeg \
diff --git a/src/tools/moc/moc.pro b/src/tools/moc/moc.pro
index 8f66a428c1..c092bbb1b1 100644
--- a/src/tools/moc/moc.pro
+++ b/src/tools/moc/moc.pro
@@ -8,6 +8,9 @@ DEFINES += \
QT_NO_COMPRESS \
QT_NO_FOREACH
+# strerror() is safe to use because moc is single-threaded
+msvc: DEFINES += _CRT_SECURE_NO_WARNINGS
+
include(moc.pri)
HEADERS += qdatetime_p.h
SOURCES += main.cpp
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 29d31a20d5..c54f4a0bc8 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -6198,9 +6198,9 @@ bool QDomDocument::setContent(const QString& text, bool namespaceProcessing, QSt
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
QXmlInputSource source;
-QT_WARNING_POP
source.setData(text);
return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn);
+QT_WARNING_POP
#else
QXmlStreamReader streamReader(text);
streamReader.setNamespaceProcessing(namespaceProcessing);
diff --git a/src/xml/dom/qdomhelpers.cpp b/src/xml/dom/qdomhelpers.cpp
index 63c2db929a..7a9ae1a46c 100644
--- a/src/xml/dom/qdomhelpers.cpp
+++ b/src/xml/dom/qdomhelpers.cpp
@@ -193,11 +193,11 @@ int QDomDocumentLocator::line() const
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
+
void QSAXDocumentLocator::setLocator(QXmlLocator *l)
{
locator = l;
}
-QT_WARNING_POP
int QSAXDocumentLocator::column() const
{
@@ -215,6 +215,8 @@ int QSAXDocumentLocator::line() const
return static_cast<int>(locator->lineNumber());
}
+QT_WARNING_POP
+
#endif // QT_DEPRECATED_SINCE(5, 15)
/**************************************************************
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index 0033d042d4..ea6124f45d 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -37,6 +37,11 @@
**
****************************************************************************/
+#include "qglobal.h"
+
+// Disable warning about use of deprecated QXmlStreamLocator in QScopedPointer<>
+QT_WARNING_DISABLE_MSVC(4996)
+
#include "qxml.h"
#include "qxml_p.h"
#if QT_CONFIG(textcodec)