Fix some warnings

Change-Id: Ief00228f83e16421fb4eec4c678632d5c996624f
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
This commit is contained in:
Andreas Buhr 2021-03-30 10:50:41 +02:00
parent 87a4841cb6
commit 2b8f7c9b15
2 changed files with 6 additions and 3 deletions

View File

@ -4643,7 +4643,8 @@ template<typename Enum> void testVariant(Enum value, bool *ok)
QVERIFY(var2.convert(QMetaType::Int));
QCOMPARE(var2.value<int>(), static_cast<int>(value));
if ((static_cast<qint64>(value) <= INT_MAX) && (static_cast<qint64>(value) >= INT_MIN)) {
// unary + to silence gcc warning
if ((+static_cast<qint64>(value) <= INT_MAX) && (+static_cast<qint64>(value) >= INT_MIN)) {
int intValue = static_cast<int>(value);
QVariant intVar = intValue;
QVERIFY(intVar.canConvert<Enum>());
@ -4702,7 +4703,8 @@ template<typename Enum> void testVariantMeta(Enum value, bool *ok, const char *s
QVariant strVar = QString::fromLatin1(string);
QVERIFY(strVar.canConvert<Enum>());
if ((static_cast<qint64>(value) > INT_MAX) || (static_cast<qint64>(value) < INT_MIN)) {
// unary + to silence gcc warning
if ((+static_cast<qint64>(value) > INT_MAX) || (+static_cast<qint64>(value) < INT_MIN)) {
QEXPECT_FAIL("", "QMetaEnum api uses 'int' as return type QTBUG-27451", Abort);
*ok = true;
}

View File

@ -1356,7 +1356,8 @@ void tst_QMenuBar::menubarSizeHint()
{
MyStyle() : QProxyStyle(QStyleFactory::create("windows")) { }
virtual int pixelMetric(PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0 ) const
int pixelMetric(PixelMetric metric, const QStyleOption *option = 0,
const QWidget *widget = 0) const override
{
// I chose strange values (prime numbers to be more sure that the size of the menubar is correct)
switch (metric)