* [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
* 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
* 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)
* 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
* 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.
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();
~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
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().
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.
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.
* 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
* 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
* 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)
* 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
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
* 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