mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-09 06:30:54 +00:00
Disable armeabi builds for Android and re-enable CI builds. (#4970)
armeabi support was removed from the Android NDK so we should no longer build it. Since this fixes the Android build failures this commit also re-enables Travis Android builds. While re-enabling Android builds, some recent changes broke C++98 support so this fixes those issues as well which include: - Conditionally compiling use of move constructors, operators and std::move. - Changing sample to use flatbuffers::unique_ptr rather than std::unique_ptr. Finally, added the special "default_ptr_type" value for the "cpp_ptr_type" attribute. This expands to the value passed to the "--cpp-ptr-type" argument of flatc.
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
d840856093
commit
569492e890
@@ -1,3 +1,5 @@
|
||||
#include "flatbuffers/stl_emulation.h"
|
||||
|
||||
#include "monster_test_generated.h"
|
||||
#include "test_builder.h"
|
||||
|
||||
@@ -12,13 +14,20 @@ struct OwnedAllocator : public flatbuffers::DefaultAllocator {};
|
||||
|
||||
class TestHeapBuilder : public flatbuffers::FlatBufferBuilder {
|
||||
private:
|
||||
// clang-format off
|
||||
#if !defined(FLATBUFFERS_CPP98_STL)
|
||||
TestHeapBuilder(const TestHeapBuilder &);
|
||||
TestHeapBuilder &operator=(const TestHeapBuilder &);
|
||||
#endif // !defined(FLATBUFFERS_CPP98_STL)
|
||||
// clang-format on
|
||||
|
||||
public:
|
||||
TestHeapBuilder()
|
||||
: flatbuffers::FlatBufferBuilder(2048, new OwnedAllocator(), true) {}
|
||||
|
||||
// clang-format off
|
||||
#if !defined(FLATBUFFERS_CPP98_STL)
|
||||
// clang-format on
|
||||
TestHeapBuilder(TestHeapBuilder &&other)
|
||||
: FlatBufferBuilder(std::move(other)) { }
|
||||
|
||||
@@ -26,6 +35,9 @@ public:
|
||||
FlatBufferBuilder::operator=(std::move(other));
|
||||
return *this;
|
||||
}
|
||||
// clang-format off
|
||||
#endif // !defined(FLATBUFFERS_CPP98_STL)
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
// This class simulates flatbuffers::grpc::detail::SliceAllocatorMember
|
||||
@@ -49,12 +61,18 @@ public:
|
||||
Swap(other);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
#if !defined(FLATBUFFERS_CPP98_STL)
|
||||
// clang-format on
|
||||
GrpcLikeMessageBuilder &operator=(GrpcLikeMessageBuilder &&other) {
|
||||
// Construct temporary and swap idiom
|
||||
GrpcLikeMessageBuilder temp(std::move(other));
|
||||
Swap(temp);
|
||||
return *this;
|
||||
}
|
||||
// clang-format off
|
||||
#endif // !defined(FLATBUFFERS_CPP98_STL)
|
||||
// clang-format on
|
||||
|
||||
void Swap(GrpcLikeMessageBuilder &other) {
|
||||
// No need to swap member_allocator_ because it's stateless.
|
||||
|
||||
Reference in New Issue
Block a user