onnxruntime/cmake/patches/flatbuffers/flatbuffers.patch
Phoebe Chen 2b361c04d6
Fix Flatbuffer build issue. (#19296)
### Description

Building on g++ 13.2.0 results in -Wstringop-overread errors on Linux.
This commit addresses the flatbuffer build issue with the following
changes:
1. Remove the Werror flag in the flarbuffer patch.
2. Add a compilation option to suppress the 'stringop-overflow' error in
the Flatbuffers within the xnnpack provider.

### Motivation and Context
https://github.com/google/flatbuffers/issues/8119
https://github.com/microsoft/onnxruntime/pull/19239

Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com>
2024-01-31 10:12:43 -08:00

36 lines
1.3 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3987eac9..5e5462f1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -223,7 +223,7 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
"${CMAKE_CXX_FLAGS} -std=c++0x")
endif(CYGWIN)
set(CMAKE_CXX_FLAGS
- "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra -Werror=shadow")
+ "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Werror=shadow -Wno-error=stringop-overflow")
set(FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wold-style-cast")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.4)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
diff --git a/src/idl_gen_rust.cpp b/src/idl_gen_rust.cpp
index 55b8439b..dc03e8a8 100644
--- a/src/idl_gen_rust.cpp
+++ b/src/idl_gen_rust.cpp
@@ -406,7 +406,8 @@ class RustGenerator : public BaseGenerator {
// example: f(A, D::E) -> super::D::E
// does not include leaf object (typically a struct type).
- size_t i = 0;
+ // fix unused but set variable warning
+ //size_t i = 0;
std::stringstream stream;
auto s = src->components.begin();
@@ -417,7 +418,7 @@ class RustGenerator : public BaseGenerator {
if (*s != *d) { break; }
++s;
++d;
- ++i;
+ //++i;
}
for (; s != src->components.end(); ++s) { stream << "super::"; }