Skip to content

Commit

Permalink
Remove custom FALLTHROUGH define
Browse files Browse the repository at this point in the history
We don't need this anymore since we require c++17 anyway, and
it raises build warnings due to macro redefinition with newer GRASS
  • Loading branch information
nyalldawson committed Oct 23, 2023
1 parent 9b095c5 commit 1d1b7c9
Show file tree
Hide file tree
Showing 30 changed files with 55 additions and 66 deletions.
1 change: 0 additions & 1 deletion python/core/auto_generated/qgis.sip.in
Expand Up @@ -2653,7 +2653,6 @@ typedef unsigned long long qgssize;




QString geoWkt();
%Docstring
Wkt string that represents a geographic coord sys
Expand Down
2 changes: 1 addition & 1 deletion src/app/layers/qgsapplayerhandling.cpp
Expand Up @@ -1530,7 +1530,7 @@ const QList<QgsVectorLayerRef> QgsAppLayerHandling::findBrokenLayerDependencies(
{
if ( !weakRelation.mappingTable().resolveWeakly( QgsProject::instance(), matchType ) )
dependencies << weakRelation.mappingTable();
FALLTHROUGH;
[[fallthrough]];
}

case Qgis::RelationshipCardinality::OneToOne:
Expand Down
2 changes: 1 addition & 1 deletion src/app/mesh/qgsmaptooleditmeshframe.cpp
Expand Up @@ -688,7 +688,7 @@ QgsMapTool::Flags QgsMapToolEditMeshFrame::flags() const
case Digitizing:
if ( !mCadDockWidget->cadEnabled() || !mSelectedVertices.isEmpty() || mCurrentFaceIndex != -1 )
return QgsMapTool::Flags() | QgsMapTool::ShowContextMenu;
FALLTHROUGH
[[fallthrough]];
case AddingNewFace:
case Selecting:
case MovingSelection:
Expand Down
2 changes: 1 addition & 1 deletion src/core/expression/qgsexpressionnodeimpl.cpp
Expand Up @@ -232,7 +232,7 @@ QVariant QgsExpressionNodeBinaryOperator::evalNode( QgsExpression *parent, const
return QVariant( sL + sR );
}
//intentional fall-through
FALLTHROUGH
[[fallthrough]];
case boMinus:
case boMul:
case boDiv:
Expand Down
2 changes: 1 addition & 1 deletion src/core/labeling/qgsvectorlayerlabeling.cpp
Expand Up @@ -216,7 +216,7 @@ std::unique_ptr<QgsMarkerSymbolLayer> backgroundToMarkerLayer( const QgsTextBack
layer.reset( static_cast< QgsMarkerSymbolLayer * >( settings.markerSymbol()->symbolLayer( 0 )->clone() ) );
break;
}
FALLTHROUGH // not set, just go with the default
[[fallthrough]]; // not set, just go with the default
}
case QgsTextBackgroundSettings::ShapeCircle:
case QgsTextBackgroundSettings::ShapeEllipse:
Expand Down
10 changes: 5 additions & 5 deletions src/core/layout/qgslayoutitemmap.cpp
Expand Up @@ -1301,7 +1301,7 @@ bool QgsLayoutItemMap::nextExportPart()
mCurrentExportPart = Background;
return true;
}
FALLTHROUGH
[[fallthrough]];

case Background:
mCurrentExportPart = Layer;
Expand Down Expand Up @@ -1330,7 +1330,7 @@ bool QgsLayoutItemMap::nextExportPart()
mCurrentExportPart = Grid;
return true;
}
FALLTHROUGH
[[fallthrough]];

case Grid:
for ( int i = 0; i < mOverviewStack->size(); ++i )
Expand All @@ -1342,7 +1342,7 @@ bool QgsLayoutItemMap::nextExportPart()
return true;
}
}
FALLTHROUGH
[[fallthrough]];

case OverviewMapExtent:
if ( frameEnabled() )
Expand All @@ -1351,15 +1351,15 @@ bool QgsLayoutItemMap::nextExportPart()
return true;
}

FALLTHROUGH
[[fallthrough]];

case Frame:
if ( isSelected() && !mLayout->renderContext().isPreviewRender() )
{
mCurrentExportPart = SelectionBoxes;
return true;
}
FALLTHROUGH
[[fallthrough]];

case SelectionBoxes:
mCurrentExportPart = End;
Expand Down
4 changes: 2 additions & 2 deletions src/core/layout/qgslayoutitemmapgrid.cpp
Expand Up @@ -641,7 +641,7 @@ void QgsLayoutItemMapGrid::draw( QPainter *p )
break;
}

FALLTHROUGH
[[fallthrough]];
case CM:
case MM:
drawGridNoTransform( context, dotsPerMM );
Expand Down Expand Up @@ -2217,7 +2217,7 @@ void QgsLayoutItemMapGrid::calculateMaxExtension( double &top, double &right, do
break;
}
}
FALLTHROUGH
[[fallthrough]];
case CM:
case MM:
drawGridNoTransform( context, 0, true );
Expand Down
2 changes: 1 addition & 1 deletion src/core/layout/qgslayoutitemmapitem.cpp
Expand Up @@ -279,7 +279,7 @@ void QgsLayoutItemMapItemStack::drawItems( QPainter *painter, bool ignoreStackin
if ( !ignoreStacking )
break;

FALLTHROUGH
[[fallthrough]];
case QgsLayoutItemMapItem::StackAboveMapLabels:
item->draw( painter );
break;
Expand Down
Expand Up @@ -193,7 +193,7 @@ QList<QgsLayerTreeModelLegendNode *> QgsPointCloudAttributeByRampRenderer::creat
mColorRampShader.maximumValue() );
break;
}
Q_FALLTHROUGH();
[[fallthrough]];
case QgsColorRampShader::Discrete:
case QgsColorRampShader::Exact:
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/pointcloud/qgspointcloudlayerexporter.cpp
Expand Up @@ -252,7 +252,7 @@ void QgsPointCloudLayerExporter::doExport()
case ExportFormat::Csv:
layerCreationOptions << QStringLiteral( "GEOMETRY=AS_XYZ" )
<< QStringLiteral( "SEPARATOR=COMMA" ); // just in case ogr changes the default lco
FALLTHROUGH
[[fallthrough]];
case ExportFormat::Gpkg:
case ExportFormat::Dxf:
case ExportFormat::Shp:
Expand Down
2 changes: 1 addition & 1 deletion src/core/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -1914,7 +1914,7 @@ bool QgsOgrProvider::addAttributeOGRLevel( const QgsField &field, bool &ignoreEr
// other lists are supported at this moment, fall through to default for other types

//intentional fall-through
FALLTHROUGH
[[fallthrough]];

default:
pushError( tr( "type %1 for field %2 not found" ).arg( field.typeName(), field.name() ) );
Expand Down
10 changes: 0 additions & 10 deletions src/core/qgis.h
Expand Up @@ -4933,16 +4933,6 @@ typedef unsigned long long qgssize;
#endif
#endif

#if __cplusplus >= 201500
#define FALLTHROUGH [[fallthrough]];
#elif defined(__clang__)
#define FALLTHROUGH [[clang::fallthrough]];
#elif defined(__GNUC__) && __GNUC__ >= 7
#define FALLTHROUGH [[gnu::fallthrough]];
#else
#define FALLTHROUGH
#endif

// see https://infektor.net/posts/2017-01-19-using-cpp17-attributes-today.html#using-the-nodiscard-attribute
#if __cplusplus >= 201703L
#define NODISCARD [[nodiscard]]
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaplayerlegend.cpp
Expand Up @@ -577,7 +577,7 @@ QList<QgsLayerTreeModelLegendNode *> QgsDefaultMeshLayerLegend::createLayerTreeM
}
break;
}
Q_FALLTHROUGH();
[[fallthrough]];
case QgsColorRampShader::Discrete:
case QgsColorRampShader::Exact:
{
Expand Down
10 changes: 5 additions & 5 deletions src/core/qgsogcutils.cpp
Expand Up @@ -1305,7 +1305,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry,
case Qgis::WkbType::MultiPoint25D:
hasZValue = true;
//intentional fall-through
FALLTHROUGH
[[fallthrough]];
case Qgis::WkbType::MultiPoint:
{
QDomElement multiPointElem = doc.createElement( QStringLiteral( "gml:MultiPoint" ) );
Expand Down Expand Up @@ -1350,7 +1350,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry,
case Qgis::WkbType::LineString25D:
hasZValue = true;
//intentional fall-through
FALLTHROUGH
[[fallthrough]];
case Qgis::WkbType::LineString:
{
QDomElement lineStringElem = doc.createElement( QStringLiteral( "gml:LineString" ) );
Expand Down Expand Up @@ -1393,7 +1393,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry,
case Qgis::WkbType::MultiLineString25D:
hasZValue = true;
//intentional fall-through
FALLTHROUGH
[[fallthrough]];
case Qgis::WkbType::MultiLineString:
{
QDomElement multiLineStringElem = doc.createElement( QStringLiteral( "gml:MultiLineString" ) );
Expand Down Expand Up @@ -1451,7 +1451,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry,
case Qgis::WkbType::Polygon25D:
hasZValue = true;
//intentional fall-through
FALLTHROUGH
[[fallthrough]];
case Qgis::WkbType::Polygon:
{
QDomElement polygonElem = doc.createElement( QStringLiteral( "gml:Polygon" ) );
Expand Down Expand Up @@ -1513,7 +1513,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry,
case Qgis::WkbType::MultiPolygon25D:
hasZValue = true;
//intentional fall-through
FALLTHROUGH
[[fallthrough]];
case Qgis::WkbType::MultiPolygon:
{
QDomElement multiPolygonElem = doc.createElement( QStringLiteral( "gml:MultiPolygon" ) );
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsrendercontext.cpp
Expand Up @@ -388,7 +388,7 @@ double QgsRenderContext::convertToPainterUnits( double size, Qgis::RenderUnit un
size = convertMetersToMapUnits( size );
unit = Qgis::RenderUnit::MapUnits;
// Fall through to RenderMapUnits with size in meters converted to size in MapUnits
FALLTHROUGH
[[fallthrough]];
}
case Qgis::RenderUnit::MapUnits:
{
Expand Down Expand Up @@ -484,7 +484,7 @@ double QgsRenderContext::convertToMapUnits( double size, Qgis::RenderUnit unit,
{
size = convertMetersToMapUnits( size );
// Fall through to RenderMapUnits with values of meters converted to MapUnits
FALLTHROUGH
[[fallthrough]];
}
case Qgis::RenderUnit::MapUnits:
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsscalecalculator.cpp
Expand Up @@ -111,7 +111,7 @@ void QgsScaleCalculator::calculateMetrics( const QgsRectangle &mapExtent, double

case Qgis::DistanceUnit::Unknown:
// assume degrees to maintain old API
FALLTHROUGH
[[fallthrough]];

case Qgis::DistanceUnit::Degrees:
// degrees require conversion to meters first
Expand Down
8 changes: 4 additions & 4 deletions src/core/qgsvectorfilewriter.cpp
Expand Up @@ -733,7 +733,7 @@ void QgsVectorFileWriter::init( QString vectorFileName,
}

//intentional fall-through
FALLTHROUGH
[[fallthrough]];

case QVariant::List:
// handle GPKG conversion to JSON
Expand Down Expand Up @@ -806,7 +806,7 @@ void QgsVectorFileWriter::init( QString vectorFileName,
break;
}
//intentional fall-through
FALLTHROUGH
[[fallthrough]];

default:
//assert(0 && "invalid variant type!");
Expand Down Expand Up @@ -2996,7 +2996,7 @@ gdal::ogr_feature_unique_ptr QgsVectorFileWriter::createFeature( const QgsFeatur
break;
}
//intentional fall-through
FALLTHROUGH
[[fallthrough]];

case QVariant::Map:
{
Expand All @@ -3017,7 +3017,7 @@ gdal::ogr_feature_unique_ptr QgsVectorFileWriter::createFeature( const QgsFeatur
}

//intentional fall-through
FALLTHROUGH
[[fallthrough]];


default:
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgssinglebandpseudocolorrenderer.cpp
Expand Up @@ -461,7 +461,7 @@ QList<QgsLayerTreeModelLegendNode *> QgsSingleBandPseudoColorRenderer::createLeg
}
break;
}
Q_FALLTHROUGH();
[[fallthrough]];
case QgsColorRampShader::Discrete:
case QgsColorRampShader::Exact:
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology/qgssymbol.cpp
Expand Up @@ -1545,7 +1545,7 @@ void QgsSymbol::renderFeature( const QgsFeature &feature, QgsRenderContext &cont
const QgsMultiPoint *mp = qgsgeometry_cast< const QgsMultiPoint * >( processedGeometry );
markers.reserve( mp->numGeometries() );
}
FALLTHROUGH
[[fallthrough]];
case Qgis::WkbType::MultiCurve:
case Qgis::WkbType::MultiLineString:
case Qgis::WkbType::GeometryCollection:
Expand Down
4 changes: 2 additions & 2 deletions src/core/textrenderer/qgstextrenderer.cpp
Expand Up @@ -478,7 +478,7 @@ void QgsTextRenderer::drawPart( const QRectF &rect, double rotation, Qgis::TextH
if ( !format.buffer().enabled() )
break;
}
FALLTHROUGH
[[fallthrough]];
case Qgis::TextComponent::Text:
case Qgis::TextComponent::Shadow:
{
Expand Down Expand Up @@ -528,7 +528,7 @@ void QgsTextRenderer::drawPart( QPointF origin, double rotation, Qgis::TextHoriz
if ( !format.buffer().enabled() )
break;
}
FALLTHROUGH
[[fallthrough]];
case Qgis::TextComponent::Text:
case Qgis::TextComponent::Shadow:
{
Expand Down
6 changes: 3 additions & 3 deletions src/core/vector/qgsvectorlayer.cpp
Expand Up @@ -4556,7 +4556,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:
Expand Down Expand Up @@ -4655,7 +4655,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:
Expand Down Expand Up @@ -4789,7 +4789,7 @@ void QgsVectorLayer::minimumOrMaximumValue( int index, QVariant *minimum, QVaria
return;
}
}
FALLTHROUGH
[[fallthrough]];
// no choice but to go through all features
case QgsFields::OriginExpression:
case QgsFields::OriginJoin:
Expand Down
2 changes: 1 addition & 1 deletion src/core/vector/qgsvectorlayerprofilegenerator.cpp
Expand Up @@ -68,7 +68,7 @@ QVector<QgsAbstractProfileResults::Feature> QgsVectorLayerProfileResults::asFeat
if ( type != Qgis::ProfileExportType::DistanceVsElevationTable )
return asIndividualFeatures( type, feedback );
// distance vs elevation table results are always handled like a continuous surface
FALLTHROUGH
[[fallthrough]];

case Qgis::VectorProfileType::ContinuousSurface:
return QgsAbstractProfileSurfaceResults::asFeatures( type, feedback );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/annotations/qgsmaptoolmodifyannotation.cpp
Expand Up @@ -537,7 +537,7 @@ void QgsMapToolModifyAnnotation::keyPressEvent( QKeyEvent *event )
event->ignore(); // disable default shortcut handling (delete vector feature)
break;
}
FALLTHROUGH
[[fallthrough]];
}

case Action::MoveItem:
Expand Down
2 changes: 1 addition & 1 deletion src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp
Expand Up @@ -2917,7 +2917,7 @@ QWidget *QgsProcessingEnumWidgetWrapper::createWidget()
return mCheckboxPanel;
}
}
FALLTHROUGH
[[fallthrough]];
case QgsProcessingGui::Modeler:
case QgsProcessingGui::Batch:
{
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgspropertyoverridebutton.cpp
Expand Up @@ -120,12 +120,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" );
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/qgsgrassnewmapset.cpp
Expand Up @@ -299,7 +299,7 @@ int QgsGrassNewMapset::nextId() const
id = MapSet;
break;
}
FALLTHROUGH
[[fallthrough]];
case Database:
case Crs:
case Region:
Expand Down

0 comments on commit 1d1b7c9

Please sign in to comment.