[CPU]Remove C4250 warning suppress, and fix the corresponding warning. (#15966)

This commit is contained in:
Xiping Yan 2023-03-06 16:43:53 +08:00 committed by GitHub
parent 4486470e02
commit 8b66b35bf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 10 deletions

View File

@ -13,3 +13,12 @@
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
#endif
// Disabled MSVC warning
#if defined(_MSC_VER)
# define DISABLE_WARNING_MSVC_BEGIN(id) __pragma(warning(push)) __pragma(warning(disable : id))
# define DISABLE_WARNING_MSVC_END(id) __pragma(warning(pop))
#else
# define DISABLE_WARNING_MSVC_BEGIN(id)
# define DISABLE_WARNING_MSVC_END(id)
#endif

View File

@ -18,8 +18,6 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
ie_add_compiler_flags(/wd4244)
# mkldnn headers: '<<': result of 32-bit shift implicitly converted to 64 bits
ie_add_compiler_flags(/wd4334)
# plugin: inherits 'XXX' via dominance
ie_add_compiler_flags(/wd4250)
# '<': signed/unsigned mismatch
ie_add_compiler_flags(/wd4018)
ie_add_compiler_flags(/wd4309)

View File

@ -5,12 +5,15 @@
#pragma once
#include "blocked_memory_desc.h"
#include "openvino/util/util.hpp"
#include <cpu_memory.h>
#include <dnnl_extension_utils.h>
namespace ov {
namespace intel_cpu {
DISABLE_WARNING_MSVC_BEGIN(4250) // Visual Studio warns us about inheritance via dominance but it's done intentionally
// so turn it off
class DnnlBlockedMemoryDesc : public BlockedMemoryDesc, public DnnlMemoryDesc {
public:
// Creates planar DnnlBlockedMemoryDesc
@ -100,6 +103,7 @@ private:
friend std::shared_ptr<DnnlBlockedMemoryDesc> DnnlExtensionUtils::makeUndefinedDesc(const dnnl::memory::desc &desc, const Shape& shape);
friend class MemoryDescUtils;
};
DISABLE_WARNING_MSVC_END(4250)
using DnnlBlockedMemoryDescPtr = std::shared_ptr<DnnlBlockedMemoryDesc>;
using DnnlBlockedMemoryDescCPtr = std::shared_ptr<const DnnlBlockedMemoryDesc>;

View File

@ -5,15 +5,13 @@
#pragma once
#include "intel_gpu/runtime/profiling.hpp"
#include "openvino/util/util.hpp"
#include "ocl_base_event.hpp"
#include <memory>
#include <list>
#ifdef _WIN32
#pragma warning(push)
#pragma warning(disable : 4250) // Visual Studio warns us about inheritance via dominance but it's done intentionally
// so turn it off
#endif
DISABLE_WARNING_MSVC_BEGIN(4250) // Visual Studio warns us about inheritance via dominance but it's done intentionally
// so turn it off
namespace cldnn {
namespace ocl {
@ -43,9 +41,7 @@ private:
bool is_set_impl() override;
};
#ifdef _WIN32
#pragma warning(pop)
#endif
DISABLE_WARNING_MSVC_END(4250)
} // namespace ocl
} // namespace cldnn

View File

@ -61,6 +61,9 @@ using compileKernelsCacheParams = std::tuple<
std::string, // device name
std::pair<std::map<std::string, std::string>, std::string> // device and cache configuration
>;
DISABLE_WARNING_MSVC_BEGIN(4250) // Visual Studio warns us about inheritance via dominance but it's done intentionally
// so turn it off
class LoadNetworkCompiledKernelsCacheTest : virtual public LayerTestsUtils::LayerTestsCommon,
virtual public BehaviorTestsUtils::IEPluginTestBase,
public testing::WithParamInterface<compileKernelsCacheParams> {
@ -92,4 +95,7 @@ protected:
cache_path = "LoadNetwork" + test_name + "_cache";
}
};
DISABLE_WARNING_MSVC_END(4250)
} // namespace LayerTestsDefinitions