summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-06-27 15:43:33 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-08-19 18:38:53 +0000
commit9f888d2fde9c5413e5519e0914e9b13638760985 (patch)
tree7e211a2ae70c272ea8041d5100f0c9a67b32de1b /src/gui
parent25dd9c521fc064a71db63b110b7973225ee20c02 (diff)
Support C++17 fallthrough attribute
Replaces our mix of comments for annotating intended absence of break in switches with the C++17 attribute [[fallthrough]], or its earlier a clang extension counterpart. Change-Id: I4b2d0b9b5e4425819c7f1bf01608093c536b6d14 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qimage.cpp4
-rw-r--r--src/gui/image/qimagereader.cpp2
-rw-r--r--src/gui/image/qpixmap_blitter.cpp4
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.cpp4
-rw-r--r--src/gui/painting/qcssutil.cpp2
-rw-r--r--src/gui/painting/qpathclipper.cpp4
-rw-r--r--src/gui/painting/qpdf.cpp4
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp4
-rw-r--r--src/gui/painting/qtransform.cpp12
-rw-r--r--src/gui/painting/qtriangulator.cpp6
-rw-r--r--src/gui/text/qfontsubset.cpp2
-rw-r--r--src/gui/text/qtextcursor.cpp8
-rw-r--r--src/gui/text/qtextdocumentfragment.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp14
-rw-r--r--src/gui/text/qtexthtmlparser.cpp6
15 files changed, 38 insertions, 40 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index bd32ca7bee..9b14500e7a 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1888,7 +1888,7 @@ void QImage::invertPixels(InvertMode mode)
case QImage::Format_RGBA8888:
if (mode == InvertRgba)
break;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGBX8888:
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
xorbits = 0xffffff00;
@@ -1900,7 +1900,7 @@ void QImage::invertPixels(InvertMode mode)
case QImage::Format_ARGB32:
if (mode == InvertRgba)
break;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGB32:
xorbits = 0x00ffffff;
break;
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 45d57856aa..0320d032b0 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -1151,7 +1151,7 @@ bool QImageReader::autoTransform() const
case QImageReaderPrivate::UsePluginDefault:
if (d->initHandler())
return d->handler->supportsOption(QImageIOHandler::TransformedByDefault);
- // no break
+ Q_FALLTHROUGH();
default:
break;
}
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index 4032176efc..950695a9d7 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -113,10 +113,10 @@ int QBlittablePlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) con
return qRound(h * 25.4 / qt_defaultDpiY());
case QPaintDevice::PdmDepth:
return 32;
- case QPaintDevice::PdmDpiX: // fall-through
+ case QPaintDevice::PdmDpiX:
case QPaintDevice::PdmPhysicalDpiX:
return qt_defaultDpiX();
- case QPaintDevice::PdmDpiY: // fall-through
+ case QPaintDevice::PdmDpiY:
case QPaintDevice::PdmPhysicalDpiY:
return qt_defaultDpiY();
case QPaintDevice::PdmDevicePixelRatio:
diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
index 82a88eca04..2afb5e6ba5 100644
--- a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
+++ b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
@@ -154,14 +154,14 @@ bool QPlatformGraphicsBufferHelper::bindSWToTexture(const QPlatformGraphicsBuffe
switch (imageformat) {
case QImage::Format_ARGB32_Premultiplied:
premultiplied = true;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGB32:
case QImage::Format_ARGB32:
swizzle = true;
break;
case QImage::Format_RGBA8888_Premultiplied:
premultiplied = true;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGBX8888:
case QImage::Format_RGBA8888:
break;
diff --git a/src/gui/painting/qcssutil.cpp b/src/gui/painting/qcssutil.cpp
index a826532b43..2d514e14e0 100644
--- a/src/gui/painting/qcssutil.cpp
+++ b/src/gui/painting/qcssutil.cpp
@@ -197,7 +197,7 @@ void qDrawEdge(QPainter *p, qreal x1, qreal y1, qreal x2, qreal y2, qreal dw1, q
if ((style == BorderStyle_Outset && (edge == TopEdge || edge == LeftEdge))
|| (style == BorderStyle_Inset && (edge == BottomEdge || edge == RightEdge)))
c = c.color().lighter();
- // fall through!
+ Q_FALLTHROUGH();
case BorderStyle_Solid: {
p->setPen(Qt::NoPen);
p->setBrush(c);
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index 4f2b59c775..f92a681eca 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -1760,7 +1760,7 @@ static bool bool_op(bool a, bool b, QPathClipper::Operation op)
switch (op) {
case QPathClipper::BoolAnd:
return a && b;
- case QPathClipper::BoolOr: // fall-through
+ case QPathClipper::BoolOr:
case QPathClipper::Simplify:
return a || b;
case QPathClipper::BoolSub:
@@ -1956,7 +1956,7 @@ QPointF intersectLine(const QPointF &a, const QPointF &b, qreal t)
{
QLineF line(a, b);
switch (edge) {
- case Left: // fall-through
+ case Left:
case Right:
return line.pointAt((t - a.x()) / (b.x() - a.x()));
default:
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 34f1c51f6d..d246c96da6 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -2091,7 +2091,7 @@ int QPdfEnginePrivate::generateLinearGradientShader(const QLinearGradient *gradi
break;
case QGradient::ReflectSpread:
reflect = true;
- // fall through
+ Q_FALLTHROUGH();
case QGradient::RepeatSpread: {
// calculate required bounds
QRectF pageRect = m_pageLayout.fullRectPixels(resolution);
@@ -2154,7 +2154,7 @@ int QPdfEnginePrivate::generateRadialGradientShader(const QRadialGradient *gradi
break;
case QGradient::ReflectSpread:
reflect = true;
- // fall through
+ Q_FALLTHROUGH();
case QGradient::RepeatSpread: {
Q_ASSERT(qFuzzyIsNull(r0)); // QPainter emulates if this is not 0
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index e2c5a82ffc..0c5de36981 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -471,14 +471,14 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion, QSize *textu
switch (image.format()) {
case QImage::Format_ARGB32_Premultiplied:
*flags |= TexturePremultiplied;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGB32:
case QImage::Format_ARGB32:
*flags |= TextureSwizzle;
break;
case QImage::Format_RGBA8888_Premultiplied:
*flags |= TexturePremultiplied;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGBX8888:
case QImage::Format_RGBA8888:
break;
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 6058811176..2d841b2953 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -446,7 +446,7 @@ QTransform &QTransform::translate(qreal dx, qreal dy)
break;
case TxProject:
m_33 += dx*m_13 + dy*m_23;
- // Fall through
+ Q_FALLTHROUGH();
case TxShear:
case TxRotate:
affine._dx += dx*affine._m11 + dy*affine._m21;
@@ -508,12 +508,12 @@ QTransform & QTransform::scale(qreal sx, qreal sy)
case TxProject:
m_13 *= sx;
m_23 *= sy;
- // fall through
+ Q_FALLTHROUGH();
case TxRotate:
case TxShear:
affine._m12 *= sx;
affine._m21 *= sy;
- // fall through
+ Q_FALLTHROUGH();
case TxScale:
affine._m11 *= sx;
affine._m22 *= sy;
@@ -581,7 +581,7 @@ QTransform & QTransform::shear(qreal sh, qreal sv)
m_13 += tm13;
m_23 += tm23;
}
- // fall through
+ Q_FALLTHROUGH();
case TxRotate:
case TxShear: {
qreal tm11 = sv*affine._m21;
@@ -663,7 +663,7 @@ QTransform & QTransform::rotate(qreal a, Qt::Axis axis)
qreal tm23 = -sina*m_13 + cosa*m_23;
m_13 = tm13;
m_23 = tm23;
- // fall through
+ Q_FALLTHROUGH();
}
case TxRotate:
case TxShear: {
@@ -742,7 +742,7 @@ QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis)
qreal tm23 = -sina*m_13 + cosa*m_23;
m_13 = tm13;
m_23 = tm23;
- // fall through
+ Q_FALLTHROUGH();
}
case TxRotate:
case TxShear: {
diff --git a/src/gui/painting/qtriangulator.cpp b/src/gui/painting/qtriangulator.cpp
index 7906011cd2..6604d407f0 100644
--- a/src/gui/painting/qtriangulator.cpp
+++ b/src/gui/painting/qtriangulator.cpp
@@ -874,7 +874,7 @@ void QTriangulator<T>::initialize(const QVectorPath &path, const QTransform &mat
case QPainterPath::MoveToElement:
if (!m_indices.isEmpty())
m_indices.push_back(T(-1)); // Q_TRIANGULATE_END_OF_POLYGON
- // Fall through.
+ Q_FALLTHROUGH();
case QPainterPath::LineToElement:
m_indices.push_back(T(m_vertices.size()));
m_vertices.resize(m_vertices.size() + 1);
@@ -2100,7 +2100,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
} else {
qWarning("Inconsistent polygon. (#3)");
}
- // Fall through.
+ Q_FALLTHROUGH();
case StartVertex:
if (m_clockwiseOrder) {
leftEdgeNode = searchEdgeLeftOfEdge(j);
@@ -2129,7 +2129,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
} else {
qWarning("Inconsistent polygon. (#4)");
}
- // Fall through.
+ Q_FALLTHROUGH();
case EndVertex:
if (m_clockwiseOrder) {
if (m_edges.at(m_edges.at(i).helper).type == MergeVertex)
diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp
index c8f0393084..49638832e0 100644
--- a/src/gui/text/qfontsubset.cpp
+++ b/src/gui/text/qfontsubset.cpp
@@ -740,7 +740,7 @@ static void convertPath(const QPainterPath &path, QVector<TTF_POINT> *points, QV
points->takeLast();
endPoints->append(points->size() - 1);
}
- // fall through
+ Q_FALLTHROUGH();
case QPainterPath::LineToElement:
p.flags = OnCurve;
break;
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index f824d1b369..f32c31d18e 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -438,7 +438,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
if (relativePos < blockIt.length()-1)
++position;
- // FALL THROUGH!
+ Q_FALLTHROUGH();
}
case QTextCursor::PreviousWord:
case QTextCursor::WordLeft:
@@ -590,9 +590,9 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
adjustX = false;
break;
}
- case QTextCursor::NextCell: // fall through
- case QTextCursor::PreviousCell: // fall through
- case QTextCursor::NextRow: // fall through
+ case QTextCursor::NextCell:
+ case QTextCursor::PreviousCell:
+ case QTextCursor::NextRow:
case QTextCursor::PreviousRow: {
QTextTable *table = qobject_cast<QTextTable *>(priv->frameAt(position));
if (!table)
diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp
index 5727b34e86..079b2e01f7 100644
--- a/src/gui/text/qtextdocumentfragment.cpp
+++ b/src/gui/text/qtextdocumentfragment.cpp
@@ -827,7 +827,7 @@ bool QTextHtmlImporter::closeTag()
case Html_div:
if (closedNode->children.isEmpty())
break;
- // fall through
+ Q_FALLTHROUGH();
default:
if (closedNode->isBlock())
blockTagClosed = true;
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index d9b648b170..1aaacdd00d 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -508,7 +508,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
case QChar::DirAN:
if (eor >= 0)
appendItems(analysis, sor, eor, control, dir);
- // fall through
+ Q_FALLTHROUGH();
case QChar::DirR:
case QChar::DirAL:
dir = QChar::DirR; eor = current; status.eor = QChar::DirR; break;
@@ -564,7 +564,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
status.eor = QChar::DirON;
dir = QChar::DirAN;
}
- // fall through
+ Q_FALLTHROUGH();
case QChar::DirEN:
case QChar::DirL:
eor = current;
@@ -744,7 +744,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
status.last = QChar::DirL;
break;
}
- // fall through
+ Q_FALLTHROUGH();
default:
status.last = dirCurrent;
}
@@ -1663,7 +1663,7 @@ void QTextEngine::itemize() const
analysis->bidiLevel = control.baseLevel();
break;
}
- // fall through
+ Q_FALLTHROUGH();
default:
analysis->flags = QScriptAnalysis::None;
break;
@@ -2250,7 +2250,6 @@ void QTextEngine::justify(const QScriptLine &line)
case Justification_Prohibited:
break;
case Justification_Space:
- // fall through
case Justification_Arabic_Space:
if (kashida_pos >= 0) {
// qDebug("kashida position at %d in word", kashida_pos);
@@ -2263,7 +2262,7 @@ void QTextEngine::justify(const QScriptLine &line)
}
kashida_pos = -1;
kashida_type = Justification_Arabic_Normal;
- // fall through
+ Q_FALLTHROUGH();
case Justification_Character:
set(&justificationPoints[nPoints++], justification, g.mid(i), fontEngine(si));
maxJustify = qMax(maxJustify, justification);
@@ -2966,9 +2965,8 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const
switch (tabSpec.type) {
case QTextOption::CenterTab:
length /= 2;
- // fall through
+ Q_FALLTHROUGH();
case QTextOption::DelimiterTab:
- // fall through
case QTextOption::RightTab:
tab = QFixed::fromReal(tabSpec.position) * dpiScale - length;
if (tab < x) // default to tab taking no space
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index 7bca50325c..7fac3331f1 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1871,7 +1871,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
decls << decl;
if (node.id == Html_b || node.id == Html_strong)
break;
- // Delibrate fall through
+ Q_FALLTHROUGH();
case Html_big:
case Html_small:
if (node.id != Html_th) {
@@ -1892,7 +1892,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
decls << decl;
break;
}
- // Delibrate fall through
+ Q_FALLTHROUGH();
case Html_center:
case Html_td:
decl = QCss::Declaration();
@@ -1969,7 +1969,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
}
if (node.id != Html_pre)
break;
- // Delibrate fall through
+ Q_FALLTHROUGH();
case Html_br:
case Html_nobr:
decl = QCss::Declaration();