diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index e2358e8077..b275c97c65 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -445,6 +445,7 @@ else() check_cxx_compiler_flag(-Wmissing-braces HAS_MISSING_BRACES) check_cxx_compiler_flag(-Wignored-attributes HAS_IGNORED_ATTRIBUTES) check_cxx_compiler_flag(-Wdeprecated-copy HAS_DEPRECATED_COPY) + check_cxx_compiler_flag(-Wclass-memaccess HAS_CLASS_MEMACCESS) if(HAS_TAUTOLOGICAL_POINTER_COMPARE) #we may have extra null pointer checkings in debug build, it's not an issue @@ -456,6 +457,11 @@ else() string(APPEND CMAKE_CXX_FLAGS_DEBUG " -Wno-nonnull-compare") string(APPEND CMAKE_C_FLAGS_DEBUG " -Wno-nonnull-compare") endif() + if(HAS_DEPRECATED_COPY) + #too many such errors in eigen and gemmlowp + string(APPEND CMAKE_CXX_FLAGS_DEBUG " -Wno-deprecated-copy") + string(APPEND CMAKE_C_FLAGS_DEBUG " -Wno-deprecated-copy") + endif() if(HAS_PARENTHESES) string(APPEND CMAKE_CXX_FLAGS " -Wno-parentheses") endif() diff --git a/cmake/onnxruntime_config.h.in b/cmake/onnxruntime_config.h.in index 5ccc20a2b0..79f3379e31 100644 --- a/cmake/onnxruntime_config.h.in +++ b/cmake/onnxruntime_config.h.in @@ -11,4 +11,5 @@ #cmakedefine HAS_USELESS_CAST #cmakedefine HAS_IGNORED_ATTRIBUTES #cmakedefine HAS_DEPRECATED_COPY +#cmakedefine HAS_CLASS_MEMACCESS #cmakedefine ORT_VERSION "@ORT_VERSION@" diff --git a/onnxruntime/core/providers/cpu/tensor/gather_elements.cc b/onnxruntime/core/providers/cpu/tensor/gather_elements.cc index efe17c194a..d4172ee6f9 100644 --- a/onnxruntime/core/providers/cpu/tensor/gather_elements.cc +++ b/onnxruntime/core/providers/cpu/tensor/gather_elements.cc @@ -2,6 +2,7 @@ // Licensed under the MIT License. #include "gather_elements.h" +#include "onnxruntime_config.h" namespace onnxruntime { @@ -124,7 +125,12 @@ static std::vector parse_and_validate_indices_tensor(const Tensor* indi return indices_data; } - +#ifdef __GNUC__ +#pragma GCC diagnostic push +#ifdef HAS_CLASS_MEMACCESS +#pragma GCC diagnostic ignored "-Wclass-memaccess" +#endif +#endif template static void core_impl(const Tensor* input_tensor, const Tensor* indices_tensor, Tensor* output_tensor, int64_t axis) { @@ -203,7 +209,9 @@ static void core_impl(const Tensor* input_tensor, const Tensor* indices_tensor, } } } - +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif Status GatherElements::Compute(OpKernelContext* context) const { const Tensor* input_tensor = context->Input(0); const TensorShape& input_data_shape = input_tensor->Shape(); diff --git a/onnxruntime/core/util/gemmlowp_common.h b/onnxruntime/core/util/gemmlowp_common.h index 1744058d46..99ea341fd4 100644 --- a/onnxruntime/core/util/gemmlowp_common.h +++ b/onnxruntime/core/util/gemmlowp_common.h @@ -3,6 +3,13 @@ #pragma once #include "core/util/gemmlowp_common_wrapper.h" #include "core/platform/threadpool.h" +#include "onnxruntime_config.h" +#ifdef __GNUC__ +#pragma GCC diagnostic push +#ifdef HAS_DEPRECATED_COPY +#pragma GCC diagnostic ignored "-Wdeprecated-copy" +#endif +#endif namespace onnxruntime { @@ -62,4 +69,8 @@ void GemmlowpMultiplyu8u8_u8(const uint8_t* lhs_data, const uint8_t* rhs_data, u void GemmlowpMultiplyu8u8_s32(const uint8_t* lhs_data, const uint8_t* rhs_data, int32_t* result_data, const int lhs_offset, const int rhs_offset, int m, int n, int k, concurrency::ThreadPool*); -} // namespace onnxruntime \ No newline at end of file +} // namespace onnxruntime + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif \ No newline at end of file diff --git a/onnxruntime/core/util/gemmlowp_common_wrapper.h b/onnxruntime/core/util/gemmlowp_common_wrapper.h index 9a2386e659..0cd3cfbb7c 100644 --- a/onnxruntime/core/util/gemmlowp_common_wrapper.h +++ b/onnxruntime/core/util/gemmlowp_common_wrapper.h @@ -10,6 +10,9 @@ #ifdef HAS_IGNORED_ATTRIBUTES #pragma GCC diagnostic ignored "-Wignored-attributes" #endif +#ifdef HAS_DEPRECATED_COPY +#pragma GCC diagnostic ignored "-Wdeprecated-copy" +#endif #else #pragma warning(push) #pragma warning(disable : 4100) //'identifier' : unreferenced formal parameter