Introduce Q_FALLTHROUGH()

Silence g++ 7.X warnings.

Change-Id: I9d06d04b496c9ec060e13e1be6f43d8fbadb1f3b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Friedemann Kleint
2018-01-10 16:51:58 +01:00
parent 66488ba0b8
commit f482270432
19 changed files with 71 additions and 43 deletions

View File

@@ -754,7 +754,7 @@ again:
u = QLatin1Char('\0');
break;
}
// fall through
Q_FALLTHROUGH();
case '1':
case '2':
case '3':

View File

@@ -278,7 +278,7 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
enter(expression_continuation);
break;
}
// fallthrough
Q_FALLTHROUGH();
case ternary_op_after_colon:
case expression:
if (tryInsideExpression())
@@ -1142,7 +1142,7 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd
*savedIndentDepth = parentState.savedIndentDepth;
break;
}
// fallthrough
Q_FALLTHROUGH();
case substatement_open:
// special case for "foo: {" and "property int foo: {"
if (parentState.type == binding_assignment)

View File

@@ -444,7 +444,7 @@ bool Evaluate::visit(AST::BinaryExpression *ast)
//case QSOperator::And: // ### enable once implemented below
//case QSOperator::Or:
lhs = value(ast->left);
// fallthrough
Q_FALLTHROUGH();
case QSOperator::Assign:
rhs = value(ast->right);
break;

View File

@@ -37,6 +37,7 @@
#include <cplusplus/cppmodelmanagerbase.h>
#include <utils/algorithm.h>
#include <utils/hostosinfo.h>
#include <utils/qtcfallthrough.h>
#include <utils/runextensions.h>
#include <QDir>
@@ -1391,7 +1392,7 @@ ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
break;
case ViewerContext::AddAllPathsAndDefaultSelectors:
res.selectors.append(defaultVCtx.selectors);
// fallthrough
Q_FALLTHROUGH();
case ViewerContext::AddAllPaths:
{
foreach (const QString &path, defaultVCtx.paths)
@@ -1400,10 +1401,10 @@ ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
case Dialect::AnyLanguage:
case Dialect::Qml:
res.maybeAddPath(info.qtQmlPath);
// fallthrough
Q_FALLTHROUGH();
case Dialect::QmlQtQuick1:
res.maybeAddPath(info.qtImportsPath);
// fallthrough
Q_FALLTHROUGH();
case Dialect::QmlQtQuick2:
case Dialect::QmlQtQuick2Ui:
{
@@ -1439,7 +1440,7 @@ ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
}
case ViewerContext::AddDefaultPathsAndSelectors:
res.selectors.append(defaultVCtx.selectors);
// fallthrough
Q_FALLTHROUGH();
case ViewerContext::AddDefaultPaths:
foreach (const QString &path, defaultVCtx.paths)
res.maybeAddPath(path);