Skip to content
Permalink
Browse files

Merge pull request #7530 from m-kuhn/implicit-fallthrough

Enable -Wimplicit-fallthrough
  • Loading branch information
m-kuhn committed Aug 6, 2018
2 parents 52ed396 + c60efaf commit 3fc8e8d61b95ea8d394a03d94f52802d4c3d1883
@@ -461,7 +461,7 @@ IF (PEDANTIC)
# ADD_DEFINITIONS( -fstrict-aliasing -Wstrict-aliasing=1 -Wredundant-decls )

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

# add any extra CXXFLAGS flags set by user. can be -D CXX_EXTRA_FLAGS or environment variable
@@ -19,7 +19,7 @@
#if __cplusplus >= 201500
#define FALLTHROUGH [[fallthrough]];
#elif defined(__clang__)
#define FALLTHROUGH //[[clang::fallthrough]]
#define FALLTHROUGH [[clang::fallthrough]];
#elif defined(__GNUC__) && __GNUC__ >= 7
#define FALLTHROUGH [[gnu::fallthrough]];
#else
@@ -28,7 +28,8 @@

#include "qgslogger.h"

/** Utility function
/**
* Utility function
* convert a int to string in hex
**/
namespace DRW
@@ -27,7 +27,7 @@
#if __cplusplus >= 201500
#define FALLTHROUGH [[fallthrough]];
#elif defined(__clang__)
#define FALLTHROUGH //[[clang::fallthrough]]
#define FALLTHROUGH [[clang::fallthrough]];
#elif defined(__GNUC__) && __GNUC__ >= 7
#define FALLTHROUGH [[gnu::fallthrough]];
#else
@@ -3782,7 +3782,7 @@ void QgsDxfExport::addFeature( QgsSymbolRenderContext &ctx, const QgsCoordinateT
tempGeom = geom->segmentize();
if ( !tempGeom )
break;
FALLTHROUGH;
FALLTHROUGH
case QgsWkbTypes::LineString:
if ( !qgsDoubleNear( offset, 0.0 ) )
{
@@ -3802,7 +3802,7 @@ void QgsDxfExport::addFeature( QgsSymbolRenderContext &ctx, const QgsCoordinateT
tempGeom = geom->segmentize();
if ( !tempGeom )
break;
FALLTHROUGH;
FALLTHROUGH
case QgsWkbTypes::MultiLineString:
{
if ( !qgsDoubleNear( offset, 0.0 ) )
@@ -3828,7 +3828,7 @@ void QgsDxfExport::addFeature( QgsSymbolRenderContext &ctx, const QgsCoordinateT
tempGeom = geom->segmentize();
if ( !tempGeom )
break;
FALLTHROUGH;
FALLTHROUGH
case QgsWkbTypes::Polygon:
{
if ( !qgsDoubleNear( offset, 0.0 ) )
@@ -3888,7 +3888,7 @@ void QgsDxfExport::addFeature( QgsSymbolRenderContext &ctx, const QgsCoordinateT
tempGeom = tempGeom->segmentize();
if ( !tempGeom )
break;
FALLTHROUGH;
FALLTHROUGH
case QgsWkbTypes::Polygon:
writePolygon( tempGeom->coordinateSequence().at( 0 ), layer, QStringLiteral( "SOLID" ), brushColor );
break;
@@ -193,7 +193,7 @@ QVariant QgsExpressionNodeBinaryOperator::evalNode( QgsExpression *parent, const
return QVariant( sL + sR );
}
//intentional fall-through
FALLTHROUGH;
FALLTHROUGH
case boMinus:
case boMul:
case boDiv:
@@ -221,7 +221,7 @@ bool QgsAbstractReportSection::next()

// but if not, then the current section is a body
mNextSection = Body;
FALLTHROUGH;
FALLTHROUGH
}

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

FALLTHROUGH;
FALLTHROUGH
}

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

// all children and bodies have spent their content, so move to the footer
mNextSection = Footer;
FALLTHROUGH;
FALLTHROUGH
}

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

// if not, then we're all done
FALLTHROUGH;
FALLTHROUGH
}

case End:
@@ -563,7 +563,7 @@ typedef unsigned long long qgssize;
#if __cplusplus >= 201500
#define FALLTHROUGH [[fallthrough]];
#elif defined(__clang__)
#define FALLTHROUGH //[[clang::fallthrough]]
#define FALLTHROUGH [[clang::fallthrough]];
#elif defined(__GNUC__) && __GNUC__ >= 7
#define FALLTHROUGH [[gnu::fallthrough]];
#else
@@ -1212,7 +1212,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry, QDomDocumen
case QgsWkbTypes::MultiPoint25D:
hasZValue = true;
//intentional fall-through
FALLTHROUGH;
FALLTHROUGH
case QgsWkbTypes::MultiPoint:
{
QDomElement multiPointElem = doc.createElement( QStringLiteral( "gml:MultiPoint" ) );
@@ -1256,7 +1256,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry, QDomDocumen
case QgsWkbTypes::LineString25D:
hasZValue = true;
//intentional fall-through
FALLTHROUGH;
FALLTHROUGH
case QgsWkbTypes::LineString:
{
QDomElement lineStringElem = doc.createElement( QStringLiteral( "gml:LineString" ) );
@@ -1298,7 +1298,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry, QDomDocumen
case QgsWkbTypes::MultiLineString25D:
hasZValue = true;
//intentional fall-through
FALLTHROUGH;
FALLTHROUGH
case QgsWkbTypes::MultiLineString:
{
QDomElement multiLineStringElem = doc.createElement( QStringLiteral( "gml:MultiLineString" ) );
@@ -1355,7 +1355,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry, QDomDocumen
case QgsWkbTypes::Polygon25D:
hasZValue = true;
//intentional fall-through
FALLTHROUGH;
FALLTHROUGH
case QgsWkbTypes::Polygon:
{
QDomElement polygonElem = doc.createElement( QStringLiteral( "gml:Polygon" ) );
@@ -1420,7 +1420,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry, QDomDocumen
case QgsWkbTypes::MultiPolygon25D:
hasZValue = true;
//intentional fall-through
FALLTHROUGH;
FALLTHROUGH
case QgsWkbTypes::MultiPolygon:
{
QDomElement multiPolygonElem = doc.createElement( QStringLiteral( "gml:MultiPolygon" ) );
@@ -357,7 +357,7 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry *geom, co
case QgsWkbTypes::LineString25D:
hasZValue = true;
//intentional fall-through
FALLTHROUGH;
FALLTHROUGH
case QgsWkbTypes::LineString:
{
int nPoints;
@@ -391,7 +391,7 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry *geom, co
case QgsWkbTypes::MultiLineString25D:
hasZValue = true;
//intentional fall-through
FALLTHROUGH;
FALLTHROUGH
case QgsWkbTypes::MultiLineString:
{
int nLines;
@@ -432,7 +432,7 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry *geom, co
case QgsWkbTypes::Polygon25D:
hasZValue = true;
//intentional fall-through
FALLTHROUGH;
FALLTHROUGH
case QgsWkbTypes::Polygon:
{
int nRings;
@@ -473,7 +473,7 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry *geom, co
case QgsWkbTypes::MultiPolygon25D:
hasZValue = true;
//intentional fall-through
FALLTHROUGH;
FALLTHROUGH
case QgsWkbTypes::MultiPolygon:
{
int nPolygons;
@@ -273,7 +273,7 @@ double QgsRenderContext::convertToPainterUnits( double size, QgsUnitTypes::Rende
size = convertMetersToMapUnits( size );
unit = QgsUnitTypes::RenderMapUnits;
// Fall through to RenderMapUnits with size in meters converted to size in MapUnits
FALLTHROUGH;
FALLTHROUGH
}
case QgsUnitTypes::RenderMapUnits:
{
@@ -323,7 +323,7 @@ double QgsRenderContext::convertToMapUnits( double size, QgsUnitTypes::RenderUni
{
size = convertMetersToMapUnits( size );
// Fall through to RenderMapUnits with values of meters converted to MapUnits
FALLTHROUGH;
FALLTHROUGH
}
case QgsUnitTypes::RenderMapUnits:
{
@@ -1813,7 +1813,7 @@ void QgsTextRenderer::drawPart( const QRectF &rect, double rotation, HAlignment
if ( !format.buffer().enabled() )
break;
}
FALLTHROUGH;
FALLTHROUGH
case Text:
case Shadow:
{
@@ -1857,7 +1857,7 @@ void QgsTextRenderer::drawPart( QPointF origin, double rotation, QgsTextRenderer
if ( !format.buffer().enabled() )
break;
}
FALLTHROUGH;
FALLTHROUGH
case Text:
case Shadow:
{
@@ -2077,6 +2077,7 @@ void QgsTextRenderer::drawBackground( QgsRenderContext &context, QgsTextRenderer
component.origin.y() - height / 2.0 + originAdjust );
break;
}
break;
}

case Label:
@@ -3464,7 +3464,7 @@ QSet<QVariant> QgsVectorLayer::uniqueValues( int index, int limit ) const
uniqueValues = mDataProvider->uniqueValues( index, limit );
return uniqueValues;
}
FALLTHROUGH;
FALLTHROUGH
//we need to go through each feature
case QgsFields::OriginJoin:
case QgsFields::OriginExpression:
@@ -3561,7 +3561,7 @@ QStringList QgsVectorLayer::uniqueStringsMatching( int index, const QString &sub
{
return mDataProvider->uniqueStringsMatching( index, substring, limit, feedback );
}
FALLTHROUGH;
FALLTHROUGH
//we need to go through each feature
case QgsFields::OriginJoin:
case QgsFields::OriginExpression:
@@ -3654,7 +3654,7 @@ QVariant QgsVectorLayer::minimumValue( int index ) const
return mDataProvider->minimumValue( index );
}
}
FALLTHROUGH;
FALLTHROUGH
// no choice but to go through all features
case QgsFields::OriginExpression:
case QgsFields::OriginJoin:
@@ -3740,7 +3740,7 @@ QVariant QgsVectorLayer::maximumValue( int index ) const
return mDataProvider->maximumValue( index );
}

FALLTHROUGH;
FALLTHROUGH
//no choice but to go through each feature
case QgsFields::OriginJoin:
case QgsFields::OriginExpression:
@@ -996,7 +996,7 @@ void QgsSymbol::renderFeature( const QgsFeature &feature, QgsRenderContext &cont
break;
}

FALLTHROUGH;
FALLTHROUGH
}
default:
QgsDebugMsg( QString( "feature %1: unsupported wkb type %2/%3 for rendering" )
@@ -119,12 +119,12 @@ void QgsPropertyOverrideButton::init( int propertyKey, const QgsProperty &proper
{
case QgsPropertyDefinition::DataTypeBoolean:
ts << tr( "boolean" );
FALLTHROUGH;
FALLTHROUGH

case QgsPropertyDefinition::DataTypeNumeric:
ts << tr( "int" );
ts << tr( "double" );
FALLTHROUGH;
FALLTHROUGH

case QgsPropertyDefinition::DataTypeString:
ts << tr( "string" );
@@ -175,16 +175,20 @@ void QgsSymbolsListWidget::createAuxiliaryField()
if ( markerSymbol )
markerSymbol->setDataDefinedAngle( button->toProperty() );
break;

case QgsSymbolLayer::PropertySize:
if ( markerSymbol )
{
markerSymbol->setDataDefinedSize( button->toProperty() );
markerSymbol->setScaleMethod( QgsSymbol::ScaleDiameter );
}
break;

case QgsSymbolLayer::PropertyStrokeWidth:
if ( lineSymbol )
lineSymbol->setDataDefinedWidth( button->toProperty() );
break;

default:
break;
}
@@ -395,7 +395,7 @@ void QgsGeorefPluginGui::generateGDALScript()
break;
}
}
FALLTHROUGH;
FALLTHROUGH
default:
mMessageBar->pushMessage( tr( "Invalid Transform" ), tr( "GDAL scripting is not supported for %1 transformation." )
.arg( convertTransformEnumToString( mTransformParam ) )
@@ -322,7 +322,7 @@ int QgsGrassNewMapset::nextId() const
id = MapSet;
break;
}
FALLTHROUGH;
FALLTHROUGH
case Database:
case Crs:
case Region:
@@ -1619,6 +1619,8 @@ bool QgsOgrProvider::addAttributeOGRLevel( const QgsField &field, bool &ignoreEr
{
case QVariant::Bool:
OGR_Fld_SetSubType( fielddefn.get(), OFSTBoolean );
break;

default:
break;
}
@@ -1841,7 +1841,7 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry &geom, QSqlQuery &qry
case QgsWkbTypes::Point25D:
case QgsWkbTypes::PointZ:
dim = 3;
FALLTHROUGH;
FALLTHROUGH

case QgsWkbTypes::Point:
g.srid = mSrid;
@@ -1856,7 +1856,7 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry &geom, QSqlQuery &qry
case QgsWkbTypes::LineStringZ:
case QgsWkbTypes::MultiLineStringZ:
dim = 3;
FALLTHROUGH;
FALLTHROUGH

case QgsWkbTypes::LineString:
case QgsWkbTypes::MultiLineString:
@@ -1895,7 +1895,7 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry &geom, QSqlQuery &qry
case QgsWkbTypes::PolygonZ:
case QgsWkbTypes::MultiPolygonZ:
dim = 3;
FALLTHROUGH;
FALLTHROUGH

case QgsWkbTypes::Polygon:
case QgsWkbTypes::MultiPolygon:
@@ -1937,7 +1937,7 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry &geom, QSqlQuery &qry
case QgsWkbTypes::MultiPoint25D:
case QgsWkbTypes::MultiPointZ:
dim = 3;
FALLTHROUGH;
FALLTHROUGH

case QgsWkbTypes::MultiPoint:
{

0 comments on commit 3fc8e8d

Please sign in to comment.
You can’t perform that action at this time.