Skip to content

Commit 3fc8e8d

Browse files
authored
Merge pull request #7530 from m-kuhn/implicit-fallthrough
Enable -Wimplicit-fallthrough
2 parents 52ed396 + c60efaf commit 3fc8e8d

22 files changed

+56
-48
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ IF (PEDANTIC)
461461
# ADD_DEFINITIONS( -fstrict-aliasing -Wstrict-aliasing=1 -Wredundant-decls )
462462

463463
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
464-
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-return-type-c-linkage -Wno-overloaded-virtual")
464+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-return-type-c-linkage -Wno-overloaded-virtual -Wimplicit-fallthrough")
465465
ENDIF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
466466

467467
# add any extra CXXFLAGS flags set by user. can be -D CXX_EXTRA_FLAGS or environment variable

external/libdxfrw/intern/dwgutil.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#if __cplusplus >= 201500
2020
#define FALLTHROUGH [[fallthrough]];
2121
#elif defined(__clang__)
22-
#define FALLTHROUGH //[[clang::fallthrough]]
22+
#define FALLTHROUGH [[clang::fallthrough]];
2323
#elif defined(__GNUC__) && __GNUC__ >= 7
2424
#define FALLTHROUGH [[gnu::fallthrough]];
2525
#else
@@ -28,7 +28,8 @@
2828

2929
#include "qgslogger.h"
3030

31-
/** Utility function
31+
/**
32+
* Utility function
3233
* convert a int to string in hex
3334
**/
3435
namespace DRW

external/libdxfrw/libdxfrw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#if __cplusplus >= 201500
2828
#define FALLTHROUGH [[fallthrough]];
2929
#elif defined(__clang__)
30-
#define FALLTHROUGH //[[clang::fallthrough]]
30+
#define FALLTHROUGH [[clang::fallthrough]];
3131
#elif defined(__GNUC__) && __GNUC__ >= 7
3232
#define FALLTHROUGH [[gnu::fallthrough]];
3333
#else

src/core/dxf/qgsdxfexport.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3782,7 +3782,7 @@ void QgsDxfExport::addFeature( QgsSymbolRenderContext &ctx, const QgsCoordinateT
37823782
tempGeom = geom->segmentize();
37833783
if ( !tempGeom )
37843784
break;
3785-
FALLTHROUGH;
3785+
FALLTHROUGH
37863786
case QgsWkbTypes::LineString:
37873787
if ( !qgsDoubleNear( offset, 0.0 ) )
37883788
{
@@ -3802,7 +3802,7 @@ void QgsDxfExport::addFeature( QgsSymbolRenderContext &ctx, const QgsCoordinateT
38023802
tempGeom = geom->segmentize();
38033803
if ( !tempGeom )
38043804
break;
3805-
FALLTHROUGH;
3805+
FALLTHROUGH
38063806
case QgsWkbTypes::MultiLineString:
38073807
{
38083808
if ( !qgsDoubleNear( offset, 0.0 ) )
@@ -3828,7 +3828,7 @@ void QgsDxfExport::addFeature( QgsSymbolRenderContext &ctx, const QgsCoordinateT
38283828
tempGeom = geom->segmentize();
38293829
if ( !tempGeom )
38303830
break;
3831-
FALLTHROUGH;
3831+
FALLTHROUGH
38323832
case QgsWkbTypes::Polygon:
38333833
{
38343834
if ( !qgsDoubleNear( offset, 0.0 ) )
@@ -3888,7 +3888,7 @@ void QgsDxfExport::addFeature( QgsSymbolRenderContext &ctx, const QgsCoordinateT
38883888
tempGeom = tempGeom->segmentize();
38893889
if ( !tempGeom )
38903890
break;
3891-
FALLTHROUGH;
3891+
FALLTHROUGH
38923892
case QgsWkbTypes::Polygon:
38933893
writePolygon( tempGeom->coordinateSequence().at( 0 ), layer, QStringLiteral( "SOLID" ), brushColor );
38943894
break;

src/core/expression/qgsexpressionnodeimpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ QVariant QgsExpressionNodeBinaryOperator::evalNode( QgsExpression *parent, const
193193
return QVariant( sL + sR );
194194
}
195195
//intentional fall-through
196-
FALLTHROUGH;
196+
FALLTHROUGH
197197
case boMinus:
198198
case boMul:
199199
case boDiv:

src/core/layout/qgsabstractreportsection.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ bool QgsAbstractReportSection::next()
221221

222222
// but if not, then the current section is a body
223223
mNextSection = Body;
224-
FALLTHROUGH;
224+
FALLTHROUGH
225225
}
226226

227227
case Body:
@@ -238,7 +238,7 @@ bool QgsAbstractReportSection::next()
238238
return true;
239239
}
240240

241-
FALLTHROUGH;
241+
FALLTHROUGH
242242
}
243243

244244
case Children:
@@ -284,7 +284,7 @@ bool QgsAbstractReportSection::next()
284284

285285
// all children and bodies have spent their content, so move to the footer
286286
mNextSection = Footer;
287-
FALLTHROUGH;
287+
FALLTHROUGH
288288
}
289289

290290
case Footer:
@@ -303,7 +303,7 @@ bool QgsAbstractReportSection::next()
303303
}
304304

305305
// if not, then we're all done
306-
FALLTHROUGH;
306+
FALLTHROUGH
307307
}
308308

309309
case End:

src/core/qgis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ typedef unsigned long long qgssize;
563563
#if __cplusplus >= 201500
564564
#define FALLTHROUGH [[fallthrough]];
565565
#elif defined(__clang__)
566-
#define FALLTHROUGH //[[clang::fallthrough]]
566+
#define FALLTHROUGH [[clang::fallthrough]];
567567
#elif defined(__GNUC__) && __GNUC__ >= 7
568568
#define FALLTHROUGH [[gnu::fallthrough]];
569569
#else

src/core/qgsogcutils.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry, QDomDocumen
12121212
case QgsWkbTypes::MultiPoint25D:
12131213
hasZValue = true;
12141214
//intentional fall-through
1215-
FALLTHROUGH;
1215+
FALLTHROUGH
12161216
case QgsWkbTypes::MultiPoint:
12171217
{
12181218
QDomElement multiPointElem = doc.createElement( QStringLiteral( "gml:MultiPoint" ) );
@@ -1256,7 +1256,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry, QDomDocumen
12561256
case QgsWkbTypes::LineString25D:
12571257
hasZValue = true;
12581258
//intentional fall-through
1259-
FALLTHROUGH;
1259+
FALLTHROUGH
12601260
case QgsWkbTypes::LineString:
12611261
{
12621262
QDomElement lineStringElem = doc.createElement( QStringLiteral( "gml:LineString" ) );
@@ -1298,7 +1298,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry, QDomDocumen
12981298
case QgsWkbTypes::MultiLineString25D:
12991299
hasZValue = true;
13001300
//intentional fall-through
1301-
FALLTHROUGH;
1301+
FALLTHROUGH
13021302
case QgsWkbTypes::MultiLineString:
13031303
{
13041304
QDomElement multiLineStringElem = doc.createElement( QStringLiteral( "gml:MultiLineString" ) );
@@ -1355,7 +1355,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry, QDomDocumen
13551355
case QgsWkbTypes::Polygon25D:
13561356
hasZValue = true;
13571357
//intentional fall-through
1358-
FALLTHROUGH;
1358+
FALLTHROUGH
13591359
case QgsWkbTypes::Polygon:
13601360
{
13611361
QDomElement polygonElem = doc.createElement( QStringLiteral( "gml:Polygon" ) );
@@ -1420,7 +1420,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry, QDomDocumen
14201420
case QgsWkbTypes::MultiPolygon25D:
14211421
hasZValue = true;
14221422
//intentional fall-through
1423-
FALLTHROUGH;
1423+
FALLTHROUGH
14241424
case QgsWkbTypes::MultiPolygon:
14251425
{
14261426
QDomElement multiPolygonElem = doc.createElement( QStringLiteral( "gml:MultiPolygon" ) );

src/core/qgspointlocator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry *geom, co
357357
case QgsWkbTypes::LineString25D:
358358
hasZValue = true;
359359
//intentional fall-through
360-
FALLTHROUGH;
360+
FALLTHROUGH
361361
case QgsWkbTypes::LineString:
362362
{
363363
int nPoints;
@@ -391,7 +391,7 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry *geom, co
391391
case QgsWkbTypes::MultiLineString25D:
392392
hasZValue = true;
393393
//intentional fall-through
394-
FALLTHROUGH;
394+
FALLTHROUGH
395395
case QgsWkbTypes::MultiLineString:
396396
{
397397
int nLines;
@@ -432,7 +432,7 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry *geom, co
432432
case QgsWkbTypes::Polygon25D:
433433
hasZValue = true;
434434
//intentional fall-through
435-
FALLTHROUGH;
435+
FALLTHROUGH
436436
case QgsWkbTypes::Polygon:
437437
{
438438
int nRings;
@@ -473,7 +473,7 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry *geom, co
473473
case QgsWkbTypes::MultiPolygon25D:
474474
hasZValue = true;
475475
//intentional fall-through
476-
FALLTHROUGH;
476+
FALLTHROUGH
477477
case QgsWkbTypes::MultiPolygon:
478478
{
479479
int nPolygons;

src/core/qgsrendercontext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ double QgsRenderContext::convertToPainterUnits( double size, QgsUnitTypes::Rende
273273
size = convertMetersToMapUnits( size );
274274
unit = QgsUnitTypes::RenderMapUnits;
275275
// Fall through to RenderMapUnits with size in meters converted to size in MapUnits
276-
FALLTHROUGH;
276+
FALLTHROUGH
277277
}
278278
case QgsUnitTypes::RenderMapUnits:
279279
{
@@ -323,7 +323,7 @@ double QgsRenderContext::convertToMapUnits( double size, QgsUnitTypes::RenderUni
323323
{
324324
size = convertMetersToMapUnits( size );
325325
// Fall through to RenderMapUnits with values of meters converted to MapUnits
326-
FALLTHROUGH;
326+
FALLTHROUGH
327327
}
328328
case QgsUnitTypes::RenderMapUnits:
329329
{

0 commit comments

Comments
 (0)