Fixed several GCC 5.x warnings

pull/7689/head
Maksim Shabunin 9 years ago committed by Alexander Alekhin
parent 4d041e6809
commit 21167b1bf1
  1. 4
      3rdparty/libtiff/CMakeLists.txt
  2. 4
      3rdparty/openexr/CMakeLists.txt
  3. 1
      cmake/OpenCVCompilerOptions.cmake
  4. 4
      modules/calib3d/src/calibinit.cpp
  5. 2
      modules/calib3d/test/test_cameracalibration.cpp
  6. 23
      modules/core/include/opencv2/core/cuda_devptrs.hpp
  7. 7
      modules/core/include/opencv2/core/gpumat.hpp
  8. 2
      modules/core/include/opencv2/core/internal.hpp
  9. 9
      modules/core/include/opencv2/core/types_c.h
  10. 2
      modules/core/test/test_ds.cpp
  11. 2
      modules/flann/include/opencv2/flann/any.h
  12. 23
      modules/flann/include/opencv2/flann/flann.hpp
  13. 11
      modules/highgui/src/cap_v4l.cpp
  14. 11
      modules/legacy/test/test_optflow.cpp
  15. 2
      modules/legacy/test/test_stereomatching.cpp
  16. 11
      modules/ocl/src/mssegmentation.cpp
  17. 2
      modules/ocl/test/utility.hpp
  18. 1
      modules/stitching/src/matchers.cpp
  19. 2
      modules/ts/include/opencv2/ts/gpu_test.hpp
  20. 4
      modules/ts/include/opencv2/ts/ts_gtest.h
  21. 4
      modules/ts/src/ts_func.cpp

@ -86,7 +86,7 @@ else()
endif()
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef -Wunused -Wsign-compare
-Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)
-Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wmisleading-indentation)
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter) # clang
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations -Wunused-parameter)
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
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4703) # vs2012
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4456 /wd4457 /wd4312) # vs2015
ocv_warnings_disable(CMAKE_C_FLAGS /wd4267 /wd4244 /wd4018)
ocv_warnings_disable(CMAKE_C_FLAGS /wd4267 /wd4244 /wd4018 /wd4311 /wd4312)
if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")

@ -37,8 +37,8 @@ endif()
source_group("Include" FILES ${lib_hdrs} )
source_group("Src" FILES ${lib_srcs})
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused -Wsign-compare -Wundef -Wmissing-declarations -Wuninitialized -Wswitch -Wparentheses -Warray-bounds -Wextra)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wdeprecated-declarations)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused -Wsign-compare -Wundef -Wmissing-declarations -Wuninitialized -Wswitch -Wparentheses -Warray-bounds -Wextra
-Wdeprecated-declarations -Wmisleading-indentation)
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4018 /wd4099 /wd4100 /wd4101 /wd4127 /wd4189 /wd4245 /wd4305 /wd4389 /wd4512 /wd4701 /wd4702 /wd4706 /wd4800) # vs2005
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4334) # vs2005 Win64
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244) # vs2008

@ -95,6 +95,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
add_extra_compiler_option(-Wno-narrowing)
add_extra_compiler_option(-Wno-delete-non-virtual-dtor)
add_extra_compiler_option(-Wno-unnamed-type-template-args)
add_extra_compiler_option(-Wno-comment)
add_extra_compiler_option(-Wno-array-bounds)
add_extra_compiler_option(-Wno-aggressive-loop-optimizations)
endif()

@ -1036,13 +1036,15 @@ icvRemoveQuadFromGroup(CvCBQuad **quads, int count, CvCBQuad *q0)
q->neighbors[j] = 0;
q->count--;
for(int k = 0; k < 4; k++ )
{
if( q0->neighbors[k] == q )
{
q0->neighbors[k] = 0;
q0->count--;
break;
}
break;
}
break;
}
}
}

@ -1339,6 +1339,7 @@ bool CV_StereoCalibrationTest::checkPandROI( int test_case_idx, const Mat& M, co
undistortPoints(Mat(pts), upts, M, D, R, P );
for( k = 0; k < N*N; k++ )
{
if( upts[k].x < -imgsize.width*eps || upts[k].x > imgsize.width*(1+eps) ||
upts[k].y < -imgsize.height*eps || upts[k].y > imgsize.height*(1+eps) )
{
@ -1346,6 +1347,7 @@ bool CV_StereoCalibrationTest::checkPandROI( int test_case_idx, const Mat& M, co
test_case_idx, pts[k].x, pts[k].y, upts[k].x, upts[k].y);
return false;
}
}
// step 2. check that all the points inside ROI belong to the original source image
Mat temp(imgsize, CV_8U), utemp, map1, map2;

@ -122,27 +122,23 @@ namespace cv
typedef PtrStep<float> PtrStepf;
typedef PtrStep<int> PtrStepi;
#if defined __GNUC__
#define __CV_GPU_DEPR_BEFORE__
#define __CV_GPU_DEPR_AFTER__ __attribute__ ((deprecated))
#define CV_GPU_DEPRECATED __attribute__ ((deprecated))
#elif defined(__MSVC__) //|| defined(__CUDACC__)
#pragma deprecated(DevMem2D_)
#define __CV_GPU_DEPR_BEFORE__ __declspec(deprecated)
#define __CV_GPU_DEPR_AFTER__
#define CV_GPU_DEPRECATED __declspec(deprecated)
#else
#define __CV_GPU_DEPR_BEFORE__
#define __CV_GPU_DEPR_AFTER__
#define CV_GPU_DEPRECATED
#endif
template <typename T> struct __CV_GPU_DEPR_BEFORE__ DevMem2D_ : public PtrStepSz<T>
template <typename T> struct DevMem2D_ : public PtrStepSz<T>
{
DevMem2D_() {}
DevMem2D_(int rows_, int cols_, T* data_, size_t step_) : PtrStepSz<T>(rows_, cols_, data_, step_) {}
CV_GPU_DEPRECATED DevMem2D_() {}
CV_GPU_DEPRECATED DevMem2D_(int rows_, int cols_, T* data_, size_t step_) : PtrStepSz<T>(rows_, cols_, data_, step_) {}
template <typename U>
explicit __CV_GPU_DEPR_BEFORE__ DevMem2D_(const DevMem2D_<U>& d) : PtrStepSz<T>(d.rows, d.cols, (T*)d.data, d.step) {}
} __CV_GPU_DEPR_AFTER__ ;
explicit CV_GPU_DEPRECATED DevMem2D_(const DevMem2D_<U>& d) : PtrStepSz<T>(d.rows, d.cols, (T*)d.data, d.step) {}
};
typedef DevMem2D_<unsigned char> DevMem2Db;
typedef DevMem2Db DevMem2D;
@ -174,8 +170,7 @@ namespace cv
typedef PtrElemStep_<float> PtrElemStepf;
typedef PtrElemStep_<int> PtrElemStepi;
//#undef __CV_GPU_DEPR_BEFORE__
//#undef __CV_GPU_DEPR_AFTER__
//#undef CV_GPU_DEPRECATED
namespace device
{

@ -277,10 +277,9 @@ namespace cv { namespace gpu
template <typename _Tp> operator PtrStep<_Tp>() const;
// Deprecated function
__CV_GPU_DEPR_BEFORE__ template <typename _Tp> operator DevMem2D_<_Tp>() const __CV_GPU_DEPR_AFTER__;
__CV_GPU_DEPR_BEFORE__ template <typename _Tp> operator PtrStep_<_Tp>() const __CV_GPU_DEPR_AFTER__;
#undef __CV_GPU_DEPR_BEFORE__
#undef __CV_GPU_DEPR_AFTER__
template <typename _Tp> CV_GPU_DEPRECATED operator DevMem2D_<_Tp>() const;
template <typename _Tp> CV_GPU_DEPRECATED operator PtrStep_<_Tp>() const;
#undef CV_GPU_DEPRECATED
/*! includes several bit-fields:
- the magic signature

@ -292,7 +292,7 @@ namespace cv
return classname##_info_var; \
} \
\
static ::cv::AlgorithmInfo& classname##_info_auto = classname##_info(); \
CV_ATTR_USED static ::cv::AlgorithmInfo& classname##_info_auto = classname##_info(); \
\
::cv::AlgorithmInfo* classname::info() const \
{ \

@ -43,6 +43,15 @@
#ifndef __OPENCV_CORE_TYPES_H__
#define __OPENCV_CORE_TYPES_H__
#if defined(__GNUC__) && !defined(COMPILER_ICC)
# define CV_ATTR_UNUSED __attribute__((unused))
# define CV_ATTR_USED __attribute__((used))
#else
# define CV_ATTR_UNUSED
# define CV_ATTR_USED
#endif
#if !defined _CRT_SECURE_NO_DEPRECATE && defined _MSC_VER
# if _MSC_VER > 1300
# define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio 2005 warnings */

@ -56,7 +56,7 @@ static void cvTsSimpleSeqShiftAndCopy( CvTsSimpleSeq* seq, int from_idx, int to_
(seq->count - from_idx)*elem_size );
}
seq->count += to_idx - from_idx;
if( elem && to_idx > from_idx )
if( elem )
memcpy( seq->array + from_idx*elem_size, elem, (to_idx - from_idx)*elem_size );
}

@ -80,7 +80,7 @@ struct big_any_policy : typed_base_any_policy<T>
{
virtual void static_delete(void** x)
{
if (* x) delete (* reinterpret_cast<T**>(x)); *x = NULL;
if (* x) { delete (* reinterpret_cast<T**>(x)); *x = NULL; }
}
virtual void copy_from_value(void const* src, void** dest)
{

@ -225,43 +225,49 @@ int GenericIndex<Distance>::radiusSearch(const Mat& query, Mat& indices, Mat& di
* @deprecated Use GenericIndex class instead
*/
template <typename T>
class
#ifndef _MSC_VER
FLANN_DEPRECATED
#endif
Index_ {
class Index_ {
public:
typedef typename L2<T>::ElementType ElementType;
typedef typename L2<T>::ResultType DistanceType;
FLANN_DEPRECATED
Index_(const Mat& features, const ::cvflann::IndexParams& params);
FLANN_DEPRECATED
~Index_();
FLANN_DEPRECATED
void knnSearch(const vector<ElementType>& query, vector<int>& indices, vector<DistanceType>& dists, int knn, const ::cvflann::SearchParams& params);
FLANN_DEPRECATED
void knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const ::cvflann::SearchParams& params);
FLANN_DEPRECATED
int radiusSearch(const vector<ElementType>& query, vector<int>& indices, vector<DistanceType>& dists, DistanceType radius, const ::cvflann::SearchParams& params);
FLANN_DEPRECATED
int radiusSearch(const Mat& query, Mat& indices, Mat& dists, DistanceType radius, const ::cvflann::SearchParams& params);
FLANN_DEPRECATED
void save(std::string filename)
{
if (nnIndex_L1) nnIndex_L1->save(filename);
if (nnIndex_L2) nnIndex_L2->save(filename);
}
FLANN_DEPRECATED
int veclen() const
{
if (nnIndex_L1) return nnIndex_L1->veclen();
if (nnIndex_L2) return nnIndex_L2->veclen();
}
FLANN_DEPRECATED
int size() const
{
if (nnIndex_L1) return nnIndex_L1->size();
if (nnIndex_L2) return nnIndex_L2->size();
}
FLANN_DEPRECATED
::cvflann::IndexParams getParameters()
{
if (nnIndex_L1) return nnIndex_L1->getParameters();
@ -269,7 +275,8 @@ public:
}
FLANN_DEPRECATED const ::cvflann::IndexParams* getIndexParameters()
FLANN_DEPRECATED
const ::cvflann::IndexParams* getIndexParameters()
{
if (nnIndex_L1) return nnIndex_L1->getIndexParameters();
if (nnIndex_L2) return nnIndex_L2->getIndexParameters();
@ -281,10 +288,6 @@ private:
::cvflann::Index< L1<ElementType> >* nnIndex_L1;
};
#ifdef _MSC_VER
template <typename T>
class FLANN_DEPRECATED Index_;
#endif
template <typename T>
Index_<T>::Index_(const Mat& dataset, const ::cvflann::IndexParams& params)

@ -380,12 +380,11 @@ static void icvInitCapture_V4L() {
deviceHandle = open(deviceName, O_RDONLY);
if (deviceHandle != -1) {
/* This device does indeed exist - add it to the total so far */
// add indexList
indexList|=(1 << CameraNumber);
numCameras++;
}
if (deviceHandle != -1)
close(deviceHandle);
// add indexList
indexList|=(1 << CameraNumber);
numCameras++;
close(deviceHandle);
}
/* Set up to test the next /dev/video source in line */
CameraNumber++;
} /* End while */

@ -166,6 +166,7 @@ double showFlowAndCalcError(const string& name, const Mat& gray, const Mat& flow
bool all = true;
Mat inner = flow(where);
for(int y = 0; y < inner.rows; ++y)
{
for(int x = 0; x < inner.cols; ++x)
{
const Point2f f = inner.at<Point2f>(y, x);
@ -178,12 +179,14 @@ double showFlowAndCalcError(const string& name, const Mat& gray, const Mat& flow
double a = atan2(f.y, f.x);
error += fabs(angle - a);
}
double res = all ? numeric_limits<double>::max() : error / (inner.cols * inner.rows);
}
double res = all ? numeric_limits<double>::max() : error / (inner.cols * inner.rows);
if (writeError)
cout << "Error " + name << " = " << res << endl;
if (writeError)
cout << "Error " + name << " = " << res << endl;
return res;
return res;
}

@ -461,7 +461,9 @@ void CV_StereoMatchingTest::run(int)
int dispScaleFactor = datasetsParams[datasetName].dispScaleFactor;
Mat tmp; trueLeftDisp.convertTo( tmp, CV_32FC1, 1.f/dispScaleFactor ); trueLeftDisp = tmp; tmp.release();
if( !trueRightDisp.empty() )
{
trueRightDisp.convertTo( tmp, CV_32FC1, 1.f/dispScaleFactor ); trueRightDisp = tmp; tmp.release();
}
Mat leftDisp, rightDisp;
int ignBorder = max(runStereoMatchingAlgorithm(leftImg, rightImg, leftDisp, rightDisp, ci), EVAL_IGNORE_BORDER);

@ -71,8 +71,8 @@ namespace
vector<int> rank;
vector<int> size;
private:
DjSets(const DjSets &) {}
DjSets operator =(const DjSets &);
DjSets(const DjSets &); // = delete
DjSets& operator =(const DjSets &); // = delete
};
template <typename T>
@ -139,13 +139,6 @@ namespace
// Implementation
//
DjSets DjSets::operator = (const DjSets &/*obj*/)
{
//cout << "Invalid DjSets constructor\n";
CV_Error(-1, "Invalid DjSets constructor\n");
return *this;
}
DjSets::DjSets(int n) : parent(n), rank(n, 0), size(n, 1)
{
for (int i = 0; i < n; ++i)

@ -296,7 +296,7 @@ CV_FLAGS(DftFlags, DFT_INVERSE, DFT_SCALE, DFT_ROWS, DFT_COMPLEX_OUTPUT, DFT_REA
}; \
\
int GTEST_TEST_CLASS_NAME_(test_case_name, \
test_name)::gtest_registering_dummy_ = \
test_name)::gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
\
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() \

@ -50,6 +50,7 @@ using namespace cv::gpu;
#ifdef HAVE_OPENCV_NONFREE
#include "opencv2/nonfree/nonfree.hpp"
CV_ATTR_USED
static bool makeUseOfNonfree = initModule_nonfree();
#endif

@ -190,7 +190,7 @@ namespace cvtest
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
}; \
int GTEST_TEST_CLASS_NAME_(test_case_name, \
test_name)::gtest_registering_dummy_ = \
test_name)::gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() \
{ \

@ -17026,14 +17026,14 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
}; \
int GTEST_TEST_CLASS_NAME_(test_case_name, \
test_name)::gtest_registering_dummy_ = \
test_name)::gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
::testing::internal::ParamGenerator<test_case_name::ParamType> \
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
int gtest_##prefix##test_case_name##_dummy_ = \
int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
GetTestCasePatternHolder<test_case_name>(\
#test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\

@ -1757,7 +1757,7 @@ cmpUlpsFlt_(const int* src1, const int* src2, size_t total, int imaxdiff, size_t
for( i = 0; i < total; i++ )
{
int a = src1[i], b = src2[i];
if( a < 0 ) a ^= C; if( b < 0 ) b ^= C;
if( a < 0 ) { a ^= C; } if( b < 0 ) { b ^= C; }
int diff = std::abs(a - b);
if( realmaxdiff < diff )
{
@ -1779,7 +1779,7 @@ cmpUlpsFlt_(const int64* src1, const int64* src2, size_t total, int imaxdiff, si
for( i = 0; i < total; i++ )
{
int64 a = src1[i], b = src2[i];
if( a < 0 ) a ^= C; if( b < 0 ) b ^= C;
if( a < 0 ) { a ^= C; } if( b < 0 ) { b ^= C; }
double diff = fabs((double)a - (double)b);
if( realmaxdiff < diff )
{

Loading…
Cancel
Save