summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-03-11[idl_parser] Add kTokenNumericConstant token (#6432)Vladimir Glavnyy2-38/+83
* [idl_parser] Add kTokenNumericConstant token This commit adds the new token for correct parsing of signed numeric constants. Before this expressions `-nan` or `-inf` were treated as kTokenStringConstant. This was ambiguous if a real string field parsed. For example, `{ "text_field" : -name }` was accepted by the parser as valid JSON object. Related oss-fuzz issue: 6200301176619008 * Add additional positive tests fo 'inf' and 'nan' as identifiers * Rebase to HEAD * Move processing of signed constants to ParseSingleValue method. * Add missed `--cpp-static-reflection` (#6324) to pass CI * Remove `flatbuffers.pc` from repository to unblock CI (#6455). Probably the generated flatbuffers.pc should not be a part of repo. * Fix FieldIdentifierTest()
2021-03-11Remove `flatbuffers.pc` from the repository (#6508)Vladimir Glavnyy2-9/+1
2021-03-09Bump grpc to 1.0.0 (#6507)mustiikhalil3-2/+3
Adds void to keywords
2021-03-08Move Traits struct and Create method out of --cpp-static-reflection. (#6503)dpacbach1-11/+13
2021-03-08Disable x64-specific optimizations for ARM64EC ReadInt64 (#6506)Ben Niu1-1/+1
ARM64EC is a new ARM64 ABI designed by Microsoft to support x64 application emulation on ARM64 CPUs. When compiling for ARM64EC, both the _M_X64 and _M_ARM64EC macros are defined. However, that causes problem in compiling this file, because the __movsb intrinsic, which is lowered to rep movsb, is not supported on ARM64, so the optimization for native x64 should be disabled for ARM64EC.
2021-03-06Add --cpp-static-reflection to generate_code.bat. (#6502)dpacbach1-1/+1
2021-03-05[C++17] Add compile-time reflection for fields. (#6324)David P. Sicilia9-11/+834
* [C++17] Add compile-time reflection for fields. Included in this commit is the following: - The C++ generator has been modified so that, when in C++17 mode, it will emit Table and Struct field traits that can be used at com- pile time as a form of static reflection. This includes field types, field names, and a tuple of field getter results. - Diffs to the cpp17 generated files. No other generated files are affected. - A unit test that also serves as an example. It demonstrates how to use the full power of this reflection to implement a full recursive JSON-like stringifier for Flatbuffers types, but without needing any runtime access to the *.fbs definition files; the computation is done using only static reflection. Tested on Linux with gcc 10.2.0. Fixes #6285. * Fix int-conversion warning on MSVC. * Try to fix std::to_string ambiguity on MSVC. * Fix clang-format diffs. * Fix more clang-format diffs. * Fix last clang-format diff. * Enable C++17 build/test for VC 19 platform in CI. * Forgot to add value to cmake command line variable. * Various fixes/changes in response to @vglavnyy's feedback. * Replace "fields pack" with index-based getters. * Fix MSVC error. * Fix clang-format diffs. * getter_for method returns result instead of address-of-getter. * Next round of reviewer suggestions. * Use type instead of hardcoded struct name. * Fix clang-format diff. * Add test for FieldType since it is not used in the stringify test. * Add fields_number field to Traits struct. * Add --cpp-static-reflection flag and put those features behind it. * Fix clang-format diffs. * Remove <tuple> include.
2021-03-04fixed invalid TS call and added test files (#6495)Kamil Rojewski36-4029/+4185
e581013e3d42af13d2fe37b0ac46a3fd43f3638c broke TS generation - please don't use "replace" to refactor function names :)
2021-03-01disable clippy (#6494)Casper1-3/+7
Co-authored-by: Casper Neo <cneo@google.com>
2021-03-01[idl_parser, JSON] Disable parsing of JSON for incomplete schemes (#6493)Vladimir Glavnyy1-1/+4
This commit disable JSON parsing for an incomplete scheme if JSON object is embedded into one file with the scheme. This should improve the quality of OSS-Fuzz inputs for the parser_fuzzer target.
2021-03-01[idl_parser] Track included files by hash (#6434)Mark Spatz4-36/+35
* [idl_gen] Delete ts::GenPrefixedImport() I don't know what this is for, but it's the only piece of code external to idl_parser.cpp that expects the key of Parser::included_files_ to be a path. And it appears to be unused. * [idl_parser] Track included files by hash Parser::included_files_ is a map whose main purpose is to keep track of which files have already been parsed in order to protect against multiple inclusion. Its key is the path that the file was found at during parsing (or, if it's an in-memory file, just its name). This commit changes the key to be the 64 bit FNV-1a hash of the file's name (just the name, not the complete path) xor'd with the hash of the file's contents (unless it's an in-memory file, then we only hash the name.) This allows multiple include protection to function even in the face of unique per-file include paths (fixes #6425). * Ran tests/generate_code.sh CI told me to do it. * Gracefullt handle case where source_filename == nullptr I just learned source_filename might also be null. In that case, we should exclude it from the hash instead of hashing a zero length string, just like we exclude source when it is null. Presumably nameless files will never be included (they can't, can they?) so this doesn't really matter, but I think it's prettier anyways.
2021-02-25fix for noUncheckedIndexedAccess in ts (#6474)Kamil Rojewski2-1/+2
2021-02-25Working on a python example plus fixing python grpc code (#6456)mustiikhalil15-690/+441
Refactored python grpc code gen Adds example server & client + fixes ci Fixes generated code Making sure we encode the reply string as utf8 Adds Readme details to clarify issue regarding encoding when python is sending/receiving
2021-02-24[rust] Remove debug code (#6475)Colin3-3/+5
* Remove debug code This was added for testing in the recent genericize PR for flexbuffer Reader. * Added alloc tests -> MapReader::{is_empty, index_key, len} * Added , accessible through Deref to deprecation warning
2021-02-23Revert "[C#] Fix truncated ArraySegment<byte> if elementSize != 1 (#6462)" ↵Derek Bailey7-24/+19
(#6488) This reverts commit cbbbaa61b34c31f17773c2fef354c31664e9562e.
2021-02-23[C#] Fix truncated ArraySegment<byte> if elementSize != 1 (#6462)Björn Harrtell7-19/+24
* WIP: Fix returned truncated ArraySegment<byte> if elementSize is not byte * Fix * Regenerated test code
2021-02-23[CI] Adds Code Generation tests on Github Actions (#6482)mustiikhalil8-6/+79
Moves check-grpc-generation to scripts
2021-02-22[CMake] generate pkg-config flatbuffers.pc file (#6455)Millian Poquet2-0/+17
This commit enables CMake to generate a flatbuffers.pc file on install. pkg-config eases the utilization of software libraries by enabling the developers of a library to define how the library should be used. It can be used as a tool by build systems to find and manage dependencies, this is notably the default Meson behavior and optionally used by CMake.
2021-02-20[Swift] Moves grpc example to grpc/examples (#6479)mustiikhalil11-206/+147
Updates generated Code Removes grpc generation code from tests dir Small fix to generate.sh
2021-02-20[TS] Moves grpc code to examples folder (#6476)mustiikhalil11-21/+33
Adds readme
2021-02-19Fixes grammer (#6477)mustiikhalil10-62/+66
Updates docs
2021-02-19Fix sample_binary.py to use latest EndVector without a size. (#6478)Richard A Hofer1-2/+2
2021-02-19updated JS docs to reflect current status (#6436)Kamil Rojewski4-143/+25
2021-02-19[Go] Working on a go example plus fixing go grpc code (#6448)mustiikhalil19-207/+842
Implemented server.go and half implemented client.go Finishes implementation for greeter go example Update grpc code for monster.fbs Adds a couple of cpp methods Adhere to gofmt standards Adds a readme for issues with grpc
2021-02-19[Swift] adds support for default vectors and strings (#6461)mustiikhalil9-37/+254
Small fix Adhere to the new protocol names
2021-02-18Update Building.md (#6473)Arnaud LE CAM1-1/+1
`cmake . -D FLATBUFFERS_CXX_FLAGS="Wno-error"` returns an error (file 'Wno-error' not found)
2021-02-18GetUOffsetT must get value by GetUint32 not GetInt32 (#6072)Thanabodee Charoenpiriyakij1-1/+1
2021-02-17Fix a typo in Swift codegen (#6470)Liu Liu1-2/+3
* Fix a typo in Swift codegen * Fix code formatting.
2021-02-16[rust] Genericize flexbuffer reader (#6450)Colin14-128/+385
* feature/rust-tokio-bytes added feature name for tokio-bytes * Added flexbuffer implementation, TODO: typecast to avoid recurse * Converted codebase to utilize FlexBuffer implementation, need to resolve deserialization issues * Added todo for lifetime issue, may use &'de [u8] for deserializer instead of current method * Added proper &[u8] implementation * Removed unused struct * Added experimental fix to get_slice * Added experimental fix to get_slice * Avoided lifetime issues via ref structs, need to check if this hurts peformance * Updated deserializer implementation to allow for borrowed data from Reader struct * Fixed bug with str * Removed unnecessary generic parameter * Added unsafe to avoid lifetime complaints, current tests pass, need to review alternatives to unsafe * Opinionated: Removed bytes crate as this implementation could be done in a separate crate * Cleaned up flatbuffer * Fixed sample / example * Resolved PR feedback, need to resolve issues with tests * Cleaned up FlexBuffer trait to be an auto impl * Removed TODO * Reverted Deserializer to only support &'de [u8] * Cleaned up / renamed function for clarification * Renamed FlexBuffer -> InternalBuffer for clarification on it's purpose * Fixed issue with key bytes * resolved issues with broken tests, confirming this is a breaking change * Removed FIXME that's solved by splitting String and Key variants * Implemented associated types approach * Fixed backward slice logic * Fixed MapReader compile error * Added from_buffer for deserialization, removed function since it's only needed for deserialization * Removed dead code * Cleaned up buffer, removed AsRef in favor of Deref * Renamed Buffer::as_str -> Buffer::buffer_str * Minor cleanup * Updated documentation, need to fix tests * Removed unnecessary & * Removed unused lifetime * removed unnecessary as_ref * Minor optimization wrap-up * resolved issue with Clone * Added test to verify no deep-copy * Added for optimization * Updated to use empty fn instead of default * Updated comments / test name - plus the 0.3.0 version bump * comment
2021-02-16[Swift] Renaming protocols (#6469)mustiikhalil5-41/+42
* Renaming protocols * Updates Generated code * format code
2021-02-14Update swift docs (#6460)mustiikhalil1-1/+1
2021-02-12Default strings and vectors: Parser + Rust support (#6421)Casper12-100/+403
* Fix tests.cpp * Parser support for vector/string defaults * tests and default empty vectors * addressed comments * Default strings and vectors for Rust * Tested Rust more_defaults * git-clang-format * add more_defaults_test * fixed vector default * removed commented out code * more unreachable Co-authored-by: Casper Neo <cneo@google.com>
2021-02-11[CMake] Renames BUILD files (#6457)mustiikhalil6-5/+7
* Renamed build to build.bazel to stop xcode from complaining about it * Renamed all build to build.bazel * Fixes small ci issue
2021-02-10[Build, cmake] Add -Werror override option (#6429)Vladimir Glavnyy2-0/+28
* [Build, cmake] Add -Werror override option This commit adds FLATBUFFERS_CXX_FLAGS cmake option. This option allows override the -Werror flag (or any other flags). Related issues: #6337, #5930 * Remove CMAKE_CXX_FLAGS replace option
2021-02-10[C++]Fix extra char generation for byte type during json schema generation ↵blueshift1550-0/+0
(#6276) * Fix extra char generation for the byte type * Fix unit tests for JSON
2021-02-10Updating working code (#6441)mustiikhalil10-288/+310
Fixes issues with namespaces in grpc ts Renamed welcome -> models
2021-02-10JSON schema - tailing double quotes for maximum (#6452)tira-misu3-11/+11
* 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 * Fix double quotes for (u)int8 in json schema * Fix reference file for JSON schema test * Fix reference file for JSON schema test
2021-02-10[idl_parser] Validate `force_align` on all possible paths (#6430)Vladimir Glavnyy5-14/+39
* [idl_parser] Validate `force_align` on all possible paths - added validation of `force_align` for `Vector`. - added assertion to `flatbuffers::PreAlign` method These changes should resolve following oss-fuzz issues: - 6275816289861632 - 5713529908887552 - 4761242994606080 * size_t problem on Mac * Fix review notes
2021-02-07Implement Rust object API defaults (#6444)Casper8-32/+403
* Implment Rust object API defaults * satisfy return analysis * git clang format Co-authored-by: Casper Neo <cneo@google.com>
2021-02-04Upgrade swift grpc to alpha 24 (#6439)mustiikhalil7-171/+474
Upgrade swift grpc to alpha 24
2021-01-30[fuzzer] Limit parser_fuzzer execution time (#6431)Vladimir Glavnyy2-2/+2
Limit the length of the fuzzer input to 16384 characters to prevent timeout in JSON parser (Vector of tables with key). Related oss-fuzz issues: - 5742497110294528
2021-01-28This commit contains the initial implementation of Flexbuffers in Kotlin. ↵Paulo Pinheiro25-0/+4772
The code was ported based (#6387) on the current Java Implementation. The code dependencies related to JVM were removed and the project is able to target all available platforms. The only requirement to implement to fully support a target is to implement functions described in `ByteArray.kt`. Right now the code support JVM and native targets. JS port still missing, but just be trivial to introduce. Currently, only the `jvm` and `macosX64` targets are enabled until we figure out how to enable tests on all platforms on CI. A submodule called "benchmark" is also introduced. It contains a series of benchmarks comparing Java and Kotlin implementations of FlexBuffers and the UTF8 API. Finally, this commit does not contain the scripts necessary to publish the artifacts. This will be introduced at a later stage once the team has an agreement on how to rollout Kotlin releases.
2021-01-28Better python generated code naming (#6336)Richard A Hofer17-497/+1001
* Remove a lot of redundancy from the Python generated code. Update tutorial to reflect new Python generated code. * Add aliases for newly deprecated Python generated methods. This should help with backwards compatibility. * Fix incorrect names in deprecated comments.
2021-01-26Rust: remove inner attributes (#6410)Casper15-9/+104
* remove inner attributes * Added test for outdir in Rust * add bin/outdir * Moved outdir test to its own package and only run it if flatc is available Co-authored-by: Casper Neo <cneo@google.com>
2021-01-25[Rust] Ensure unions are referenced with the correct path (#6422)William Bain32-57/+1448
* Add codegen test for namespaced unions * [Rust] Handle cross-namespace union use * [Rust] Test namespace handling * [Rust] Drop trailing whitespace in codegen * [Rust] Set flags in generate_code.bat to match .sh * [C#] Add additional namespace test file
2021-01-25Refactor FieldDef to model presense as an enum rather than 2 bools. (#6420)Casper14-160/+183
* Define presence. * Migrate to IsRequired and IsOptional methods * moved stuff around * Removed optional and required bools from FieldDef * change assert to return error * Fix tests.cpp * MakeFieldPresence helper * fmt * old c++ compatibility stuff Co-authored-by: Casper Neo <cneo@google.com>
2021-01-25[c++] Apply NativeName before WrapInNameSpace in idl_gen_cpp.cpp (#6419)Andreas Kabel1-34/+33
* Apply NativeName before WrapInNameSpace in idl_gen_cpp.cpp * remove actual_type argument from GetUnionElement -- it's always true * Merge GetUnionElement's native_type and wrap_native argument -- they always have the same value. * Use convenience method WrapNativeNameInNameSpace * Remove wrap_namespace argument from GetUnionElement * Move declaration closer to first use.
2021-01-22Formats cpp code (#6349)mustiikhalil11-100/+167
2021-01-22Rust Object API (#6070)Casper21-321/+2364
* inital commit of rust object api * Required fields support. * clang fallthrough * Fix unused variables * just don't fall through * remove comment * s/panic/unreachable * Tests for object API * Added defaults * deleted unintentionally added files and updated .bat file * fix bat file * clang format * Cargo clippy checks * remove commented out code * clippy allows * Remove matches! macro since we're not yet at Rust v1.42 * install clippy in RustTest.sh * move line Co-authored-by: Casper Neo <cneo@google.com>
2021-01-21Clarify that (Flat|Flex)Buffers do not deduplicate vector elements (#6415)Juan Cruz Viotti1-2/+8
I'm also clarifying that while elements are not deduplicated, vectors may contain more than one offset to the same value. Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>