summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-03-23 10:31:55 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-03-27 14:11:57 +0000
commitd3fd3171ce22f0974d571e91f2df6e2a98368081 (patch)
treed34a4f6d986c8072481c9266268caddc6b02af52 /src
parent1ab60b0430f2b57418ee4954fcfa43e1e14766fc (diff)
Annotate more implicit fallthroughs
Reduces our number of gcc 7 warnings Change-Id: I792d658cbc11cad15cf45da3a36fc93fcdcc67ea Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/painting/qdrawhelper.cpp16
-rw-r--r--src/gui/painting/qdrawhelper_sse2.cpp24
-rw-r--r--src/printsupport/kernel/qcups.cpp1
-rw-r--r--src/widgets/accessible/itemviews.cpp1
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp1
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp1
-rw-r--r--src/widgets/itemviews/qheaderview.cpp1
-rw-r--r--src/widgets/itemviews/qlistview.cpp2
8 files changed, 27 insertions, 20 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 7b3e1b991d..23da42c8cf 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -5980,13 +5980,13 @@ inline void qt_memfill_template(T *dest, T color, int count)
int n = (count + 7) / 8;
switch (count & 0x07)
{
- case 0: do { *dest++ = color;
- case 7: *dest++ = color;
- case 6: *dest++ = color;
- case 5: *dest++ = color;
- case 4: *dest++ = color;
- case 3: *dest++ = color;
- case 2: *dest++ = color;
+ case 0: do { *dest++ = color; Q_FALLTHROUGH();
+ case 7: *dest++ = color; Q_FALLTHROUGH();
+ case 6: *dest++ = color; Q_FALLTHROUGH();
+ case 5: *dest++ = color; Q_FALLTHROUGH();
+ case 4: *dest++ = color; Q_FALLTHROUGH();
+ case 3: *dest++ = color; Q_FALLTHROUGH();
+ case 2: *dest++ = color; Q_FALLTHROUGH();
case 1: *dest++ = color;
} while (--n > 0);
}
@@ -5997,7 +5997,7 @@ inline void qt_memfill_template(quint16 *dest, quint16 value, int count)
{
if (count < 3) {
switch (count) {
- case 2: *dest++ = value;
+ case 2: *dest++ = value; Q_FALLTHROUGH();
case 1: *dest = value;
}
return;
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index edce70d2d0..3013d2cf3e 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -237,11 +237,11 @@ void qt_memfill32(quint32 *dest, quint32 value, int count)
{
if (count < 7) {
switch (count) {
- case 6: *dest++ = value;
- case 5: *dest++ = value;
- case 4: *dest++ = value;
- case 3: *dest++ = value;
- case 2: *dest++ = value;
+ case 6: *dest++ = value; Q_FALLTHROUGH();
+ case 5: *dest++ = value; Q_FALLTHROUGH();
+ case 4: *dest++ = value; Q_FALLTHROUGH();
+ case 3: *dest++ = value; Q_FALLTHROUGH();
+ case 2: *dest++ = value; Q_FALLTHROUGH();
case 1: *dest = value;
}
return;
@@ -249,16 +249,16 @@ void qt_memfill32(quint32 *dest, quint32 value, int count)
const int align = (quintptr)(dest) & 0xf;
switch (align) {
- case 4: *dest++ = value; --count;
- case 8: *dest++ = value; --count;
+ case 4: *dest++ = value; --count; Q_FALLTHROUGH();
+ case 8: *dest++ = value; --count; Q_FALLTHROUGH();
case 12: *dest++ = value; --count;
}
const int rest = count & 0x3;
if (rest) {
switch (rest) {
- case 3: dest[count - 3] = value;
- case 2: dest[count - 2] = value;
+ case 3: dest[count - 3] = value; Q_FALLTHROUGH();
+ case 2: dest[count - 2] = value; Q_FALLTHROUGH();
case 1: dest[count - 1] = value;
}
}
@@ -277,8 +277,8 @@ void qt_memfill32(quint32 *dest, quint32 value, int count)
}
switch (count128 & 0x3) {
- case 3: _mm_stream_si128(dst128++, value128);
- case 2: _mm_stream_si128(dst128++, value128);
+ case 3: _mm_stream_si128(dst128++, value128); Q_FALLTHROUGH();
+ case 2: _mm_stream_si128(dst128++, value128); Q_FALLTHROUGH();
case 1: _mm_stream_si128(dst128++, value128);
}
}
@@ -318,7 +318,7 @@ void qt_memfill16(quint16 *dest, quint16 value, int count)
{
if (count < 3) {
switch (count) {
- case 2: *dest++ = value;
+ case 2: *dest++ = value; Q_FALLTHROUGH();
case 1: *dest = value;
}
return;
diff --git a/src/printsupport/kernel/qcups.cpp b/src/printsupport/kernel/qcups.cpp
index 3c6a6caffa..d655dd09ba 100644
--- a/src/printsupport/kernel/qcups.cpp
+++ b/src/printsupport/kernel/qcups.cpp
@@ -101,6 +101,7 @@ static inline QString jobHoldToString(const QCUPSSupport::JobHoldUntil jobHold,
return localDateTime.toUTC().time().toString(QStringLiteral("HH:mm"));
}
// else fall through:
+ Q_FALLTHROUGH();
case QCUPSSupport::NoHold:
return QString();
}
diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp
index db5af4fd7c..eec9a0021c 100644
--- a/src/widgets/accessible/itemviews.cpp
+++ b/src/widgets/accessible/itemviews.cpp
@@ -310,6 +310,7 @@ bool QAccessibleTable::selectColumn(int column)
case QAbstractItemView::SingleSelection:
if (view()->selectionBehavior() != QAbstractItemView::SelectColumns && rowCount() > 1)
return false;
+ Q_FALLTHROUGH();
case QAbstractItemView::ContiguousSelection:
if ((!column || !view()->selectionModel()->isColumnSelected(column - 1, view()->rootIndex()))
&& !view()->selectionModel()->isColumnSelected(column + 1, view()->rootIndex()))
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index 2adc58e4a4..1ff01b875c 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -1500,6 +1500,7 @@ void QGraphicsWidget::changeEvent(QEvent *event)
unsetWindowFrameMargins();
if (d->layout)
d->layout->invalidate();
+ Q_FALLTHROUGH();
case QEvent::FontChange:
update();
updateGeometry();
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 319cc86c18..e234f56799 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -4035,6 +4035,7 @@ QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::extendedSelectionC
switch (static_cast<const QKeyEvent*>(event)->key()) {
case Qt::Key_Backtab:
modifiers = modifiers & ~Qt::ShiftModifier; // special case for backtab
+ Q_FALLTHROUGH();
case Qt::Key_Down:
case Qt::Key_Up:
case Qt::Key_Left:
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 1310a060ea..e15fc558bf 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -2558,6 +2558,7 @@ void QHeaderView::mouseReleaseEvent(QMouseEvent *e)
d->updateSectionIndicator(d->section, pos);
break;
} // not moving
+ Q_FALLTHROUGH();
case QHeaderViewPrivate::SelectSections:
if (!d->clickableSections) {
int section = logicalIndexAt(pos);
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 65421bfb67..0f5e83b83b 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -1157,6 +1157,7 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
rect.moveTop(rect.top() - d->viewport->height() + 2 * rect.height());
if (rect.top() < rect.height())
rect.moveTop(rect.height());
+ Q_FALLTHROUGH();
case MovePrevious:
case MoveUp:
while (intersectVector.isEmpty()) {
@@ -1185,6 +1186,7 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
rect.moveTop(rect.top() + d->viewport->height() - 2 * rect.height());
if (rect.bottom() > contents.height() - rect.height())
rect.moveBottom(contents.height() - rect.height());
+ Q_FALLTHROUGH();
case MoveNext:
case MoveDown:
while (intersectVector.isEmpty()) {