Skip to content

Commit af8e6b0

Browse files
committed
Merge pull request opencv#7689 from alalek:warnings_2.4
2 parents 7b13550 + 0a543c5 commit af8e6b0

File tree

25 files changed

+96
-63
lines changed

25 files changed

+96
-63
lines changed

3rdparty/libtiff/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ else()
8686
endif()
8787

8888
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef -Wunused -Wsign-compare
89-
-Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)
89+
-Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wmisleading-indentation)
9090
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter) # clang
9191
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations -Wunused-parameter)
9292
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4018 /wd4100 /wd4127 /wd4311 /wd4701 /wd4706) # vs2005
@@ -95,7 +95,7 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4267 /wd4305 /wd4306) # vs2008 Win64
9595
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4703) # vs2012
9696
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4456 /wd4457 /wd4312) # vs2015
9797

98-
ocv_warnings_disable(CMAKE_C_FLAGS /wd4267 /wd4244 /wd4018)
98+
ocv_warnings_disable(CMAKE_C_FLAGS /wd4267 /wd4244 /wd4018 /wd4311 /wd4312)
9999

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

3rdparty/openexr/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ endif()
3737
source_group("Include" FILES ${lib_hdrs} )
3838
source_group("Src" FILES ${lib_srcs})
3939

40-
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused -Wsign-compare -Wundef -Wmissing-declarations -Wuninitialized -Wswitch -Wparentheses -Warray-bounds -Wextra)
41-
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wdeprecated-declarations)
40+
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused -Wsign-compare -Wundef -Wmissing-declarations -Wuninitialized -Wswitch -Wparentheses -Warray-bounds -Wextra
41+
-Wdeprecated-declarations -Wmisleading-indentation)
4242
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4018 /wd4099 /wd4100 /wd4101 /wd4127 /wd4189 /wd4245 /wd4305 /wd4389 /wd4512 /wd4701 /wd4702 /wd4706 /wd4800) # vs2005
4343
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4334) # vs2005 Win64
4444
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244) # vs2008

apps/haartraining/createsamples.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@
5252
#include <ctime>
5353
#include <memory>
5454

55+
// std::auto_ptr
56+
#if defined(__GNUC__) && __GNUC__ >= 6
57+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
58+
#endif
59+
5560
using namespace std;
5661

5762
#include "cvhaartraining.h"

cmake/OpenCVCompilerOptions.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
9595
add_extra_compiler_option(-Wno-narrowing)
9696
add_extra_compiler_option(-Wno-delete-non-virtual-dtor)
9797
add_extra_compiler_option(-Wno-unnamed-type-template-args)
98+
add_extra_compiler_option(-Wno-comment)
9899
add_extra_compiler_option(-Wno-array-bounds)
99100
add_extra_compiler_option(-Wno-aggressive-loop-optimizations)
100101
endif()

modules/calib3d/src/calibinit.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,13 +1036,15 @@ icvRemoveQuadFromGroup(CvCBQuad **quads, int count, CvCBQuad *q0)
10361036
q->neighbors[j] = 0;
10371037
q->count--;
10381038
for(int k = 0; k < 4; k++ )
1039+
{
10391040
if( q0->neighbors[k] == q )
10401041
{
10411042
q0->neighbors[k] = 0;
10421043
q0->count--;
10431044
break;
10441045
}
1045-
break;
1046+
}
1047+
break;
10461048
}
10471049
}
10481050
}

modules/calib3d/test/test_cameracalibration.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,13 +1339,15 @@ bool CV_StereoCalibrationTest::checkPandROI( int test_case_idx, const Mat& M, co
13391339

13401340
undistortPoints(Mat(pts), upts, M, D, R, P );
13411341
for( k = 0; k < N*N; k++ )
1342+
{
13421343
if( upts[k].x < -imgsize.width*eps || upts[k].x > imgsize.width*(1+eps) ||
13431344
upts[k].y < -imgsize.height*eps || upts[k].y > imgsize.height*(1+eps) )
13441345
{
13451346
ts->printf(cvtest::TS::LOG, "Test #%d. The point (%g, %g) was mapped to (%g, %g) which is out of image\n",
13461347
test_case_idx, pts[k].x, pts[k].y, upts[k].x, upts[k].y);
13471348
return false;
13481349
}
1350+
}
13491351

13501352
// step 2. check that all the points inside ROI belong to the original source image
13511353
Mat temp(imgsize, CV_8U), utemp, map1, map2;

modules/core/include/opencv2/core/cuda_devptrs.hpp

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -122,27 +122,23 @@ namespace cv
122122
typedef PtrStep<float> PtrStepf;
123123
typedef PtrStep<int> PtrStepi;
124124

125-
126125
#if defined __GNUC__
127-
#define __CV_GPU_DEPR_BEFORE__
128-
#define __CV_GPU_DEPR_AFTER__ __attribute__ ((deprecated))
126+
#define CV_GPU_DEPRECATED __attribute__ ((deprecated))
129127
#elif defined(__MSVC__) //|| defined(__CUDACC__)
130128
#pragma deprecated(DevMem2D_)
131-
#define __CV_GPU_DEPR_BEFORE__ __declspec(deprecated)
132-
#define __CV_GPU_DEPR_AFTER__
129+
#define CV_GPU_DEPRECATED __declspec(deprecated)
133130
#else
134-
#define __CV_GPU_DEPR_BEFORE__
135-
#define __CV_GPU_DEPR_AFTER__
131+
#define CV_GPU_DEPRECATED
136132
#endif
137133

138-
template <typename T> struct __CV_GPU_DEPR_BEFORE__ DevMem2D_ : public PtrStepSz<T>
134+
template <typename T> struct DevMem2D_ : public PtrStepSz<T>
139135
{
140-
DevMem2D_() {}
141-
DevMem2D_(int rows_, int cols_, T* data_, size_t step_) : PtrStepSz<T>(rows_, cols_, data_, step_) {}
136+
CV_GPU_DEPRECATED DevMem2D_() {}
137+
CV_GPU_DEPRECATED DevMem2D_(int rows_, int cols_, T* data_, size_t step_) : PtrStepSz<T>(rows_, cols_, data_, step_) {}
142138

143139
template <typename U>
144-
explicit __CV_GPU_DEPR_BEFORE__ DevMem2D_(const DevMem2D_<U>& d) : PtrStepSz<T>(d.rows, d.cols, (T*)d.data, d.step) {}
145-
} __CV_GPU_DEPR_AFTER__ ;
140+
explicit CV_GPU_DEPRECATED DevMem2D_(const DevMem2D_<U>& d) : PtrStepSz<T>(d.rows, d.cols, (T*)d.data, d.step) {}
141+
};
146142

147143
typedef DevMem2D_<unsigned char> DevMem2Db;
148144
typedef DevMem2Db DevMem2D;
@@ -174,8 +170,7 @@ namespace cv
174170
typedef PtrElemStep_<float> PtrElemStepf;
175171
typedef PtrElemStep_<int> PtrElemStepi;
176172

177-
//#undef __CV_GPU_DEPR_BEFORE__
178-
//#undef __CV_GPU_DEPR_AFTER__
173+
//#undef CV_GPU_DEPRECATED
179174

180175
namespace device
181176
{

modules/core/include/opencv2/core/gpumat.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,9 @@ namespace cv { namespace gpu
277277
template <typename _Tp> operator PtrStep<_Tp>() const;
278278

279279
// Deprecated function
280-
__CV_GPU_DEPR_BEFORE__ template <typename _Tp> operator DevMem2D_<_Tp>() const __CV_GPU_DEPR_AFTER__;
281-
__CV_GPU_DEPR_BEFORE__ template <typename _Tp> operator PtrStep_<_Tp>() const __CV_GPU_DEPR_AFTER__;
282-
#undef __CV_GPU_DEPR_BEFORE__
283-
#undef __CV_GPU_DEPR_AFTER__
280+
template <typename _Tp> CV_GPU_DEPRECATED operator DevMem2D_<_Tp>() const;
281+
template <typename _Tp> CV_GPU_DEPRECATED operator PtrStep_<_Tp>() const;
282+
#undef CV_GPU_DEPRECATED
284283

285284
/*! includes several bit-fields:
286285
- the magic signature

modules/core/include/opencv2/core/internal.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ namespace cv
292292
return classname##_info_var; \
293293
} \
294294
\
295-
static ::cv::AlgorithmInfo& classname##_info_auto = classname##_info(); \
295+
CV_ATTR_USED static ::cv::AlgorithmInfo& classname##_info_auto = classname##_info(); \
296296
\
297297
::cv::AlgorithmInfo* classname::info() const \
298298
{ \

modules/core/include/opencv2/core/types_c.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@
4343
#ifndef __OPENCV_CORE_TYPES_H__
4444
#define __OPENCV_CORE_TYPES_H__
4545

46+
#if defined(__GNUC__) && !defined(COMPILER_ICC)
47+
# define CV_ATTR_UNUSED __attribute__((unused))
48+
# define CV_ATTR_USED __attribute__((used))
49+
#else
50+
# define CV_ATTR_UNUSED
51+
# define CV_ATTR_USED
52+
#endif
53+
54+
4655
#if !defined _CRT_SECURE_NO_DEPRECATE && defined _MSC_VER
4756
# if _MSC_VER > 1300
4857
# define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio 2005 warnings */

0 commit comments

Comments
 (0)