diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index a55dfc55a9..aeb0de07ac 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -364,6 +364,8 @@ else() check_cxx_compiler_flag(-Wtautological-pointer-compare HAS_TAUTOLOGICAL_POINTER_COMPARE) check_cxx_compiler_flag(-Wcatch-value HAS_CATCH_VALUE) check_cxx_compiler_flag(-Wmissing-braces HAS_MISSING_BRACES) + check_cxx_compiler_flag(-Wignored-attributes HAS_IGNORED_ATTRIBUTES) + if(HAS_TAUTOLOGICAL_POINTER_COMPARE) #we may have extra null pointer checkings in debug build, it's not an issue string(APPEND CMAKE_CXX_FLAGS_DEBUG " -Wno-tautological-pointer-compare") diff --git a/cmake/onnxruntime_config.h.in b/cmake/onnxruntime_config.h.in index 7dd3c034fb..e3648f82a2 100644 --- a/cmake/onnxruntime_config.h.in +++ b/cmake/onnxruntime_config.h.in @@ -9,5 +9,5 @@ #cmakedefine HAS_PARENTHESES #cmakedefine HAS_NULL_DEREFERENCE #cmakedefine HAS_USELESS_CAST - +#cmakedefine HAS_IGNORED_ATTRIBUTES diff --git a/onnxruntime/core/providers/cpu/nn/conv_integer.cc b/onnxruntime/core/providers/cpu/nn/conv_integer.cc index 8f5694a0fc..8742699876 100644 --- a/onnxruntime/core/providers/cpu/nn/conv_integer.cc +++ b/onnxruntime/core/providers/cpu/nn/conv_integer.cc @@ -9,8 +9,26 @@ #include "core/providers/cpu/nn/conv_integer.h" #include "core/util/math.h" #include "core/util/math_cpuonly.h" +#include "onnxruntime_config.h" +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#ifdef HAS_IGNORED_ATTRIBUTES +#pragma GCC diagnostic ignored "-Wignored-attributes" +#endif +#else +#pragma warning(push) +#pragma warning(disable : 4100) //'identifier' : unreferenced formal parameter +#endif + #include "public/gemmlowp.h" +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#else +#pragma warning(pop) +#endif + namespace onnxruntime { namespace contrib { Status ConvInteger::Compute(OpKernelContext* context) const { @@ -146,5 +164,5 @@ ONNX_OPERATOR_KERNEL_EX( .TypeConstraint("T2", DataTypeImpl::GetTensorType()) .TypeConstraint("T3", DataTypeImpl::GetTensorType()), ConvInteger); -} +} // namespace contrib } // namespace onnxruntime