Skip to content

Commit dbbbad4

Browse files
committed
build: eliminate ICC warnings
1 parent 540ece7 commit dbbbad4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

cmake/OpenCVCompilerOptions.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,12 @@ if(MSVC)
436436
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4275) # non dll-interface class 'std::exception' used as base for dll-interface class 'cv::Exception'
437437
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4589) # Constructor of abstract class 'cv::ORB' ignores initializer for virtual base class 'cv::Algorithm'
438438
endif()
439+
440+
if(CV_ICC AND NOT ENABLE_NOISY_WARNINGS)
441+
foreach(flags CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG)
442+
string(REGEX REPLACE "( |^)/W[0-9]+( |$)" "\\1\\2" ${flags} "${${flags}}")
443+
endforeach()
444+
endif()
439445
endif()
440446

441447
if(APPLE AND NOT CMAKE_CROSSCOMPILING AND NOT DEFINED ENV{LDFLAGS} AND EXISTS "/usr/local/lib")

modules/core/test/test_arithm.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#include "test_precomp.hpp"
22
#include <cmath>
3-
#ifndef NAN
4-
#include <limits> // numeric_limits<T>::quiet_NaN()
5-
#define NAN std::numeric_limits<float>::quiet_NaN()
6-
#endif
73

84
using namespace cv;
95
using namespace std;
@@ -1895,7 +1891,7 @@ TEST(MinMaxLoc, regression_4955_nans)
18951891
cv::Mat one_mat(2, 2, CV_32F, cv::Scalar(1));
18961892
cv::minMaxLoc(one_mat, NULL, NULL, NULL, NULL);
18971893

1898-
cv::Mat nan_mat(2, 2, CV_32F, cv::Scalar(NAN));
1894+
cv::Mat nan_mat(2, 2, CV_32F, cv::Scalar(std::numeric_limits<float>::quiet_NaN()));
18991895
cv::minMaxLoc(nan_mat, NULL, NULL, NULL, NULL);
19001896
}
19011897

0 commit comments

Comments
 (0)