Skip to content

Commit

Permalink
Fix some warnings in manual tests
Browse files Browse the repository at this point in the history
Fix:
gestures.cpp:46:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
gestures.cpp:47:5: note: here
gestures.cpp:48:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
gestures.cpp:52:5: note: here
main.cpp: In function 'QByteArray windowsVersionToString(QSysInfo::WinVersion)':
main.cpp:40:12: warning: enumeration value 'WV_CE' not handled in switch [-Wswitch]
...

main.cpp: In function 'QByteArray macVersionToString(QSysInfo::MacVersion)':
main.cpp:68:12: warning: enumeration value 'MV_10_12' not handled in switch [-Wswitch]
...

widget.cpp: In member function 'CustomItem* Widget::checkedItem() const':
widget.cpp:238:12: warning: 'item' may be used uninitialized in this function [-Wmaybe-uninitialized]

Change-Id: I434784e86d127e56b92663cb45eba7d60d8f8eaf
Reviewed-by: Edward Welbourne <[email protected]>
  • Loading branch information
FriedemannKleint committed Mar 7, 2019
1 parent e431a3a commit 464d261
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/manual/gestures/graphicsview/gestures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::recognize(QGesture
switch (event->type()) {
case QEvent::TouchBegin:
result = QGestureRecognizer::MayBeGesture;
break;
case QEvent::TouchEnd:
if (d->gestureFired)
result = QGestureRecognizer::FinishGesture;
else
result = QGestureRecognizer::CancelGesture;
break;
case QEvent::TouchUpdate:
if (d->state() != Qt::NoGesture) {
QTouchEvent *ev = static_cast<QTouchEvent*>(event);
Expand Down
2 changes: 1 addition & 1 deletion tests/manual/qgraphicsitemgroup/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void Widget::updateUngroupButton()

CustomItem * Widget::checkedItem() const
{
CustomItem *item;
CustomItem *item = nullptr;

if (ui->blue->isChecked())
item = rectBlue;
Expand Down
22 changes: 22 additions & 0 deletions tests/manual/qsysinfo/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ QByteArray windowsVersionToString(QSysInfo::WinVersion v)
CASE_VERSION(WV_WINDOWS8_1);
CASE_VERSION(WV_WINDOWS10);
case QSysInfo::WV_NT_based: // shouldn't happen
case QSysInfo::WV_CE:
case QSysInfo::WV_CENET:
case QSysInfo::WV_CE_5:
case QSysInfo::WV_CE_6:
case QSysInfo::WV_CE_based:
break;
}

Expand All @@ -82,6 +87,7 @@ QByteArray macVersionToString(QSysInfo::MacVersion v)
CASE_VERSION(MV_10_9);
CASE_VERSION(MV_10_10);
CASE_VERSION(MV_10_11);
CASE_VERSION(MV_10_12);

CASE_VERSION(MV_IOS_4_3);
CASE_VERSION(MV_IOS_5_0);
Expand All @@ -96,8 +102,24 @@ QByteArray macVersionToString(QSysInfo::MacVersion v)
CASE_VERSION(MV_IOS_8_3);
CASE_VERSION(MV_IOS_8_4);
CASE_VERSION(MV_IOS_9_0);
CASE_VERSION(MV_IOS_9_1);
CASE_VERSION(MV_IOS_9_2);
CASE_VERSION(MV_IOS_9_3);
CASE_VERSION(MV_IOS_10_0);
case QSysInfo::MV_IOS: // shouldn't happen:
case QSysInfo::MV_TVOS:
case QSysInfo::MV_WATCHOS:
break;

CASE_VERSION(MV_TVOS_9_0);
CASE_VERSION(MV_TVOS_9_1);
CASE_VERSION(MV_TVOS_9_2);
CASE_VERSION(MV_TVOS_10_0);

CASE_VERSION(MV_WATCHOS_2_0);
CASE_VERSION(MV_WATCHOS_2_1);
CASE_VERSION(MV_WATCHOS_2_2);
CASE_VERSION(MV_WATCHOS_3_0);
}

if (v & QSysInfo::MV_IOS) {
Expand Down

0 comments on commit 464d261

Please sign in to comment.