diff --git a/3rdparty/ittnotify/CMakeLists.txt b/3rdparty/ittnotify/CMakeLists.txt index a227aff88e..0f39adcd4b 100644 --- a/3rdparty/ittnotify/CMakeLists.txt +++ b/3rdparty/ittnotify/CMakeLists.txt @@ -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") diff --git a/3rdparty/libpng/CMakeLists.txt b/3rdparty/libpng/CMakeLists.txt index efa59627eb..bb0f3dd2c5 100644 --- a/3rdparty/libpng/CMakeLists.txt +++ b/3rdparty/libpng/CMakeLists.txt @@ -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} diff --git a/3rdparty/libtiff/CMakeLists.txt b/3rdparty/libtiff/CMakeLists.txt index 2074888a52..d37cfff337 100644 --- a/3rdparty/libtiff/CMakeLists.txt +++ b/3rdparty/libtiff/CMakeLists.txt @@ -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 ) diff --git a/3rdparty/libwebp/CMakeLists.txt b/3rdparty/libwebp/CMakeLists.txt index 9160e2024c..723575c8db 100644 --- a/3rdparty/libwebp/CMakeLists.txt +++ b/3rdparty/libwebp/CMakeLists.txt @@ -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 diff --git a/3rdparty/openjpeg/CMakeLists.txt b/3rdparty/openjpeg/CMakeLists.txt index fe766101d0..42730bab2b 100644 --- a/3rdparty/openjpeg/CMakeLists.txt +++ b/3rdparty/openjpeg/CMakeLists.txt @@ -13,6 +13,7 @@ project(openjpeg C) ocv_warnings_disable(CMAKE_C_FLAGS -Wimplicit-const-int-float-conversion # clang + -Wunused-but-set-variable # clang15 ) #----------------------------------------------------------------------------- diff --git a/modules/calib3d/src/calibinit.cpp b/modules/calib3d/src/calibinit.cpp index e25dd26d21..9e96802388 100644 --- a/modules/calib3d/src/calibinit.cpp +++ b/modules/calib3d/src/calibinit.cpp @@ -1469,7 +1469,7 @@ int ChessBoardDetector::checkQuadGroup(std::vector& 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); diff --git a/modules/calib3d/test/test_cameracalibration.cpp b/modules/calib3d/test/test_cameracalibration.cpp index c1704ad928..1c04bb78dd 100644 --- a/modules/calib3d/test/test_cameracalibration.cpp +++ b/modules/calib3d/test/test_cameracalibration.cpp @@ -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); diff --git a/modules/calib3d/test/test_fisheye.cpp b/modules/calib3d/test/test_fisheye.cpp index ad3b066a6a..7e40493db3 100644 --- a/modules/calib3d/test/test_fisheye.cpp +++ b/modules/calib3d/test/test_fisheye.cpp @@ -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++; } } diff --git a/modules/core/perf/opencl/perf_matop.cpp b/modules/core/perf/opencl/perf_matop.cpp index 5be1f431f6..b763a98e2a 100644 --- a/modules/core/perf/opencl/perf_matop.cpp +++ b/modules/core/perf/opencl/perf_matop.cpp @@ -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(); diff --git a/modules/core/src/datastructs.cpp b/modules/core/src/datastructs.cpp index eec7ade02b..80b02283dc 100644 --- a/modules/core/src/datastructs.cpp +++ b/modules/core/src/datastructs.cpp @@ -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; diff --git a/modules/core/src/lpsolver.cpp b/modules/core/src/lpsolver.cpp index 951da3fd7f..43fa73a025 100644 --- a/modules/core/src/lpsolver.cpp +++ b/modules/core/src/lpsolver.cpp @@ -253,11 +253,8 @@ static int initialize_simplex(Mat_& c, Mat_& b,double& v,vector< } static int inner_simplex(Mat_& c, Mat_& b,double& v,vector& N,vector& B,vector& indexToRow){ - int count=0; - for(;;){ - dprintf(("iteration #%d\n",count)); - count++; + for(;;){ static MatIterator_ pos_ptr; int e=-1,pos_ctr=0,min_var=INT_MAX; bool all_nonzero=true; diff --git a/modules/core/src/trace.cpp b/modules/core/src/trace.cpp index 1011db5e3b..05acbde7c9 100644 --- a/modules/core/src/trace.cpp +++ b/modules/core/src/trace.cpp @@ -988,7 +988,6 @@ void parallelForFinalize(const Region& rootRegion) std::vector 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); diff --git a/modules/features2d/src/evaluation.cpp b/modules/features2d/src/evaluation.cpp index ca7ab14500..7135891e0d 100644 --- a/modules/features2d/src/evaluation.cpp +++ b/modules/features2d/src/evaluation.cpp @@ -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; }; }; diff --git a/modules/features2d/src/kaze/KAZEFeatures.cpp b/modules/features2d/src/kaze/KAZEFeatures.cpp index ab591d417c..7bd0ba6dcd 100644 --- a/modules/features2d/src/kaze/KAZEFeatures.cpp +++ b/modules/features2d/src/kaze/KAZEFeatures.cpp @@ -312,7 +312,7 @@ void KAZEFeatures::Determinant_Hessian(std::vector& 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& kpts) if (is_out == false) { if (is_repeated == false) { kpts.push_back(kpts_par_ij); - npoints++; } else { kpts[id_repeated] = kpts_par_ij; diff --git a/modules/features2d/src/keypoint.cpp b/modules/features2d/src/keypoint.cpp index e14c9da94c..21d9eb30f7 100644 --- a/modules/features2d/src/keypoint.cpp +++ b/modules/features2d/src/keypoint.cpp @@ -148,10 +148,12 @@ public: { return mask.at( (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& keypoints, const Mat& mask ) diff --git a/modules/flann/include/opencv2/flann/index_testing.h b/modules/flann/include/opencv2/flann/index_testing.h index 207adef449..4c00143326 100644 --- a/modules/flann/include/opencv2/flann/index_testing.h +++ b/modules/flann/include/opencv2/flann/index_testing.h @@ -246,7 +246,6 @@ void test_index_precisions(NNIndex& index, const Matrix& index, const Matrix 0)&&(time > maxTime)&&(p2 middle; k-- ) { CV_Assert(vals[ofs[k]] >= pivot); - more += vals[ofs[k]] > pivot; } return vals[ofs[middle]]; diff --git a/modules/stitching/src/motion_estimators.cpp b/modules/stitching/src/motion_estimators.cpp index c0b46b101d..29616a4915 100644 --- a/modules/stitching/src/motion_estimators.cpp +++ b/modules/stitching/src/motion_estimators.cpp @@ -262,7 +262,9 @@ bool BundleAdjusterBase::estimate(const std::vector &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 &features, { calcError(err); LOG_CHAT("."); +#if ENABLE_LOG iter++; +#endif CvMat tmp = cvMat(err); cvCopy(&tmp, _err); } diff --git a/modules/video/test/test_optflowpyrlk.cpp b/modules/video/test/test_optflowpyrlk.cpp index 905cfebafa..a79a0ff4e4 100644 --- a/modules/video/test/test_optflowpyrlk.cpp +++ b/modules/video/test/test_optflowpyrlk.cpp @@ -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; diff --git a/modules/video/test/test_trackers.impl.hpp b/modules/video/test/test_trackers.impl.hpp index 5ae98d1eb8..fc2315ced0 100644 --- a/modules/video/test/test_trackers.impl.hpp +++ b/modules/video/test/test_trackers.impl.hpp @@ -336,7 +336,6 @@ void TrackerTest::checkDataTest() gt2.open(gtFile.c_str()); ASSERT_TRUE(gt2.is_open()) << gtFile; string line2; - int bbCounter2 = 0; while (getline(gt2, line2)) { vector tokens = splitString(line2, ","); @@ -344,7 +343,6 @@ void TrackerTest::checkDataTest() ASSERT_EQ((size_t)4, tokens.size()) << "Incorrect ground truth file " << gtFile; bbs.push_back(bb); - bbCounter2++; } gt2.close();