Skip to content

Commit

Permalink
fix warnings brought up by clang
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Feb 2, 2013
1 parent 4a77429 commit 63cc49b
Show file tree
Hide file tree
Showing 25 changed files with 94 additions and 41 deletions.
20 changes: 14 additions & 6 deletions CMakeLists.txt
Expand Up @@ -308,18 +308,26 @@ IF (PEDANTIC)
ADD_DEFINITIONS( /wd4610 ) # user defined constructor required (sqlite3_index_info)
ADD_DEFINITIONS( /wd4706 ) # assignment within conditional expression (pal)
ELSE (MSVC)
IF (APPLE_CLANG AND NOT APPLE_CLANG_WARNINGS)
SET(CMAKE_C_FLAGS "-Wall -Wextra -Wno-long-long -Wformat-security -Wno-strict-aliasing ")
SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wno-return-type-c-linkage -Wno-overloaded-virtual ")
ELSE (APPLE_CLANG AND NOT APPLE_CLANG_WARNINGS)
ADD_DEFINITIONS( -Wall -Wextra -Wno-long-long -Wformat-security -Wno-strict-aliasing )
ENDIF (APPLE_CLANG AND NOT APPLE_CLANG_WARNINGS)
ADD_DEFINITIONS( -Wall -Wextra -Wno-long-long -Wformat-security -Wno-strict-aliasing )
# Qt produces lots of warnings with strict aliasing (as of Qt 4.4.0 & GCC 4.3)
# There are redundant declarations in Qt and GDAL
# ADD_DEFINITIONS( -fstrict-aliasing -Wstrict-aliasing=1 -Wredundant-decls )

IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
ADD_DEFINITIONS(-Wno-return-type-c-linkage) # used in plugins and providers
ENDIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
ENDIF (MSVC)

ENDIF (PEDANTIC)

IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Qunused-arguments")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Qunused-arguments")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Qunused-arguments")
ENDIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")

IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
# spatialite crashes on ppc - see bugs.debian.org/603986
ADD_DEFINITIONS( -fno-strict-aliasing )
Expand Down
Expand Up @@ -27,13 +27,15 @@ class QgsCategorizedSymbolRendererV2Widget : QgsRendererV2Widget

void showSymbolLevels();

void rowsMoved();

protected:

void updateUiFromRenderer();

void updateCategorizedSymbolIcon();

//! populate categories view
// Called by virtual refreshSymbolView()
void populateCategories();

//! populate column combo
Expand All @@ -42,6 +44,12 @@ class QgsCategorizedSymbolRendererV2Widget : QgsRendererV2Widget
//! return row index for the currently selected category (-1 if on no selection)
int currentCategoryRow();

//! return a list of indexes for the categories unders selection
QList<int> selectedCategories();

//! change the selected symbols alone for the change button, if there is a selection
void changeSelectedSymbols();

void changeCategorySymbol();

QList<QgsSymbolV2*> selectedSymbols();
Expand Down
11 changes: 10 additions & 1 deletion python/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.sip
Expand Up @@ -22,26 +22,35 @@ class QgsGraduatedSymbolRendererV2Widget : QgsRendererV2Widget

/**Adds a class manually to the classification*/
void addClass();
/**Removes selected classes*/
/**Removes currently selected classes */
void deleteClasses();
/**Removes all classes from the classification*/
void deleteAllClasses();

void rotationFieldChanged( QString fldName );
void sizeScaleFieldChanged( QString fldName );
void scaleMethodChanged( QgsSymbolV2::ScaleMethod scaleMethod );

void showSymbolLevels();

void rowsMoved();

protected:
void updateUiFromRenderer();

void updateGraduatedSymbolIcon();

//! return a list of indexes for the classes under selection
QList<int> selectedClasses();

//! populate column combos in categorized and graduated page
void populateColumns();

void changeRangeSymbol( int rangeIdx );
void changeRange( int rangeIdx );

void changeSelectedSymbols();

QList<QgsSymbolV2*> selectedSymbols();
QgsSymbolV2* findSymbolForRange( double lowerBound, double upperBound, const QgsRangeList& ranges ) const;
void refreshSymbolView();
Expand Down
2 changes: 1 addition & 1 deletion scripts/prepare-commit.sh
Expand Up @@ -31,7 +31,7 @@ fi

if [ "$1" = "-c" ]; then
echo "Cleaning..."
find . \( -name "*.prepare" -o -name "*.astyle" -o -name "astyle.*.diff" -o -name "sha-*.diff" \) -print -delete
find . \( -name "*.prepare" -o -name "*.astyle" -o -name "*.nocopyright" -o -name "astyle.*.diff" -o -name "sha-*.diff" \) -print -delete
fi

set -e
Expand Down
26 changes: 18 additions & 8 deletions src/analysis/CMakeLists.txt
Expand Up @@ -44,14 +44,24 @@ ADD_FLEX_FILES_PREFIX(QGIS_ANALYSIS_SRCS raster raster/qgsrastercalclexer.ll)

ADD_BISON_FILES_PREFIX(QGIS_ANALYSIS_SRCS raster raster/qgsrastercalcparser.yy)

IF (MSVC AND PEDANTIC)
# disable warnings
# 4065 switch with default and no case
# 4702 unreachable code
SET_SOURCE_FILES_PROPERTIES(
${CMAKE_BINARY_DIR}/src/analysis/qgsrastercalcparser.cpp
PROPERTIES COMPILE_FLAGS "-wd4065 -wd4702")
ENDIF (MSVC AND PEDANTIC)
IF (PEDANTIC AND MSVC)
# disable warnings
# 4065 switch with default and no case
# 4702 unreachable code
SET_SOURCE_FILES_PROPERTIES(
${CMAKE_BINARY_DIR}/src/analysis/qgsrastercalcparser.cpp
PROPERTIES COMPILE_FLAGS "-wd4065 -wd4702"
)
ENDIF (PEDANTIC AND MSVC)

IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
SET_SOURCE_FILES_PROPERTIES(
interpolation/qgstininterpolator.cpp
interpolation/NormVecDecorator.cc
interpolation/CloughTocherInterpolator.cc
PROPERTIES COMPILE_FLAGS "-Wno-overloaded-virtual"
)
ENDIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")

SET(QGIS_ANALYSIS_MOC_HDRS
)
Expand Down
5 changes: 5 additions & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -218,6 +218,11 @@ SET(QGIS_CORE_SRCS
qgsscaleutils.cpp
)

IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# spatialindex headers produce warnings
SET_SOURCE_FILES_PROPERTIES(qgsspatialindex.cpp PROPERTIES COMPILE_FLAGS -Wno-overloaded-virtual)
ENDIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")

IF (WITH_INTERNAL_QEXTSERIALPORT)
SET(QGIS_CORE_SRCS ${QGIS_CORE_SRCS}
gps/qextserialport/qextserialport.cpp
Expand Down
4 changes: 2 additions & 2 deletions src/core/composer/qgscomposertable.cpp
Expand Up @@ -44,7 +44,7 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*

//getFeatureAttributes
QList<QgsAttributeMap> attributeList;
if ( !getFeatureAttributes( attributeList ) )
if ( !getFeatureAttributeMap( attributeList ) )
{
return;
}
Expand Down Expand Up @@ -119,7 +119,7 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*
void QgsComposerTable::adjustFrameToSize()
{
QList<QgsAttributeMap> attributes;
if ( !getFeatureAttributes( attributes ) )
if ( !getFeatureAttributeMap( attributes ) )
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposertable.h
Expand Up @@ -75,7 +75,7 @@ class CORE_EXPORT QgsComposerTable: public QgsComposerItem

/**Retrieves feature attributes*/
//! @note not available in python bindings
virtual bool getFeatureAttributes( QList<QgsAttributeMap>& attributes )
virtual bool getFeatureAttributeMap( QList<QgsAttributeMap>& attributes )
{ Q_UNUSED( attributes ); return false; } //= 0;
virtual QMap<int, QString> getHeaderLabels() const { return QMap<int, QString>(); } //= 0;
/**Calculate the maximum width values of the vector attributes*/
Expand Down
5 changes: 3 additions & 2 deletions src/core/qgsvectorfilewriter.h
Expand Up @@ -80,8 +80,9 @@ class CORE_EXPORT QgsVectorFileWriter
@param datasourceOptions list of OGR data source creation options
@param layerOptions list of OGR layer creation options
@param skipAttributeCreation only write geometries
@param newFilename QString pointer which will contain the new file name created
(in case it is different to fileName).
@param newFilename QString pointer which will contain the new file name created (in case it is different to fileName).
@param symbologyExport symbology to export
@param symbologyScale scale of symbology
*/
static WriterError writeAsVectorFormat( QgsVectorLayer* layer,
const QString& fileName,
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgsfillsymbollayerv2.cpp
Expand Up @@ -918,7 +918,7 @@ void QgsLinePatternFillSymbolLayer::toSld( QDomDocument &doc, QDomElement &eleme
}
}

QString QgsLinePatternFillSymbolLayer::ogrFeatureStyle( double widthScaleFactor ) const
QString QgsLinePatternFillSymbolLayer::ogrFeatureStyleWidth( double widthScaleFactor ) const
{
QString featureStyle;
featureStyle.append( "Brush(" );
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgsfillsymbollayerv2.h
Expand Up @@ -191,7 +191,7 @@ class CORE_EXPORT QgsLinePatternFillSymbolLayer: public QgsImageFillSymbolLayer

void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;

QString ogrFeatureStyle( double widthScaleFactor ) const;
QString ogrFeatureStyleWidth( double widthScaleFactor ) const;

//getters and setters
void setLineAngle( double a ) { mLineAngle = a; }
Expand Down
4 changes: 3 additions & 1 deletion src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
Expand Up @@ -480,8 +480,10 @@ void QgsSimpleMarkerSymbolLayerV2::writeSldMarker( QDomDocument &doc, QDomElemen
QgsSymbolLayerV2Utils::createDisplacementElement( doc, graphicElem, mOffset );
}

QString QgsSimpleMarkerSymbolLayerV2::ogrFeatureStyle( double widthScaleFactor ) const
QString QgsSimpleMarkerSymbolLayerV2::ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const
{
Q_UNUSED( mmScaleFactor );
Q_UNUSED( mapUnitScaleFactor );
#if 0
QString ogrType = "3"; //default is circle
if ( mName == "square" )
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgsmarkersymbollayerv2.h
Expand Up @@ -62,7 +62,7 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2

void writeSldMarker( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;

QString ogrFeatureStyle( double widthScaleFactor ) const;
QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const;

QString name() const { return mName; }
void setName( QString name ) { mName = name; }
Expand Down
4 changes: 1 addition & 3 deletions src/core/symbology-ng/qgssymbollayerv2utils.h
Expand Up @@ -164,9 +164,7 @@ class CORE_EXPORT QgsSymbolLayerV2Utils
static void labelTextToSld( QDomDocument &doc, QDomElement &element, QString label,
QFont font, QColor color = QColor(), double size = -1 );

/**Create ogr feature style string for pen
@param width linewidth in mm
@param c line color*/
/**Create ogr feature style string for pen */
static QString ogrFeatureStylePen( double width, double mmScaleFactor, double mapUnitsScaleFactor, const QColor& c,
Qt::PenJoinStyle joinStyle = Qt::MiterJoin,
Qt::PenCapStyle capStyle = Qt::FlatCap,
Expand Down
4 changes: 2 additions & 2 deletions src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp
Expand Up @@ -261,7 +261,7 @@ bool QgsCategorizedSymbolRendererV2Model::dropMimeData( const QMimeData *data, Q
return false;
}

void QgsCategorizedSymbolRendererV2Model::removeRows( QList<int> rows )
void QgsCategorizedSymbolRendererV2Model::deleteRows( QList<int> rows )
{
for ( int i = rows.size() - 1; i >= 0; i-- )
{
Expand Down Expand Up @@ -723,7 +723,7 @@ QList<int> QgsCategorizedSymbolRendererV2Widget::selectedCategories()
void QgsCategorizedSymbolRendererV2Widget::deleteCategories()
{
QList<int> categoryIndexes = selectedCategories();
mModel->removeRows( categoryIndexes );
mModel->deleteRows( categoryIndexes );
}

void QgsCategorizedSymbolRendererV2Widget::deleteAllCategories()
Expand Down
Expand Up @@ -46,7 +46,7 @@ class GUI_EXPORT QgsCategorizedSymbolRendererV2Model : public QAbstractItemModel
void setRenderer( QgsCategorizedSymbolRendererV2* renderer );

void addCategory( const QgsRendererCategoryV2 &cat );
void removeRows( QList<int> rows );
void deleteRows( QList<int> rows );
void removeAllRows( );
void sort( int column, Qt::SortOrder order = Qt::AscendingOrder );

Expand Down
4 changes: 2 additions & 2 deletions src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
Expand Up @@ -248,7 +248,7 @@ bool QgsGraduatedSymbolRendererV2Model::dropMimeData( const QMimeData *data, Qt:
return false;
}

void QgsGraduatedSymbolRendererV2Model::removeRows( QList<int> rows )
void QgsGraduatedSymbolRendererV2Model::deleteRows( QList<int> rows )
{
for ( int i = rows.size() - 1; i >= 0; i-- )
{
Expand Down Expand Up @@ -657,7 +657,7 @@ void QgsGraduatedSymbolRendererV2Widget::addClass()
void QgsGraduatedSymbolRendererV2Widget::deleteClasses()
{
QList<int> classIndexes = selectedClasses();
mModel->removeRows( classIndexes );
mModel->deleteRows( classIndexes );
}

void QgsGraduatedSymbolRendererV2Widget::deleteAllClasses()
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.h
Expand Up @@ -44,7 +44,7 @@ class GUI_EXPORT QgsGraduatedSymbolRendererV2Model : public QAbstractItemModel
void setRenderer( QgsGraduatedSymbolRendererV2* renderer );

void addClass( QgsSymbolV2* symbol );
void removeRows( QList<int> rows );
void deleteRows( QList<int> rows );
void removeAllRows( );
void sort( int column, Qt::SortOrder order = Qt::AscendingOrder );

Expand Down
11 changes: 11 additions & 0 deletions src/plugins/grass/CMakeLists.txt
Expand Up @@ -99,6 +99,17 @@ IF(NOT WIN32)
qtermwidget/k3processcontroller.h
qtermwidget/qtermwidget.h
)

IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
SET_SOURCE_FILES_PROPERTIES(
${CMAKE_CURRENT_BINARY_DIR}/qtermwidget/moc_Pty.cxx
qtermwidget/Pty.cpp
qtermwidget/Session.cpp
qtermwidget/kpty.cpp
qtermwidget/k3process.cpp
PROPERTIES COMPILE_FLAGS "-Wno-overloaded-virtual -Wno-mismatched-tags"
)
ENDIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
ENDIF(NOT WIN32)

SET (GRASS_PLUGIN_RCCS qgsgrass_plugin.qrc)
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/grass/qgsgrassmapcalc.cpp
Expand Up @@ -531,8 +531,9 @@ QStringList QgsGrassMapcalc::checkRegion()
return list;
}

bool QgsGrassMapcalc::inputRegion( struct Cell_head *window, bool all )
bool QgsGrassMapcalc::inputRegion( struct Cell_head *window, QgsCoordinateReferenceSystem & crs, bool all )
{
Q_UNUSED( crs );
Q_UNUSED( all );
QgsDebugMsg( "entered." );

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/qgsgrassmapcalc.h
Expand Up @@ -64,7 +64,7 @@ class QgsGrassMapcalc: public QMainWindow, private Ui::QgsGrassMapcalcBase,
bool requestsRegion() { return false; }
bool usesRegion() { return true; }
QStringList checkRegion();
bool inputRegion( struct Cell_head *window, bool all );
bool inputRegion( struct Cell_head *window, QgsCoordinateReferenceSystem & crs, bool all );
QStringList output( int type );
bool hasOutput( int type )
{ Q_UNUSED( type ); return true; }
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/qtermwidget/KeyboardTranslator.cpp
Expand Up @@ -663,7 +663,7 @@ QByteArray KeyboardTranslator::Entry::escapedText( bool expandWildCards, Qt::Key

if ( replacement == 'x' )
{
result.replace( i, 1, "\\x" + QByteArray( 1, ch ).toInt( 0, 16 ) );
result.replace( i, 1, QString( "\\x%1" ).arg(( int ) ch, 0, 16 ).toAscii() );
}
else if ( replacement != 0 )
{
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgsabout.ui
Expand Up @@ -175,7 +175,7 @@ p, li { white-space: pre-wrap; }
<attribute name="title">
<string>Developers</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" rowspan="2">
<widget class="QListWidget" name="lstDevelopers">
<property name="alternatingRowColors">
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgsoraclenewconnectionbase.ui
Expand Up @@ -44,7 +44,7 @@
<property name="title">
<string>Connection Information</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout_1">
<item row="4" column="1" colspan="2">
<widget class="QLineEdit" name="txtUsername"/>
</item>
Expand Down
2 changes: 1 addition & 1 deletion tests/src/core/testqgsdataitem.cpp
Expand Up @@ -122,7 +122,7 @@ void TestQgsDataItem::testDirItemChildren()
{
QVERIFY2( lProvider == "gdal", errStr.toLocal8Bit().constData() );
}
else if ( lFile == "points.vrt", errStr.toLocal8Bit().constData() )
else if ( lFile == "points.vrt" )
{
QVERIFY2( lProvider == "ogr", errStr.toLocal8Bit().constData() );
}
Expand Down

0 comments on commit 63cc49b

Please sign in to comment.