Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Address -Woverloaded-virtual clang virtual and enable the warning
  • Loading branch information
rouault authored and nyalldawson committed Jun 24, 2021
1 parent e64e8d2 commit 8a6ed7d
Show file tree
Hide file tree
Showing 22 changed files with 97 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -635,7 +635,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 -Wimplicit-fallthrough")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-return-type-c-linkage -Woverloaded-virtual -Wimplicit-fallthrough")
endif()

# add any extra CXXFLAGS flags set by user. can be -D CXX_EXTRA_FLAGS or environment variable
Expand Down
1 change: 1 addition & 0 deletions python/core/auto_generated/browser/qgsdataitem.sip.in
Expand Up @@ -205,6 +205,7 @@ Subclasses should override this and :py:func:`~QgsDataItem.handleDrop` to accept
QGIS 3.10
%End


virtual bool handleDrop( const QMimeData * /*data*/, Qt::DropAction /*action*/ ) /Deprecated/;
%Docstring
Attempts to process the mime data dropped on this item. Subclasses must override this and :py:func:`~QgsDataItem.acceptDrop` if they
Expand Down
2 changes: 2 additions & 0 deletions python/core/auto_generated/geometry/qgstriangle.sip.in
Expand Up @@ -105,6 +105,8 @@ Inherited method not used. You cannot delete or insert a vertex directly. Return





QgsPoint vertexAt( int atVertex ) const /HoldGIL/;
%Docstring
Returns coordinates of a vertex.
Expand Down
1 change: 1 addition & 0 deletions python/core/auto_generated/qgsauxiliarystorage.sip.in
Expand Up @@ -61,6 +61,7 @@ Constructor
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End


QgsAuxiliaryLayer *clone( QgsVectorLayer *layer ) const /Factory/;
%Docstring
Returns a new instance equivalent to this one. The underlying table
Expand Down
Expand Up @@ -48,6 +48,7 @@ Make sure, the master model is already loaded, so the selection will get synchro
:param canvas: The mapCanvas. Used to identify the currently visible features.
%End


void setSourceModel( QgsAttributeTableModel *sourceModel );
%Docstring
Set the attribute table model that backs this model
Expand All @@ -57,6 +58,7 @@ Set the attribute table model that backs this model
.. versionadded:: 2.0
%End


void setSelectedOnTop( bool selectedOnTop );
%Docstring
Changes the sort order of the features. If set to ``True``, selected features
Expand Down
Expand Up @@ -38,6 +38,7 @@ Returns the layer cache
:return: the layer cache used as backend
%End


virtual void setModel( QgsFeatureListModel *featureListModel );
%Docstring
Set the :py:class:`QgsFeatureListModel` which is used to retrieve information
Expand Down
Expand Up @@ -29,6 +29,7 @@ Widget to control a layers transparency and related options

public slots:


void syncToLayer();
%Docstring
Sync the widget state to the layer set for the widget.
Expand Down
Expand Up @@ -55,6 +55,8 @@ called when user changes renderer type
Apply the changes from the dialog to the layer.
%End



void syncToLayer( QgsRasterLayer *layer );
%Docstring
Sync the widget to the given layer.
Expand Down
2 changes: 2 additions & 0 deletions src/app/devtools/networklogger/qgsnetworklogger.h
Expand Up @@ -76,6 +76,8 @@ class QgsNetworkLogger : public QAbstractItemModel
QList< QAction * > actions( const QModelIndex &index, QObject *parent );


using QAbstractItemModel::removeRows;

/**
* Removes a list of request \a rows from the log.
*/
Expand Down
8 changes: 8 additions & 0 deletions src/core/browser/qgsdataitem.h
Expand Up @@ -217,6 +217,11 @@ class CORE_EXPORT QgsDataItem : public QObject
*/
Q_DECL_DEPRECATED virtual bool acceptDrop() SIP_DEPRECATED { return false; }

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#endif

/**
* Attempts to process the mime data dropped on this item. Subclasses must override this and acceptDrop() if they
* accept dropped layers.
Expand All @@ -226,6 +231,9 @@ class CORE_EXPORT QgsDataItem : public QObject
* \deprecated QGIS 3.10
*/
Q_DECL_DEPRECATED virtual bool handleDrop( const QMimeData * /*data*/, Qt::DropAction /*action*/ ) SIP_DEPRECATED { return false; }
#ifdef __clang__
#pragma clang diagnostic pop
#endif

/**
* Called when a user double clicks on the item. Subclasses should return TRUE
Expand Down
9 changes: 9 additions & 0 deletions src/core/geometry/qgstriangle.h
Expand Up @@ -102,12 +102,21 @@ class CORE_EXPORT QgsTriangle : public QgsPolygon

// inherited: double pointDistanceToBoundary( double x, double y ) const;


#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#endif

/**
* Returns coordinates of a vertex.
* \param atVertex index of the vertex
* \returns Coordinates of the vertex or empty QgsPoint on error (\a atVertex < 0 or > 3).
*/
QgsPoint vertexAt( int atVertex ) const SIP_HOLDGIL;
#ifdef __clang__
#pragma clang diagnostic pop
#endif

/**
* Returns the three lengths of the triangle.
Expand Down
8 changes: 8 additions & 0 deletions src/core/qgsauxiliarystorage.h
Expand Up @@ -89,6 +89,11 @@ class CORE_EXPORT QgsAuxiliaryLayer : public QgsVectorLayer
% End
#endif

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#endif

/**
* Returns a new instance equivalent to this one. The underlying table
* is duplicate for the layer given in parameter. Note that the current
Expand All @@ -97,6 +102,9 @@ class CORE_EXPORT QgsAuxiliaryLayer : public QgsVectorLayer
* \param layer The layer for which the clone is made
*/
QgsAuxiliaryLayer *clone( QgsVectorLayer *layer ) const SIP_FACTORY;
#ifdef __clang__
#pragma clang diagnostic pop
#endif

/**
* An auxiliary layer is not spatial. This method returns a spatial
Expand Down
9 changes: 9 additions & 0 deletions src/gui/attributetable/qgsattributetablefiltermodel.h
Expand Up @@ -82,6 +82,11 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub
*/
QgsAttributeTableFilterModel( QgsMapCanvas *canvas, QgsAttributeTableModel *sourceModel, QObject *parent SIP_TRANSFERTHIS = nullptr );

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#endif

/**
* Set the attribute table model that backs this model
*
Expand All @@ -91,6 +96,10 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub
*/
void setSourceModel( QgsAttributeTableModel *sourceModel );

#ifdef __clang__
#pragma clang diagnostic pop
#endif

/**
* Changes the sort order of the features. If set to TRUE, selected features
* will be sorted on top, regardless of the current sort column
Expand Down
7 changes: 7 additions & 0 deletions src/gui/attributetable/qgsattributetableview.h
Expand Up @@ -54,7 +54,14 @@ class GUI_EXPORT QgsAttributeTableView : public QTableView
//! Constructor for QgsAttributeTableView
QgsAttributeTableView( QWidget *parent SIP_TRANSFERTHIS = nullptr );

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#endif
virtual void setModel( QgsAttributeTableFilterModel *filterModel );
#ifdef __clang__
#pragma clang diagnostic pop
#endif

/**
* \brief setFeatureSelectionManager
Expand Down
7 changes: 7 additions & 0 deletions src/gui/attributetable/qgsfeaturelistmodel.h
Expand Up @@ -68,7 +68,14 @@ class GUI_EXPORT QgsFeatureListModel : public QSortFilterProxyModel, public QgsF
//! Constructor for QgsFeatureListModel
explicit QgsFeatureListModel( QgsAttributeTableFilterModel *sourceModel, QObject *parent SIP_TRANSFERTHIS = nullptr );

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#endif
virtual void setSourceModel( QgsAttributeTableFilterModel *sourceModel );
#ifdef __clang__
#pragma clang diagnostic pop
#endif

/**
* Returns the vector layer cache which is being used to populate the model.
Expand Down
8 changes: 8 additions & 0 deletions src/gui/attributetable/qgsfeaturelistview.h
Expand Up @@ -62,12 +62,20 @@ class GUI_EXPORT QgsFeatureListView : public QListView
*/
QgsVectorLayerCache *layerCache();

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#endif

/**
* Set the QgsFeatureListModel which is used to retrieve information
*
* \param featureListModel The model to use
*/
virtual void setModel( QgsFeatureListModel *featureListModel );
#ifdef __clang__
#pragma clang diagnostic pop
#endif

/**
* Gets the featureListModel used by this view
Expand Down
7 changes: 7 additions & 0 deletions src/gui/mesh/qgsrenderermeshpropertieswidget.h
Expand Up @@ -51,8 +51,15 @@ class GUI_EXPORT QgsRendererMeshPropertiesWidget : public QgsMapLayerConfigWidge
//! Applies the settings made in the dialog
void apply() override;

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#endif
//! Synchronize widgets state with associated mesh layer
void syncToLayer();
#ifdef __clang__
#pragma clang diagnostic pop
#endif

private slots:
void onActiveScalarGroupChanged( int groupIndex );
Expand Down
8 changes: 8 additions & 0 deletions src/gui/raster/qgsrastertransparencywidget.h
Expand Up @@ -45,10 +45,18 @@ class GUI_EXPORT QgsRasterTransparencyWidget : public QgsMapLayerConfigWidget, p

public slots:

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#endif

/**
* Sync the widget state to the layer set for the widget.
*/
void syncToLayer();
#ifdef __clang__
#pragma clang diagnostic pop
#endif

/**
* Apply any changes on the widget to the set layer.
Expand Down
9 changes: 9 additions & 0 deletions src/gui/raster/qgsrendererrasterpropertieswidget.h
Expand Up @@ -67,11 +67,20 @@ class GUI_EXPORT QgsRendererRasterPropertiesWidget : public QgsMapLayerConfigWid
//! Apply the changes from the dialog to the layer.
void apply() override;


#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#endif

/**
* \brief Sync the widget to the given layer.
* \param layer The layer to use for the widget
*/
void syncToLayer( QgsRasterLayer *layer );
#ifdef __clang__
#pragma clang diagnostic pop
#endif

private slots:
//! Slot to reset all color rendering options to default
Expand Down
2 changes: 2 additions & 0 deletions src/providers/db2/qgsdb2dataitems.h
Expand Up @@ -80,7 +80,9 @@ class QgsDb2ConnectionItem : public QgsDataCollectionItem
QVector<QgsDataItem *> createChildren() override;
bool equal( const QgsDataItem *other ) override;

using QgsDataCollectionItem::handleDrop;
bool handleDrop( const QMimeData *data, const QString &toSchema );

void refresh() override;

QString connInfo() const { return mConnInfo; }
Expand Down
1 change: 1 addition & 0 deletions src/providers/mssql/qgsmssqldataitems.h
Expand Up @@ -65,6 +65,7 @@ class QgsMssqlConnectionItem : public QgsDataCollectionItem
QVector<QgsDataItem *> createChildren() override;
bool equal( const QgsDataItem *other ) override;

using QgsDataCollectionItem::handleDrop;
bool handleDrop( const QMimeData *data, const QString &toSchema );

QString connInfo() const { return mConnInfo; }
Expand Down
1 change: 1 addition & 0 deletions src/providers/postgres/qgspostgresdataitems.h
Expand Up @@ -55,6 +55,7 @@ class QgsPGConnectionItem : public QgsDataCollectionItem
QVector<QgsDataItem *> createChildren() override;
bool equal( const QgsDataItem *other ) override;

using QgsDataCollectionItem::handleDrop;
bool handleDrop( const QMimeData *data, const QString &toSchema );

signals:
Expand Down

0 comments on commit 8a6ed7d

Please sign in to comment.