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>
This commit is contained in:
Kai Koehne 2020-08-12 16:53:06 +02:00
parent 1022944a35
commit 0243951e0a
5 changed files with 14 additions and 2 deletions

View File

@ -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 \

View File

@ -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

View File

@ -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);

View File

@ -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)
/**************************************************************

View File

@ -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"