Commit Graph

2466 Commits

Author SHA1 Message Date
Derek Bailey
240be9b5ae attempt to remove appveyor (#7056) 2022-01-31 21:52:15 -08:00
Derek Bailey
bc366a7f9e Provide a short help text and default in error case (#6992)
* Provide a short help text and default in error case

* clean up short options a bit
2022-01-31 21:24:48 -08:00
Derek Bailey
14b19d446f Use FindPython3 (#7055) 2022-01-31 20:47:12 -08:00
Derek Bailey
9e6f17b94d remove BIICODE 2022-01-31 19:01:55 -08:00
Derek Bailey
c3801ad375 Update readme.md
Remove travis badge
Added Github action badge
Add dbaileychess twitter
2022-01-31 17:00:24 -08:00
mustiikhalil
4f3b24db09 Fixes a bug where bools arent being nil when marked optional (#7051) 2022-01-31 18:12:57 +03:00
Max Burke
1d294a31b8 Implement Serialize on generated rust types (#7022)
* fix for rust build

* Rust: Implement Serialize on generated types

For debugging convenience it is really handy to be able to dump out
types as another format (ie: json). For example, if we are logging a
type to a structured logging system, or even printing it out in a
structured way to the console.

Right now we handle this by shelling out to `flatc` which is not ideal;
by implementing Serialize on the generated types we can use any of the
Serializer-implementing packages for our structured debug output.

* clang-format

* Make the flatbuffers Rust crate only have an optional dependency on the `serde` packages.

* fix warning

* fix rust test build

* Oh yeah this needs to be initialized

* fix toml syntax

* code review feedback

* rebuild test data
2022-01-30 19:29:18 -05:00
Derek Bailey
dd8fccfb1b Cmake 3.16 de-facto minimum version (#7049) 2022-01-30 12:56:16 -08:00
Derek Bailey
7089c9ecdd Convert flatbuffers_version_string to inline function (#7046)
* Skip conditional for python executable

* replaced flatbuffers_version_string with inline function

* use const char* instead of string
2022-01-29 19:42:56 -08:00
Jean-François Roy
43203984f7 [C++] Support C++ object copies and moves (#5988)
Augment the C++ generator to emit a C++ copy constructor and a by-value
copy assignment operator. This is enabled by default when the C++
standard is C++11 or later. These additional functions are only emitted
for objects that need it, typically tables containing other tables.

These new functions are declared in the object table type and are
defined as inline functions after table declarations.

When these new functions are declared, a user-defined
explicitly-defaulted default constructor and move constructor are also
emitted.

The copy assignment operator uses the copy-and-swap idiom to provide
strong exception safety, at the expense of keeping 2 full table copies
in memory temporarily.

fixes #5783
2022-01-29 14:24:24 -08:00
Max Burke
5993338ee3 [ts] Builder incorrectly serializing empty strings (#7047)
* [ts] Builder incorrectly serializing empty strings

The builder was returning an offset of zero for empty strings. This is
leading to flatbuffers which fail verification in other languages, such
as Rust.

* tests expect 0 offset for null or undefined strings
2022-01-29 14:23:57 -08:00
Justin T Conroy
19920db39f Include a SizePrefixed..HasIdentifier for c++. (#6871)
* Include a SizePrefixed..HasIdentifier for c++.

* Add updated generated code.
2022-01-28 20:52:32 -08:00
Derek Bailey
dbbaeac85c Use ${PYTHON_EXECUTABLE} instead of py in cmake (#7042)
* Emit include for bfbs-gen-embed

* Use python3 explicitly

* bump min python version to 3.6

* Sort find_package for python

* try casting Path to string

* cast WindowsPath to string to please CI

* stringify the wrong thing

* another stringify path
2022-01-28 15:00:57 -08:00
Derek Bailey
028f0fde62 'flattest': Add --test_path option (#7041) 2022-01-27 14:21:01 -08:00
MS
87343631b9 Added support for clang-cl on windows (CMake) (#7038)
* Moved the CMake check for Clang *after* the one for MSVC, as clang-cl
  matches both Clang and MSVC.
* Removed /MP definition - controlled by CMake
* Added CPP define for _CRT_SECURE_NO_WARNINGS so clang can see it
  (it seems it doesnt pick up the pragma in util.cpp)
2022-01-27 10:48:01 -08:00
LouisP
1fbfaf5c5e Fix/cmake build grpc (#7028)
* BuildFlatbuffers.cmake: add verbose on build

* BuildFlatbuffers.cmake: properly add *.fb.* files with --grpc argument

When "--grpc" argument is provided as an extra flag, resulting grpc files
should be added as part of the interface library.
This prevent adding .fb.cc files manually to the build.

V2: fix dependency on grpc files
2022-01-25 20:57:31 -08:00
BogDan Vatra
4421375bb6 Add FlatBuffers::FlatBuffers interface, needed for FetchContent_Declare (#7023) 2022-01-25 20:51:00 -08:00
Jon Simantov
162ad7a37e Fix comment with line orders - Rust should be last. (#7037)
Fix for #6867.
2022-01-25 16:43:08 -08:00
Jon Simantov
a0a6c3f8c6 Use actions/checkout@v2, which fixes security vulnerability. (#7036)
Fix for issue #6999.
2022-01-25 16:19:05 -08:00
Jon Simantov
a2d38fbb98 Add --warnings-as-errors to flatc compiler. (#7034)
* Add --warnings-as-errors to flatc compiler.

With this option set, flatc will return an error on parsing if
any warnings occurred.

* Add unit test for opts.warnings_as_errors.

* Change explicit option setting to default.
2022-01-25 14:01:16 -08:00
Derek Bailey
9ef1524d3f Emit include for bfbs-gen-embed (#7031) 2022-01-25 10:43:16 -08:00
Derek Bailey
0c9de0352a Upgraded GRPC version to 1.42.0 (#7033) 2022-01-25 09:59:29 -08:00
Ivan Dlugos
a783bc9267 chore: dart 2.0.5 release changes (#6983) 2022-01-20 13:30:03 -08:00
Marcin Witkowski
aff818cebf rust: Allow for usage in no_std environment (#6989) 2022-01-20 11:49:02 -05:00
Danila Kutenin
d7b75417fc Make flatbuffer builder deterministic (#6993) 2022-01-14 15:37:27 -08:00
Wouter van Oortmerssen
a42e898979 Added verifier alignment checking to table fields (#7018) 2022-01-14 14:39:15 -08:00
LouisP
96cc2f3ee3 BuildFlatBuffers.cmake: fix arguments not passed properly to flatc (#7013)
Fix regression introduced by commit e9d4532401
2022-01-14 14:38:04 -08:00
Richard A Hofer
3250a1f8dd Add initial C# vector of unions support to the documentation. (#6880)
* Add initial C# vector of unions support to the documentation.

* Add notes about missing documentation for vector of unions.
2022-01-13 22:15:35 -08:00
Alex E
ace4a37f22 [TS/JS] BigInt implementation (#6998)
* BigInt implementation

* Unit test reading long from existing bytebuffer

* Code review
2022-01-06 20:35:37 -06:00
Advait Jain
f28c2b2936 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();
    ~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
2021-12-23 20:31:30 -06:00
Shlomi Regev
96f3cf690f 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().
2021-12-22 10:40:38 -06:00
Panagiotis Gourgaris
b3edfdbfb7 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
2021-12-18 18:23:28 -08:00
Wouter van Oortmerssen
b8aaccee82 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.
2021-12-15 10:41:29 -08:00
Wouter van Oortmerssen
2dc8ae7742 Enable OSS-Fuzz on CI 2021-12-14 12:10:43 -08:00
Wouter van Oortmerssen
5b0d491127 Updated FlexBuffers fuzzer 2021-12-14 11:57:42 -08:00
Wouter van Oortmerssen
d8b7041d7e Added alignment checking to FlexBuffers verifier 2021-12-14 11:20:23 -08:00
Wouter van Oortmerssen
5a0c3366c3 FlexBuffers verifier additionally checks for nesting 2021-12-14 11:20:23 -08:00
Wouter van Oortmerssen
f8148b8dad Made FlexBuffers reuse tracker track types 2021-12-14 11:20:23 -08:00
Derek Bailey
a22b1b6267 Prevent shadow with _{{FIELD_NAME}} (#6991) 2021-12-13 21:27:36 -08:00
Wouter van Oortmerssen
4264daadd2 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.
2021-12-13 15:47:06 -08:00
Derek Bailey
3cbc120a08 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
2021-12-13 13:56:47 -08:00
Vadim-Valdis Yudaev
8dcd2682c7 [CMake] Add option for disable universal on OSX (#6990)
See https://github.com/google/flatbuffers/issues/6988
2021-12-13 13:32:58 -08:00
Derek Bailey
b78002ff3e Validate C# json/object-api options (#6985) 2021-12-13 11:52:01 -08:00
Derek Bailey
c555ee8fac Add .NET test to github workflows (#6982) 2021-12-13 11:51:27 -08:00
Biswapriyo Nath
b92bb0584d [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.
2021-12-10 15:40:21 -08:00
Wouter van Oortmerssen
956d11569e re-enabled FlexBuffer JSON in fuzzer 2021-12-10 15:22:06 -08:00
Wouter van Oortmerssen
e367ca32ad Verifier for FlexBuffers (#6977)
* Verifier for FlexBuffers

* Verifier improvements & fuzzer
2021-12-10 14:59:08 -08:00
Biswapriyo Nath
705f27f6ee [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
2021-12-10 11:28:24 -08:00
lu-wang-g
5fc87f4c4b 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
2021-12-09 15:47:09 -08:00
Danila Kutenin
11749095a1 Make idl_parser deterministic (#6976)
* Make idl_parser deterministic

Some golden tests even exercise this [logic](df2df21ec1/tests/prototest/test.golden (L8)). Let's make the parser fully stable not depending on the implementation of std::sort

* Retry the ci
2021-12-09 13:07:29 -08:00