clean up the code
authorTomoaki Teshima <tomoaki.teshima@gmail.com>
Thu, 21 Dec 2017 23:42:21 +0000 (08:42 +0900)
committerTomoaki Teshima <tomoaki.teshima@gmail.com>
Thu, 21 Dec 2017 23:42:21 +0000 (08:42 +0900)
  * disable the warning in CMake, not int the code using pragma

cmake/OpenCVCompilerOptions.cmake
modules/cudalegacy/test/NCVTest.hpp
modules/features2d/src/agast.cpp
modules/features2d/src/agast_score.cpp
modules/features2d/src/fast.cpp
modules/imgcodecs/src/grfmt_jpeg.cpp
modules/imgproc/src/canny.cpp
modules/ts/include/opencv2/ts.hpp
modules/ts/include/opencv2/ts/ts_gtest.h
modules/videoio/src/cap_ffmpeg_impl.hpp
modules/videoio/src/cap_msmf.hpp

index 47dc705..353ee12 100644 (file)
@@ -309,9 +309,6 @@ if(MSVC)
     if(MSVC_VERSION EQUAL 1400)
       ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4510 /wd4610 /wd4312 /wd4201 /wd4244 /wd4328 /wd4267)
     endif()
-    if(MSVC_VERSION LESS 1900) # MSVS2015
-      ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127) # warning C4127: conditional expression is constant
-    endif()
   endif()
 
   # allow extern "C" functions throw exceptions
@@ -323,6 +320,7 @@ if(MSVC)
   endforeach()
 
   if(NOT ENABLE_NOISY_WARNINGS)
+    ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127) # conditional expression is constant
     ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4251) # class 'std::XXX' needs to have dll-interface to be used by clients of YYY
     ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4324) # 'struct_name' : structure was padded due to __declspec(align())
     ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4275) # non dll-interface class 'std::exception' used as base for dll-interface class 'cv::Exception'
index 23b1fee..3d7bf47 100644 (file)
@@ -44,7 +44,7 @@
 #define _ncvtest_hpp_
 
 #if defined _MSC_VER
-# pragma warning( disable : 4201 4408 4127 4100)
+# pragma warning( disable : 4201 4408 4100)
 #endif
 
 #include <string>
index d1f1bb6..ee14d06 100644 (file)
@@ -45,10 +45,6 @@ The references are:
 #include "precomp.hpp"
 #include "agast_score.hpp"
 
-#ifdef _MSC_VER
-#pragma warning( disable : 4127 )
-#endif
-
 namespace cv
 {
 
index ac80077..92a34a7 100644 (file)
@@ -44,10 +44,6 @@ The references are:
 
 #include "agast_score.hpp"
 
-#ifdef _MSC_VER
-#pragma warning( disable : 4127 )
-#endif
-
 namespace cv
 {
 
index c87ea69..f81e7e2 100644 (file)
@@ -48,9 +48,6 @@ The references are:
 #include "opencv2/core/hal/intrin.hpp"
 
 #include "opencv2/core/openvx/ovx_defs.hpp"
-#if defined _MSC_VER
-# pragma warning( disable : 4127)
-#endif
 
 namespace cv
 {
index caf768d..f53550a 100644 (file)
@@ -78,18 +78,11 @@ extern "C" {
 namespace cv
 {
 
-#ifdef _MSC_VER
-# pragma warning(push)
-# pragma warning(disable:4324) //structure was padded due to __declspec(align())
-#endif
 struct JpegErrorMgr
 {
     struct jpeg_error_mgr pub;
     jmp_buf setjmp_buffer;
 };
-#ifdef _MSC_VER
-# pragma warning(pop)
-#endif
 
 struct JpegSource
 {
index 23bb40e..7c13e4d 100644 (file)
 
 #include "opencv2/core/openvx/ovx_defs.hpp"
 
-#ifdef _MSC_VER
-#pragma warning( disable: 4127 ) // conditional expression is constant
-#endif
-
 #if CV_SIMD128
 #define CV_MALLOC_SIMD128 16
 #endif
index dd1bc14..82e945a 100644 (file)
@@ -34,7 +34,6 @@
 #endif
 
 #ifdef _MSC_VER
-#pragma warning( disable: 4127 ) // conditional expression is constant
 #pragma warning( disable: 4503 ) // decorated name length exceeded, name was truncated
 #endif
 
index fb31603..18e6415 100644 (file)
@@ -7976,20 +7976,11 @@ GTEST_API_ std::string AppendUserMessage(
 // std::runtime_error inherits from std::exception, many testing
 // frameworks know how to extract and print the message inside it.
 
-#ifdef _MSC_VER
-# pragma warning(push)          // Saves the current warning state.
-# pragma warning(disable:4275)  // Temporarily disables warning 4275.
-#endif  // _MSC_VER
-
 class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
  public:
   explicit GoogleTestFailureException(const TestPartResult& failure);
 };
 
-#ifdef _MSC_VER
-# pragma warning(pop)           // Restores the warning state.
-#endif  // _MSC_VER
-
 #endif  // GTEST_HAS_EXCEPTIONS
 
 // A helper class for creating scoped traces in user programs.
index 27c374b..fb12902 100644 (file)
@@ -51,7 +51,7 @@
 #define CALC_FFMPEG_VERSION(a,b,c) ( a<<16 | b<<8 | c )
 
 #if defined _MSC_VER && _MSC_VER >= 1200
-#pragma warning( disable: 4244 4510 4512 4610 )
+#pragma warning( disable: 4244 4510 4610 )
 #endif
 
 #ifdef __GNUC__
@@ -83,7 +83,7 @@ extern "C" {
 #endif
 
 #if defined _MSC_VER && _MSC_VER >= 1200
-#pragma warning( default: 4244 4510 4512 4610 )
+#pragma warning( default: 4244 4510 4610 )
 #endif
 
 #ifdef NDEBUG
index 87a7476..cb0514f 100644 (file)
@@ -2084,11 +2084,6 @@ public:
 // succeed but return a nullptr pointer. By default, the list does not allow nullptr
 // pointers.
 
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable: 4127) // constant expression
-#endif
-
 template <class T, bool NULLABLE = FALSE>
 class ComPtrList : public List<T*>
 {
@@ -2179,10 +2174,6 @@ protected:
     }
 };
 
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
 /* Be sure to declare webcam device capability in manifest
   For better media capture support, add the following snippet with correct module name to the project manifest
     (videoio needs DLL activation class factoryentry points):