Skip to content

Commit

Permalink
Fix some warnings
Browse files Browse the repository at this point in the history
Change-Id: Ief00228f83e16421fb4eec4c678632d5c996624f
Reviewed-by: Karsten Heimrich <[email protected]>
  • Loading branch information
andreasbuhr committed Mar 31, 2021
1 parent 87a4841 commit 2b8f7c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>());
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2b8f7c9

Please sign in to comment.