Merge pull request #21937 from Kumataro:4.x-fix-21911

* Fix warnings for clang15

* Fix warnings: Remove unnecessary code

* Fix warnings: Remove unnecessary code
pull/21981/head
Kumataro 3 years ago committed by GitHub
parent 2b67bc448d
commit 602caa9cd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      3rdparty/ittnotify/CMakeLists.txt
  2. 2
      3rdparty/libpng/CMakeLists.txt
  3. 1
      3rdparty/libtiff/CMakeLists.txt
  4. 1
      3rdparty/libwebp/CMakeLists.txt
  5. 1
      3rdparty/openjpeg/CMakeLists.txt
  6. 2
      modules/calib3d/src/calibinit.cpp
  7. 20
      modules/calib3d/test/test_cameracalibration.cpp
  8. 3
      modules/calib3d/test/test_fisheye.cpp
  9. 1
      modules/core/perf/opencl/perf_matop.cpp
  10. 4
      modules/core/src/datastructs.cpp
  11. 5
      modules/core/src/lpsolver.cpp
  12. 3
      modules/core/src/trace.cpp
  13. 2
      modules/features2d/src/evaluation.cpp
  14. 3
      modules/features2d/src/kaze/KAZEFeatures.cpp
  15. 4
      modules/features2d/src/keypoint.cpp
  16. 2
      modules/flann/include/opencv2/flann/index_testing.h
  17. 4
      modules/gapi/src/compiler/passes/exec.cpp
  18. 2
      modules/gapi/test/s11n/gapi_s11n_tests.cpp
  19. 1
      modules/imgproc/test/test_approxpoly.cpp
  20. 3
      modules/ml/src/kdtree.cpp
  21. 4
      modules/stitching/src/motion_estimators.cpp
  22. 9
      modules/video/test/test_optflowpyrlk.cpp
  23. 2
      modules/video/test/test_trackers.impl.hpp

@ -54,6 +54,7 @@ set_target_properties(${ITT_LIBRARY} PROPERTIES
)
ocv_warnings_disable(CMAKE_C_FLAGS -Wundef -Wsign-compare)
ocv_warnings_disable(CMAKE_C_FLAGS -Wstrict-prototypes) # clang15
if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(${ITT_LIBRARY} PROPERTIES FOLDER "3rdparty")

@ -78,6 +78,8 @@ add_library(${PNG_LIBRARY} STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${lib_srcs
target_link_libraries(${PNG_LIBRARY} ${ZLIB_LIBRARIES})
ocv_warnings_disable(CMAKE_C_FLAGS -Wundef -Wcast-align -Wimplicit-fallthrough -Wunused-parameter -Wsign-compare)
ocv_warnings_disable(CMAKE_C_FLAGS -Wnull-pointer-subtraction) # clang15
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-but-set-variable) # clang15
set_target_properties(${PNG_LIBRARY}
PROPERTIES OUTPUT_NAME ${PNG_LIBRARY}

@ -454,6 +454,7 @@ ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-protot
-Wimplicit-fallthrough
)
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter) # clang
ocv_warnings_disable(CMAKE_C_FLAGS -Wstrict-prototypes) # clang15
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations -Wunused-parameter -Wmissing-prototypes
-Wundef # tiffiop.h: #if __clang_major__ >= 4
)

@ -45,6 +45,7 @@ ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-variable -Wunused-function -Wshadow
-Wmissing-prototypes # clang
-Wmissing-declarations # gcc
-Wimplicit-fallthrough
-Wunused-but-set-variable # clang15
)
ocv_warnings_disable(CMAKE_C_FLAGS /wd4244 /wd4267) # vs2005

@ -13,6 +13,7 @@ project(openjpeg C)
ocv_warnings_disable(CMAKE_C_FLAGS
-Wimplicit-const-int-float-conversion # clang
-Wunused-but-set-variable # clang15
)
#-----------------------------------------------------------------------------

@ -1469,7 +1469,7 @@ int ChessBoardDetector::checkQuadGroup(std::vector<ChessBoardQuad*>& quad_group,
first = below; // remember the first corner in the next row
// find and store the first row (or column)
for (int j = 1; ; ++j)
while( 1 )
{
right->row = 0;
out_corners.push_back(right);

@ -568,12 +568,7 @@ void CV_CameraCalibrationTest::run( int start_from )
/* ----- Compute reprojection error ----- */
double dx,dy;
double rx,ry;
double meanDx,meanDy;
double maxDx = 0.0;
double maxDy = 0.0;
meanDx = 0;
meanDy = 0;
for( currImage = 0; currImage < numImages; currImage++ )
{
double imageMeanDx = 0;
@ -585,20 +580,8 @@ void CV_CameraCalibrationTest::run( int start_from )
dx = rx - imagePoints[currImage][currPoint].x;
dy = ry - imagePoints[currImage][currPoint].y;
meanDx += dx;
meanDy += dy;
imageMeanDx += dx*dx;
imageMeanDy += dy*dy;
dx = fabs(dx);
dy = fabs(dy);
if( dx > maxDx )
maxDx = dx;
if( dy > maxDy )
maxDy = dy;
}
goodPerViewErrors[currImage] = sqrt( (imageMeanDx + imageMeanDy) /
(etalonSize.width * etalonSize.height));
@ -609,9 +592,6 @@ void CV_CameraCalibrationTest::run( int start_from )
perViewErrors[currImage] = goodPerViewErrors[currImage];
}
meanDx /= numImages * etalonSize.width * etalonSize.height;
meanDy /= numImages * etalonSize.width * etalonSize.height;
/* ========= Compare parameters ========= */
CV_Assert(cameraMatrix.type() == CV_64F && cameraMatrix.size() == Size(3, 3));
CV_Assert(distortion.type() == CV_64F);

@ -227,7 +227,7 @@ TEST_F(fisheyeTest, undistortAndDistortImage)
cv::Mat undPointsGt(imageHeight, imageWidth, CV_32FC2);
cv::Mat imageGt(imageHeight, imageWidth, CV_8UC3);
for(int y = 0, k = 0; y < imageHeight; ++y)
for(int y = 0; y < imageHeight; ++y)
{
for(int x = 0; x < imageWidth; ++x)
{
@ -261,7 +261,6 @@ TEST_F(fisheyeTest, undistortAndDistortImage)
pixel_gt[2] = pixel[2];
}
k++;
}
}

@ -233,6 +233,7 @@ PERF_TEST_P_(OpenCLBuffer, cpu_read)
for (size_t x_bytes = 0; x_bytes < width_bytes; x_bytes++)
counter += (unsigned)(ptr[x_bytes]);
}
(void)counter; // To avoid -Wunused-but-set-variable
}
SANITY_CHECK_NOTHING();

@ -133,8 +133,6 @@ cvCreateChildMemStorage( CvMemStorage * parent )
static void
icvDestroyMemStorage( CvMemStorage* storage )
{
int k = 0;
CvMemBlock *block;
CvMemBlock *dst_top = 0;
@ -144,7 +142,7 @@ icvDestroyMemStorage( CvMemStorage* storage )
if( storage->parent )
dst_top = storage->parent->top;
for( block = storage->bottom; block != 0; k++ )
for( block = storage->bottom; block != 0; )
{
CvMemBlock *temp = block;

@ -253,11 +253,8 @@ static int initialize_simplex(Mat_<double>& c, Mat_<double>& b,double& v,vector<
}
static int inner_simplex(Mat_<double>& c, Mat_<double>& b,double& v,vector<int>& N,vector<int>& B,vector<unsigned int>& indexToRow){
int count=0;
for(;;){
dprintf(("iteration #%d\n",count));
count++;
for(;;){
static MatIterator_<double> pos_ptr;
int e=-1,pos_ctr=0,min_var=INT_MAX;
bool all_nonzero=true;

@ -988,7 +988,6 @@ void parallelForFinalize(const Region& rootRegion)
std::vector<TraceManagerThreadLocal*> threads_ctx;
getTraceManager().tls.gather(threads_ctx);
RegionStatistics parallel_for_stat;
int threads = 0;
for (size_t i = 0; i < threads_ctx.size(); i++)
{
TraceManagerThreadLocal* child_ctx = threads_ctx[i];
@ -996,7 +995,6 @@ void parallelForFinalize(const Region& rootRegion)
if (child_ctx && child_ctx->stackTopRegion() == &rootRegion)
{
CV_LOG_PARALLEL(NULL, "Thread=" << child_ctx->threadID << " " << child_ctx->stat);
threads++;
RegionStatistics child_stat;
child_ctx->stat.grab(child_stat);
parallel_for_stat.append(child_stat);
@ -1012,6 +1010,7 @@ void parallelForFinalize(const Region& rootRegion)
}
}
}
float parallel_coeff = std::min(1.0f, duration / (float)(parallel_for_stat.duration));
CV_LOG_PARALLEL(NULL, "parallel_coeff=" << 1.0f / parallel_coeff);
CV_LOG_PARALLEL(NULL, parallel_for_stat);

@ -315,6 +315,8 @@ struct SIdx
const SIdx& used;
bool operator()(const SIdx& v) const { return (v.i1 == used.i1 || v.i2 == used.i2); }
UsedFinder& operator=(const UsedFinder&) = delete;
// To avoid -Wdeprecated-copy warning, copy constructor is needed.
UsedFinder(const UsedFinder&) = default;
};
};

@ -312,7 +312,7 @@ void KAZEFeatures::Determinant_Hessian(std::vector<KeyPoint>& kpts)
{
int level = 0;
float smax = 3.0;
int npoints = 0, id_repeated = 0;
int id_repeated = 0;
int left_x = 0, right_x = 0, up_y = 0, down_y = 0;
bool is_extremum = false, is_repeated = false, is_out = false;
@ -383,7 +383,6 @@ void KAZEFeatures::Determinant_Hessian(std::vector<KeyPoint>& kpts)
if (is_out == false) {
if (is_repeated == false) {
kpts.push_back(kpts_par_ij);
npoints++;
}
else {
kpts[id_repeated] = kpts_par_ij;

@ -148,10 +148,12 @@ public:
{
return mask.at<uchar>( (int)(key_pt.pt.y + 0.5f), (int)(key_pt.pt.x + 0.5f) ) == 0;
}
MaskPredicate& operator=(const MaskPredicate&) = delete;
// To avoid -Wdeprecated-copy warning, copy constructor is needed.
MaskPredicate(const MaskPredicate&) = default;
private:
const Mat mask;
MaskPredicate& operator=(const MaskPredicate&) = delete;
};
void KeyPointsFilter::runByPixelsMask( std::vector<KeyPoint>& keypoints, const Mat& mask )

@ -246,7 +246,6 @@ void test_index_precisions(NNIndex<Distance>& index, const Matrix<typename Dista
float p2;
int c1 = 1;
float p1;
float time;
DistanceType dist;
@ -270,7 +269,6 @@ void test_index_precisions(NNIndex<Distance>& index, const Matrix<typename Dista
precision = precisions[i];
while (p2<precision) {
c1 = c2;
p1 = p2;
c2 *=2;
p2 = search_with_ground_truth(index, inputData, testData, matches, nn, c2, time, dist, distance, skipMatches);
if ((maxTime> 0)&&(time > maxTime)&&(p2<precision)) return;

@ -606,7 +606,9 @@ namespace
MergeContext mc;
bool there_was_a_merge = false;
#ifdef DEBUG_MERGE
std::size_t iteration = 0u;
#endif
do
{
there_was_a_merge = false;
@ -615,8 +617,8 @@ namespace
#ifdef DEBUG_MERGE
GAPI_LOG_INFO(NULL, "Before next merge attempt " << iteration << "...");
merge_debug(g, iteration);
#endif
iteration++;
#endif
auto sorted = pass_helpers::topoSort(im);
for (auto nh : sorted)
{

@ -569,7 +569,6 @@ TEST_F(S11N_Basic, Test_Bind_RunArgs_MatScalar) {
v[0] = cv::GRunArg{ mat };
v[1] = cv::GRunArg{ scalar };
GRunArgsP output = cv::gapi::bind(v);
unsigned int i = 0;
for (auto it : output)
{
using T = cv::GRunArgP;
@ -591,7 +590,6 @@ TEST_F(S11N_Basic, Test_Bind_RunArgs_MatScalar) {
GAPI_Assert(false && "This value type is not supported!"); // ...maybe because of STANDALONE mode.
break;
}
i++;
}
}

@ -220,6 +220,7 @@ int CV_ApproxPolyTest::check_slice( CvPoint StartPt, CvPoint EndPt,
*_j = j;
(void) TotalErrors; // To avoid -Wunused-but-set-variable warning
//return TotalErrors;
return 0;
}

@ -120,16 +120,13 @@ medianPartition( size_t* ofs, int a, int b, const float* vals )
}
float pivot = vals[ofs[middle]];
int less = 0, more = 0;
for( k = a0; k < middle; k++ )
{
CV_Assert(vals[ofs[k]] <= pivot);
less += vals[ofs[k]] < pivot;
}
for( k = b0; k > middle; k-- )
{
CV_Assert(vals[ofs[k]] >= pivot);
more += vals[ofs[k]] > pivot;
}
return vals[ofs[middle]];

@ -262,7 +262,9 @@ bool BundleAdjusterBase::estimate(const std::vector<ImageFeatures> &features,
CvMat matParams = cvMat(cam_params_);
cvCopy(&matParams, solver.param);
#if ENABLE_LOG
int iter = 0;
#endif
for(;;)
{
const CvMat* _param = 0;
@ -287,7 +289,9 @@ bool BundleAdjusterBase::estimate(const std::vector<ImageFeatures> &features,
{
calcError(err);
LOG_CHAT(".");
#if ENABLE_LOG
iter++;
#endif
CvMat tmp = cvMat(err);
cvCopy(&tmp, _err);
}

@ -64,10 +64,9 @@ void CV_OptFlowPyrLKTest::run( int )
const int bad_points_max = 8;
/* test parameters */
double max_err = 0., sum_err = 0;
int pt_cmpd = 0;
double max_err = 0.;
int pt_exceed = 0;
int merr_i = 0, merr_j = 0, merr_k = 0, merr_nan = 0;
int merr_i = 0, merr_nan = 0;
char filename[1000];
cv::Point2f *v = 0, *v2 = 0;
@ -155,7 +154,6 @@ void CV_OptFlowPyrLKTest::run( int )
double err;
if( cvIsNaN(v[i].x) || cvIsNaN(v[i].y) )
{
merr_j++;
continue;
}
@ -173,15 +171,12 @@ void CV_OptFlowPyrLKTest::run( int )
}
pt_exceed += err > success_error_level;
sum_err += err;
pt_cmpd++;
}
else
{
if( !cvIsNaN( v[i].x ))
{
merr_i = i;
merr_k++;
ts->printf( cvtest::TS::LOG, "The algorithm lost the point #%d\n", i );
code = cvtest::TS::FAIL_BAD_ACCURACY;
break;

@ -336,7 +336,6 @@ void TrackerTest<Tracker, ROI_t>::checkDataTest()
gt2.open(gtFile.c_str());
ASSERT_TRUE(gt2.is_open()) << gtFile;
string line2;
int bbCounter2 = 0;
while (getline(gt2, line2))
{
vector<string> tokens = splitString(line2, ",");
@ -344,7 +343,6 @@ void TrackerTest<Tracker, ROI_t>::checkDataTest()
ASSERT_EQ((size_t)4, tokens.size()) << "Incorrect ground truth file " << gtFile;
bbs.push_back(bb);
bbCounter2++;
}
gt2.close();

Loading…
Cancel
Save