Skip to content

Commit

Permalink
Properly enable CMAKE_COMPILE_WARNING_AS_ERROR (#19828)
Browse files Browse the repository at this point in the history
* Properly enable CMAKE_COMPILE_WARNING_AS_ERROR_DEFAULT

* Properly enable CMAKE_COMPILE_WARNING_AS_ERROR
  • Loading branch information
ilya-lavrenov authored Sep 14, 2023
1 parent 18f29c0 commit ba67db6
Show file tree
Hide file tree
Showing 17 changed files with 48 additions and 23 deletions.
1 change: 1 addition & 0 deletions cmake/developer_package/compile_flags/os_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion cmake/developer_package/features.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/features.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions cmake/templates/OpenVINODeveloperPackageConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ enum class ShapeInferStatus {
*/
class IShapeInferSnippets {
public:
enum {DYNAMIC_DIMENSION = 0xffffffffffffffff};
enum {DYNAMIC_DIMENSION = std::numeric_limits<size_t>::max()};
struct Result {
std::vector<VectorDims> dims;
ShapeInferStatus status;
Expand Down
15 changes: 13 additions & 2 deletions src/common/util/src/file_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <Shlwapi.h>
# include <direct.h>
# include <shlwapi.h>
# include <windows.h>
/// @brief Max length of absolute file path
# define MAX_ABS_PATH _MAX_PATH
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions src/core/reference/src/op/jit_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/frontends/tensorflow/src/checkpoint_v1_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void CheckpointV1Reader::init_block(const std::shared_ptr<std::ifstream>& 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 "
Expand Down
5 changes: 5 additions & 0 deletions src/inference/src/infer_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_cpu/thirdparty/onednn
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class GraphCache : public ICache {
ExtractorsManager m_manager = ExtractorsManager();
static std::shared_ptr<GraphCache> m_cache_instance;
// cache byte size
size_t m_graph_cache_bytesize = 0;
uint64_t m_graph_cache_bytesize = 0;

GraphCache() {
ExtractorsManager::ExtractorsMap matchers = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 "";
}

Expand Down
3 changes: 3 additions & 0 deletions tests/fuzz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion thirdparty/zlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit ba67db6

Please sign in to comment.