Skip to content

Commit a395148

Browse files
authored
Patch flatbuffers to fix unused variable warning that occurs with some C++ compiler versions (#1322)
1 parent e44c994 commit a395148

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

cmake/external/flatbuffers.cmake

+6-3
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ if(TARGET flatbuffers OR NOT DOWNLOAD_FLATBUFFERS)
1919
endif()
2020

2121
set(version 99aa1ef21dd9dc3f9d4fb0eb82f4b59d0bb5e4c5)
22+
set(patch_file
23+
${CMAKE_CURRENT_LIST_DIR}/../../scripts/git/patches/flatbuffers/0001-remove-unused-var.patch)
2224

2325
ExternalProject_Add(
2426
flatbuffers
2527

26-
DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR}
27-
DOWNLOAD_NAME flatbuffers-${version}.tar.gz
28-
URL https://github.com/google/flatbuffers/archive/${version}.tar.gz
28+
DOWNLOAD_COMMAND
29+
COMMAND git init flatbuffers
30+
COMMAND cd flatbuffers && git fetch --depth=1 https://github.com/google/flatbuffers.git ${version} && git reset --hard FETCH_HEAD
2931

32+
PATCH_COMMAND git apply ${patch_file} && git gc --aggressive
3033
PREFIX ${PROJECT_BINARY_DIR}
3134

3235
CONFIGURE_COMMAND ""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
From b08adb291f3ae0a2626d50eb8abecbc3a0de63d9 Mon Sep 17 00:00:00 2001
2+
3+
Date: Fri, 21 Apr 2023 14:31:06 -0400
4+
Subject: [PATCH] remove unused var
5+
6+
---
7+
src/idl_gen_rust.cpp | 2 --
8+
1 file changed, 2 deletions(-)
9+
10+
diff --git a/src/idl_gen_rust.cpp b/src/idl_gen_rust.cpp
11+
index 55b8439b..48539d52 100644
12+
--- a/src/idl_gen_rust.cpp
13+
+++ b/src/idl_gen_rust.cpp
14+
@@ -406,7 +406,6 @@ class RustGenerator : public BaseGenerator {
15+
// example: f(A, D::E) -> super::D::E
16+
// does not include leaf object (typically a struct type).
17+
18+
- size_t i = 0;
19+
std::stringstream stream;
20+
21+
auto s = src->components.begin();
22+
@@ -417,7 +416,6 @@ class RustGenerator : public BaseGenerator {
23+
if (*s != *d) { break; }
24+
++s;
25+
++d;
26+
- ++i;
27+
}
28+
29+
for (; s != src->components.end(); ++s) { stream << "super::"; }
30+
--
31+
2.40.1.606.ga4b1b128d6-goog
32+

0 commit comments

Comments
 (0)