diff options
author | Tim Blechmann <tim@klingt.org> | 2024-02-29 09:30:24 +0800 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2024-03-01 03:04:06 +0000 |
commit | c26994ff1551aa5450383cc51bed9b4d39f973f7 (patch) | |
tree | 8f7ee7af13b5e2b26a50be7b762fc690a314270f /src/widgets | |
parent | ddaf7642828c970a69c995a606c5cb16e003c26c (diff) |
Fix -Wimplicit-fallthrough for clang
Clang's `-Wimplicit-fallthrough` warnings are a little stricter than
gcc's interpretation:
switch (i) {
case 0:
foo();
case 4:
break;
}
While gcc accepts the implicit fallthrough, if the following statement
is a trivial `break`, clang will warn about it.
Pick-to: 6.7
Change-Id: I38e0817f1bc034fbb552aeac21de1516edcbcbb0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/accessible/itemviews.cpp | 2 | ||||
-rw-r--r-- | src/widgets/dialogs/qmessagebox.cpp | 1 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsscene.cpp | 1 | ||||
-rw-r--r-- | src/widgets/itemviews/qabstractitemview.cpp | 1 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qtooltip.cpp | 1 | ||||
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 1 | ||||
-rw-r--r-- | src/widgets/styles/qfusionstyle.cpp | 1 | ||||
-rw-r--r-- | src/widgets/styles/qstyleanimation.cpp | 1 | ||||
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qabstractspinbox.cpp | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qcalendarwidget.cpp | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qdatetimeedit.cpp | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qeffects.cpp | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qmainwindowlayout.cpp | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qtoolbar.cpp | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgetlinecontrol.cpp | 1 |
17 files changed, 19 insertions, 0 deletions
diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp index b960cd70e2..aa5f729820 100644 --- a/src/widgets/accessible/itemviews.cpp +++ b/src/widgets/accessible/itemviews.cpp @@ -352,6 +352,7 @@ bool QAccessibleTable::unselectRow(int row) //the ones which are down the current row will be deselected selection = QItemSelection(index, theModel->index(rowCount() - 1, 0, rootIndex)); } + break; default: break; } @@ -392,6 +393,7 @@ bool QAccessibleTable::unselectColumn(int column) //of the current rown, the ones which are at the right will be deselected selection = QItemSelection(index, theModel->index(0, columnCount() - 1, rootIndex)); } + break; default: break; } diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 9ff2b5159b..f60bdcff8e 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -2767,6 +2767,7 @@ QPixmap QMessageBoxPrivate::standardIcon(QMessageBox::Icon icon, QMessageBox *mb break; case QMessageBox::Question: tmpIcon = style->standardIcon(QStyle::SP_MessageBoxQuestion, nullptr, mb); + break; default: break; } diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index ad63ff18a0..c022af6fc0 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -3253,6 +3253,7 @@ bool QGraphicsScene::event(QEvent *event) // ### this should only be cleared if we received a new mouse move event, // which relies on us fixing the replay mechanism in QGraphicsView. d->cachedItemsUnderMouse.clear(); + break; default: break; } diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 6d057b264d..85e478a71e 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -4301,6 +4301,7 @@ QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::extendedSelectionC default: break; } + break; } default: break; diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 6b4d827541..f5236d910e 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2645,6 +2645,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) Q_FALLTHROUGH(); case QEvent::Leave: d->toolTipWakeUp.stop(); + break; default: break; } @@ -2669,6 +2670,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) || key == Qt::Key_Up || key == Qt::Key_Right || key == Qt::Key_Down); + break; } default: break; diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp index 11c2b5db1b..35eaa8042a 100644 --- a/src/widgets/kernel/qtooltip.cpp +++ b/src/widgets/kernel/qtooltip.cpp @@ -329,6 +329,7 @@ bool QTipLabel::eventFilter(QObject *o, QEvent *e) case QEvent::MouseMove: if (o == widget && !rect.isNull() && !rect.contains(static_cast<QMouseEvent*>(e)->position().toPoint())) hideTip(); + break; default: break; } diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index a7d52b9755..e2d0e5227b 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -4224,6 +4224,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex break; case SC_SpinBoxFrame: ret = spinbox->rect; + break; default: break; } diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 1682ebcfd3..d2b1524796 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -3311,6 +3311,7 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom break; case SC_SpinBoxFrame: rect = spinbox->rect; + break; default: break; } diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp index 32b77f1b53..8e71bb4fae 100644 --- a/src/widgets/styles/qstyleanimation.cpp +++ b/src/widgets/styles/qstyleanimation.cpp @@ -256,6 +256,7 @@ static QImage blendedImage(const QImage &start, const QImage &end, float alpha) front_data += bpl; } } + break; default: break; } diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 6e0ce31df4..fcbe9ae613 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -4871,6 +4871,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op w = w->parentWidget(); //match on the QTabBar instead of the CloseButton } pseudoElement = PseudoElement_TabBarTabCloseButton; + break; #endif default: diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 27bc9e9099..f377275d23 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -2043,6 +2043,7 @@ QVariant operator-(const QVariant &arg1, const QVariant &arg2) dt.setTime(dt.time().addMSecs(msecs)); ret = QVariant(dt); } + break; } default: break; } diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp index 7c34426a3f..034127b4f3 100644 --- a/src/widgets/widgets/qcalendarwidget.cpp +++ b/src/widgets/widgets/qcalendarwidget.cpp @@ -3099,6 +3099,7 @@ bool QCalendarWidget::event(QEvent *event) case QEvent::StyleChange: d->cachedSizeHint = QSize(); d->m_view->updateGeometry(); + break; default: break; } diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index dfeee394f1..01e52b2fa6 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -1331,6 +1331,7 @@ void QDateTimeEdit::focusInEvent(QFocusEvent *event) case Qt::ActiveWindowFocusReason: if (oldHasHadFocus) return; + break; case Qt::ShortcutFocusReason: case Qt::TabFocusReason: default: diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp index 1e16b53d5c..74ac24a2b0 100644 --- a/src/widgets/widgets/qeffects.cpp +++ b/src/widgets/widgets/qeffects.cpp @@ -292,6 +292,7 @@ void QAlphaWidget::alphaBlend() back_data += bpl; front_data += bpl; } + break; } default: break; diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index e17fa28b83..9008f023fa 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -338,6 +338,7 @@ bool QDockWidgetGroupWindow::event(QEvent *e) case QEvent::Resize: updateCurrentGapRect(); emit resized(); + break; default: break; } diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp index e0f10a172a..5e5ef8e8d5 100644 --- a/src/widgets/widgets/qtoolbar.cpp +++ b/src/widgets/widgets/qtoolbar.cpp @@ -1084,6 +1084,7 @@ bool QToolBar::event(QEvent *event) d->layout->setExpanded(false); break; } + break; default: break; } diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 6365073e53..ce1b8706ae 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -1638,6 +1638,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) setText(m_completer->currentCompletion()); inlineCompletionAccepted = true; } + break; default: break; // normal key processing } |