emkornfield [Thu, 9 Jan 2020 18:56:35 +0000 (10:56 -0800)]
Document JSON compatibility guarantees. (#5704)
https://github.com/google/flatbuffers/issues/5688
Vladimir Glavnyy [Mon, 6 Jan 2020 23:26:41 +0000 (06:26 +0700)]
Add CMake 'generated_code' target to simplify resolution of build dependencies (#5697)
Michael Beardsworth [Mon, 6 Jan 2020 18:00:59 +0000 (10:00 -0800)]
(Optionally) add an additional suffix namespace to generated fbs files. (#5698)
This change allows for the generation of fbs files (from proto) that
don't contain name collisions with the protobuf generated C++ code,
allowing both the proto and fbs message types to be linked into the same binary.
dreifachstein [Mon, 6 Jan 2020 17:28:19 +0000 (01:28 +0800)]
[Java] Replace Table.UTF8_CHARSET with StandardCharsets.UTF_8 (#5696)
StandardCharsets.UTF_8 is already used in FlexBuffersBuilder.
Robert Winslow [Thu, 2 Jan 2020 21:34:47 +0000 (13:34 -0800)]
Rust: Temporarily disable 2 endianness unit tests (#5695)
Rare failures occur on AppVeyor in these functions; the failures appear
spurious.
David P. Sicilia [Thu, 2 Jan 2020 18:12:14 +0000 (13:12 -0500)]
[C++17] Add Traits class for Tables and Factory function within it. (#5678)
* Include flattests_cpp17 in unit tests when C++17 build is enabled.
* [C++17] Generate generic table factory function.
1. For each table, generate a convenient free-standing factory
function that allows creating the table in a generic way by
specifying only the type. This is the first change in a series
of changes to make Flatbuffers generated C++ code more friendly
to code bases that make use of C++ template metaprogramming
techniques to manage the serialization process. Example:
Before :(
// The name of the Flatbuffers type (and namespace) must
// be hard-coded when writing the factory function.
auto monster = MyGame::Example::CreateMonster(fbb, ...);
After :)
using type_to_create = MyGame::Example::Monster;
// No namespace needed on CreateByTagType.
auto monster = CreateByTagType((type_to_create*)nullptr,
fbb, ...);
This feature requires building with C++14 or greater, and thus
it is guarded behind --cpp-std >= c++17 in the flatbuffers C++
generator.
2. Fix a CMake bug to include C++17 unit tests in test suite.
* [C++17] Replace standalone variadic factory function with type_traits.
Add a `type_traits` to each table class. This `type_traits` can be
populated with various compile-time info about the table. Initially,
we have the Create* function and type, but is extensible in the future.
* Remove empty line and fix stale comments.
* Rename type_traits to Traits and move fwd declaration.
* Fix parameter evaluation order issue and use lambda for scope.
Wouter van Oortmerssen [Thu, 2 Jan 2020 16:49:57 +0000 (08:49 -0800)]
Removed code_generators.cpp from library targets
Change-Id: Ia6e032a77983bf1838b8675f51d1c910acc991d8
Max Burke [Tue, 31 Dec 2019 18:28:58 +0000 (10:28 -0800)]
[rust] Make enum names public (#5690)
* Bugfix for Rust generation of union fields named with language keywords
Looking at ParseField, it appears that in the case of unions, an extra field with a `UnionTypeFieldSuffix` is added to the type definition, however, if the name of this field is a keyword in the target language, it isn't escaped.
For example, if generating code for rust for a union field named `type`, flatc will generate a (non-keyword escaped) field named `type_type` for this hidden union field, and one (keyword escaped) called `type_` for the actual union contents.
When the union accessors are generated, they refer to this `type_type` field, but they will escape it mistakenly, generating code like this:
```
#[inline]
#[allow(non_snake_case)]
pub fn type__as_int(&self) -> Option<Int<'a>> {
if self.type__type() == Type::Int {
self.type_().map(|u| Int::init_from_table(u))
} else {
None
}
}
```
Which will fail to build because the field is called `self.type_type()`, not `self.type__type()`.
* [Rust] Add crate-relative use statements for FBS includes.
At present if a flatbuffer description includes a reference to a type in
another file, the generated Rust code needs to be hand-modified to add
the appropriate `use` statements.
This assumes that the dependencies are built into the same crate, which
I think is a reasonable assumption?
* Revert "[Rust] Add crate-relative use statements for FBS includes."
This reverts commit
d554d79fecf5afd6da6fb993b30b4cd523a5889a.
* Address comments raised in PR
* Update documentation comments per feedback
* Fix typo
* [rust] Make enum variant names public.
* Update generated test files
* Add test for public enum names
Michael Beardsworth [Mon, 30 Dec 2019 18:34:01 +0000 (10:34 -0800)]
Correct inverted logic around include prefixes. (#5689)
4d1a9f8d9eab9fc6762e03cd862576965a0c6920 inverted the logic around
keeping the include prefix. This change fixes the error.
lu-wang-g [Fri, 27 Dec 2019 02:42:11 +0000 (18:42 -0800)]
Optimize Pack method using numpy (#5662)
Add the support to pack using numpy for scalar vectors when numpy is available.
Austin Schuh [Thu, 26 Dec 2019 22:56:46 +0000 (14:56 -0800)]
[C++] Add Builder and Table typedefs (#5685)
* Add Builder and Table typedefs
This gives us a way to use templates to go from a builder to a table
and back again without having to pass both types in.
* Fix tests/cpp17/generated_cpp17/monster_test_generated.h
Wouter van Oortmerssen [Thu, 26 Dec 2019 20:24:20 +0000 (12:24 -0800)]
Minor doc updates: FlexBuffers C#, Discord, CppUsage.
Change-Id: Ie34ff580eb2f41ff35f85271b10865f4a14d0dca
Austin Schuh [Thu, 26 Dec 2019 18:07:15 +0000 (10:07 -0800)]
Upgrade rules_go (#5684)
This should help with #5672 if I'm reading the report back from
buildkite properly.
Austin Schuh [Thu, 26 Dec 2019 18:03:22 +0000 (10:03 -0800)]
Fix --incompatible_load_cc_rules_from_bzl (#5683)
Incompatible flag --incompatible_load_cc_rules_from_bzl will break
FlatBuffers once Bazel 1.2.1 is released.
Fixes #5671
Austin Schuh [Thu, 26 Dec 2019 18:02:24 +0000 (10:02 -0800)]
Add support for absl::string_view when available (#5682)
For C++11 platforms, absl::string_view is sometimes available. This can
be used for string_view when std::string_view is not available.
Austin Schuh [Thu, 26 Dec 2019 17:58:48 +0000 (09:58 -0800)]
[Bazel] Add support for compatible_with and restricted_to (#5681)
* Add support for compatible_with and restricted_to
These attributes have been available in Bazel for years. Pass them
through so the flatbuffer rules can be used with them. They let you
constrain which target platform is used.
While we are here, fix gen_reflections to work with bazel.
* Add docs
Robert Winslow [Tue, 24 Dec 2019 07:14:55 +0000 (02:14 -0500)]
CI: New Docker tests for Python with numpy (#5677)
* New Docker tests for Python with numpy
* print numpy status in test suite
Wouter van Oortmerssen [Tue, 24 Dec 2019 01:35:54 +0000 (17:35 -0800)]
Fixed struct initialization error on older versions of C#
"'this' object cannot be used before all of its fields are assigned to"
Change-Id: Icccdcc0d0be0fe0b87abe0eb28fe1cc91116fcfb
Wouter van Oortmerssen [Tue, 24 Dec 2019 01:11:57 +0000 (17:11 -0800)]
Fixed warnings in FlexBuffers.java
- Missing return statement <- bug!
- Missing hashCode function.
Change-Id: I6333cac72adf8ead92ab2e6c7215650ce4571a73
Wouter van Oortmerssen [Mon, 23 Dec 2019 22:01:41 +0000 (14:01 -0800)]
Fixed out of date licenses on gRPC Python files.
Change-Id: Ia6c3bf5d7da795db46c0baa8e9c7591de3400517
Wouter van Oortmerssen [Mon, 23 Dec 2019 20:32:52 +0000 (12:32 -0800)]
Removed test proto output.
Change-Id: Iaf64bec068d03dd1b75670e9a28dde7392ebddb5
Vladimir Glavnyy [Mon, 23 Dec 2019 20:13:48 +0000 (03:13 +0700)]
Add flatc '--cpp_std' switch (#5656)
* Add flatc '--cpp_std' switch and sandbox for C++17 code generator
- Added 'flac --cpp_std legacy' for compatibility with old compilers (VS2010);
- Added experimental switch 'flac --cpp_std c++17' for future development;
- Added C++17 sandbox test_cpp17.cpp;
- C++ code generator generates enums with explicit underlying type to avoid problems with the forward and backward schema compatibility;
- Adjusted CMakeLists.txt, CI and generate code scripts to support of introduced '--cpp_std';
* Fix --cpp_std values: c++0x, c++11, c++17
* Add 'cpp::CppStandard' enum
* Add testing engine into test_cpp17
* Rebase to upstream/master
* Set default '--cpp-std C++0x'
* Fix code generation (--cpp_std C++11) in CMakeLists.txt
- Fix dependency declaration of grpctest target
* Revert --cpp-std for the tests from explicit C++11 to flatc default value (C++0x)
Wouter van Oortmerssen [Mon, 23 Dec 2019 19:12:41 +0000 (11:12 -0800)]
Fix for FlexBuffers FBT_VECTOR_STRING size bit-width.
For details, test.cpp/FlexBuffersDeprecatedTest(), and also
https://github.com/google/flatbuffers/issues/5627
Change-Id: I6e86e1138a5777e31055cfa2f79276d44732efbc
stefan301 [Mon, 23 Dec 2019 17:08:35 +0000 (18:08 +0100)]
Added Check to VerifyAlignment (#5675)
* Added missing EndTable() call to VerifyObject()
VerifyObject called VerifyTableStart() but not EndTable(). This made Verifier::VerifyComplexity() increase depth_ with each table, not with the depth of tables.
https://groups.google.com/forum/#!topic/flatbuffers/OpxtW5UFAdg
* Added Check to VerifyAlignment
https://stackoverflow.com/questions/
59376308/flatbuffers-verifier-returns-false-without-any-assertion-flatbuffers-debug-veri
Michael Beardsworth [Mon, 23 Dec 2019 16:50:29 +0000 (08:50 -0800)]
Improve import handling for proto conversion (#5673)
* Keep include prefix when converting from proto.
This change preserves the include prefix when generating flatbuffers
from proto (with FBS_GEN_INCLUDES) defined.
* Improve handling of imports in proto conversion.
Previously, there was no runtime flag to make proto->fbs conversion keep
the import structure of a collection of files. This change makes proto
conversion respect the --no-gen-includes flag and skip the output of
"generated" symbols.
Light Lin [Wed, 18 Dec 2019 19:23:54 +0000 (03:23 +0800)]
[Dart] Fix prepare space for writeListInt64 and writeListUint64 (#5654)
* Fix prepare space for writeListInt64 and
writeListUint64
* Fix align issues
Matt Brubeck [Tue, 17 Dec 2019 20:18:59 +0000 (12:18 -0800)]
Make Rust constants public (#5659)
* Make Rust constants public
Otherwise they cannot be accessed by code that consumes the generated
bindings.
* Re-generate test code
* Add a test for enum constants
cryptocode [Tue, 17 Dec 2019 17:11:26 +0000 (18:11 +0100)]
Add namespace qualification to union types (#5666)
Max Burke [Sun, 15 Dec 2019 23:18:22 +0000 (15:18 -0800)]
Bugfix for Rust generation of union fields named with language keywords (#5592)
* Bugfix for Rust generation of union fields named with language keywords
Looking at ParseField, it appears that in the case of unions, an extra field with a `UnionTypeFieldSuffix` is added to the type definition, however, if the name of this field is a keyword in the target language, it isn't escaped.
For example, if generating code for rust for a union field named `type`, flatc will generate a (non-keyword escaped) field named `type_type` for this hidden union field, and one (keyword escaped) called `type_` for the actual union contents.
When the union accessors are generated, they refer to this `type_type` field, but they will escape it mistakenly, generating code like this:
```
#[inline]
#[allow(non_snake_case)]
pub fn type__as_int(&self) -> Option<Int<'a>> {
if self.type__type() == Type::Int {
self.type_().map(|u| Int::init_from_table(u))
} else {
None
}
}
```
Which will fail to build because the field is called `self.type_type()`, not `self.type__type()`.
* [Rust] Add crate-relative use statements for FBS includes.
At present if a flatbuffer description includes a reference to a type in
another file, the generated Rust code needs to be hand-modified to add
the appropriate `use` statements.
This assumes that the dependencies are built into the same crate, which
I think is a reasonable assumption?
* Revert "[Rust] Add crate-relative use statements for FBS includes."
This reverts commit
d554d79fecf5afd6da6fb993b30b4cd523a5889a.
* Address comments raised in PR
* Update documentation comments per feedback
* Fix typo
FujiZ [Fri, 13 Dec 2019 18:14:14 +0000 (02:14 +0800)]
wrap multiple statements in do {} while(!IsConstTrue(true)) (#5655)
Gautham B A [Mon, 9 Dec 2019 18:28:31 +0000 (23:58 +0530)]
[gRPC] Uncomment MessageBuilder (#5658)
The line where the MessageBuilder was
constructed was commented out (perhaps
an oversight).
Björn Harrtell [Mon, 9 Dec 2019 18:06:04 +0000 (19:06 +0100)]
Supress unsigned-integer-overflow for PaddingBytes (#5647)
cryptocode [Fri, 6 Dec 2019 01:33:45 +0000 (02:33 +0100)]
Add --force-empty-vectors option (#5653)
The rationale for this option is that JSON clients typically want empty arrays (i.e [] in the JSON) instead of missing properties, but not empty strings when the value isn't set.
--force-empty is kept as-is, i.e. it will force both empty strings and vectors.
Closes #5652
Wouter van Oortmerssen [Thu, 5 Dec 2019 22:28:02 +0000 (14:28 -0800)]
Fixed enum min/max values not properly escaped.
Change-Id: I503fbfaff1d2579807ca71a07cca8363dff75e52
bttk [Mon, 2 Dec 2019 22:14:48 +0000 (14:14 -0800)]
Split Bazel targets into multiple packages (#5640)
* Split Bazel targets into multiple packages
* Merge /include/BUILD back into /BUILD
Google AutoFuzz Team [Mon, 2 Dec 2019 22:13:28 +0000 (17:13 -0500)]
Remove a static_assert (#5643)
Having a static_assert on MSAN and ASAN prevents
the fuzzers from being used with different engines,
like TSAN, UBSAN, … but also with fuzzers that aren't
using MSAN/ASAN like afl for example.
lu-wang-g [Mon, 2 Dec 2019 22:11:28 +0000 (14:11 -0800)]
Flatbuffers Python Object API (#5616)
* Flatbuffers Python Object API
Implement the logic to generate the Python object API that can
unpack the data from a buf class into an object class, and pack
the data of an object class to a buf class.
* Fix the build issues
Remove unused parameters and replace auto in the for-loop statement
with std::string to make it compatible with VS2010.
* Fix the build issues.
* Add support for Array type
Added logic to handle Array type in Python Object API. Updated the
generated code accordingly.
* Fix the old style casting from int to char
* Fixed another conversion from int to char
* Fixed the import for typing
Importing typing may cause errors when a machine do not have the
moduel typing installed. This PR fixes the issue by guarding
"import typing" with the "try/except" statement.
* Fix issue of iterating the vector of import list
* Update the generated examples using generate_code.sh
* Fix the import order for typing
The import list was stored in unordered_set, so that each generated
codes may have different import order. Therefore, it failed in the
consistency test where two generated copies need to have exactly the
same apperance.
* Optimize unpack using numpy
Use numpy to unpack vector whenever it is possible to improve unpack
performance.
Also, added codegen command for Python specificly in generate_code.sh,
because --no-includes cannot be turn on for Python.
* Fix the import order
* Update generate_code.bat for windows accordingly
* Replace error message with pass
Avoid printing error message for every Python2 users about typing.
Replace it with pass.
Ivan Shynkarenka [Mon, 2 Dec 2019 22:10:09 +0000 (01:10 +0300)]
[Clang 10]: definition of implicit copy constructor for 'TableKeyComparatoris deprecated #5649 (#5650)
nilsocket [Mon, 2 Dec 2019 22:01:25 +0000 (22:01 +0000)]
[docs]: add missing semicolon (#5648)
Add missing semicolon for table field.
Tiago Silva [Tue, 26 Nov 2019 20:25:36 +0000 (20:25 +0000)]
[GO] Fix support for enums with underscores and Unions with imported members (#5600)
* Fix Enum Stringer method when Enum has underscores
Fixes #5481
* Fix go package importing itself when Union has imported members.
Vladimir Glavnyy [Mon, 25 Nov 2019 20:56:47 +0000 (03:56 +0700)]
Fix ambiguity of a type deduction in TEST_EQ macro if arguments have `enum class` type. (#5630)
Vladimir Glavnyy [Mon, 25 Nov 2019 20:54:59 +0000 (03:54 +0700)]
Simplify declarations of x-macro FLATBUFFERS_TD (#5638)
FujiZ [Mon, 25 Nov 2019 20:52:42 +0000 (04:52 +0800)]
read vtable size through ReadScalar() (#5636)
Derek Bailey [Thu, 21 Nov 2019 18:25:31 +0000 (10:25 -0800)]
Changed null checks in test. Removed verifier pointer usage (#5634)
Vladimir Glavnyy [Mon, 18 Nov 2019 20:16:41 +0000 (03:16 +0700)]
Add testing of C++ with sanitizers (CI-Docker) (#5631)
* Add C++ build testing with clang and gcc
This adds Dockerfiles which test building flatc and the C++ library against clang
and gcc. See discussion at #5119. It is derived from the Travis CI tooling.
The GRPC tests are failing due to #5099 so those are commented out.
These are run from the .travis.yml file rather than the tests/docker/languages
folder because the builds may each take longer than 30 minutes and were hitting
Travis timeouts.
Parallel builds and build caching attempt to keep the build times low.
* Add GCC 8.3 and Clang 7.0 with sanitizers into CI (based on #5130)
- Add a docker based on Debian Buster.
- Add C++ building scripts for the docker.
- Leak-sanitizer requires SYS_PTRACE.
FujiZ [Mon, 18 Nov 2019 20:02:14 +0000 (04:02 +0800)]
add namespace prefix in FLATBUFFERS_MAX_BUFFER_SIZE (#5629)
Malar Kannan [Fri, 15 Nov 2019 00:58:35 +0000 (06:28 +0530)]
Support for python grpc - continuing the work from the pull request #4270 #4705 (#5613)
* Support for python grpc
* add few fixes
* Fixes build
* Fix python generator
* Add tests
* Fix grpc python test
* Fix tests and add incomplete python generator
* Fix python generator
* Add python generator methods
* Fix Appveyor build
* grpc python support v0.1
* Update tests
* update grpctest
* Remove duplicated code and fix a brace
* tests for flatbuffers grpc python
* Updated tests + removed SerializeToString, From String
* remove pickle import
* include missing files in ci - BUILD and generated test result
Derek Bailey [Thu, 14 Nov 2019 23:47:58 +0000 (15:47 -0800)]
Removed idl_gen_general.cpp and move contents to code_generators.cpp (#5625)
Derek Bailey [Thu, 14 Nov 2019 23:46:47 +0000 (15:46 -0800)]
Lua cleanup (#5624)
Derek Bailey [Thu, 14 Nov 2019 23:44:18 +0000 (15:44 -0800)]
[C++] Adds basic schema evolution tests (#5611)
* Added basic schema evolution tests
* Add BUILD targets for evolution tests. Added to test/generate_code scripts
* Use vector.front() instead of vector.data()
* Added --scoped-enums option for evolution test
Derek Bailey [Mon, 11 Nov 2019 19:37:55 +0000 (11:37 -0800)]
[C++, C#, Java] Separated C# and Java generators into their own classes (#5618)
* Cloned idl_gen_general.cpp to idl_gen_csharp.cpp and removed java references
* Java generator changes
Dmitry [Mon, 11 Nov 2019 19:33:27 +0000 (22:33 +0300)]
add check for root_type specified for json schema generation (#5622)
messense [Mon, 11 Nov 2019 17:52:26 +0000 (01:52 +0800)]
[Rust] Bump smallvec version to 1.0 (#5621)
See https://github.com/servo/rust-smallvec/pull/175 for changelog.
Derek Bailey [Mon, 11 Nov 2019 17:29:37 +0000 (09:29 -0800)]
Ran src/clang-format-all.sh (#5617)
Wouter van Oortmerssen [Thu, 7 Nov 2019 22:35:42 +0000 (14:35 -0800)]
Improved pull request & clang-format instructions.
Change-Id: Ia439bcc61bac5788792244d10e573b1fba54b347
Derek Bailey [Thu, 7 Nov 2019 22:10:41 +0000 (14:10 -0800)]
Change monster_extra generation to use flatbuffers::unique_ptr (#5612)
Derek Bailey [Thu, 7 Nov 2019 20:22:54 +0000 (12:22 -0800)]
[C++] Refactor to conform to Google C++ style guide (#5608)
* Automatic refractor of C++ headers to Google C++ style guide
* Automatic refractor of C++ source to Google C++ style guide
* Automatic refractor of C++ tests to Google C++ style guide
* Fixed clang-format issues by running clang-format twice to correct itself. Kotlin was missing clang-format on after turning it off, so it was changed,
Wouter van Oortmerssen [Tue, 5 Nov 2019 01:23:01 +0000 (17:23 -0800)]
Fixed deprecated method in GRPC Java test.
Change-Id: Iccae8fe9409adbf3cd3013a5cf3368e068175ad3
Wouter van Oortmerssen [Tue, 5 Nov 2019 01:15:56 +0000 (17:15 -0800)]
Fixed Apache license not using canonical version.
Now identical to https://www.apache.org/licenses/LICENSE-2.0.txt
Change-Id: I6eab8bdee2472107dfc72265e204fdd16f3abc2e
Even Rouault [Mon, 4 Nov 2019 22:58:51 +0000 (23:58 +0100)]
include/flatbuffers/base.h: fix no_sanitize issue with old clang (#5610)
Older clang versions raise:
```
./flatbuffers/base.h:365:1: error: unknown attribute 'no_sanitize' ignored [-Werror,-Wattributes]
__supress_ubsan__("alignment")
^
./flatbuffers/base.h:246:50: note: expanded from macro '__supress_ubsan__'
#define __supress_ubsan__(type) __attribute__((no_sanitize(type)))
^
```
Comparing https://releases.llvm.org/3.6.0/tools/clang/docs/AttributeReference.html
with https://releases.llvm.org/3.7.0/tools/clang/docs/AttributeReference.html
shows that __attribute__((no_sanitize(type))) is available since 3.7.0
Derek Bailey [Mon, 4 Nov 2019 22:54:44 +0000 (14:54 -0800)]
[C++, Java, C#, TypeScript, JavaScript] Skip generation of mutable union types (#5599)
* Skip generation of mutable union types
* Removed C# and Java unit tests that mutated a Union type
Even Rouault [Mon, 4 Nov 2019 22:28:33 +0000 (23:28 +0100)]
flatbuffers.h: fix documentation warning (#5607)
Fixes following clang -Wdocumentation warning:
```
flatbuffers.h:1762:17: error: parameter ']' not found in the function declaration [-Werror,-Wdocumentation]
/// @param[in]] v A const reference to the `std::vector` of structs to
```
Derek Bailey [Mon, 4 Nov 2019 22:27:59 +0000 (14:27 -0800)]
Add Lua FlatbufferBuilder Clean() method to enable reuseable builders (#5606)
Paulo Pinheiro [Mon, 4 Nov 2019 22:25:07 +0000 (23:25 +0100)]
[Kotlin] Fix union vector accessor after change in Java API (#5605)
Kolin uses java library as dependency, which changed the way it access union vector recently
(
e365c502ffc659752f9b7a8d60b0052a07e33659).
This changes updates kotlin code generation to match Java's changes.
Paulo Pinheiro [Mon, 4 Nov 2019 22:23:15 +0000 (23:23 +0100)]
[flatc] Remove an always true condition for flexbuffers (#5604)
The condition was unnecessary and Detected by
PVS-Studio
V560 [CWE-571] A part of conditional expression is always true: !opts.use_flexbuffers. flatc.cpp 438
Lawrence Chan [Mon, 4 Nov 2019 20:12:25 +0000 (14:12 -0600)]
[Go] Add UnPackTo functions (#5598)
iceboy [Thu, 31 Oct 2019 18:13:45 +0000 (11:13 -0700)]
[Go] Object API support (#5339)
* start
* works for current usages!
* unpack: vector of struct
* optimize byte slice
* support nested struct
* support null table
* support struct
* support union
* update generated code
* grumble
* fix compiler warning
* update generated code
* wrap type in namespace
* bug
* wrap in namespace
* enum byte arrays
* generate struct for unions
* basic testing
* remove branching
* fix assert
* pack vector of fixed structs correctly
* omit null vectors
* Refactor Union Pack and UnPack methods
Remove append usage to increase code efficiency when dealing with large vectors
* generate goldens
Mathias Svensson [Mon, 28 Oct 2019 18:19:47 +0000 (19:19 +0100)]
Rust: Add idiomatic iterator for Vector type (#5579)
* Rust: Add idiomatic iterator for Vector type
* Add comments explaining some implementation details
Even Rouault [Mon, 28 Oct 2019 17:02:46 +0000 (18:02 +0100)]
Fix typos in comments (#5590)
Found by the https://github.com/OSGeo/gdal/blob/master/gdal/scripts/fix_typos.sh
script on the internal copy of flatbuffers inside GDAL
Derek Bailey [Mon, 28 Oct 2019 16:43:33 +0000 (09:43 -0700)]
C++ verifier for evolved union fields should return true (#5586)
Derek Bailey [Mon, 28 Oct 2019 16:30:31 +0000 (09:30 -0700)]
Add ByteBuffer copy for vector of bytes in Java (#5587)
Mathias Svensson [Mon, 28 Oct 2019 04:20:29 +0000 (05:20 +0100)]
Rust: Fix Copy and Clone impls for a few generic types (#5577)
* Rust: Fix Copy and Clone impls for a few generic types
* Add tests for Copy+Clone
* Wrap Copy+Clone checks in a #[test] function
Vladimir Glavnyy [Mon, 21 Oct 2019 17:11:32 +0000 (00:11 +0700)]
Add `--clean-first` to the cmake-build command (travis) (#5574)
- `--clean-first` runs `clean` target to remove previously generated files
- missed `monster_extra_generated.h` file added to the `flattests` target
StackDoubleFlow [Sun, 20 Oct 2019 03:24:13 +0000 (22:24 -0500)]
Fix Follow implementation for bool (#5554)
Vladimir Glavnyy [Fri, 18 Oct 2019 17:16:55 +0000 (00:16 +0700)]
Fix issue #5557 (#5573)
- remove not necessary file `monster_test_generated.h` from sample_bfbs.cpp
Björn Harrtell [Thu, 17 Oct 2019 22:47:51 +0000 (00:47 +0200)]
Avoid intentional unsigned integer overflow getting caught by sanitizers (#5572)
* Avoid intentional unsigned integer overflow getting caught by sanitizers
* Adapt from suggested compiler compatible solution
* And a third way :)
Bharat Tak [Thu, 17 Oct 2019 22:25:05 +0000 (00:25 +0200)]
Python: Add forceDefaults opt to python Builder (#5564)
* Add forceDefaults opt to python Builder
* Add test functions for force_default option for python builder
* Simplify
* Add force default test for UOffsetTFlags
Jacek Surazski [Thu, 17 Oct 2019 22:23:15 +0000 (15:23 -0700)]
Java: Don't annotate vector-of-tables item getters with @nullable. (#5562)
* Annotate getters with @Pure when --java-checkerframework is specified.
Together with @Nullable, this allows users to use static analysis tools
like CheckerFramework to catch NPEs caused by unset fields.
* Don't annotate vector-of-tables item getters with @Nullable.
Since Flatbuffers don't support null items in vectors of tables.
Wouter van Oortmerssen [Thu, 17 Oct 2019 22:16:00 +0000 (15:16 -0700)]
Fixed warnings generated by recent JSON sorting feature.
Change-Id: I6fd6283b616c7a39bb878b1610e4ddf6e208fa0a
Idan Sheinberg [Thu, 17 Oct 2019 22:11:33 +0000 (01:11 +0300)]
[Java] byte buffer factory returned buffer capcity is used instead of the requested size (#5558)
* byte buffer factory returned buffer is used instead of the requested capacity
* byte buffer factory returned buffer is used instead of the requested capacity
* Comment fix
tira-misu [Thu, 17 Oct 2019 21:22:21 +0000 (23:22 +0200)]
#5544 Fix of Array of table is not sorted if Create<type>Direct() is used (#5546)
* Fix C/C++ Create<Type>Direct with sorted vectors
If a struct has a key the vector has to be sorted. To sort the vector
you can't use "const".
* Changes due to code review
* Improve code readability
Brian Harris [Tue, 15 Oct 2019 17:56:58 +0000 (12:56 -0500)]
Fix build with gcc version 7.4.0 (#5570)
Wouter van Oortmerssen [Thu, 10 Oct 2019 22:24:54 +0000 (15:24 -0700)]
Fixed JSON parser not sorting vectors of tables/structs with key.
Change-Id: Iacc0c8513af80a736700e6cbaf513ebdf8e3ac89
Paulo Pinheiro [Thu, 3 Oct 2019 22:56:29 +0000 (00:56 +0200)]
[FlexBuffers][Java] Cache size of Sized objects in FlexBuffers (#5551)
In my benchmarks it shows deserialization performance improvements of
around 7%
Paulo Pinheiro [Mon, 30 Sep 2019 21:05:19 +0000 (23:05 +0200)]
Fix issue #5542 (#5543)
Empty objects that inherit from Sized would try to access internal
ByteBuffer when Sized::size was called. So we add a single byte in
the empty buffer, so when size() is called it would return 0
Wouter van Oortmerssen [Mon, 30 Sep 2019 19:12:36 +0000 (12:12 -0700)]
Fixed Android STLPort related error.
Change-Id: I59ff072e526fc63b3215767a4d4a2a8944b65654
Jack Zhou [Mon, 30 Sep 2019 18:50:03 +0000 (14:50 -0400)]
Fix namespaced struct/field name collision detection (#5540) (#5545)
Changes the use of `LookupStruct` to `LookupCreateStruct` in
`ParseField` to also detect when collisions happen in namespaces.
Paulo Pinheiro [Thu, 26 Sep 2019 22:06:11 +0000 (00:06 +0200)]
[flac] Add FlexBuffers option for generating data (#5519)
Alongside --binary and --json, an additional
switch (--flexbuffers) can be passed to convert
data using FlexBuffers
Robert Winslow [Thu, 26 Sep 2019 21:31:11 +0000 (14:31 -0700)]
Update Rust versions under test from 1.30.1 to 1.37.0 (#5538)
Fixes build errors from using newer crate versions with an old Rust version.
mjvk [Thu, 26 Sep 2019 16:40:14 +0000 (18:40 +0200)]
Adds XOPEN_SOURCE for PATH_MAX and POSIX 1993 for stat (#5529)
* Adds XOPEN_SOURCE for PATH_MAX and POSIX 1993 for stat
These are the only two required extension for compilation of
flatbuffers using -std=c++11 instead of gnu++11.
* Sets _XOPEN_SOURCE to 600 and enable POSIX2001 for fseeko
Paulo Pinheiro [Wed, 25 Sep 2019 21:14:39 +0000 (23:14 +0200)]
[FlexBuffers][Java] Add override Key::toString (#5533)
Paulo Pinheiro [Wed, 25 Sep 2019 18:59:10 +0000 (20:59 +0200)]
[FlexBuffers][Java] Fix wrong access to a string using Reference::asString(). (#5532)
The real position of a string is calculated by using the indirect() method,
which should be based on parentWidth and not byteWidth, as it was implemented.
We are also fixing the flag BUILDER_FLAG_SHARE_STRINGS on FlexBuffersBuilder
that was set as '1', same value as BUILDER_FLAG_SHARE_KEYS.
Vladimir Glavnyy [Mon, 23 Sep 2019 16:31:51 +0000 (23:31 +0700)]
Fix Mutate() methods of Array<scalar/struct> (override 5508) (#5526)
* Draft with Array specialization (#5508)
* Array specialization + SFINAE to fold copy-paste (#5508)
* Add implicit specialization of Array<scalar> and Array<struct> (#5508)
- Tag dispatching is used for implicit specialization
- Array<scalar> and Array<struct> have different iterators and accessors
- Array<scalar> and Array<struct> have different Mutate() methods
* Add implicit specialization of Array<scalar> and Array<struct> (#5508)
- Tag dispatching is used for implicit specialization
- Array<scalar> and Array<struct> have different iterators and accessors
- Array<scalar> and Array<struct> have different Mutate() methods
Kulikov Alexey [Mon, 23 Sep 2019 16:22:43 +0000 (23:22 +0700)]
Java: Added access object for vector of struct and vector of tables. (#5233)
* Java: Added access object for vector of struct and vector of tables.
* Java: Workarounds removed when accessing the union vector.
mmoscicki2 [Thu, 19 Sep 2019 17:32:24 +0000 (19:32 +0200)]
Fixed DetachedBuffer self move assignment (#5521)
Austin Schuh [Thu, 19 Sep 2019 16:58:36 +0000 (09:58 -0700)]
Fix buildifier warnings found in new bazel (#5517)
Fixes warnings caught in:
https://buildkite.com/bazel/flatbuffers/builds/863#
cff87e1d-b976-4734-8157-
4b6d88c7b5e1
Wouter van Oortmerssen [Tue, 17 Sep 2019 00:48:54 +0000 (17:48 -0700)]
Fixed Reflection Verifier not handling vectors of unions.
Change-Id: Ie94386ff8e10fd2a964bd9155139b50953746a37
Wouter van Oortmerssen [Mon, 16 Sep 2019 21:43:35 +0000 (14:43 -0700)]
Fixed GenerateText not handling vectors of unions.
Change-Id: Ie82abaf178495c4692e7d10be6b4a13f2fa1bee6
Kevin Fort [Wed, 11 Sep 2019 00:07:46 +0000 (19:07 -0500)]
Add element size parameter to __vector_as_arraysegment [c#] (#5512)
* Add element size parameter to __vector_as_arraysegment
Add element size parameter to __vector_as_arraysegment fixing issue where VectorAsBytes returns incorrect size span for multibyte element types.
* Update codegen
Update codegen and Table to return typed span.
* update test files
update test files
Paulo Pinheiro [Tue, 10 Sep 2019 17:06:47 +0000 (19:06 +0200)]
[Java][FlexBuffers] Improve documentation for FlexBuffers in Java. (#5506)
Also add a FlexBuffer constructor to simplify usage