Warning supression fix for XCode 13.1 and newer. Backport #23203

This commit is contained in:
Alexander Smorkalov 2023-02-02 13:57:20 +03:00
parent cb2052dbfe
commit 3d635cb4a7
6 changed files with 9 additions and 16 deletions

View File

@ -66,6 +66,11 @@ if(PPC64LE OR PPC64)
endif() endif()
endif() endif()
if(APPLE AND CV_CLANG AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.1)
ocv_warnings_disable(CMAKE_C_FLAGS -Wnull-pointer-subtraction)
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-but-set-variable)
endif()
# ---------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------
# Define the library target: # Define the library target:
# ---------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------

View File

@ -559,12 +559,9 @@ void CV_CameraCalibrationTest::run( int start_from )
i = 0; i = 0;
double dx,dy; double dx,dy;
double rx,ry; double rx,ry;
double meanDx,meanDy;
double maxDx = 0.0; double maxDx = 0.0;
double maxDy = 0.0; double maxDy = 0.0;
meanDx = 0;
meanDy = 0;
for( currImage = 0; currImage < numImages; currImage++ ) for( currImage = 0; currImage < numImages; currImage++ )
{ {
double imageMeanDx = 0; double imageMeanDx = 0;
@ -576,9 +573,6 @@ void CV_CameraCalibrationTest::run( int start_from )
dx = rx - imagePoints[i].x; dx = rx - imagePoints[i].x;
dy = ry - imagePoints[i].y; dy = ry - imagePoints[i].y;
meanDx += dx;
meanDy += dy;
imageMeanDx += dx*dx; imageMeanDx += dx*dx;
imageMeanDy += dy*dy; imageMeanDy += dy*dy;
@ -601,9 +595,6 @@ void CV_CameraCalibrationTest::run( int start_from )
perViewErrors[currImage] = goodPerViewErrors[currImage]; perViewErrors[currImage] = goodPerViewErrors[currImage];
} }
meanDx /= numImages * etalonSize.width * etalonSize.height;
meanDy /= numImages * etalonSize.width * etalonSize.height;
/* ========= Compare parameters ========= */ /* ========= Compare parameters ========= */
/* ----- Compare focal lengths ----- */ /* ----- Compare focal lengths ----- */

View File

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

View File

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

View File

@ -122,6 +122,9 @@
//#pragma GCC diagnostic push //#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override" #pragma GCC diagnostic ignored "-Wsuggest-override"
#endif #endif
#if defined(__OPENCV_BUILD) && defined(__APPLE__) && defined(__clang__) && ((__clang_major__*100 + __clang_minor__) >= 1301)
#pragma clang diagnostic ignored "-Wdeprecated-copy"
#endif
#include "opencv2/ts/ts_gtest.h" #include "opencv2/ts/ts_gtest.h"
#if defined(__OPENCV_BUILD) && defined(__GNUC__) && __GNUC__ >= 5 #if defined(__OPENCV_BUILD) && defined(__GNUC__) && __GNUC__ >= 5
//#pragma GCC diagnostic pop //#pragma GCC diagnostic pop

View File

@ -65,7 +65,7 @@ void CV_OptFlowPyrLKTest::run( int )
const int bad_points_max = 8; const int bad_points_max = 8;
/* test parameters */ /* test parameters */
double max_err = 0., sum_err = 0; double max_err = 0.;
int pt_cmpd = 0; int pt_cmpd = 0;
int pt_exceed = 0; int pt_exceed = 0;
int merr_i = 0, merr_j = 0, merr_k = 0, merr_nan = 0; int merr_i = 0, merr_j = 0, merr_k = 0, merr_nan = 0;
@ -175,7 +175,6 @@ void CV_OptFlowPyrLKTest::run( int )
} }
pt_exceed += err > success_error_level; pt_exceed += err > success_error_level;
sum_err += err;
pt_cmpd++; pt_cmpd++;
} }
else else