Commit Graph

1798 Commits

Author SHA1 Message Date
Tiago Silva 3c964e10ab [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.
2019-11-26 12:25:36 -08:00
Vladimir Glavnyy c3c32ec942 Fix ambiguity of a type deduction in TEST_EQ macro if arguments have `enum class` type. (#5630) 2019-11-25 12:56:47 -08:00
Vladimir Glavnyy 075e8d676b Simplify declarations of x-macro FLATBUFFERS_TD (#5638) 2019-11-25 12:54:59 -08:00
FujiZ bcf1bd5c9e read vtable size through ReadScalar() (#5636) 2019-11-25 12:52:42 -08:00
Derek Bailey 136d75fa65 Changed null checks in test. Removed verifier pointer usage (#5634) 2019-11-21 10:25:31 -08:00
Vladimir Glavnyy 091fa1fd1b 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.
2019-11-18 12:16:41 -08:00
FujiZ ff3781dc2d add namespace prefix in FLATBUFFERS_MAX_BUFFER_SIZE (#5629) 2019-11-18 12:02:14 -08:00
Malar Kannan 6beb9f49cb 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
2019-11-14 16:58:35 -08:00
Derek Bailey 80988ea869 Removed idl_gen_general.cpp and move contents to code_generators.cpp (#5625) 2019-11-14 15:47:58 -08:00
Derek Bailey 0f2ff7eaa9 Lua cleanup (#5624) 2019-11-14 15:46:46 -08:00
Derek Bailey dda095023d [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
2019-11-14 15:44:18 -08:00
Derek Bailey adbcbba5d1 [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
2019-11-11 11:37:55 -08:00
Dmitry cbbd6aca04 add check for root_type specified for json schema generation (#5622) 2019-11-11 11:33:27 -08:00
messense 405c64e07d [Rust] Bump smallvec version to 1.0 (#5621)
See https://github.com/servo/rust-smallvec/pull/175 for changelog.
2019-11-11 09:52:26 -08:00
Derek Bailey 42c08cbca6 Ran src/clang-format-all.sh (#5617) 2019-11-11 09:29:37 -08:00
Wouter van Oortmerssen 33d5dd9bdd Improved pull request & clang-format instructions.
Change-Id: Ia439bcc61bac5788792244d10e573b1fba54b347
2019-11-07 14:37:33 -08:00
Derek Bailey 105dd528e9 Change monster_extra generation to use flatbuffers::unique_ptr (#5612) 2019-11-07 14:10:41 -08:00
Derek Bailey f0f0efe7b8 [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,
2019-11-07 12:22:54 -08:00
Wouter van Oortmerssen e837d5a296 Fixed deprecated method in GRPC Java test.
Change-Id: Iccae8fe9409adbf3cd3013a5cf3368e068175ad3
2019-11-04 17:23:01 -08:00
Wouter van Oortmerssen 9834ee9787 Fixed Apache license not using canonical version.
Now identical to https://www.apache.org/licenses/LICENSE-2.0.txt

Change-Id: I6eab8bdee2472107dfc72265e204fdd16f3abc2e
2019-11-04 17:15:56 -08:00
Even Rouault 44b2ab087c 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
2019-11-04 14:58:51 -08:00
Derek Bailey 46ae3f80a6 [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
2019-11-04 14:54:44 -08:00
Even Rouault 7b38aa71e6 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
```
2019-11-04 14:28:33 -08:00
Derek Bailey 661bedd837 Add Lua FlatbufferBuilder Clean() method to enable reuseable builders (#5606) 2019-11-04 14:27:59 -08:00
Paulo Pinheiro 8526e12d73 [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
(e365c502ff).

This changes updates kotlin code generation to match Java's changes.
2019-11-04 14:25:07 -08:00
Paulo Pinheiro 3c7b660d62 [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
2019-11-04 14:23:15 -08:00
Lawrence Chan 964365ba69 [Go] Add UnPackTo functions (#5598) 2019-11-04 12:12:25 -08:00
iceboy 32254b7acd [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
2019-10-31 11:13:45 -07:00
Mathias Svensson 521e255ad9 Rust: Add idiomatic iterator for Vector type (#5579)
* Rust: Add idiomatic iterator for Vector type

* Add comments explaining some implementation details
2019-10-28 14:19:47 -04:00
Even Rouault 1b85292fd3 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
2019-10-28 10:02:46 -07:00
Derek Bailey 480815447a C++ verifier for evolved union fields should return true (#5586) 2019-10-28 09:43:33 -07:00
Derek Bailey 8d5e424c65 Add ByteBuffer copy for vector of bytes in Java (#5587) 2019-10-28 09:30:31 -07:00
Mathias Svensson b4774d2354 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
2019-10-28 00:20:29 -04:00
Vladimir Glavnyy 26f238c248 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
2019-10-21 10:11:32 -07:00
StackDoubleFlow e93c8c46e6 Fix Follow implementation for bool (#5554) 2019-10-19 23:24:13 -04:00
Vladimir Glavnyy e21516b9d7 Fix issue #5557 (#5573)
- remove not necessary file `monster_test_generated.h` from sample_bfbs.cpp
2019-10-18 10:16:55 -07:00
Björn Harrtell fbc11e8aec 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 :)
2019-10-17 15:47:51 -07:00
Bharat Tak e9d29c21a7 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
2019-10-17 15:25:05 -07:00
Jacek Surazski 8bfafc76de 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.
2019-10-17 15:23:15 -07:00
Wouter van Oortmerssen df3e8bf4a7 Fixed warnings generated by recent JSON sorting feature.
Change-Id: I6fd6283b616c7a39bb878b1610e4ddf6e208fa0a
2019-10-17 15:16:40 -07:00
Idan Sheinberg 5665cfe492 [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
2019-10-17 15:11:33 -07:00
tira-misu 5797540ed0 #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
2019-10-17 14:22:21 -07:00
Brian Harris 7f1af7cb02 Fix build with gcc version 7.4.0 (#5570) 2019-10-15 10:56:58 -07:00
Wouter van Oortmerssen 32f47ad247 Fixed JSON parser not sorting vectors of tables/structs with key.
Change-Id: Iacc0c8513af80a736700e6cbaf513ebdf8e3ac89
2019-10-10 15:25:39 -07:00
Paulo Pinheiro 842f672baf [FlexBuffers][Java] Cache size of Sized objects in FlexBuffers (#5551)
In my benchmarks it shows deserialization performance improvements of
around 7%
2019-10-03 15:56:29 -07:00
Paulo Pinheiro d4cae0a623 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
2019-09-30 14:05:19 -07:00
Wouter van Oortmerssen f1147f65bb Fixed Android STLPort related error.
Change-Id: I59ff072e526fc63b3215767a4d4a2a8944b65654
2019-09-30 12:12:36 -07:00
Jack Zhou 69d3fec488 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.
2019-09-30 11:50:03 -07:00
Paulo Pinheiro cfb4ecf6f0 [flac] Add FlexBuffers option for generating data (#5519)
Alongside --binary and --json, an additional
switch (--flexbuffers) can be passed to convert
data using FlexBuffers
2019-09-26 15:06:11 -07:00
Robert Winslow a92039687a
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.
2019-09-26 14:31:11 -07:00