From ba67db66ae4c5d8c81b44a6162485257c0e8bbe9 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Fri, 15 Sep 2023 01:20:00 +0400 Subject: [PATCH] Properly enable CMAKE_COMPILE_WARNING_AS_ERROR (#19828) * Properly enable CMAKE_COMPILE_WARNING_AS_ERROR_DEFAULT * Properly enable CMAKE_COMPILE_WARNING_AS_ERROR --- .../compile_flags/os_flags.cmake | 1 + cmake/developer_package/features.cmake | 2 +- cmake/features.cmake | 2 +- ...InferenceEngineDeveloperPackageConfig.cmake.in | 6 ++---- .../OpenVINODeveloperPackageConfig.cmake.in | 6 ++---- .../snippets/shape_inference/shape_inference.hpp | 2 +- src/common/util/src/file_util.cpp | 15 +++++++++++++-- src/core/reference/src/op/jit_generator.cpp | 4 +--- .../tensorflow/src/checkpoint_v1_reader.cpp | 2 +- src/inference/src/infer_request.cpp | 5 +++++ src/plugins/intel_cpu/CMakeLists.txt | 2 +- src/plugins/intel_cpu/thirdparty/onednn | 2 +- .../include/cache/graph_cache.hpp | 2 +- .../common_test_utils/postgres_helpers.hpp | 2 +- .../common_test_utils/src/postgres_helpers.cpp | 9 ++++++++- tests/fuzz/CMakeLists.txt | 3 +++ thirdparty/zlib/CMakeLists.txt | 6 +++++- 17 files changed, 48 insertions(+), 23 deletions(-) diff --git a/cmake/developer_package/compile_flags/os_flags.cmake b/cmake/developer_package/compile_flags/os_flags.cmake index 777540769071f4..db0e6a1a53fe8a 100644 --- a/cmake/developer_package/compile_flags/os_flags.cmake +++ b/cmake/developer_package/compile_flags/os_flags.cmake @@ -33,6 +33,7 @@ macro(ov_disable_deprecated_warnings) endmacro() macro(disable_deprecated_warnings) + message(WARNING "disable_deprecated_warnings is deprecated, use ov_disable_deprecated_warnings instead") ov_disable_deprecated_warnings() endmacro() diff --git a/cmake/developer_package/features.cmake b/cmake/developer_package/features.cmake index fe1cfe02ab7754..8129e428dcddf5 100644 --- a/cmake/developer_package/features.cmake +++ b/cmake/developer_package/features.cmake @@ -18,7 +18,7 @@ else() ie_option(USE_BUILD_TYPE_SUBFOLDER "Create dedicated sub-folder per build type for output binaries" ON) endif() -if(CI_BUILD_NUMBER) +if(DEFINED ENV{CI_BUILD_NUMBER} AND NOT (WIN32 OR CMAKE_CROSSCOMPILING)) set(CMAKE_COMPILE_WARNING_AS_ERROR_DEFAULT ON) else() set(CMAKE_COMPILE_WARNING_AS_ERROR_DEFAULT OFF) diff --git a/cmake/features.cmake b/cmake/features.cmake index f842ba724f7a20..9fdee1f1f8277b 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -23,7 +23,7 @@ endif() ie_dependent_option (ENABLE_INTEL_GPU "GPU OpenCL-based plugin for OpenVINO Runtime" ${ENABLE_INTEL_GPU_DEFAULT} "X86_64 OR AARCH64;NOT APPLE;NOT WINDOWS_STORE;NOT WINDOWS_PHONE" OFF) -if (ANDROID OR (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) OR NOT BUILD_SHARED_LIBS) +if (ANDROID OR MINGW OR (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) OR NOT BUILD_SHARED_LIBS) # oneDNN doesn't support old compilers and android builds for now, so we'll build GPU plugin without oneDNN # also, in case of static build CPU's and GPU's oneDNNs will conflict, so we are disabling GPU's one in this case set(ENABLE_ONEDNN_FOR_GPU_DEFAULT OFF) diff --git a/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in b/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in index 5acfe60efdfb12..4249559e027031 100644 --- a/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in +++ b/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in @@ -49,10 +49,8 @@ if(ENABLE_SAMPLES) set_and_check(gflags_DIR "@gflags_BINARY_DIR@") endif() -if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - # Disable warning as error for private components - set(CMAKE_COMPILE_WARNING_AS_ERROR OFF) -endif() +# Disable warning as error for private components +set(CMAKE_COMPILE_WARNING_AS_ERROR OFF) # # Content diff --git a/cmake/templates/OpenVINODeveloperPackageConfig.cmake.in b/cmake/templates/OpenVINODeveloperPackageConfig.cmake.in index aa2153eb76bc77..074139df5f3bf8 100644 --- a/cmake/templates/OpenVINODeveloperPackageConfig.cmake.in +++ b/cmake/templates/OpenVINODeveloperPackageConfig.cmake.in @@ -54,10 +54,8 @@ if(ENABLE_SAMPLES) endif() endif() -if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - # Disable warning as error for private components - set(CMAKE_COMPILE_WARNING_AS_ERROR OFF) -endif() +# Disable warning as error for private components +set(CMAKE_COMPILE_WARNING_AS_ERROR OFF) # # Content diff --git a/src/common/snippets/include/snippets/shape_inference/shape_inference.hpp b/src/common/snippets/include/snippets/shape_inference/shape_inference.hpp index 719ca69610e343..ad2145d9f59bfc 100644 --- a/src/common/snippets/include/snippets/shape_inference/shape_inference.hpp +++ b/src/common/snippets/include/snippets/shape_inference/shape_inference.hpp @@ -20,7 +20,7 @@ enum class ShapeInferStatus { */ class IShapeInferSnippets { public: - enum {DYNAMIC_DIMENSION = 0xffffffffffffffff}; + enum {DYNAMIC_DIMENSION = std::numeric_limits::max()}; struct Result { std::vector dims; ShapeInferStatus status; diff --git a/src/common/util/src/file_util.cpp b/src/common/util/src/file_util.cpp index 535e7c250386d0..a26188ee6f7b3a 100644 --- a/src/common/util/src/file_util.cpp +++ b/src/common/util/src/file_util.cpp @@ -18,8 +18,8 @@ # ifndef NOMINMAX # define NOMINMAX # endif -# include # include +# include # include /// @brief Max length of absolute file path # define MAX_ABS_PATH _MAX_PATH @@ -325,6 +325,12 @@ void ov::util::convert_path_win_style(std::string& path) { } #ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT + +# ifdef __APPLE__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-declarations" +# endif + std::string ov::util::wstring_to_string(const std::wstring& wstr) { # ifdef _WIN32 int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL); @@ -351,7 +357,12 @@ std::wstring ov::util::string_to_wstring(const std::string& string) { return result; # endif } -#endif + +# ifdef __APPLE__ +# pragma clang diagnostic pop +# endif + +#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT std::string ov::util::get_absolute_file_path(const std::string& path) { std::string absolutePath; diff --git a/src/core/reference/src/op/jit_generator.cpp b/src/core/reference/src/op/jit_generator.cpp index 1ca5affacddeab..f62b897a462990 100644 --- a/src/core/reference/src/op/jit_generator.cpp +++ b/src/core/reference/src/op/jit_generator.cpp @@ -37,9 +37,7 @@ static const Xbyak::Operand::Code abi_save_gpr_regs[] = { static const Xbyak::Reg64 abi_param1(Xbyak::Operand::RCX), abi_param2(Xbyak::Operand::RDX), abi_param3(Xbyak::Operand::R8), abi_param4(Xbyak::Operand::R9), abi_not_param1(Xbyak::Operand::RDI); # else -static const Xbyak::Reg64 abi_param1(Xbyak::Operand::RDI), abi_param2(Xbyak::Operand::RSI), - abi_param3(Xbyak::Operand::RDX), abi_param4(Xbyak::Operand::RCX), abi_param5(Xbyak::Operand::R8), - abi_param6(Xbyak::Operand::R9), abi_not_param1(Xbyak::Operand::RCX); +static const Xbyak::Reg64 abi_param1(Xbyak::Operand::RDI); # endif # endif // XBYAK64 diff --git a/src/frontends/tensorflow/src/checkpoint_v1_reader.cpp b/src/frontends/tensorflow/src/checkpoint_v1_reader.cpp index b51b8c91b3ea09..33833100ad6c6f 100644 --- a/src/frontends/tensorflow/src/checkpoint_v1_reader.cpp +++ b/src/frontends/tensorflow/src/checkpoint_v1_reader.cpp @@ -168,7 +168,7 @@ void CheckpointV1Reader::init_block(const std::shared_ptr& shard, "[TensorFlow Frontend] internal error: compression method for given block is not supported " "for checkpoint file " + shard_name); - result_data = std::string(buf.get(), size); + block = std::string(buf.data(), size); #else FRONT_END_GENERAL_CHECK(buf[size] == 0 || buf[size] == 1, "[TensorFlow Frontend] internal error: compression method for given block is not supported " diff --git a/src/inference/src/infer_request.cpp b/src/inference/src/infer_request.cpp index f48d6f0edea47e..89f283f162045d 100644 --- a/src/inference/src/infer_request.cpp +++ b/src/inference/src/infer_request.cpp @@ -18,6 +18,11 @@ #include "openvino/runtime/so_ptr.hpp" #include "transformations/utils/utils.hpp" +#ifdef __GNUC__ +// on RHEL 8.2 deprecation inside the macro does not work +OPENVINO_SUPPRESS_DEPRECATED_START +#endif + #define OV_INFER_REQ_CALL_STATEMENT(...) \ OPENVINO_ASSERT(_impl != nullptr, "InferRequest was not initialized."); \ OPENVINO_SUPPRESS_DEPRECATED_START \ diff --git a/src/plugins/intel_cpu/CMakeLists.txt b/src/plugins/intel_cpu/CMakeLists.txt index e55f7777ee3914..b2a2e0fab32608 100644 --- a/src/plugins/intel_cpu/CMakeLists.txt +++ b/src/plugins/intel_cpu/CMakeLists.txt @@ -35,7 +35,7 @@ set(OV_CPU_ARM_TARGET_ARCH ${OV_CPU_ARM_TARGET_ARCH_DEFAULT}) if(X86 OR X86_64 OR AARCH64) # disable mlas with webassembly - if(EMSCRIPTEN OR (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7)) + if(EMSCRIPTEN OR MINGW OR (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7)) set(ENABLE_MLAS_FOR_CPU_DEFAULT OFF) else() set(ENABLE_MLAS_FOR_CPU_DEFAULT ON) diff --git a/src/plugins/intel_cpu/thirdparty/onednn b/src/plugins/intel_cpu/thirdparty/onednn index 3110963434d866..31c8555b923e16 160000 --- a/src/plugins/intel_cpu/thirdparty/onednn +++ b/src/plugins/intel_cpu/thirdparty/onednn @@ -1 +1 @@ -Subproject commit 3110963434d8662e93b3cdafc9bf6b41235aa602 +Subproject commit 31c8555b923e16b4ddfdcd1d1f126c115b5e0da7 diff --git a/src/tests/functional/plugin/conformance/subgraphs_dumper/include/cache/graph_cache.hpp b/src/tests/functional/plugin/conformance/subgraphs_dumper/include/cache/graph_cache.hpp index cb18bb685219eb..afd501b669de81 100644 --- a/src/tests/functional/plugin/conformance/subgraphs_dumper/include/cache/graph_cache.hpp +++ b/src/tests/functional/plugin/conformance/subgraphs_dumper/include/cache/graph_cache.hpp @@ -44,7 +44,7 @@ class GraphCache : public ICache { ExtractorsManager m_manager = ExtractorsManager(); static std::shared_ptr m_cache_instance; // cache byte size - size_t m_graph_cache_bytesize = 0; + uint64_t m_graph_cache_bytesize = 0; GraphCache() { ExtractorsManager::ExtractorsMap matchers = { diff --git a/src/tests/test_utils/common_test_utils/include/common_test_utils/postgres_helpers.hpp b/src/tests/test_utils/common_test_utils/include/common_test_utils/postgres_helpers.hpp index dff641a5f97cd6..0fef7c20d33c76 100644 --- a/src/tests/test_utils/common_test_utils/include/common_test_utils/postgres_helpers.hpp +++ b/src/tests/test_utils/common_test_utils/include/common_test_utils/postgres_helpers.hpp @@ -127,7 +127,7 @@ extern fnPQclear PQclear; extern fnPQresultErrorMessage PQresultErrorMessage; #endif -extern char* PGPrefix(const char* text, ::testing::internal::GTestColor color); +extern const char* PGPrefix(const char* text, ::testing::internal::GTestColor color); #define PG_ERR PGPrefix("[ PG ERROR ] ", ::testing::internal::COLOR_RED) #define PG_WRN PGPrefix("[ PG WARN ] ", ::testing::internal::COLOR_YELLOW) diff --git a/src/tests/test_utils/common_test_utils/src/postgres_helpers.cpp b/src/tests/test_utils/common_test_utils/src/postgres_helpers.cpp index 2a7148133eae24..d31605a154bb2d 100644 --- a/src/tests/test_utils/common_test_utils/src/postgres_helpers.cpp +++ b/src/tests/test_utils/common_test_utils/src/postgres_helpers.cpp @@ -26,8 +26,15 @@ fnPQgetisnull PQgetisnull; fnPQclear PQclear; fnPQresultErrorMessage PQresultErrorMessage; -char* PGPrefix(const char* text, ::testing::internal::GTestColor color) { +const char* PGPrefix(const char* text, ::testing::internal::GTestColor color) { +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-security" +#endif ::testing::internal::ColoredPrintf(color, text); +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif return ""; } diff --git a/tests/fuzz/CMakeLists.txt b/tests/fuzz/CMakeLists.txt index 3d051a0183aeef..af134ae28e8cdc 100644 --- a/tests/fuzz/CMakeLists.txt +++ b/tests/fuzz/CMakeLists.txt @@ -16,6 +16,9 @@ find_package(IEDevScripts REQUIRED NO_CMAKE_FIND_ROOT_PATH NO_DEFAULT_PATH) +# TODO: remove this when all the deprecated functions are removed +ov_deprecated_no_errors() + find_package(OpenVINO REQUIRED) if (NOT ENABLE_FUZZING) diff --git a/thirdparty/zlib/CMakeLists.txt b/thirdparty/zlib/CMakeLists.txt index 89fa92abef341d..f52d7bd027b1e5 100644 --- a/thirdparty/zlib/CMakeLists.txt +++ b/thirdparty/zlib/CMakeLists.txt @@ -14,7 +14,11 @@ else() set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -diag-disable=266") endif() if(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-non-prototype") + include(CheckCCompilerFlag) + check_c_compiler_flag("-Wdeprecated-non-prototype" DEPRECATED_NO_PROTOTYPE) + if(DEPRECATED_NO_PROTOTYPE) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-non-prototype") + endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-variable") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations") endif()