diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-01-10 16:08:03 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-01-12 07:10:25 +0000 |
commit | 9031069e12a9870c61de2fb7bfe3569f8c8859b0 (patch) | |
tree | 5964cdd7cd106ca81be94424cdefc99769d9564f | |
parent | cf7a4016a17615df2952389bae11149a49b151bc (diff) | |
download | qtbase-9031069e12a9870c61de2fb7bfe3569f8c8859b0.tar.gz |
Add more Q_FALLTHROUGH()
Silence g++ 7.X warnings.
Change-Id: Id06d06e7e3b5be2cf3934d81f1891da58dea2649
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
24 files changed, 57 insertions, 54 deletions
diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp index ef5ff2d827..3055fb392e 100644 --- a/src/corelib/io/qwindowspipereader.cpp +++ b/src/corelib/io/qwindowspipereader.cpp @@ -175,7 +175,7 @@ void QWindowsPipeReader::notified(DWORD errorCode, DWORD numberOfBytesRead) case ERROR_OPERATION_ABORTED: if (stopped) break; - // fall through + Q_FALLTHROUGH(); default: emit winError(errorCode, QLatin1String("QWindowsPipeReader::notified")); pipeBroken = true; diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp index 75cb8a7ede..92e8b6db52 100644 --- a/src/corelib/io/qwindowspipewriter.cpp +++ b/src/corelib/io/qwindowspipewriter.cpp @@ -145,7 +145,7 @@ void QWindowsPipeWriter::notified(DWORD errorCode, DWORD numberOfBytesWritten) case ERROR_OPERATION_ABORTED: if (stopped) break; - // fall through + Q_FALLTHROUGH(); default: qErrnoWarning(errorCode, "QWindowsPipeWriter: asynchronous write failed."); break; diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index 50a0483231..7ddf68daa0 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -761,27 +761,28 @@ QDBusMessage QDBusAbstractInterface::call(QDBus::CallMode mode, const QString &m switch (count) { case 8: argList.prepend(arg8); - // fall through + Q_FALLTHROUGH(); case 7: argList.prepend(arg7); - // fall through + Q_FALLTHROUGH(); case 6: argList.prepend(arg6); - // fall through + Q_FALLTHROUGH(); case 5: argList.prepend(arg5); - // fall through + Q_FALLTHROUGH(); case 4: argList.prepend(arg4); - // fall through + Q_FALLTHROUGH(); case 3: argList.prepend(arg3); - // fall through + Q_FALLTHROUGH(); case 2: argList.prepend(arg2); - // fall through + Q_FALLTHROUGH(); case 1: argList.prepend(arg1); + break; } return callWithArgumentList(mode, method, argList); @@ -826,27 +827,28 @@ QDBusPendingCall QDBusAbstractInterface::asyncCall(const QString &method, const switch (count) { case 8: argList.prepend(arg8); - // fall through + Q_FALLTHROUGH(); case 7: argList.prepend(arg7); - // fall through + Q_FALLTHROUGH(); case 6: argList.prepend(arg6); - // fall through + Q_FALLTHROUGH(); case 5: argList.prepend(arg5); - // fall through + Q_FALLTHROUGH(); case 4: argList.prepend(arg4); - // fall through + Q_FALLTHROUGH(); case 3: argList.prepend(arg3); - // fall through + Q_FALLTHROUGH(); case 2: argList.prepend(arg2); - // fall through + Q_FALLTHROUGH(); case 1: argList.prepend(arg1); + break; } return asyncCallWithArgumentList(method, argList); diff --git a/src/dbus/qdbusdemarshaller.cpp b/src/dbus/qdbusdemarshaller.cpp index 57684897c6..6befb33d61 100644 --- a/src/dbus/qdbusdemarshaller.cpp +++ b/src/dbus/qdbusdemarshaller.cpp @@ -289,7 +289,7 @@ QVariant QDBusDemarshaller::toVariantInternal() case DBUS_TYPE_UNIX_FD: if (capabilities & QDBusConnection::UnixFileDescriptorPassing) return QVariant::fromValue(toUnixFileDescriptor()); - // fall through + Q_FALLTHROUGH(); default: // qWarning("QDBusDemarshaller: Found unknown D-Bus type %d '%c'", diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp index cc8af16bfe..b044397f8e 100644 --- a/src/gui/opengl/qopenglshaderprogram.cpp +++ b/src/gui/opengl/qopenglshaderprogram.cpp @@ -562,7 +562,7 @@ static QVersionDirectivePosition findVersionDirectivePosition(const char *source break; } state = Normal; - // fall through + Q_FALLTHROUGH(); case Normal: if (*c == '/') state = CommentStarting; diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp index 516fac681c..9547ec5b88 100644 --- a/src/network/socket/qlocalserver_unix.cpp +++ b/src/network/socket/qlocalserver_unix.cpp @@ -297,7 +297,7 @@ void QLocalServerPrivate::waitForNewConnection(int msec, bool *timedOut) } errno = EBADF; - // FALLTHROUGH + Q_FALLTHROUGH(); case -1: setError(QLatin1String("QLocalServer::waitForNewConnection")); closeServer(); diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index a2124974d7..d9f2113c14 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1292,19 +1292,19 @@ QGLFormat::OpenGLVersionFlags Q_AUTOTEST_EXPORT qOpenGLVersionFlagsFromString(co switch (versionString[2].toLatin1()) { case '5': versionFlags |= QGLFormat::OpenGL_Version_1_5; - // fall through + Q_FALLTHROUGH(); case '4': versionFlags |= QGLFormat::OpenGL_Version_1_4; - // fall through + Q_FALLTHROUGH(); case '3': versionFlags |= QGLFormat::OpenGL_Version_1_3; - // fall through + Q_FALLTHROUGH(); case '2': versionFlags |= QGLFormat::OpenGL_Version_1_2; - // fall through + Q_FALLTHROUGH(); case '1': versionFlags |= QGLFormat::OpenGL_Version_1_1; - // fall through + Q_FALLTHROUGH(); default: break; } @@ -1329,13 +1329,13 @@ QGLFormat::OpenGLVersionFlags Q_AUTOTEST_EXPORT qOpenGLVersionFlagsFromString(co switch (versionString[2].toLatin1()) { case '3': versionFlags |= QGLFormat::OpenGL_Version_3_3; - // fall through + Q_FALLTHROUGH(); case '2': versionFlags |= QGLFormat::OpenGL_Version_3_2; - // fall through + Q_FALLTHROUGH(); case '1': versionFlags |= QGLFormat::OpenGL_Version_3_1; - // fall through + Q_FALLTHROUGH(); case '0': break; default: @@ -1360,13 +1360,13 @@ QGLFormat::OpenGLVersionFlags Q_AUTOTEST_EXPORT qOpenGLVersionFlagsFromString(co switch (versionString[2].toLatin1()) { case '3': versionFlags |= QGLFormat::OpenGL_Version_4_3; - // fall through + Q_FALLTHROUGH(); case '2': versionFlags |= QGLFormat::OpenGL_Version_4_2; - // fall through + Q_FALLTHROUGH(); case '1': versionFlags |= QGLFormat::OpenGL_Version_4_1; - // fall through + Q_FALLTHROUGH(); case '0': break; default: diff --git a/src/sql/kernel/qsqldriver.cpp b/src/sql/kernel/qsqldriver.cpp index 6fe5b351dc..2d306e9fae 100644 --- a/src/sql/kernel/qsqldriver.cpp +++ b/src/sql/kernel/qsqldriver.cpp @@ -672,7 +672,7 @@ QString QSqlDriver::formatValue(const QSqlField &field, bool trimStrings) const break; } } - // fall through + Q_FALLTHROUGH(); default: r = field.value().toString(); break; diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp index c03df08345..b9bf25f99c 100644 --- a/src/widgets/dialogs/qinputdialog.cpp +++ b/src/widgets/dialogs/qinputdialog.cpp @@ -71,7 +71,8 @@ static const char *candidateSignal(int which) case IntValueSelectedSignal: return SIGNAL(intValueSelected(int)); case DoubleValueSelectedSignal: return SIGNAL(doubleValueSelected(double)); - case NumCandidateSignals: ; // fall through + case NumCandidateSignals: + break; }; Q_UNREACHABLE(); return nullptr; diff --git a/src/widgets/graphicsview/qsimplex_p.cpp b/src/widgets/graphicsview/qsimplex_p.cpp index 1e847489bb..e6ffa856f1 100644 --- a/src/widgets/graphicsview/qsimplex_p.cpp +++ b/src/widgets/graphicsview/qsimplex_p.cpp @@ -209,7 +209,7 @@ bool QSimplex::setConstraints(const QList<QSimplexConstraint *> &newConstraints) surplus->index = ++variableIndex; constraints[i]->helper.first = surplus; constraints[i]->helper.second = -1.0; - // fall through + Q_FALLTHROUGH(); case QSimplexConstraint::Equal: artificial = new QSimplexVariable; constraints[i]->artificial = artificial; diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 23e727e670..5bf4fec92c 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -219,7 +219,7 @@ void QAbstractItemViewPrivate::_q_scrollerStateChanged() q->selectionModel()->select(oldSelection, QItemSelectionModel::ClearAndSelect); q->selectionModel()->setCurrentIndex(oldCurrent, QItemSelectionModel::NoUpdate); } - // fall through + Q_FALLTHROUGH(); default: oldSelection = QItemSelection(); diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index e336c5f06d..9e4910ebd0 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3057,7 +3057,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: d->toolTipFallAsleep.stop(); - // fall-through + Q_FALLTHROUGH(); case QEvent::Leave: d->toolTipWakeUp.stop(); default: diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index 07588d2ee2..c95be2dfe1 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -1429,7 +1429,7 @@ bool QOpenGLWidget::event(QEvent *e) d->reset(); if (isHidden()) break; - // FALLTHROUGH + Q_FALLTHROUGH(); case QEvent::Show: // reparenting may not lead to a resize so reinitalize on Show too if (d->initialized && window()->windowHandle() && d->context->shareContext() != QWidgetPrivate::get(window())->shareContext()) diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index d5a18b525b..1078652234 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -248,7 +248,7 @@ bool QWidgetWindow::event(QEvent *event) // are sent by QApplicationPrivate::notifyActiveWindowChange() case QEvent::FocusIn: handleFocusInEvent(static_cast<QFocusEvent *>(event)); - // Fallthrough + Q_FALLTHROUGH(); case QEvent::FocusOut: { #ifndef QT_NO_ACCESSIBILITY QAccessible::State state; diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 14f81afe83..25ee085f30 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -4620,7 +4620,7 @@ QStyle::SubControl QStyleSheetStyle::hitTestComplexControl(ComplexControl cc, co if (!rule.hasDrawable() && !rule.hasBox()) break; } - // intentionally falls through + Q_FALLTHROUGH(); case CC_SpinBox: case CC_GroupBox: case CC_ComboBox: @@ -5786,7 +5786,7 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c if (!qstyleoption_cast<const QStyleOptionViewItem *>(opt)) { return subElementRect(SE_CheckBoxIndicator, opt, w); } - // intentionally falls through + Q_FALLTHROUGH(); case SE_ItemViewItemText: case SE_ItemViewItemDecoration: case SE_ItemViewItemFocusRect: @@ -5846,15 +5846,15 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c #if QT_CONFIG(tabbar) case SE_TabWidgetLeftCorner: pe = PseudoElement_TabWidgetLeftCorner; - // intentionally falls through + Q_FALLTHROUGH(); case SE_TabWidgetRightCorner: if (pe == PseudoElement_None) pe = PseudoElement_TabWidgetRightCorner; - // intentionally falls through + Q_FALLTHROUGH(); case SE_TabWidgetTabBar: if (pe == PseudoElement_None) pe = PseudoElement_TabWidgetTabBar; - // intentionally falls through + Q_FALLTHROUGH(); case SE_TabWidgetTabPane: case SE_TabWidgetTabContents: if (pe == PseudoElement_None) diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index c6d66bafd4..917cddce6f 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -1163,7 +1163,7 @@ bool QAbstractScrollArea::event(QEvent *e) case QEvent::ApplicationLayoutDirectionChange: case QEvent::LayoutRequest: d->layoutChildren(); - // fall through + Q_FALLTHROUGH(); default: return QFrame::event(e); } diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 4e8668b001..7d4498af5b 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -3215,7 +3215,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e) case Qt::Key_Up: if (e->modifiers() & Qt::ControlModifier) break; // pass to line edit for auto completion - // fall through + Q_FALLTHROUGH(); case Qt::Key_PageUp: #ifdef QT_KEYPAD_NAVIGATION if (QApplication::keypadNavigationEnabled()) @@ -3303,7 +3303,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e) switch (move) { case MoveFirst: newIndex = -1; - // fall through + Q_FALLTHROUGH(); case MoveDown: newIndex++; while (newIndex < rowCount && !(d->model->index(newIndex, d->modelColumn, d->root).flags() & Qt::ItemIsEnabled)) @@ -3311,7 +3311,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e) break; case MoveLast: newIndex = rowCount; - // fall through + Q_FALLTHROUGH(); case MoveUp: newIndex--; while ((newIndex >= 0) && !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled)) diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index 17cea09b1f..fca81bec48 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -1129,7 +1129,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event) } #endif } - // else fall through + Q_FALLTHROUGH(); case Qt::Key_Backtab: case Qt::Key_Tab: { event->accept(); diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index 788ec67fb2..9f5b739230 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -927,8 +927,8 @@ void QDialogButtonBox::changeEvent(QEvent *event) for (StandardButtonHash::iterator it = d->standardButtonHash.begin(); it != end; ++it) it.key()->setStyle(newStyle); } - // fallthrough intended #ifdef Q_OS_MAC + Q_FALLTHROUGH(); case QEvent::MacSizeChange: #endif d->resetLayout(); diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index bc7333df2e..ff3e9d2d3b 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -2638,7 +2638,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event) d->tabBar->setTabEnabled(tabIndex, true); } #endif // QT_CONFIG(tabbar) - // fall through + Q_FALLTHROUGH(); case QEvent::Hide: d->isSubWindowsTiled = false; break; diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 384c3b4c2c..7bc764030a 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -1542,7 +1542,7 @@ bool QMenuBar::eventFilter(QObject *object, QEvent *event) d->setKeyboardMode(!d->keyboardState); } } - // fall through + Q_FALLTHROUGH(); case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseMove: diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index 8187b8f35c..afb17f533b 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -461,7 +461,7 @@ void QPushButton::keyPressEvent(QKeyEvent *e) click(); break; } - // fall through + Q_FALLTHROUGH(); default: QAbstractButton::keyPressEvent(e); } diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp index 5f49623941..8e4c846402 100644 --- a/src/widgets/widgets/qsplitter.cpp +++ b/src/widgets/widgets/qsplitter.cpp @@ -1372,7 +1372,7 @@ bool QSplitter::event(QEvent *e) if (!d->firstShow) break; d->firstShow = false; - // fall through + Q_FALLTHROUGH(); case QEvent::HideToParent: case QEvent::ShowToParent: case QEvent::LayoutRequest: diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index adaafc7d21..258e018151 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -1034,7 +1034,7 @@ void QTabBar::removeTab(int index) newIndex--; if (d->validIndex(newIndex)) break; - // else fallthrough + Q_FALLTHROUGH(); case SelectRightTab: newIndex = index; if (newIndex >= d->tabList.size()) @@ -2221,7 +2221,7 @@ void QTabBar::changeEvent(QEvent *event) d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this)); if (!d->useScrollButtonsSetByUser) d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this); - // fallthrough + Q_FALLTHROUGH(); case QEvent::FontChange: d->textSizes.clear(); d->refresh(); |