Skip to content

Commit c5aba33

Browse files
author
Andrey Kamaev
committed
Fixed number of warnings. Fixed mingw64 build.
1 parent 02e3afa commit c5aba33

File tree

110 files changed

+2393
-2528
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+2393
-2528
lines changed

3rdparty/libjasper/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ if(MSVC)
2323
add_definitions(-DJAS_WIN_MSVC_BUILD)
2424
endif()
2525

26-
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-implicit-function-declaration -Wno-uninitialized -Wmissing-prototypes -Wmissing-declarations -Wunused)
26+
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-implicit-function-declaration -Wno-uninitialized -Wmissing-prototypes -Wmissing-declarations -Wunused -Wshadow
27+
/wd4013 /wd4018 /wd4715 /wd4244 /wd4101 /wd4267)
2728

2829
if(UNIX)
2930
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)

3rdparty/libtiff/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ if(WIN32)
9090
list(APPEND lib_srcs tif_win32.c)
9191
endif(WIN32)
9292

93-
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef -Wcast-align)
94-
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations)
93+
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef
94+
-Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)
95+
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations /wd4100 /wd4244 /wd4706 /wd4127 /wd4701 /wd4018 /wd4267 /wd4306 /wd4305 /wd4312 /wd4311)
9596

9697
if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
9798
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")

3rdparty/zlib/zconf.h.cmakein

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ typedef uLong FAR uLongf;
419419
#endif
420420

421421
#ifndef _FILE_OFFSET_BITS
422-
# define _FILE_OFFSET_BITS
422+
# define _FILE_OFFSET_BITS 0
423423
#endif
424424

425425
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0

apps/haartraining/cvhaartraining.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2191,15 +2191,15 @@ void cvCreateCascadeClassifier( const char* dirname,
21912191
{
21922192
char xml_path[1024];
21932193
int len = (int)strlen(dirname);
2194-
CvHaarClassifierCascade* cascade = 0;
2194+
CvHaarClassifierCascade* cascade1 = 0;
21952195
strcpy( xml_path, dirname );
21962196
if( xml_path[len-1] == '\\' || xml_path[len-1] == '/' )
21972197
len--;
21982198
strcpy( xml_path + len, ".xml" );
2199-
cascade = cvLoadHaarClassifierCascade( dirname, cvSize(winwidth,winheight) );
2200-
if( cascade )
2201-
cvSave( xml_path, cascade );
2202-
cvReleaseHaarClassifierCascade( &cascade );
2199+
cascade1 = cvLoadHaarClassifierCascade( dirname, cvSize(winwidth,winheight) );
2200+
if( cascade1 )
2201+
cvSave( xml_path, cascade1 );
2202+
cvReleaseHaarClassifierCascade( &cascade1 );
22032203
}
22042204
}
22052205
else
@@ -2502,7 +2502,6 @@ void cvCreateTreeCascadeClassifier( const char* dirname,
25022502
{
25032503
CvTreeCascadeNode* single_cluster;
25042504
CvTreeCascadeNode* multiple_clusters;
2505-
CvSplit* cur_split;
25062505
int single_num;
25072506

25082507
icvSetNumSamples( training_data, poscount + negcount );
@@ -2675,18 +2674,19 @@ void cvCreateTreeCascadeClassifier( const char* dirname,
26752674
} /* try different number of clusters */
26762675
cvReleaseMat( &vals );
26772676

2678-
CV_CALL( cur_split = (CvSplit*) cvAlloc( sizeof( *cur_split ) ) );
2679-
CV_ZERO_OBJ( cur_split );
2677+
CvSplit* curSplit;
2678+
CV_CALL( curSplit = (CvSplit*) cvAlloc( sizeof( *curSplit ) ) );
2679+
CV_ZERO_OBJ( curSplit );
26802680

2681-
if( last_split ) last_split->next = cur_split;
2682-
else first_split = cur_split;
2683-
last_split = cur_split;
2681+
if( last_split ) last_split->next = curSplit;
2682+
else first_split = curSplit;
2683+
last_split = curSplit;
26842684

2685-
cur_split->single_cluster = single_cluster;
2686-
cur_split->multiple_clusters = multiple_clusters;
2687-
cur_split->num_clusters = best_clusters;
2688-
cur_split->parent = parent;
2689-
cur_split->single_multiple_ratio = (float) single_num / best_num;
2685+
curSplit->single_cluster = single_cluster;
2686+
curSplit->multiple_clusters = multiple_clusters;
2687+
curSplit->num_clusters = best_clusters;
2688+
curSplit->parent = parent;
2689+
curSplit->single_multiple_ratio = (float) single_num / best_num;
26902690
}
26912691

26922692
if( parent ) parent = parent->next_same_level;

apps/haartraining/cvsamples.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,6 @@ static void cvWarpPerspective( CvArr* src, CvArr* dst, double quad[4][2] )
323323
int i00, i10, i01, i11;
324324
i00 = i10 = i01 = i11 = (int) fill_value;
325325

326-
double i = fill_value;
327-
328326
/* linear interpolation using 2x2 neighborhood */
329327
if( isrc_x >= 0 && isrc_x <= src_size.width &&
330328
isrc_y >= 0 && isrc_y <= src_size.height )
@@ -349,9 +347,8 @@ static void cvWarpPerspective( CvArr* src, CvArr* dst, double quad[4][2] )
349347

350348
double i0 = i00 + (i10 - i00)*delta_x;
351349
double i1 = i01 + (i11 - i01)*delta_x;
352-
i = i0 + (i1 - i0)*delta_y;
353350

354-
((uchar*)(dst_data + y * dst_step))[x] = (uchar) i;
351+
((uchar*)(dst_data + y * dst_step))[x] = (uchar) (i0 + (i1 - i0)*delta_y);
355352
}
356353
x_min += k_left;
357354
x_max += k_right;

apps/haartraining/performance.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ int main( int argc, char* argv[] )
214214
totaltime = 0.0;
215215
if( info != NULL )
216216
{
217-
int x, y, width, height;
217+
int x, y;
218218
IplImage* img;
219219
int hits, missed, falseAlarms;
220220
int totalHits, totalMissed, totalFalseAlarms;
@@ -249,11 +249,12 @@ int main( int argc, char* argv[] )
249249
ref = (ObjectPos*) cvAlloc( refcount * sizeof( *ref ) );
250250
for( i = 0; i < refcount; i++ )
251251
{
252-
error = (fscanf( info, "%d %d %d %d", &x, &y, &width, &height ) != 4);
252+
int w, h;
253+
error = (fscanf( info, "%d %d %d %d", &x, &y, &w, &h ) != 4);
253254
if( error ) break;
254-
ref[i].x = 0.5F * width + x;
255-
ref[i].y = 0.5F * height + y;
256-
ref[i].width = sqrtf( 0.5F * (width * width + height * height) );
255+
ref[i].x = 0.5F * w + x;
256+
ref[i].y = 0.5F * h + y;
257+
ref[i].width = sqrtf( 0.5F * (w * w + h * h) );
257258
ref[i].found = 0;
258259
ref[i].neghbors = 0;
259260
}

cmake/OpenCVCompilerOptions.cmake

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ if(MINGW)
1414
endif()
1515

1616
if(MSVC)
17+
string(REGEX REPLACE "^ *| * $" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
18+
string(REGEX REPLACE "^ *| * $" "" CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT}")
1719
if(CMAKE_CXX_FLAGS STREQUAL CMAKE_CXX_FLAGS_INIT)
1820
# override cmake default exception handling option
1921
string(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
@@ -72,10 +74,16 @@ if(CMAKE_COMPILER_IS_GNUCXX)
7274
add_extra_compiler_option(-Wundef)
7375
add_extra_compiler_option(-Winit-self)
7476
add_extra_compiler_option(-Wpointer-arith)
75-
#add_extra_compiler_option(-Wcast-align)
76-
#add_extra_compiler_option(-Wstrict-aliasing=2)
77-
#add_extra_compiler_option(-Wshadow)
78-
#add_extra_compiler_option(-Wno-unnamed-type-template-args)
77+
add_extra_compiler_option(-Wshadow)
78+
79+
if(ENABLE_NOISY_WARNINGS)
80+
add_extra_compiler_option(-Wcast-align)
81+
add_extra_compiler_option(-Wstrict-aliasing=2)
82+
else()
83+
add_extra_compiler_option(-Wno-narrowing)
84+
add_extra_compiler_option(-Wno-delete-non-virtual-dtor)
85+
#add_extra_compiler_option(-Wno-unnamed-type-template-args)
86+
endif()
7987

8088
# The -Wno-long-long is required in 64bit systems when including sytem headers.
8189
if(X86_64)
@@ -259,6 +267,10 @@ if(MSVC)
259267
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
260268
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
261269

270+
if(NOT ENABLE_NOISY_WARNINGS AND MSVC_VERSION EQUAL 1400)
271+
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4510 /wd4610 /wd4312 /wd4201 /wd4244 /wd4328 /wd4267)
272+
endif()
273+
262274
# allow extern "C" functions throw exceptions
263275
foreach(flags CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
264276
string(REPLACE "/EHsc-" "/EHs" ${flags} "${${flags}}")

cmake/OpenCVFindXimea.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if(WIN32)
1818
# Try to find the XIMEA API path in registry.
1919
GET_FILENAME_COMPONENT(XIMEA_PATH "[HKEY_CURRENT_USER\\Software\\XIMEA\\CamSupport\\API;Path]" ABSOLUTE)
2020

21-
if(XIMEA_PATH)
21+
if(EXISTS XIMEA_PATH)
2222
set(XIMEA_FOUND 1)
2323

2424
# set LIB folders

modules/calib3d/src/precomp.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@
4242
#ifndef __OPENCV_PRECOMP_H__
4343
#define __OPENCV_PRECOMP_H__
4444

45-
#if defined _MSC_VER && _MSC_VER >= 1200
46-
#pragma warning( disable: 4251 4710 4711 4514 4996 )
47-
#endif
48-
4945
#ifdef HAVE_CVCONFIG_H
5046
#include "cvconfig.h"
5147
#endif

modules/contrib/src/basicretinafilter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ void BasicRetinaFilter::_localLuminanceAdaptation(const float *inputFrame, const
335335
{
336336
float X0=*(localLuminancePTR++)*_localLuminanceFactor+_localLuminanceAddon;
337337
// TODO : the following line can lead to a divide by zero ! A small offset is added, take care if the offset is too large in case of High Dynamic Range images which can use very small values...
338-
*(outputFramePTR++) = (_maxInputValue+X0)**inputFramePTR/(*inputFramePTR +X0+0.00000000001);
338+
*(outputFramePTR++) = (_maxInputValue+X0)**inputFramePTR/(*inputFramePTR +X0+0.00000000001f);
339339
//std::cout<<"BasicRetinaFilter::inputFrame[IDpixel]=%f, X0=%f, outputFrame[IDpixel]=%f\n", inputFrame[IDpixel], X0, outputFrame[IDpixel]);
340340
}
341341
}

0 commit comments

Comments
 (0)