Skip to content

Commit

Permalink
ARROW-15388: [C++] Avoid including absl from flatbuffers
Browse files Browse the repository at this point in the history
There may be an incomplete/broken copy of the Abseil library lying around
(for example because of a race condition while installing it as a bundled library).

Since absl is only used by Flatbuffers to provide a string_view facility,
use our own vendored string_view instead.

Closes #12204 from pitrou/ARROW-15388-flatbuffers-string-view

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
  • Loading branch information
pitrou committed Jan 20, 2022
1 parent a3efe72 commit 22dc537
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 7 deletions.
42 changes: 42 additions & 0 deletions cpp/thirdparty/flatbuffers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!---
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

This directory contains a vendored version of Flatbuffers
(unknown changeset), with the following patch for ARROW-15388:

```diff
diff --git a/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h b/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h
index 955738067..fccce42f6 100644
--- a/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h
+++ b/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h
@@ -212,13 +212,6 @@ namespace flatbuffers {
typedef std::experimental::string_view string_view;
}
#define FLATBUFFERS_HAS_STRING_VIEW 1
- // Check for absl::string_view
- #elif __has_include("absl/strings/string_view.h")
- #include "absl/strings/string_view.h"
- namespace flatbuffers {
- typedef absl::string_view string_view;
- }
- #define FLATBUFFERS_HAS_STRING_VIEW 1
#endif
#endif // __has_include
#endif // !FLATBUFFERS_HAS_STRING_VIEW
```
7 changes: 0 additions & 7 deletions cpp/thirdparty/flatbuffers/include/flatbuffers/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,6 @@ namespace flatbuffers {
typedef std::experimental::string_view string_view;
}
#define FLATBUFFERS_HAS_STRING_VIEW 1
// Check for absl::string_view
#elif __has_include("absl/strings/string_view.h")
#include "absl/strings/string_view.h"
namespace flatbuffers {
typedef absl::string_view string_view;
}
#define FLATBUFFERS_HAS_STRING_VIEW 1
#endif
#endif // __has_include
#endif // !FLATBUFFERS_HAS_STRING_VIEW
Expand Down

0 comments on commit 22dc537

Please sign in to comment.