Disable spurious MSVC warning C4273 in Qt Gui, Qt OpenGL

For optimized/release builds, cl 19.28 produces some false positive
"potential divide by 0" warnings even for code where no valid code path
can lead to such a division.

Fixes: QTBUG-92940
Pick-to: 6.1
Change-Id: I461f9104d7b9dc2d74839bf30bebb2b9d4cf2db3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
bb10
Kai Köhne 2021-04-29 15:55:11 +02:00 committed by Kai Koehne
parent b5ceba0128
commit 16a1ba69a6
3 changed files with 20 additions and 0 deletions

View File

@ -77,6 +77,11 @@
QT_BEGIN_NAMESPACE
// MSVC 19.28 does show spurious warning "C4723: potential divide by 0" for code that divides
// by height() in release builds. Anyhow, all the code paths in this file are only executed
// for valid QImage's, where height() cannot be 0. Therefore disable the warning.
QT_WARNING_DISABLE_MSVC(4723)
static inline bool isLocked(QImageData *data)
{
return data != nullptr && data->is_locked;

View File

@ -70,6 +70,11 @@
QT_BEGIN_NAMESPACE
// MSVC 19.28 does show spurious warning "C4723: potential divide by 0" for code that divides
// by height() in release builds. Anyhow, all the code paths in this file are only executed
// for valid QPixmap's, where height() cannot be 0. Therefore disable the warning.
QT_WARNING_DISABLE_MSVC(4723)
static bool qt_pixmap_thread_test()
{
if (Q_UNLIKELY(!QCoreApplication::instance())) {

View File

@ -1745,6 +1745,14 @@ bool QOpenGL2PaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, cons
return QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, t);
}
// MSVC 19.28 does show spurious warning "C4723: potential divide by 0" for the code
// that divides by QOpenGLTextureGlyphCache::height() in release builds.
// Anyhow, the code path in this method is only executed
// if height() != 0. Therefore disable the warning.
QT_WARNING_PUSH
QT_WARNING_DISABLE_MSVC(4723)
void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat glyphFormat,
QStaticTextItem *staticTextItem)
{
@ -2060,6 +2068,8 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly
#endif
}
QT_WARNING_POP
void QOpenGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
QPainter::PixmapFragmentHints hints)
{