Ignore some gcc warnings (#1996)

This commit is contained in:
Changming Sun 2019-10-07 16:32:34 -07:00 committed by GitHub
parent ea60469af5
commit 8f7657fa32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 3 deletions

View file

@ -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()

View file

@ -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@"

View file

@ -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<int64_t> 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<bool is_string, typename T>
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<Tensor>(0);
const TensorShape& input_data_shape = input_tensor->Shape();

View file

@ -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
} // namespace onnxruntime
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

View file

@ -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