Skip to content

Commit 03e0298

Browse files
committedAug 9, 2017
msvc warning fixes:
* use AUTORCC to avoid locked qrc_images.cpp during build of gui tests * bump minimum version of cmake to 3.0.0 for AUTORCC * suppress some warnings in sip bindings * suppress unreachable warnings and some more * split sip files in more parts to suppress warning BK4504 * also remove old WITH_INTERNAL_YAML from travis
1 parent d9a2492 commit 03e0298

31 files changed

+162
-62
lines changed
 

‎.ci/travis/linux/install.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ CMAKE_FLAGS="
5252
-DWITH_QWTPOLAR=OFF
5353
-DWITH_APIDOC=OFF
5454
-DWITH_ASTYLE=OFF
55-
-DWITH_INTERNAL_YAML=OFF
5655
-DDISABLE_DEPRECATED=ON
5756
-DCXX_EXTRA_FLAGS=${CLANG_WARNINGS}
5857
"

‎CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ MESSAGE(STATUS "QGIS version: ${COMPLETE_VERSION} ${RELEASE_NAME} (${QGIS_VERSIO
2121
#############################################################
2222
# CMake settings
2323

24-
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.6)
24+
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)
2525

2626
SET(CMAKE_COLOR_MAKEFILE ON)
2727

‎cmake/SIPMacros.cmake

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
SET(SIP_INCLUDES)
3939
SET(SIP_TAGS)
40-
SET(SIP_CONCAT_PARTS 8)
40+
SET(SIP_CONCAT_PARTS 10)
4141
SET(SIP_DISABLE_FEATURES)
4242
SET(SIP_EXTRA_OPTIONS)
4343
SET(SIP_EXTRA_OBJECTS)
@@ -79,10 +79,13 @@ MACRO(GENERATE_SIP_PYTHON_MODULE_CODE MODULE_NAME MODULE_SIP CPP_FILES)
7979
# Suppress warnings
8080
IF(PEDANTIC)
8181
IF(MSVC)
82-
# 4996 deprecation warnings (bindings re-export deprecated methods)
83-
# 4701 potentially uninitialized variable used (sip generated code)
84-
# 4702 unreachable code (sip generated code)
85-
ADD_DEFINITIONS( /wd4996 /wd4701 /wd4702 )
82+
ADD_DEFINITIONS(
83+
/wd4189 # local variable is initialized but not referenced
84+
/wd4996 # deprecation warnings (bindings re-export deprecated methods)
85+
/wd4701 # potentially uninitialized variable used (sip generated code)
86+
/wd4702 # unreachable code (sip generated code)
87+
/wd4703 # potentially uninitialized local pointer variable 'sipType' used
88+
)
8689
ELSE(MSVC)
8790
# disable all warnings
8891
ADD_DEFINITIONS( -w -Wno-deprecated-declarations )

‎doc/overview.t2t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Following a summary of the required dependencies for building:
88

99
Required build tools:
1010

11-
- CMake >= 2.8.6
11+
- CMake >= 3.0.0
1212
- Flex >= 2.5.6
1313
- Bison >= 2.4
1414
-

‎python/gui/qgisinterface.sip

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,6 @@ Unregister a previously registered action. (e.g. when plugin is going to be unlo
577577
%End
578578

579579

580-
581580
virtual QMenu *projectMenu() = 0;
582581
%Docstring
583582
:rtype: QMenu

‎scripts/sipify.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,8 @@ sub detect_comment_block{
463463
if ( $LINE =~ m/^\s*friend class \w+/ ){
464464
next;
465465
}
466-
# Skip Q_OBJECT, Q_PROPERTY, Q_ENUM, Q_GADGET
467-
if ($LINE =~ m/^\s*Q_(OBJECT|ENUMS|PROPERTY|GADGET|DECLARE_METATYPE|DECLARE_TYPEINFO|DECL_DEPRECATED).*?$/){
466+
# Skip Q_OBJECT, Q_PROPERTY, Q_ENUM, Q_GADGET etc.
467+
if ($LINE =~ m/^\s*Q_(OBJECT|ENUMS|PROPERTY|GADGET|DECLARE_METATYPE|DECLARE_TYPEINFO|DECL_DEPRECATED|NOWARN_DEPRECATED_(PUSH|POP)).*?$/){
468468
next;
469469
}
470470

‎scripts/spell_check/check_spelling.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ declare -A GLOBREP_IGNORE=()
8282
ERRORFOUND=NO
8383

8484
for I in $(seq -f '%02g' 0 $(($SPLIT-1)) ) ; do
85-
( [[ "$INTERACTIVE" =~ YES ]] || [[ "$TRAVIS" =~ true ]] ) && printf "Progress: %d/%d\n" $I $SPLIT
85+
( [[ "$INTERACTIVE" =~ YES ]] || [[ "$TRAVIS" =~ true ]] ) && printf "Progress: %d/%d\n" $(( I + 1 )) $SPLIT
8686
SPELLFILE=spelling$I~
8787

8888
# if correction contains an uppercase letter and is the same as the error character wise, this means that the error is searched as a full word and case sensitive (not incorporated in a bigger one)

‎src/app/dwg/libdxfrw/intern/dwgutil.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@
1616
#include "rscodec.h"
1717
#include "../libdwgr.h"
1818

19+
#if __cplusplus >= 201500
20+
#define FALLTHROUGH [[fallthrough]];
21+
#elif defined(__clang__)
22+
#define FALLTHROUGH //[[clang::fallthrough]]
23+
#elif defined(__GNUC__) && __GNUC__ >= 7
24+
#define FALLTHROUGH [[gnu::fallthrough]];
25+
#else
26+
#define FALLTHROUGH
27+
#endif
28+
1929
#include "qgslogger.h"
2030

2131
/** Utility function
@@ -486,6 +496,9 @@ void dwgCompressor::copyCompBytes21( duint8 *cbuf, duint8 *dbuf, duint32 l, duin
486496
for ( int i = 1; i < 5; i++ )
487497
dbuf[dix++] = cbuf[six + i];
488498
dbuf[dix] = cbuf[six];
499+
500+
FALLTHROUGH
501+
489502
case 8: //OK
490503
for ( int i = 0; i < 8; i++ ) //RLZ 4[0],4[4] or 4[4],4[0]
491504
dbuf[dix++] = cbuf[six++];

‎src/app/dwg/libdxfrw/libdxfrw.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@
2424

2525
#include "qgslogger.h"
2626

27+
#if __cplusplus >= 201500
28+
#define FALLTHROUGH [[fallthrough]];
29+
#elif defined(__clang__)
30+
#define FALLTHROUGH //[[clang::fallthrough]]
31+
#elif defined(__GNUC__) && __GNUC__ >= 7
32+
#define FALLTHROUGH [[gnu::fallthrough]];
33+
#else
34+
#define FALLTHROUGH
35+
#endif
36+
2737
#define FIRSTHANDLE 48
2838

2939
#if 0
@@ -3047,6 +3057,8 @@ bool dxfRW::processPolyline()
30473057
{
30483058
processVertex( &pl );
30493059
}
3060+
3061+
FALLTHROUGH
30503062
}
30513063
default:
30523064
pl.parseCode( code, reader );
@@ -3079,6 +3091,8 @@ bool dxfRW::processVertex( DRW_Polyline *pl )
30793091
{
30803092
v = new DRW_Vertex(); //another vertex
30813093
}
3094+
3095+
FALLTHROUGH
30823096
}
30833097
default:
30843098
v->parseCode( code, reader );

‎src/app/dwg/qgsdwgimporter.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ void QgsDwgImporter::addEllipse( const DRW_Ellipse &data )
13951395

13961396
bool QgsDwgImporter::curveFromLWPolyline( const DRW_LWPolyline &data, QgsCompoundCurve &cc )
13971397
{
1398-
int vertexnum = data.vertlist.size();
1398+
size_t vertexnum = data.vertlist.size();
13991399
if ( vertexnum == 0 )
14001400
{
14011401
QgsDebugMsg( "polyline without points" );
@@ -1407,7 +1407,7 @@ bool QgsDwgImporter::curveFromLWPolyline( const DRW_LWPolyline &data, QgsCompoun
14071407
std::vector<DRW_Vertex2D *>::size_type n = data.flags & 1 ? vertexnum + 1 : vertexnum;
14081408
for ( std::vector<DRW_Vertex2D *>::size_type i = 0; i < n; i++ )
14091409
{
1410-
int i0 = i % vertexnum;
1410+
size_t i0 = i % vertexnum;
14111411

14121412
Q_ASSERT( data.vertlist[i0] != nullptr );
14131413
QgsDebugMsgLevel( QString( "%1: %2,%3 bulge:%4" ).arg( i ).arg( data.vertlist[i0]->x ).arg( data.vertlist[i0]->y ).arg( data.vertlist[i0]->bulge ), 5 );
@@ -1439,7 +1439,7 @@ bool QgsDwgImporter::curveFromLWPolyline( const DRW_LWPolyline &data, QgsCompoun
14391439

14401440
if ( hasBulge && i < n - 1 )
14411441
{
1442-
int i1 = ( i + 1 ) % vertexnum;
1442+
size_t i1 = ( i + 1 ) % vertexnum;
14431443

14441444
double a = 2.0 * atan( data.vertlist[i]->bulge );
14451445
double dx = data.vertlist[i1]->x - data.vertlist[i0]->x;
@@ -1461,7 +1461,7 @@ bool QgsDwgImporter::curveFromLWPolyline( const DRW_LWPolyline &data, QgsCompoun
14611461

14621462
void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
14631463
{
1464-
int vertexnum = data.vertlist.size();
1464+
size_t vertexnum = data.vertlist.size();
14651465
if ( vertexnum == 0 )
14661466
{
14671467
QgsDebugMsg( "LWPolyline without vertices" );
@@ -1476,8 +1476,8 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
14761476
std::vector<DRW_Vertex2D *>::size_type n = data.flags & 1 ? vertexnum : vertexnum - 1;
14771477
for ( std::vector<DRW_Vertex2D *>::size_type i = 0; i < n; i++ )
14781478
{
1479-
int i0 = i % vertexnum;
1480-
int i1 = ( i + 1 ) % vertexnum;
1479+
size_t i0 = i % vertexnum;
1480+
size_t i1 = ( i + 1 ) % vertexnum;
14811481

14821482
QgsPoint p0( QgsWkbTypes::PointZ, data.vertlist[i0]->x, data.vertlist[i0]->y, data.elevation );
14831483
QgsPoint p1( QgsWkbTypes::PointZ, data.vertlist[i1]->x, data.vertlist[i1]->y, data.elevation );
@@ -1660,7 +1660,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
16601660

16611661
void QgsDwgImporter::addPolyline( const DRW_Polyline &data )
16621662
{
1663-
int vertexnum = data.vertlist.size();
1663+
size_t vertexnum = data.vertlist.size();
16641664
if ( vertexnum == 0 )
16651665
{
16661666
QgsDebugMsg( "Polyline without vertices" );
@@ -1675,8 +1675,8 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data )
16751675
std::vector<DRW_Vertex *>::size_type n = data.flags & 1 ? vertexnum : vertexnum - 1;
16761676
for ( std::vector<DRW_Vertex *>::size_type i = 0; i < n; i++ )
16771677
{
1678-
int i0 = i % vertexnum;
1679-
int i1 = ( i + 1 ) % vertexnum;
1678+
size_t i0 = i % vertexnum;
1679+
size_t i1 = ( i + 1 ) % vertexnum;
16801680

16811681
QgsPoint p0( QgsWkbTypes::PointZ, data.vertlist[i0]->basePoint.x, data.vertlist[i0]->basePoint.y, data.vertlist[i0]->basePoint.z );
16821682
QgsPoint p1( QgsWkbTypes::PointZ, data.vertlist[i1]->basePoint.x, data.vertlist[i1]->basePoint.y, data.vertlist[i1]->basePoint.z );
@@ -1906,24 +1906,24 @@ static std::vector<double> knotu( const DRW_Spline &data, size_t num, size_t ord
19061906
}
19071907
}
19081908

1909-
static std::vector<double> rbasis( int c, double t, int npts,
1909+
static std::vector<double> rbasis( size_t c, double t, size_t npts,
19101910
const std::vector<double> &x,
19111911
const std::vector<double> &h )
19121912
{
1913-
int nplusc = npts + c;
1913+
size_t nplusc = npts + c;
19141914
std::vector<double> temp( nplusc, 0. );
19151915

19161916
// calculate the first order nonrational basis functions n[i]
1917-
for ( int i = 0; i < nplusc - 1; ++i )
1917+
for ( size_t i = 0; i < nplusc - 1; ++i )
19181918
{
19191919
if ( t >= x[i] && t < x[i + 1] )
19201920
temp[i] = 1;
19211921
}
19221922

19231923
// calculate the higher order nonrational base functions
1924-
for ( int k = 2; k <= c; ++k )
1924+
for ( size_t k = 2; k <= c; ++k )
19251925
{
1926-
for ( int i = 0; i < nplusc - k; ++i )
1926+
for ( size_t i = 0; i < nplusc - k; ++i )
19271927
{
19281928
// if the lower order basis function is zero skip the calculation
19291929
if ( temp[i] != 0 )
@@ -1941,7 +1941,7 @@ static std::vector<double> rbasis( int c, double t, int npts,
19411941

19421942
// calculate sum for denominator of rational basis functions
19431943
double sum = 0.;
1944-
for ( int i = 0; i < npts; ++i )
1944+
for ( size_t i = 0; i < npts; ++i )
19451945
{
19461946
sum += temp[i] * h[i];
19471947
}
@@ -1951,7 +1951,7 @@ static std::vector<double> rbasis( int c, double t, int npts,
19511951
// form rational basis functions and put in r vector
19521952
if ( sum != 0.0 )
19531953
{
1954-
for ( int i = 0; i < npts; i++ )
1954+
for ( size_t i = 0; i < npts; i++ )
19551955
{
19561956
r[i] = ( temp[i] * h[i] ) / sum;
19571957
}
@@ -1969,7 +1969,7 @@ static void rbspline( const DRW_Spline &data,
19691969
const std::vector<double> &h,
19701970
std::vector<QgsPointXY> &p )
19711971
{
1972-
int nplusc = npts + k;
1972+
size_t nplusc = npts + k;
19731973

19741974
// generate the open knot vector
19751975
std::vector<double> x( knot( data, npts, k ) );

‎src/app/qgisappinterface.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class QgisApp;
3333
* plugin.
3434
*/
3535

36+
Q_NOWARN_DEPRECATED_PUSH
3637
class APP_EXPORT QgisAppInterface : public QgisInterface
3738
{
3839
Q_OBJECT
@@ -519,5 +520,6 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
519520
//! Pointer to the PluginManagerInterface object
520521
QgsAppPluginManagerInterface pluginManagerIface;
521522
};
523+
Q_NOWARN_DEPRECATED_POP
522524

523525
#endif //#define QGISAPPINTERFACE_H

0 commit comments

Comments
 (0)
Please sign in to comment.