platform/upstream/flatbuffers.git
2 years agoAvoid implicit conversion from float to double. (#7003)
Advait Jain [Fri, 24 Dec 2021 02:31:30 +0000 (18:31 -0800)]
Avoid implicit conversion from float to double. (#7003)

https://github.com/tensorflow/tflite-micro makes use of flatbuffers with
a variety of DSP toolchains.

Without the change from this PR, we can get a double-promotion warning
with some of these DSP toolchains:
```
flatbuffers/include/flatbuffers/util.h:104:11: error: implicit conversion increases floating-point precision: 'std::numeric_limits<float>::_Ty' (aka 'float') to 'double' [-Werror,-Wdouble-promotion]
  T eps = std::numeric_limits<float>::epsilon();
    ~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

2 years agoRearrange #include directives to pass to compilation with a particular DSP toolchain...
Shlomi Regev [Wed, 22 Dec 2021 16:40:38 +0000 (08:40 -0800)]
Rearrange #include directives to pass to compilation with a particular DSP toolchain (#7000)

iomanip isn't available for our DSP. Luckily, we compile with FLATBUFFERS_PREFER_PRINTF, so moved the #include directive there.
ctype.h has to be included explicilty for tolower() and toupper().

2 years agoReverting grpc generated file suffix (#6995)
Panagiotis Gourgaris [Sun, 19 Dec 2021 02:23:28 +0000 (04:23 +0200)]
Reverting grpc generated file suffix (#6995)

* Reverting grpc generated file suffix

* - Setting the greeter sample as it was
- Reverting the include of the generated message in grpc.cc file

2 years agoDisable parsing of nested_flatbuffers as bytes by default
Wouter van Oortmerssen [Wed, 15 Dec 2021 18:41:29 +0000 (10:41 -0800)]
Disable parsing of nested_flatbuffers as bytes by default

Parsing as bytes produces buffers that are unsafe to access unless passed thru a verifier,
whereas users could reasonably assume that any JSON parsed without errors is safe to access.
Users that still have legacy JSON files with such bytes in it will get a helpful error point them
to the option to turn on to have it work again.

2 years agoEnable OSS-Fuzz on CI
Wouter van Oortmerssen [Tue, 14 Dec 2021 20:10:43 +0000 (12:10 -0800)]
Enable OSS-Fuzz on CI

2 years agoUpdated FlexBuffers fuzzer
Wouter van Oortmerssen [Tue, 14 Dec 2021 19:57:42 +0000 (11:57 -0800)]
Updated FlexBuffers fuzzer

2 years agoAdded alignment checking to FlexBuffers verifier
Wouter van Oortmerssen [Tue, 14 Dec 2021 19:20:15 +0000 (11:20 -0800)]
Added alignment checking to FlexBuffers verifier

2 years agoFlexBuffers verifier additionally checks for nesting
Wouter van Oortmerssen [Tue, 14 Dec 2021 19:01:23 +0000 (11:01 -0800)]
FlexBuffers verifier additionally checks for nesting

2 years agoMade FlexBuffers reuse tracker track types
Wouter van Oortmerssen [Tue, 14 Dec 2021 18:00:56 +0000 (10:00 -0800)]
Made FlexBuffers reuse tracker track types

2 years agoPrevent shadow with _{{FIELD_NAME}} (#6991)
Derek Bailey [Tue, 14 Dec 2021 05:27:36 +0000 (21:27 -0800)]
Prevent shadow with _{{FIELD_NAME}} (#6991)

2 years agoFlexBuffers fuzzer fixes
Wouter van Oortmerssen [Mon, 13 Dec 2021 23:45:21 +0000 (15:45 -0800)]
FlexBuffers fuzzer fixes

- String dedup wasn't handling internal nulls correctly.
- Verifier wasn't recursing for certain types.
- Vector self-reference could create inf recursion.

2 years agoRefractor Flatc Options (#6987)
Derek Bailey [Mon, 13 Dec 2021 21:56:47 +0000 (13:56 -0800)]
Refractor Flatc Options (#6987)

* Moved error/warnings to bottom of std error

* Refactor flatc options

* pass program name to flatc

* extra -- in one option

* merge of upstream

2 years ago[CMake] Add option for disable universal on OSX (#6990)
Vadim-Valdis Yudaev [Mon, 13 Dec 2021 21:32:58 +0000 (23:32 +0200)]
[CMake] Add option for disable universal on OSX (#6990)

See https://github.com/google/flatbuffers/issues/6988

2 years agoValidate C# json/object-api options (#6985)
Derek Bailey [Mon, 13 Dec 2021 19:52:01 +0000 (11:52 -0800)]
Validate C# json/object-api options (#6985)

2 years agoAdd .NET test to github workflows (#6982)
Derek Bailey [Mon, 13 Dec 2021 19:51:27 +0000 (11:51 -0800)]
Add .NET test to github workflows (#6982)

2 years ago[CMake]: Fix version in pkgconfig file (#6986)
Biswapriyo Nath [Fri, 10 Dec 2021 23:40:21 +0000 (05:10 +0530)]
[CMake]: Fix version in pkgconfig file (#6986)

This change checks if the current source directory is a git repository.
If this is not checked the git command picks the commit hash from
parent directory. e.g. when tarball is extracted in a packaging repository.

2 years agore-enabled FlexBuffer JSON in fuzzer
Wouter van Oortmerssen [Fri, 10 Dec 2021 23:22:06 +0000 (15:22 -0800)]
re-enabled FlexBuffer JSON in fuzzer

2 years agoVerifier for FlexBuffers (#6977)
Wouter van Oortmerssen [Fri, 10 Dec 2021 22:59:08 +0000 (14:59 -0800)]
Verifier for FlexBuffers (#6977)

* Verifier for FlexBuffers

* Verifier improvements & fuzzer

2 years ago[CMake]: Fix python command for mingw environment (#6984)
Biswapriyo Nath [Fri, 10 Dec 2021 19:28:24 +0000 (00:58 +0530)]
[CMake]: Fix python command for mingw environment (#6984)

In mingw build environment, this fixes the build error:
'py' is not recognized as an internal or external command
The 'py' launcher is available for MSVC python only. More
https://docs.python.org/3/using/windows.html#from-the-command-line

2 years agoEnable --gen-onefile in Python (#6953)
lu-wang-g [Thu, 9 Dec 2021 23:47:09 +0000 (15:47 -0800)]
Enable --gen-onefile in Python (#6953)

* Enable --gen-onefile in Python

Made it possible to generate all python code in one file. Modified
py_test.py so that it can switch between the multi-file code and
the one-file code.

Updated PythonTest.sh and py_test.py so that the multi-file code
and the one-file code can be tested based on the same test code.

* Sync with google/flatbuffers

* Add --gen-onefile to generate_code.py

2 years agoMake idl_parser deterministic (#6976)
Danila Kutenin [Thu, 9 Dec 2021 21:07:29 +0000 (21:07 +0000)]
Make idl_parser deterministic (#6976)

* Make idl_parser deterministic

Some golden tests even exercise this [logic](https://github.com/google/flatbuffers/blob/df2df21ec1be2468106fed10c1533eacc1cf0d2e/tests/prototest/test.golden#L8). Let's make the parser fully stable not depending on the implementation of std::sort

* Retry the ci

2 years agoBumping to Version 2.0.5 (#6967)
Derek Bailey [Thu, 9 Dec 2021 18:31:57 +0000 (10:31 -0800)]
Bumping to Version 2.0.5 (#6967)

2 years agoFix typo in variable name (#6973)
David Sanders [Thu, 9 Dec 2021 18:30:15 +0000 (10:30 -0800)]
Fix typo in variable name (#6973)

2 years agoremove Appveyor's Vs2010 and 13 builds (#6969)
Derek Bailey [Mon, 6 Dec 2021 22:18:22 +0000 (14:18 -0800)]
remove Appveyor's Vs2010 and 13 builds (#6969)

2 years ago[TS] Fix reserved words as arguments (#6955) (#6956)
tira-misu [Mon, 6 Dec 2021 22:16:04 +0000 (23:16 +0100)]
[TS] Fix reserved words as arguments (#6955) (#6956)

* 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

* Add generate of JSON schema to string to lib

* option indent_step is supported

* Remove unused variables

* Fix break in test

* Fix style to be consistent with rest of the code

* [TS] Fix reserved words as arguments (#6955)

2 years agoUpdate stale bot version and provide away to exempt issues with the not-stale label...
Derek Bailey [Fri, 3 Dec 2021 21:51:05 +0000 (13:51 -0800)]
Update stale bot version and provide away to exempt issues with the not-stale label (#6968)

2 years agomissing generated files (#6966)
Derek Bailey [Fri, 3 Dec 2021 19:23:58 +0000 (11:23 -0800)]
missing generated files (#6966)

These shouldn't be used, so short circuiting CI.

2 years agoLua Generator using IR. (#6940)
Derek Bailey [Fri, 3 Dec 2021 05:29:19 +0000 (21:29 -0800)]
Lua Generator using IR. (#6940)

* initial hack to get new Lua generator into flatc

* Starting to output enum defs for Lua

* Continue to work on table generation for Lua

* Finished basic getter access for Lua

* Added ability to get object by index

* Finished struct builder

* aliased reflection to r

* finish table builder generation

* register requiring files

* better generated header info

* Tying up loose ends

* Updated reflection to handle struct padding

* Addd type sizes to reflection

* Fixed some vector indirect issues

* Lua tests passed

* Misc cleanup

* ci fixes 1

* ci fixes 2

* renaming

* up size of type sizes

* manually ran clang-format-11 -i src/idl_parser.cpp

* fixed some windows casting

* remove stupid auto import

* more static_casting

* remove std

* update other build environments

* remove scoped enums

* replaced std::to_string with NumToString

* more win fixes

* more win fixes

* replaced old lua with new

* removed auto import

* review responses

* more style fixes

* refactor bfbs_gen_len to use code +=

* added consts

* fix lambda capture for windows

* remove unused return type

2 years agoFixedTypedVector: add const to ElementType() and size() (#6965)
Markus Junginger [Fri, 3 Dec 2021 04:32:51 +0000 (05:32 +0100)]
FixedTypedVector: add const to ElementType() and size() (#6965)

2 years agoHave grpc include file with correct filename-suffix given to flatc (#6954)
Panagiotis Gourgaris [Thu, 2 Dec 2021 17:49:12 +0000 (19:49 +0200)]
Have grpc include file with correct filename-suffix given to flatc (#6954)

When generating code with --grpc,  --cpp and using filename-suffix, the generated grpc files where not including the correct header that had the filename-suffix. As a suffix, they used the default "_generated".
Free functions for these were used to get the suffix. FlatBufFile had such methods, but also needed to be into its base File and use these.
- grpc generated files include the correct message header.
- grpc generated files also have the suffix
- grpc generated cc file does not include initial message header

2 years agoRemoved test/generate_code.{sh|bat} (#6873)
Derek Bailey [Wed, 1 Dec 2021 07:13:24 +0000 (23:13 -0800)]
Removed test/generate_code.{sh|bat} (#6873)

* removed test/generate_code.{sh|bat}

remove c++0x from generate_code.py

added check generate code script in python

add windows specific call

added flags to generate_code.py

Set c++-0x on BUILD_LEGACY

Skip generating monster_extra if requested

* added option to skip monster extra

* add conditional to skip 2010 check gen

2 years agoswitched to windows-lastest, removed deadcode (#6948)
Derek Bailey [Wed, 1 Dec 2021 07:12:57 +0000 (23:12 -0800)]
switched to windows-lastest, removed deadcode (#6948)

2 years agoRestore FlatBufferBuilder::kFileIdentifierLength. (#6960)
engedy [Wed, 1 Dec 2021 07:06:19 +0000 (08:06 +0100)]
Restore FlatBufferBuilder::kFileIdentifierLength. (#6960)

Restore flatbuffers::FlatBufferBuilder::kFileIdentifierLength, which was a documented part of the public API, but the identifier was lost during the refactoring effected by comment commit 6c8c291559053f90a35c138499053449a40e3b9a.

2 years agoEnable verifier on nested_flatbuffers
Wouter van Oortmerssen [Tue, 23 Nov 2021 01:07:49 +0000 (17:07 -0800)]
Enable verifier on nested_flatbuffers

2 years agoTurn off nested FlatBuffers/FlexBuffers for the fuzzer
Wouter van Oortmerssen [Tue, 23 Nov 2021 00:28:04 +0000 (16:28 -0800)]
Turn off nested FlatBuffers/FlexBuffers for the fuzzer

this is a temporary fix to allow the fuzzer to work until the real fix of adding a verifier for this is added.

2 years agoinvalid conditional running genrate_code.py (#6952)
Derek Bailey [Wed, 24 Nov 2021 06:32:06 +0000 (22:32 -0800)]
invalid conditional running genrate_code.py (#6952)

2 years agorust: remove needless borrow (#6922)
Élie ROUDNINSKI [Tue, 23 Nov 2021 16:46:56 +0000 (16:46 +0000)]
rust: remove needless borrow (#6922)

This was discovered by running clippy.

2 years agoVector Downward GetSize optimization (#6925)
Derek Bailey [Tue, 23 Nov 2021 03:50:42 +0000 (19:50 -0800)]
Vector Downward GetSize optimization (#6925)

* Added Google benchmarks (and gtests)

* Separate benchmark CMakeLists.txt to its own file

* Move output directory to target just flatbenchmark

* Reduced from encoding 210ns -> 188ns

* store size_ as uoffset_t

* fixed windows c4267 warning

2 years agoFix flexbuffers clang-analyzer warning (#6947)
jonathan-conder-sm [Mon, 22 Nov 2021 21:37:36 +0000 (10:37 +1300)]
Fix flexbuffers clang-analyzer warning (#6947)

2 years agotest: fix undefined order of functio parameters. (#6946)
Sergei Trofimovich [Mon, 22 Nov 2021 20:14:31 +0000 (20:14 +0000)]
test: fix undefined order of functio parameters. (#6946)

Detected instability when built `flatbuffers-2.0.0` on `gcc-12`:

    [ 75%] Building CXX object CMakeFiles/flattests.dir/tests/test_builder.cpp.o
    .../c++/12.0.0/bits/shared_ptr_base.h:397:45: error: 'size' may be used uninitialized [-Werror=maybe-uninitialized]
      397 |       explicit _Sp_ebo_helper(_Tp&& __tp) : _M_tp(std::move(__tp)) { }
          |                                             ^~~~~~~~~~~~~~~~~~~~~~
    In file included from flatbuffers/tests/test_builder.cpp:1:
    flatbuffers/tests/test_builder.h: In function 'void builder_move_assign_after_releaseraw_test(Builder) [with Builder = flatbuffers::FlatBufferBuilder]':
    flatbuffers/tests/test_builder.h:63:10: note: 'size' was declared here
       63 |   size_t size, offset;
          |          ^~~~
    ...
    In file included from flatbuffers/tests/test_builder.cpp:1:
    flatbuffers/tests/test_builder.h: In function 'void builder_move_assign_after_releaseraw_test(Builder) [with Builder = GrpcLikeMessageBuilder]':
    flatbuffers/tests/test_builder.h:63:10: note: 'size' was declared here
       63 |   size_t size, offset;
          |          ^~~~
    cc1plus: all warnings being treated as errors

Here is the relevant bit of test:

    template<class Builder>
    void builder_move_assign_after_releaseraw_test(Builder b1) {
      auto root_offset1 = populate1(b1);
      b1.Finish(root_offset1);
      size_t size, offset;
      std::shared_ptr<uint8_t> raw(
          b1.ReleaseRaw(size, offset), [size](uint8_t *ptr) {
            flatbuffers::DefaultAllocator::dealloc(ptr, size);
          });

Note how `b1.ReleaseRaw(size, offset)` is expected to populate `size`
and `[size](uint8_t *ptr) {` captures the result. But both are parameters
to the same function call and thus evaluation order is unspecified.

2 years ago[cmake] Fix getting version info from tags during the build (#6936)
Denis Protivensky [Mon, 22 Nov 2021 19:53:50 +0000 (22:53 +0300)]
[cmake] Fix getting version info from tags during the build (#6936)

Use `git describe --tags` to query for lightweight tags along with
the annotated ones.

2 years agoclang-all (#6941)
Derek Bailey [Sat, 20 Nov 2021 01:01:48 +0000 (17:01 -0800)]
clang-all (#6941)

2 years agoWIP: Dart release 2.0 (#6927)
Ivan Dlugos [Thu, 18 Nov 2021 18:56:29 +0000 (19:56 +0100)]
WIP: Dart release 2.0 (#6927)

* chore: make flatc artifacts from CI executable

* chore: prepare dart 2.0.0 release

* refactor: update description in pubspec.yaml to make pub.dev happy

"The package description is too long.
Search engines display only the first part of the description. Try to keep the value of the description field in your package's pubspec.yaml file between 60 and 180 characters."

2 years agoAdd benchmarks to Linux CI (#6928)
Derek Bailey [Thu, 18 Nov 2021 18:55:57 +0000 (10:55 -0800)]
Add benchmarks to Linux CI (#6928)

2 years ago[C++] Fix compile failure on Object API union construction for struct member (#6923)
Taiju Tsuiki [Thu, 18 Nov 2021 18:55:11 +0000 (03:55 +0900)]
[C++] Fix compile failure on Object API union construction for struct member (#6923)

* Add dedicated traits to Object API version of unions.

* Add suppression for unused parameters on unions of structs.

2 years agoFix integer overflow warnings
Wouter van Oortmerssen [Thu, 18 Nov 2021 17:41:44 +0000 (09:41 -0800)]
Fix integer overflow warnings

2 years agofixed cmp0048 error (#6932)
Derek Bailey [Thu, 18 Nov 2021 04:22:23 +0000 (20:22 -0800)]
fixed cmp0048 error (#6932)

2 years agofuzzers: fix typo in file path (#6931)
Catena cyber [Wed, 17 Nov 2021 22:43:56 +0000 (23:43 +0100)]
fuzzers: fix typo in file path (#6931)

2 years agoAdded Raw C++ benchmarks (#6924)
Derek Bailey [Mon, 15 Nov 2021 23:19:03 +0000 (15:19 -0800)]
Added Raw C++ benchmarks (#6924)

2 years agoAdded Google benchmarks (and gtests) (#6920)
Derek Bailey [Mon, 15 Nov 2021 21:41:22 +0000 (13:41 -0800)]
Added Google benchmarks (and gtests) (#6920)

* Added Google benchmarks (and gtests)

* Default building benchmarks to OFF as it requires c++11

* Separate benchmark CMakeLists.txt to its own file

* Move output directory to target just flatbenchmark

2 years ago[Java] lookup by byteArray is giving back wrong entry (#6915)
taroplus [Mon, 15 Nov 2021 19:16:45 +0000 (11:16 -0800)]
[Java] lookup by byteArray is giving back wrong entry (#6915)

2 years agoRemoval of support for FLATBUFFERS_CPP98_STL (#6918)
Wouter van Oortmerssen [Fri, 12 Nov 2021 22:01:11 +0000 (14:01 -0800)]
Removal of support for FLATBUFFERS_CPP98_STL (#6918)

* Removal of support for FLATBUFFERS_CPP98_STL

For context, see https://github.com/google/flatbuffers/issues/6704

* Also removed vector_data

2 years agomove [[ ]] to calling sites (#6914)
Derek Bailey [Thu, 11 Nov 2021 18:31:15 +0000 (10:31 -0800)]
move [[ ]] to calling sites (#6914)

2 years ago[C++] Split flatbuffers.h into separate files (#6868)
Derek Bailey [Thu, 11 Nov 2021 06:26:09 +0000 (22:26 -0800)]
[C++] Split flatbuffers.h into separate files (#6868)

* split flatbuffers.h into separate files

* wrong variable in cmakelists for android

* readded two accidentally deleted includes

* created buffer.h and moved buffer related things over

2 years agoKeep methods with struct name and switch them to default (#6879)
lu-wang-g [Thu, 4 Nov 2021 22:12:25 +0000 (15:12 -0700)]
Keep methods with struct name and switch them to default (#6879)

* Keep methods with struct name and switch them to default

This PR can help fix the following two issues:
1): A set of simplified API (without struct name) was added in
https://github.com/google/flatbuffers/pull/6336. It causes name
conflict when merging all generated python file into a single one
(the primary usage senario in Google).
2): Flatbuffers 2.0 generates absolute import path, which may cause
name space conflicts. See more details in
https://github.com/google/flatbuffers/issues/5840.

The solution for both is to generate the merged Python code, similar
C++. The merged code will not contain the simplied API, but only the
method with struct name. For issue (1), it will mimic the exactly
usage pattern for Google internal. For issue (2), users can generate
the merged flatbuffer code, without worrying about the imports.

The above idea will be implemented in the following steps:
Step 1 (this PR): revert changes in https://github.com/google/flatbuffers/pull/6336
that set the simplified API as default. Remove statements that the
original API will be deprecated, and reset the original API as default.
Step 2 (the following PR): create a flag to generate the merged code.
The Simplified API will be removed from the merged code, otherwise it
will cause name conflict.

* Update the generated sample code

* Update the generated example code

* Reverst the changes of GetRootAs

* Update examples from grpc/example/generate.sh

2 years ago[Python] Verify EnumDef is not generated in GenUnionCreator (#6903)
Tom Miller [Thu, 4 Nov 2021 21:21:31 +0000 (17:21 -0400)]
[Python] Verify EnumDef is not generated in GenUnionCreator (#6903)

* [Python] Verify EnumDef is not generated in GenUnionCreator

* update test output

2 years agoSupport `--conform` for vector of unions (#6883)
Alec Theriault [Mon, 1 Nov 2021 18:26:36 +0000 (14:26 -0400)]
Support `--conform` for vector of unions (#6883)

It seems like `--conform` already works for vectors of unions - there is
just a spurious check that prevents it from running. Fixes #6882

Also, if schemas do not conform, `flatc` no longer prints out the usage
(since the error is not due to bad usage). Fixes #6496

2 years agoTypo fixes in comments of flatbuffers.h and flexbuffers.h (#6901)
Even Rouault [Thu, 28 Oct 2021 20:03:03 +0000 (22:03 +0200)]
Typo fixes in comments of flatbuffers.h and flexbuffers.h (#6901)

2 years ago[Java] Prevent generation of enum names when underlying type is long (#6781) (#6895)
Fraser Crossman [Mon, 18 Oct 2021 22:18:36 +0000 (23:18 +0100)]
[Java] Prevent generation of enum names when underlying type is long (#6781) (#6895)

2 years ago[C++] Fix memory leak when using grpc (#6896) (#6897)
xuyatian [Mon, 18 Oct 2021 18:24:52 +0000 (11:24 -0700)]
[C++] Fix memory leak when using grpc (#6896) (#6897)

2 years agoOutput errors / warnings on stderr instead of stdout (#6881)
Brian King [Thu, 7 Oct 2021 21:58:10 +0000 (16:58 -0500)]
Output errors / warnings on stderr instead of stdout (#6881)

2 years agoAdds JSON encoding to swift (#6874)
mustiikhalil [Thu, 7 Oct 2021 21:22:22 +0000 (23:22 +0200)]
Adds JSON encoding to swift (#6874)

Updates generated code & removes unneeded protocol

Updates cpp to only generate code when flag is passed

Updates code gen script

2 years ago[Kotlin] Fix missing escape for struct construction statements (#6877)
Paulo Pinheiro [Thu, 7 Oct 2021 20:00:07 +0000 (22:00 +0200)]
[Kotlin] Fix missing escape for struct construction statements (#6877)

An escaping was missing leading to wrong generation when using
kotlin keywords.

2 years agoadd working directory (#6878)
Derek Bailey [Wed, 6 Oct 2021 01:24:00 +0000 (20:24 -0500)]
add working directory (#6878)

2 years agoDefault Arguments for Mutators C++ [Updated] (#6872)
T Sprecher [Thu, 30 Sep 2021 23:44:39 +0000 (19:44 -0400)]
Default Arguments for Mutators C++ [Updated] (#6872)

* CPP Default Value Generation in Mutators

If the mutator is for a value that is compatible with having a default value, then the single parameter becomes a default parameter. With this, a value can be mutated to it's default value without storing the default value, as that will be stored with the mutate function.
Fixed Casting When Generating Default for Enum Value

Added support for typecasting an int default value into the correct enum type in the default parameter. This fixed the issue of trying to use set a strongly typed enum parameter to an int which fails type checking.
Fixed Boolean Edge Case

Boolean types generate 0 != 0 when generating the underlying type which appears to be unique to the boolean type so it is now checked and the proper default value generated. It may be beneficial to check if it is instead an enum type, however the seeming edge case nature is why boolean was chosen to be checked.
Updated Generated Files

Regenerated the auto generated files to reflect the new changes.
Updated Remaining Files

Should fix auto generated header files that were not updated.

* Unified Repeated Code

Relocated identical append code to outside of conditional. Also changed 'casted' default value name from FIELD to INTERFACE to more accurately describe it.

* Moved Field Name Outside Conditional

Removed duplicate _{{FIELD_NAME}} and moved to unified append.

2 years ago[Cmake] Add a post build command after flatc to run the new generate_code.py script...
Derek Bailey [Thu, 30 Sep 2021 19:38:52 +0000 (14:38 -0500)]
[Cmake] Add a post build command after flatc to run the new generate_code.py script. (#6866)

* starting to add python script

* finish first draft of script

* add windows-specific edits

* Add cmake post flatc build generated_code.py command

* fixed windows issue

* Provided flatc location to generate_code.py

* Allow relative flatc pathing and fix macro typo

* escape post build arguments

* change script and args quoting

* skip running generate_code.py on old MSVC compilers

2 years agodart - add Packable interface (#6846)
Ivan Dlugos [Tue, 28 Sep 2021 20:23:30 +0000 (22:23 +0200)]
dart - add Packable interface (#6846)

3 years agoBumped package.json to 2.0.4
Wouter van Oortmerssen [Mon, 27 Sep 2021 22:49:45 +0000 (15:49 -0700)]
Bumped package.json to 2.0.4

See https://github.com/google/flatbuffers/pull/6850 for context

3 years agoFix linker errors on (Free|Open)BSD. (#6860)
Yesudeep Mangalapilly [Mon, 27 Sep 2021 19:07:04 +0000 (12:07 -0700)]
Fix linker errors on (Free|Open)BSD. (#6860)

* Fix linker errors on (Free|Open)BSD.

* Adds a TODO for the FreeBSD linker flags: -lm and moves platform config to main BUILD.bazel

3 years agoImproves documentation, and adding DocC (#6784)
mustiikhalil [Mon, 27 Sep 2021 18:59:19 +0000 (20:59 +0200)]
Improves documentation, and adding DocC (#6784)

Finished documenting flatbuffersbuilder

Replaces swift 5.5 with 5.2 packages

Starts building the tutorial for xcode 13

Finishes building the tutorial for xcode 13

Removes docc files from old swift versions

Updates swift style guide

3 years agoMake and generate_code.sh generate same outputs (#6855)
Derek Bailey [Fri, 24 Sep 2021 19:01:34 +0000 (14:01 -0500)]
Make and generate_code.sh generate same outputs (#6855)

* added --bfbs-builtins

* update generate_code.bat

* forgot the .

* updated checking scripts

* added bypass for the monster_test.bfbs and arrays_test.bfbs diff issue

* removed check on windows for now

3 years agoInclude subdirectories in published npm package (#6850)
Louis DeScioli [Thu, 23 Sep 2021 23:22:49 +0000 (19:22 -0400)]
Include subdirectories in published npm package (#6850)

Updates the `files` globs in package.json to include subdirectories in order to also include the flexbuffers directory in the published npm package.

Updates .gitignore to include the tsc-generated JS files.

3 years agoUse ArrayBuffer type for JS flexbuffer's toObject (#6851)
Louis DeScioli [Thu, 23 Sep 2021 23:22:13 +0000 (19:22 -0400)]
Use ArrayBuffer type for JS flexbuffer's toObject (#6851)

3 years agofeat(build): compile "universal" libraries and executables for Mac (#6852)
Ivan Dlugos [Thu, 23 Sep 2021 19:36:20 +0000 (21:36 +0200)]
feat(build): compile "universal" libraries and executables for Mac (#6852)

to support both x86_64 and arm64 with a single artifact

3 years agofixed errant itemgroup element in C# test project (#6854)
Derek Bailey [Tue, 21 Sep 2021 22:01:29 +0000 (17:01 -0500)]
fixed errant itemgroup element in C# test project (#6854)

errant save

3 years ago[C#] Using 'global::' as qualifying_start_ within BaseGenerator (#6767)
Todd Hansen [Wed, 15 Sep 2021 21:57:29 +0000 (16:57 -0500)]
[C#] Using 'global::' as qualifying_start_ within BaseGenerator (#6767)

* Update idl_gen_csharp.cpp

Change csharp generator to use "global::" for it's qualifying_start_ to disambiguate namespaces

* regenerate testing files

regenerate testing files

* Missed TableInC.cs

updated with global prefix

* Remove "global::" from qualifying_start_ for csharp generator

* C# global alias

* Tests and docs for --cs-global-alias

Add tests for --cs-global-alias to demonstrate use case for why it's needed.

Add documentation to Compiler.md

* Add also to help text

Add also to help text

3 years agoDart: binary lists (typed_data) (#6839)
Ivan Dlugos [Wed, 15 Sep 2021 15:50:57 +0000 (17:50 +0200)]
Dart: binary lists (typed_data) (#6839)

* Dart - add eager mode to Uint8ListReader

* Dart - add Int8ListReader

* Dart - use binary reader where useful

* Dart - test binary list reader laziness

* Dart - update generated code

3 years agoDelete IDLOptions::lang (#6841)
Casper [Mon, 13 Sep 2021 22:18:00 +0000 (18:18 -0400)]
Delete IDLOptions::lang (#6841)

Co-authored-by: Casper Neo <cneo@google.com>
3 years agoBugFix: Optional enum when it is null (#6835)
Artavazd Balaian [Fri, 10 Sep 2021 16:55:46 +0000 (00:55 +0800)]
BugFix: Optional enum when it is null (#6835)

* Test to make sure optional enum is written properly

* Handle optional enum codegen: when cast optional enum add `?`

* Run `tests/generate_code.sh` to generate code from schema

* Fix type casting in case of CreateXXXTypeVector

* Reason why vector's type is not optional

3 years ago[C#] Use @ for keyword escaping (#6834)
Derek Bailey [Thu, 9 Sep 2021 17:29:27 +0000 (10:29 -0700)]
[C#] Use @ for keyword escaping (#6834)

3 years ago[C++] Let builder accept custom-alloc std::vector (#6814)
Maksim Ivanov [Wed, 8 Sep 2021 20:25:06 +0000 (22:25 +0200)]
[C++] Let builder accept custom-alloc std::vector (#6814)

Change the FlatBufferBuilder's methods to accept std::vector parameters
with non-default allocator, by adding another template parameter to
them. This should make using the builder slightly more convenient, as
one won't need to manually pass data() and size() separately.

3 years agoChanges to support binary schema file loading and parsing (flatc) (#6823)
Herr Frei [Wed, 8 Sep 2021 20:19:00 +0000 (22:19 +0200)]
Changes to support binary schema file loading and parsing (flatc) (#6823)

* Changes to support binary schema file loading and parsing (flatc)
- parser.reset() is also called if binary schema file is given
- code flow changed to not try to load a binary schema as textual schema

* Removed unneeded braces

3 years agoMove Apple-specific build flags to Clang section (#6802)
Rafal Kapuscik [Wed, 8 Sep 2021 20:14:53 +0000 (22:14 +0200)]
Move Apple-specific build flags to Clang section (#6802)

This allows building FlatBuffers with gcc on macOS:
- avoid linking libc++ when not using clang
- look at compiler first, then OS-specific options

Signed-off-by: Rafal Kapuscik <rkapuscik@antmicro.com>
3 years agoIssue error if jsonschema has no root type defined #6821 (#6831)
schoetbi [Thu, 2 Sep 2021 21:24:47 +0000 (23:24 +0200)]
Issue error if jsonschema has no root type defined #6821 (#6831)

3 years agoFix typos in docs (#6829)
SaintMalik [Thu, 2 Sep 2021 15:38:45 +0000 (16:38 +0100)]
Fix typos in docs (#6829)

3 years ago[C++] Add mutable version of LookupByKey and test (#6826)
Tyler Denniston [Tue, 31 Aug 2021 21:17:20 +0000 (17:17 -0400)]
[C++] Add mutable version of LookupByKey and test (#6826)

* [C++] Add mutable version of LookupByKey and test

This adds an overload of LookupByKey to allow lookup in sorted Vectors to
return a mutable instance of the object (or nullptr if not found).

* Fix naming

3 years agoAdd html and latex to gitignore (#6819)
Casper [Mon, 30 Aug 2021 23:36:00 +0000 (19:36 -0400)]
Add html and latex to gitignore (#6819)

Co-authored-by: Casper Neo <cneo@google.com>
3 years ago[Java] Avoid casting ByteBuffer to Buffer (#6785)
Björn Harrtell [Mon, 30 Aug 2021 22:51:06 +0000 (00:51 +0200)]
[Java] Avoid casting ByteBuffer to Buffer (#6785)

* Revert "avoiding even more NoSuchMethod exceptions (#6729)"

This reverts commit 6fb2c90d9ef1469312840f80612504f27f03cf00.

* Revert "avoiding more NoSuchMethod exceptions (#6671)"

This reverts commit 752c7b576d395ffab646aa6878ccf4e17a0a7a2e.

* Revert "avoiding NoSuchMethod exception (#6658)"

This reverts commit 813d3632ecefaf6d4068d87abdef04d94663dca3.

* Use Java 8 for Kotlin Linux builds to verify

3 years ago[C++] Add GetMutableSizePrefixedRoot and generate GetMutableSizePrefixedXxx functions...
Stefan F [Mon, 30 Aug 2021 22:34:42 +0000 (00:34 +0200)]
[C++] Add GetMutableSizePrefixedRoot and generate GetMutableSizePrefixedXxx functions (#6815)

* flattests_cpp17 doesn't compile with Visual Studio 2017: warning C4100: 'indent': unreferenced formal parameter

stringify_util.h(127): error C2220: warning treated as error - no 'object' file generated
stringify_util.h(127): warning C4100: 'indent': unreferenced formal parameter
stringify_util.h(85): warning C4100: 'indent': unreferenced formal parameter
stringify_util.h(85): warning C4100: 'fbs': unreferenced formal parameter

* [C++] Add GetMutableSizePrefixedRoot() and generate a GetMutableSizePrefixed function
When using the mutable API together with size prefixed buffers these functions should be present.

* clang-format

* Cleanup branch for PR
Revert "flattests_cpp17 doesn't compile with Visual Studio 2017: warning C4100: 'indent': unreferenced formal parameter"

This reverts commit a92055203e3c26b69df4896d6babd7714539307a.

3 years agoflattests_cpp17 doesn't compile with Visual Studio 2017: warning C4100: 'indent'...
Stefan F [Mon, 30 Aug 2021 22:32:36 +0000 (00:32 +0200)]
flattests_cpp17 doesn't compile with Visual Studio 2017: warning C4100: 'indent': unreferenced formal parameter (#6811)

stringify_util.h(127): error C2220: warning treated as error - no 'object' file generated
stringify_util.h(127): warning C4100: 'indent': unreferenced formal parameter
stringify_util.h(85): warning C4100: 'indent': unreferenced formal parameter
stringify_util.h(85): warning C4100: 'fbs': unreferenced formal parameter

3 years agoDart lints (#6808)
Ivan Dlugos [Mon, 30 Aug 2021 19:54:59 +0000 (21:54 +0200)]
Dart lints (#6808)

* Dart - add analysis options with the recommended lints

* Dart - generate code without linter issues

* Dart - remove linter issues in example and test code

* Dart - remove linter issues in lib code

* Dart - update generate code in /tests/

3 years agofix parser string=null (#6810)
Casper [Tue, 24 Aug 2021 13:41:39 +0000 (09:41 -0400)]
fix parser string=null (#6810)

Co-authored-by: Casper Neo <cneo@google.com>
3 years agoRefactor idl_gen_rust and Rust generated code to use consistent whitespace (#6809)
Casper [Mon, 23 Aug 2021 22:53:10 +0000 (18:53 -0400)]
Refactor idl_gen_rust and Rust generated code to use consistent whitespace (#6809)

* Remove dead code in idl_gen_rust

* Use 2space indentation in mod.rs

* use In/DecrementIdentValue in idl_gen_rust

Fix some whitespace too in generated code.

* make default fn 2space ident

* More 2space formatting

* git clang format

* make vs2015 happy

Co-authored-by: Casper Neo <cneo@google.com>
3 years agoFix Rust keyword inconsistency (#6794)
Casper [Wed, 18 Aug 2021 19:37:44 +0000 (15:37 -0400)]
Fix Rust keyword inconsistency (#6794)

* Make Rust keyword escaping more consistent

* fix comment

* git clang format

Co-authored-by: Casper Neo <cneo@google.com>
3 years ago[C#] Remove superfluous semicolon in C# structs (#6791)
Todd Hansen [Tue, 17 Aug 2021 15:02:57 +0000 (10:02 -0500)]
[C#] Remove superfluous semicolon in C# structs (#6791)

Aims to resolve #6788

-Remove superfluous semicolon in C# structs

3 years agofix ptr in flatbuffers cpp tutorial (#6787)
Casper [Mon, 16 Aug 2021 18:43:26 +0000 (14:43 -0400)]
fix ptr in flatbuffers cpp tutorial (#6787)

Co-authored-by: Casper Neo <cneo@google.com>
3 years ago[C#] Handle keywords (#6775)
Todd Hansen [Mon, 16 Aug 2021 18:09:21 +0000 (13:09 -0500)]
[C#] Handle keywords (#6775)

* Handle keywords in C#

C# should handle keywords similarly to other languages by appending an underscore after the keyword.

* Fix clang-format for idl_gen_csharp.cpp

* Fix spacing clang-format issue

3 years ago[C#] Respect command line parameter for file name extension and suffix (#6779)
Todd Hansen [Sun, 15 Aug 2021 19:51:58 +0000 (14:51 -0500)]
[C#] Respect command line parameter for file name extension and suffix (#6779)

* Make CSharp use the command line parameter for file name extension and suffix

* Default file name now has _generated in it,
so we need to rename all the generated test files

tests/namespace_test/NamespaceA/TableInC.* are no
longer used, so these can be deleted

* Fix C# testing projects so that they reference
the new _generated.cs files

* Revert "Fix C# testing projects so that they reference"

This reverts commit cf62b9c5d446fc535e2b3808ddd92b5f4c00ce48.

* Revert "Default file name now has _generated in it,"

This reverts commit 042aa81f1051a0f9556b4df360f08b3c9cd9ecc3.

* Revert "Make CSharp use the command line parameter for file name extension and suffix"

This reverts commit ba8cd06646e82029b5144b7c3c75c06fe2ea41da.

* Make CSharp use the command line parameter for file name extension and suffix

* Fixup clang tidy

* Fix more clang-tidy

3 years agoupdate Java version to 2.0.3
Wouter van Oortmerssen [Sat, 14 Aug 2021 16:01:54 +0000 (09:01 -0700)]
update Java version to 2.0.3

3 years ago[Kotlin] Fix CI by changing compiler to Java 11 (#6783)
Paulo Pinheiro [Sat, 14 Aug 2021 15:57:38 +0000 (17:57 +0200)]
[Kotlin] Fix CI by changing compiler to Java 11 (#6783)

With the changes introduced on #6729, #6671, #6658 it seems that using java
compiler version 8 is no longer possible. We are adjusting our CI build for
Kotlin to use Java 11 as compiler, while still emiting 1.8 bytecode.

The Kotlin CI action is also being breakdown into two: Mac & Linux.
Kotlin mac will test ios & mac builds while Linux will test js and JVM.
This change will improve build times for Kotlin on CI, which is currently
taking long times.