Skip to content
Permalink
Browse files
fix warnings brought up by clang
  • Loading branch information
jef-n committed Feb 2, 2013
1 parent 4a77429 commit 63cc49be6180d0d57228a750ec09ce994d23aa6c
@@ -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 )
@@ -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
@@ -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();
@@ -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();
@@ -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
@@ -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
)
@@ -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
@@ -44,7 +44,7 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*

//getFeatureAttributes
QList<QgsAttributeMap> attributeList;
if ( !getFeatureAttributes( attributeList ) )
if ( !getFeatureAttributeMap( attributeList ) )
{
return;
}
@@ -119,7 +119,7 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*
void QgsComposerTable::adjustFrameToSize()
{
QList<QgsAttributeMap> attributes;
if ( !getFeatureAttributes( attributes ) )
if ( !getFeatureAttributeMap( attributes ) )
{
return;
}
@@ -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*/
@@ -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,
@@ -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(" );
@@ -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; }
@@ -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" )
@@ -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; }
@@ -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,
@@ -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-- )
{
@@ -723,7 +723,7 @@ QList<int> QgsCategorizedSymbolRendererV2Widget::selectedCategories()
void QgsCategorizedSymbolRendererV2Widget::deleteCategories()
{
QList<int> categoryIndexes = selectedCategories();
mModel->removeRows( categoryIndexes );
mModel->deleteRows( categoryIndexes );
}

void QgsCategorizedSymbolRendererV2Widget::deleteAllCategories()
@@ -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 );

@@ -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-- )
{
@@ -657,7 +657,7 @@ void QgsGraduatedSymbolRendererV2Widget::addClass()
void QgsGraduatedSymbolRendererV2Widget::deleteClasses()
{
QList<int> classIndexes = selectedClasses();
mModel->removeRows( classIndexes );
mModel->deleteRows( classIndexes );
}

void QgsGraduatedSymbolRendererV2Widget::deleteAllClasses()
@@ -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 );

@@ -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)
@@ -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." );

@@ -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; }
@@ -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 )
{
@@ -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">
@@ -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>
@@ -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() );
}

0 comments on commit 63cc49b

Please sign in to comment.