From d2a4a5e60162bb66558ab483679b1943c11caa8b Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 11 Jun 2021 16:03:39 +0200 Subject: [PATCH] Suppress gcc warning -Wmemset-elt-size on test code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test uses a 64-unit array and deliberately clears various portions of it, provoking a gcc warning: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size] The calls to memset() do, in fact, have a sizeof(T) factor in their size. Suppress this warning for the duration of that test. Change-Id: I7d144d655a75f5ef4449fa3b956f80bcc509a83b Reviewed-by: Thiago Macieira --- tests/auto/corelib/global/qtendian/tst_qtendian.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/auto/corelib/global/qtendian/tst_qtendian.cpp b/tests/auto/corelib/global/qtendian/tst_qtendian.cpp index 58fcca4351..74c2deff52 100644 --- a/tests/auto/corelib/global/qtendian/tst_qtendian.cpp +++ b/tests/auto/corelib/global/qtendian/tst_qtendian.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -156,6 +156,9 @@ void tst_QtEndian::fromLittleEndian() #undef ENDIAN_TEST +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wmemset-elt-size") + template void transformRegion_template(T (*transformOne)(T), void (*transformRegion)(const void *, qsizetype, void *)) { @@ -225,6 +228,7 @@ void transformRegion_template(T (*transformOne)(T), void (*transformRegion)(cons for (int i = 0; i < 64; ++i) QCOMPARE(dest[i], expected); } +QT_WARNING_POP void tst_QtEndian::fromBigEndianRegion_data() {