summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2020-08-12 16:53:06 +0200
committerKai Koehne <kai.koehne@qt.io>2020-08-19 12:46:09 +0200
commit0243951e0aba20a010577f09d6486f21d621d575 (patch)
tree876dd6cb441e3e5b52067612166e3ef35a148194
parent1022944a35acf9fd5de49bda249a3717aefade26 (diff)
MSVC: Fix C4996 warnings when building Qt
Task-number: QTBUG-85227 Pick-to: 5.15 Change-Id: I22ca672d993d77164c91939d1b8fad0c0332b57a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-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 9af79e58dc..364dbb11a6 100644
--- a/src/3rdparty/libjpeg.pri
+++ b/src/3rdparty/libjpeg.pri
@@ -1,6 +1,8 @@
# 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 b907d88f07..e6c21a3332 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -6179,9 +6179,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 1f605b1d5c..0d07383532 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"
#include "qbuffer.h"