From dbbbad40fb5cc5974979d0a0c667115752c89547 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 7 Dec 2016 13:16:44 +0300 Subject: [PATCH] build: eliminate ICC warnings --- cmake/OpenCVCompilerOptions.cmake | 6 ++++++ modules/core/test/test_arithm.cpp | 6 +----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake index 03592732e0..02443541d5 100644 --- a/cmake/OpenCVCompilerOptions.cmake +++ b/cmake/OpenCVCompilerOptions.cmake @@ -436,6 +436,12 @@ if(MSVC) ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4275) # non dll-interface class 'std::exception' used as base for dll-interface class 'cv::Exception' ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4589) # Constructor of abstract class 'cv::ORB' ignores initializer for virtual base class 'cv::Algorithm' endif() + + if(CV_ICC AND NOT ENABLE_NOISY_WARNINGS) + foreach(flags CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG) + string(REGEX REPLACE "( |^)/W[0-9]+( |$)" "\\1\\2" ${flags} "${${flags}}") + endforeach() + endif() endif() if(APPLE AND NOT CMAKE_CROSSCOMPILING AND NOT DEFINED ENV{LDFLAGS} AND EXISTS "/usr/local/lib") diff --git a/modules/core/test/test_arithm.cpp b/modules/core/test/test_arithm.cpp index 0781fd1a3f..a23cee91dd 100644 --- a/modules/core/test/test_arithm.cpp +++ b/modules/core/test/test_arithm.cpp @@ -1,9 +1,5 @@ #include "test_precomp.hpp" #include -#ifndef NAN -#include // numeric_limits::quiet_NaN() -#define NAN std::numeric_limits::quiet_NaN() -#endif using namespace cv; using namespace std; @@ -1895,7 +1891,7 @@ TEST(MinMaxLoc, regression_4955_nans) cv::Mat one_mat(2, 2, CV_32F, cv::Scalar(1)); cv::minMaxLoc(one_mat, NULL, NULL, NULL, NULL); - cv::Mat nan_mat(2, 2, CV_32F, cv::Scalar(NAN)); + cv::Mat nan_mat(2, 2, CV_32F, cv::Scalar(std::numeric_limits::quiet_NaN())); cv::minMaxLoc(nan_mat, NULL, NULL, NULL, NULL); }