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>
bb10
Friedemann Kleint 2018-01-10 16:08:03 +01:00
parent cf7a4016a1
commit 9031069e12
24 changed files with 57 additions and 54 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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'",

View File

@ -562,7 +562,7 @@ static QVersionDirectivePosition findVersionDirectivePosition(const char *source
break;
}
state = Normal;
// fall through
Q_FALLTHROUGH();
case Normal:
if (*c == '/')
state = CommentStarting;

View File

@ -297,7 +297,7 @@ void QLocalServerPrivate::waitForNewConnection(int msec, bool *timedOut)
}
errno = EBADF;
// FALLTHROUGH
Q_FALLTHROUGH();
case -1:
setError(QLatin1String("QLocalServer::waitForNewConnection"));
closeServer();

View File

@ -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:

View File

@ -672,7 +672,7 @@ QString QSqlDriver::formatValue(const QSqlField &field, bool trimStrings) const
break;
}
}
// fall through
Q_FALLTHROUGH();
default:
r = field.value().toString();
break;

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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:

View File

@ -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())

View File

@ -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;

View File

@ -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)

View File

@ -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);
}

View File

@ -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))

View File

@ -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();

View File

@ -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();

View File

@ -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;

View File

@ -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:

View File

@ -461,7 +461,7 @@ void QPushButton::keyPressEvent(QKeyEvent *e)
click();
break;
}
// fall through
Q_FALLTHROUGH();
default:
QAbstractButton::keyPressEvent(e);
}

View File

@ -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:

View File

@ -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();