diff --git a/0001-Fix-compiler-warning-Wredundant-parens.patch b/0001-Fix-compiler-warning-Wredundant-parens.patch deleted file mode 100644 index a7d31b6e88fd775c33b8be967adac17e88d0353e..0000000000000000000000000000000000000000 --- a/0001-Fix-compiler-warning-Wredundant-parens.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h -index ee34d54..aecf80f 100644 ---- a/include/flatbuffers/flatbuffers.h -+++ b/include/flatbuffers/flatbuffers.h -@@ -1824,7 +1824,7 @@ class FlatBufferBuilder { - /// where the vector is stored. - template - Offset> CreateVectorOfNativeStructs( -- const S *v, size_t len, T((*const pack_func)(const S &))) { -+ const S *v, size_t len, T (*const pack_func)(const S &)) { - FLATBUFFERS_ASSERT(pack_func); - std::vector vv(len); - std::transform(v, v + len, vv.begin(), pack_func); -@@ -1912,7 +1912,7 @@ class FlatBufferBuilder { - /// where the vector is stored. - template - Offset> CreateVectorOfNativeStructs( -- const std::vector &v, T((*const pack_func)(const S &))) { -+ const std::vector &v, T (*const pack_func)(const S &)) { - return CreateVectorOfNativeStructs(data(v), v.size(), pack_func); - } - diff --git a/0002-typo-fixes-in-comments.patch b/0002-typo-fixes-in-comments.patch deleted file mode 100644 index 89701eb39745429dbe5b93adfa630369120253f8..0000000000000000000000000000000000000000 --- a/0002-typo-fixes-in-comments.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0a50504c58d61a260a36e5bd63e3afe42a7a6a91 Mon Sep 17 00:00:00 2001 -From: yefeng -Date: Mon, 15 Nov 2021 18:55:21 +0800 -Subject: [PATCH 1/3] typo fixes in comments - ---- - include/flatbuffers/flatbuffers.h | 6 +++--- - include/flatbuffers/flexbuffers.h | 2 +- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h -index ee34d54..e652e40 100644 ---- a/include/flatbuffers/flatbuffers.h -+++ b/include/flatbuffers/flatbuffers.h -@@ -536,7 +536,7 @@ template class Array { - - void CopyFromSpanImpl(flatbuffers::integral_constant, - flatbuffers::span src) { -- // Use std::memcpy() instead of std::copy() to avoid preformance degradation -+ // Use std::memcpy() instead of std::copy() to avoid performance degradation - // due to aliasing if T is char or unsigned char. - // The size is known at compile time, so memcpy would be inlined. - std::memcpy(data(), src.data(), length * sizeof(T)); -@@ -2204,7 +2204,7 @@ class FlatBufferBuilder { - return reinterpret_cast(buf_.make_space(vector_size * sizeof(T))); - } - -- // End the vector of structues in the flatbuffers. -+ // End the vector of structures in the flatbuffers. - // Vector should have previously be started with StartVectorOfStructs(). - template - Offset> EndVectorOfStructs(size_t vector_size) { -@@ -2821,7 +2821,7 @@ inline int LookupEnum(const char **names, const char *name) { - - // Minimal reflection via code generation. - // Besides full-fat reflection (see reflection.h) and parsing/printing by --// loading schemas (see idl.h), we can also have code generation for mimimal -+// loading schemas (see idl.h), we can also have code generation for minimal - // reflection data which allows pretty-printing and other uses without needing - // a schema or a parser. - // Generate code with --reflect-types (types only) or --reflect-names (names -diff --git a/include/flatbuffers/flexbuffers.h b/include/flatbuffers/flexbuffers.h -index c71928e..3e7ab3e 100644 ---- a/include/flatbuffers/flexbuffers.h -+++ b/include/flatbuffers/flexbuffers.h -@@ -1086,7 +1086,7 @@ class Builder FLATBUFFERS_FINAL_CLASS { - return stack_.size(); - } - -- // TODO(wvo): allow this to specify an aligment greater than the natural -+ // TODO(wvo): allow this to specify an alignment greater than the natural - // alignment. - size_t EndVector(size_t start, bool typed, bool fixed) { - auto vec = CreateVector(start, stack_.size() - start, 1, typed, fixed); --- -2.17.1 - diff --git a/0003-Changes-to-support-binary-schema-file-loading-and-pa.patch b/0003-Changes-to-support-binary-schema-file-loading-and-pa.patch deleted file mode 100644 index fc3525043e30dacd30d64fea0ad8047ed7f7146d..0000000000000000000000000000000000000000 --- a/0003-Changes-to-support-binary-schema-file-loading-and-pa.patch +++ /dev/null @@ -1,37 +0,0 @@ -From fa1930955cb95a445f0a8547a9ef555e1b090860 Mon Sep 17 00:00:00 2001 -From: yefeng -Date: Mon, 15 Nov 2021 18:58:22 +0800 -Subject: [PATCH 2/3] Changes to support binary schema file loading and parsing - ---- - src/flatc.cpp | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/src/flatc.cpp b/src/flatc.cpp -index 221b886..a3043cc 100644 ---- a/src/flatc.cpp -+++ b/src/flatc.cpp -@@ -453,16 +453,17 @@ int FlatCompiler::Compile(int argc, const char **argv) { - contents.length() != strlen(contents.c_str())) { - Error("input file appears to be binary: " + filename, true); - } -- if (is_schema) { -+ if (is_schema || is_binary_schema) { - // If we're processing multiple schemas, make sure to start each - // one from scratch. If it depends on previous schemas it must do - // so explicitly using an include. - parser.reset(new flatbuffers::Parser(opts)); - } -+ // Try to parse the file contents (binary schema/flexbuffer/textual -+ // schema) - if (is_binary_schema) { - LoadBinarySchema(*parser.get(), filename, contents); -- } -- if (opts.use_flexbuffers) { -+ } else if (opts.use_flexbuffers) { - if (opts.lang_to_generate == IDLOptions::kJson) { - parser->flex_root_ = flexbuffers::GetRoot( - reinterpret_cast(contents.c_str()), --- -2.17.1 - diff --git a/0004-output-errors-instead-of-stdout.patch b/0004-output-errors-instead-of-stdout.patch deleted file mode 100644 index 3f7b60ad26798d8d1145c111764e09a618758e53..0000000000000000000000000000000000000000 --- a/0004-output-errors-instead-of-stdout.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 766c1984b6e5e3e8ac1c153238e05b7f0624f7b5 Mon Sep 17 00:00:00 2001 -From: yefeng -Date: Mon, 15 Nov 2021 18:59:03 +0800 -Subject: [PATCH 3/3] output errors instead of stdout - ---- - src/flatc_main.cpp | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/flatc_main.cpp b/src/flatc_main.cpp -index b196666..30d0b47 100644 ---- a/src/flatc_main.cpp -+++ b/src/flatc_main.cpp -@@ -23,15 +23,15 @@ static void Warn(const flatbuffers::FlatCompiler *flatc, - const std::string &warn, bool show_exe_name) { - (void)flatc; - if (show_exe_name) { printf("%s: ", g_program_name); } -- printf("warning: %s\n", warn.c_str()); -+ fprintf(stderr, "warning: %s\n", warn.c_str()); - } - - static void Error(const flatbuffers::FlatCompiler *flatc, - const std::string &err, bool usage, bool show_exe_name) { - if (show_exe_name) { printf("%s: ", g_program_name); } -- printf("error: %s\n", err.c_str()); -+ fprintf(stderr, "error: %s\n", err.c_str()); - if (usage && flatc) { -- printf("%s", flatc->GetUsageString(g_program_name).c_str()); -+ fprintf(stderr, "%s", flatc->GetUsageString(g_program_name).c_str()); - } - exit(1); - } --- -2.17.1 - diff --git a/0005-fix-undefined-behaviour.patch b/0005-fix-undefined-behaviour.patch deleted file mode 100644 index c719d5c61d2a2f5a9f1af40737c185f5f8398e82..0000000000000000000000000000000000000000 --- a/0005-fix-undefined-behaviour.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 57ee742cb1d2a2902dd5e00af5da9293aa11326c Mon Sep 17 00:00:00 2001 -From: yefeng -Date: Wed, 17 Nov 2021 14:49:42 +0800 -Subject: [PATCH 1/2] fix undefined behaviour - ---- - include/flatbuffers/flatbuffers.h | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h -index e652e40..42c4fa8 100644 ---- a/include/flatbuffers/flatbuffers.h -+++ b/include/flatbuffers/flatbuffers.h -@@ -1808,7 +1808,9 @@ class FlatBufferBuilder { - template - Offset> CreateVectorOfStructs(const T *v, size_t len) { - StartVector(len * sizeof(T) / AlignOf(), AlignOf()); -- PushBytes(reinterpret_cast(v), sizeof(T) * len); -+ if (len > 0) { -+ PushBytes(reinterpret_cast(v), sizeof(T) * len); -+ } - return Offset>(EndVector(len)); - } - --- -2.17.1 - diff --git a/flatbuffers-23.5.26.tar.gz b/flatbuffers-23.5.26.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..111e3b908c2918c561065dc423e4ee6c740d0104 Binary files /dev/null and b/flatbuffers-23.5.26.tar.gz differ diff --git a/flatbuffers.7 b/flatbuffers.7 deleted file mode 100644 index 1ccbe150463f63ffa957af9d2ea0afb526611447..0000000000000000000000000000000000000000 --- a/flatbuffers.7 +++ /dev/null @@ -1,461 +0,0 @@ -.TH FLATBUFFERS 7 "APRIL 2018" Linux "User Manuals" -.SH NAME -.PP -flatbuffers \- memory efficient serialization library -.SH DESCRIPTION -.TP -\fBBefore you get started\fP -Before diving into the FlatBuffers usage in C++, it should be noted that the -Tutorial \[la]http://google.github.io/flatbuffers/flatbuffers_guide_tutorial.html\[ra] page has a complete guide to general -FlatBuffers usage in all of the supported languages (including C++). This page is designed to cover the nuances of -FlatBuffers usage, specific to C++. -.IP -This page assumes you have written a FlatBuffers schema and compiled it with the Schema Compiler. If you have not, -please see Using the schema -compiler \[la]http://google.github.io/flatbuffers/flatbuffers_guide_using_schema_compiler.html\[ra] and Writing a -schema \[la]http://google.github.io/flatbuffers/flatbuffers_guide_writing_schema.html\[ra]\&. -.IP -Assuming you wrote a schema, say \fB\fCmygame.fbs\fR (though the extension doesn't matter), you've generated a C++ header -called \fB\fCmygame_generated.h\fR using the compiler (e.g. \fB\fCflatc \-c mygame.fbs\fR), you can now start using this in your -program by including the header. As noted, this header relies on \fB\fCflatbuffers/flatbuffers.h\fR, which should be in your -include path. -.TP -\fBFlatBuffers C++ library code location\fP -The code for the FlatBuffers C++ library can be found at \fB\fCflatbuffers/include/flatbuffers\fR\&. You can browse the library -code on the FlatBuffers GitHub page \[la]https://github.com/google/flatbuffers/tree/master/include/flatbuffers\[ra]\&. -.TP -\fBTesting the FlatBuffers C++ library\fP -The code to test the C++ library can be found at \fB\fCflatbuffers/tests\fR\&. The test code itself is located in -test.cpp \[la]https://github.com/google/flatbuffers/blob/master/tests/test.cpp\[ra]\&. -.IP -This test file is built alongside \fB\fCflatc\fR\&. To review how to build the project, please read the -Building \[la]http://google.github.io/flatbuffers/flatbuffers_guide_building.html\[ra] documenation. -.IP -To run the tests, execute \fB\fCflattests\fR from the root \fB\fCflatbuffers/\fR directory. For example, on -Linux \[la]https://en.wikipedia.org/wiki/Linux\[ra], you would simply run: \fB\fC\&./flattests\fR\&. -.TP -\fBUsing the FlatBuffers C++ library\fP -Note: See Tutorial \[la]http://google.github.io/flatbuffers/flatbuffers_guide_tutorial.html\[ra] for a more in\-depth example -of how to use FlatBuffers in C++. -.IP -FlatBuffers supports both reading and writing FlatBuffers in C++. -.IP -To use FlatBuffers in your code, first generate the C++ classes from your schema with the \fB\fC\-\-cpp\fR option to -\fB\fCflatc\fR\&. Then you can include both FlatBuffers and the generated code to read or write FlatBuffers. -.IP -For example, here is how you would read a FlatBuffer binary file in C++: First, include the library and generated -code. Then read the file into a \fB\fCchar *\fR array, which you pass to \fB\fCGetMonster()\fR\&. -.PP -.RS -.nf - #include "flatbuffers/flatbuffers.h" - #include "monster_test_generate.h" - #include // C++ header file for printing - #include // C++ header file for file access - - - std::ifstream infile; - infile.open("monsterdata_test.mon", std::ios::binary | std::ios::in); - infile.seekg(0,std::ios::end); - int length = infile.tellg(); - infile.seekg(0,std::ios::beg); - char *data = new char[length]; - infile.read(data, length); - infile.close(); - - auto monster = GetMonster(data); -.fi -.RE -.IP -\fB\fCmonster\fR is of type \fB\fCMonster *\fR, and points to somewhere \fIinside\fP your buffer (root object pointers are not the same -as \fB\fCbuffer_pointer\fR !). If you look in your generated header, you'll see it has convenient accessors for all fields, -e.g. \fB\fChp()\fR, \fB\fCmana()\fR, etc: -.PP -.RS -.nf - std::cout << "hp : " << monster\->hp() << std::endl; // `80` - std::cout << "mana : " << monster\->mana() << std::endl; // default value of `150` - std::cout << "name : " << monster\->name()\->c_str() << std::endl; // "MyMonster" -.fi -.RE -.IP -Note: That we never stored a \fB\fCmana\fR value, so it will return the default. -.TP -\fBObject based API\fP -FlatBuffers is all about memory efficiency, which is why its base API is written around using as little as possible of -it. This does make the API clumsier (requiring pre\-order construction of all data, and making mutation harder). -.IP -For times when efficiency is less important a more convenient object based API can be used (through -\fB\fC\-\-gen\-object\-api\fR) that is able to unpack & pack a FlatBuffer into objects and standard STL containers, allowing for -convenient construction, access and mutation. -.IP -To use: -.PP -.RS -.nf - // Autogenerated class from table Monster. - MonsterT monsterobj; - - // Deserialize from buffer into object. - UnPackTo(&monsterobj, flatbuffer); - - // Update object directly like a C++ class instance. - cout << monsterobj\->name; // This is now a std::string! - monsterobj\->name = "Bob"; // Change the name. - - // Serialize into new flatbuffer. - FlatBufferBuilder fbb; - Pack(fbb, &monsterobj); -.fi -.RE -.IP -The following attributes are specific to the object\-based API code generation: -.RS -.IP \(bu 2 -\fB\fCnative_inline\fR: (on a field): Because FlatBuffer tables and structs are optionally present in a given buffer, they -are best represented as pointers (specifically std::unique\fIptrs) in the native class since they can be null. This -attribute changes the member declaration to use the type directly rather than wrapped in a unique\fPptr. -.IP \(bu 2 -\fB\fCnative_default\fR: "value" (on a field): For members that are declared "native_inline", the value specified with this -attribute will be included verbatim in the class constructor initializer list for this member. -.IP \(bu 2 -\fB\fCnative_custom_alloc\fR:"custom\fIallocator" (on a table or struct): When using the -object\-based API all generated NativeTables that are allocated when unpacking -your flatbuffer will use "custom allocator". The allocator is also used by -any std::vector that appears in a table defined with `native\fPcustom_alloc`. -This can be used to provide allocation from a pool for example, for faster -unpacking when using the object\-based API. -.PP -Minimal Example: -.PP -schema: -.PP -.RS -.nf -table mytable(native_custom_alloc:"custom_allocator") { - ... -} -.fi -.RE -.PP -with custom_allocator defined before flatbuffers.h is included, as: -.PP -.RS -.nf -template struct custom_allocator : public std::allocator { - - typedef T *pointer; - - template - struct rebind { - typedef custom_allocator other; - }; - - pointer allocate(const std::size_t n) { - return std::allocator::allocate(n); - } - - void deallocate(T* ptr, std::size_t n) { - return std::allocator::deallocate(ptr,n); - } - - custom_allocator() throw() {} - template - custom_allocator(const custom_allocator&) throw() {} -}; -.fi -.RE -.IP \(bu 2 -\fB\fCnative_type\fR: "type" (on a struct): In some cases, a more optimal C++ data type exists for a given struct. For -example, the following schema: -.PP -.RS -.nf -struct Vec2 { - x: float; - y: float; -} -.fi -.RE -.IP -generates the following Object\-Based API class: -.PP -.RS -.nf -struct Vec2T : flatbuffers::NativeTable { - float x; - float y; -}; -.fi -.RE -.IP -However, it can be useful to instead use a user\-defined C++ type since it can provide more functionality, eg. -.PP -.RS -.nf -struct vector2 { - float x = 0, y = 0; - vector2 operator+(vector2 rhs) const { ... } - vector2 operator\-(vector2 rhs) const { ... } - float length() const { ... } - // etc. -}; -.fi -.RE -.IP -The \fB\fCnative_type\fR attribute will replace the usage of the generated class with the given type. So, continuing with -the example, the generated code would use |vector2| in place of |Vec2T| for all generated code. -.IP -However, because the native_type is unknown to flatbuffers, the user must provide the following functions to aide -in the serialization process: -.PP -.RS -.nf -namespace flatbuffers { - FlatbufferStruct Pack(const native_type& obj); - native_type UnPack(const FlatbufferStruct& obj); -} -.fi -.RE -.IP \(bu 2 -\fB\fCnative_include\fR: "path" (at file level): Because the \fB\fCnative_type\fR attribute can be used to introduce types that -are unknown to flatbuffers, it may be necessary to include "external" header files in the generated code. This -attribute can be used to directly add an #include directive to the top of the generated code that includes the -specified path directly. -.RE -.TP -\fBExternal references\fP -An additional feature of the object API is the ability to allow you to load multiple independent FlatBuffers, and have -them refer to eachothers objects using hashes which are then represented as typed pointers in the object API. -.IP -To make this work have a field in the objects you want to referred to which is using the string hashing feature (see -\fB\fChash\fR attribute in the schema \[la]http://google.github.io/flatbuffers/flatbuffers_guide_writing_schema.html\[ra] -documentation). Then you have a similar hash in the field referring to it, along with a \fB\fCcpp_type\fR attribute -specifying the C++ type this will refer to (this can be any C++ type, and will get a \fB\fC*\fR added). -.IP -Then, in JSON or however you create these buffers, make sure they use the same string (or hash). -.IP -When you call \fB\fCUnPack\fR (or \fB\fCCreate\fR), you'll need a function that maps from hash to the object (see -\fB\fCresolver_function_t\fR for details). -.TP -\fBUsing different pointer types\fP -By default the object tree is built out of \fB\fCstd::unique_ptr\fR, but you can influence this either globally (using the -\fB\fC\-\-cpp\-ptr\-type\fR argument to \fB\fCflatc\fR) or per field (using the \fB\fCcpp_ptr_type\fR attribute) to by any smart pointer type -(\fB\fCmy_ptr\fR), or by specifying \fB\fCnaked\fR as the type to get \fB\fCT *\fR pointers. Unlike the smart pointers, naked pointers -do not manage memory for you, so you'll have to manage their lifecycles manually. -.TP -\fBUsing different string type\fP -By default the object tree is built out of \fB\fCstd::string\fR, but you can influence this either globally (using the -\fB\fC\-\-cpp\-str\-type\fR argument to \fB\fCflatc\fR) or per field using the \fB\fCcpp_str_type\fR attribute. -.IP -The type must support \fB\fCT::c_str()\fR and \fB\fCT::length()\fR as member functions. -.TP -\fBReflection (& Resizing)\fP -There is experimental support for reflection in FlatBuffers, allowing you to read and write data even if you don't -know the exact format of a buffer, and even allows you to change sizes of strings and vectors in\-place. -.IP -The way this works is very elegant; there is actually a FlatBuffer schema that describes schemas (!) which you can -find in \fB\fCreflection/reflection.fbs\fR\&. The compiler, \fB\fCflatc\fR, can write out any schemas it has just parsed as a binary -FlatBuffer, corresponding to this meta\-schema. -.IP -Loading in one of these binary schemas at runtime allows you traverse any FlatBuffer data that corresponds to it -without knowing the exact format. You can query what fields are present, and then read/write them after. -.IP -For convenient field manipulation, you can include the header \fB\fCflatbuffers/reflection.h\fR which includes both the -generated code from the meta schema, as well as a lot of helper functions. -.IP -And example of usage, for the time being, can be found in \fB\fCtest.cpp/ReflectionTest()\fR\&. -.PP -\fBMini Reflection\fP -.IP -A more limited form of reflection is available for direct inclusion in generated code, which doesn't any (binary) -schema access at all. It was designed to keep the overhead of reflection as low as possible (on the order of 2\-6 -bytes per field added to your executable), but doesn't contain all the information the (binary) schema contains. -.IP -You add this information to your generated code by specifying \fB\fC\-\-reflect\-types\fR (or instead \fB\fC\-\-reflect\-names\fR if you -also want field / enum names). -.IP -You can now use this information, for example to print a FlatBuffer to text: -.PP -.RS -.nf - auto s = flatbuffers::FlatBufferToString(flatbuf, MonsterTypeTable()); -.fi -.RE -.IP -\fB\fCMonsterTypeTable()\fR is declared in the generated code for each type. The string produced is very similar to the JSON -produced by the \fB\fCParser\fR based text generator. -.IP -You'll need \fB\fCflatbuffers/minireflect.h\fR for this functionality. In there is also a convenient visitor/iterator so you -can write your own output / functionality based on the mini reflection tables without having to know the FlatBuffers -or reflection encoding. -.TP -\fBStoring maps / dictionaries in a FlatBuffer\fP -FlatBuffers doesn't support maps natively, but there is support to emulate their behavior with vectors and binary -search, which means you can have fast lookups directly from a FlatBuffer without having to unpack your data into a -\fB\fCstd::map\fR or similar. -.IP -To use it: -.RS -.IP \(bu 2 -Designate one of the fields in a table as they "key" field. You do this by setting the \fB\fCkey\fR attribute on this -field, e.g. \fB\fCname:string (key)\fR\&. -.IP -You may only have one key field, and it must be of string or scalar type. -.IP \(bu 2 -Write out tables of this type as usual, collect their offsets in an array or vector. -.IP \(bu 2 -Instead of \fB\fCCreateVector\fR, call \fB\fCCreateVectorOfSortedTables\fR, which will first sort all offsets such that the tables -they refer to are sorted by the key field, then serialize it. -.IP \(bu 2 -Now when you're accessing the FlatBuffer, you can use \fB\fCVector::LookupByKey\fR instead of just \fB\fCVector::Get\fR to access -elements of the vector, e.g.: \fB\fCmyvector\->LookupByKey("Fred")\fR, which returns a pointer to the corresponding table -type, or \fB\fCnullptr\fR if not found. \fB\fCLookupByKey\fR performs a binary search, so should have a similar speed to -\fB\fCstd::map\fR, though may be faster because of better caching. \fB\fCLookupByKey\fR only works if the vector has been sorted, -it will likely not find elements if it hasn't been sorted. -.RE -.TP -\fBDirect memory access\fP -As you can see from the above examples, all elements in a buffer are accessed through generated accessors. This is -because everything is stored in little endian format on all platforms (the accessor performs a swap operation on big -endian machines), and also because the layout of things is generally not known to the user. -.IP -For structs, layout is deterministic and guaranteed to be the same across platforms (scalars are aligned to their own -size, and structs themselves to their largest member), and you are allowed to access this memory directly by using -\fB\fCsizeof()\fR and \fB\fCmemcpy\fR on the pointer to a struct, or even an array of structs. -.IP -To compute offsets to sub\-elements of a struct, make sure they are a structs themselves, as then you can use the -pointers to figure out the offset without having to hardcode it. This is handy for use of arrays of structs with calls -like \fB\fCglVertexAttribPointer\fR in OpenGL or similar APIs. -.IP -It is important to note is that structs are still little endian on all machines, so only use tricks like this if you -can guarantee you're not shipping on a big endian machine (an \fB\fCassert(FLATBUFFERS_LITTLEENDIAN)\fR would be wise). -.TP -\fBAccess of untrusted buffers\fP -The generated accessor functions access fields over offsets, which is very quick. These offsets are not verified at -run\-time, so a malformed buffer could cause a program to crash by accessing random memory. -.IP -When you're processing large amounts of data from a source you know (e.g. your own generated data on disk), this is -acceptable, but when reading data from the network that can potentially have been modified by an attacker, this is -undesirable. -.IP -For this reason, you can optionally use a buffer verifier before you access the data. This verifier will check all -offsets, all sizes of fields, and null termination of strings to ensure that when a buffer is accessed, all reads will -end up inside the buffer. -.IP -Each root type will have a verification function generated for it, e.g. for \fB\fCMonster\fR, you can call: -.PP -.RS -.nf - bool ok = VerifyMonsterBuffer(Verifier(buf, len)); -.fi -.RE -.IP -if \fB\fCok\fR is true, the buffer is safe to read. -.IP -Besides untrusted data, this function may be useful to call in debug mode, as extra insurance against data being -corrupted somewhere along the way. -.IP -While verifying a buffer isn't "free", it is typically faster than a full traversal (since any scalar data is not -actually touched), and since it may cause the buffer to be brought into cache before reading, the actual overhead may -be even lower than expected. -.IP -In specialized cases where a denial of service attack is possible, the verifier has two additional constructor -arguments that allow you to limit the nesting depth and total amount of tables the verifier may encounter before -declaring the buffer malformed. The default is \fB\fCVerifier(buf, len, 64 /* max depth */, 1000000, /* max tables */)\fR -which should be sufficient for most uses. -.TP -\fBText & schema parsing\fP -Using binary buffers with the generated header provides a super low overhead use of FlatBuffer data. There are, -however, times when you want to use text formats, for example because it interacts better with source control, or you -want to give your users easy access to data. -.IP -Another reason might be that you already have a lot of data in JSON format, or a tool that generates JSON, and if you -can write a schema for it, this will provide you an easy way to use that data directly. -.IP -(see the schema documentation for some specifics on the JSON format accepted). -.IP -There are two ways to use text formats: -.RS -.IP \(bu 2 -Using the compiler as a conversion tool. -.PP - This is the preferred path, as it doesn't require you to add any new code to your program, and is maximally - efficient since you can ship with binary data. The disadvantage is that it is an extra step for your - users/developers to perform, though you might be able to automate it. -.PP -.RS -.nf -flatc \-b myschema.fbs mydata.json -.fi -.RE -.PP - This will generate the binary file \fB\fCmydata_wire.bin\fR which can be loaded as before. -.IP \(bu 2 -Making your program capable of loading text directly. -.PP - This gives you maximum flexibility. You could even opt to support both, i.e. check for both files, and regenerate - the binary from text when required, otherwise just load the binary. This option is currently only available for - C++, or Java through JNI. -.PP - As mentioned in the section "Building" above, this technique requires you to link a few more files into your - program, and you'll want to include \fB\fCflatbuffers/idl.h\fR\&. -.PP - Load text (either a schema or json) into an in\-memory buffer (there is a convenient \fB\fCLoadFile()\fR utility function - in \fB\fCflatbuffers/util.h\fR if you wish). Construct a parser: -.PP -.RS -.nf -flatbuffers::Parser parser; -.fi -.RE -.PP - Now you can parse any number of text files in sequence: -.PP -.RS -.nf -parser.Parse(text_file.c_str()); -.fi -.RE -.PP - This works similarly to how the command\-line compiler works: a sequence of files parsed by the same \fB\fCParser\fR object - allow later files to reference definitions in earlier files. Typically this means you first load a schema file - (which populates \fB\fCParser\fR with definitions), followed by one or more JSON files. -.PP - As optional argument to \fB\fCParse\fR, you may specify a null\-terminated list of include paths. If not specified, any - include statements try to resolve from the current directory. -.PP - If there were any parsing errors, \fB\fCParse\fR will return \fB\fCfalse\fR, and \fB\fCParser::err\fR contains a human readable error - string with a line number etc, which you should present to the creator of that file. -.PP - After each JSON file, the \fB\fCParser::fbb\fR member variable is the \fB\fCFlatBufferBuilder\fR that contains the binary buffer - version of that file, that you can access as described above. \fB\fCsamples/sample_text.cpp\fR is a code sample showing - the above operations. -.RE -.TP -\fBThreading\fP -Reading a FlatBuffer does not touch any memory outside the original buffer, and is entirely read\-only (all const), so -is safe to access from multiple threads even without synchronisation primitives. -.IP -Creating a FlatBuffer is not thread safe. All state related to building a FlatBuffer is contained in a -FlatBufferBuilder instance, and no memory outside of it is touched. To make this thread safe, either do not share -instances of FlatBufferBuilder between threads (recommended), or manually wrap it in synchronisation primites. There's -no automatic way to accomplish this, by design, as we feel multithreaded construction of a single buffer will be rare, -and synchronisation overhead would be costly. -.TP -\fBAdvanced union features\fP -The C++ implementation currently supports vectors of unions (i.e. you can declare a field as \fB\fC[T]\fR where \fB\fCT\fR is a -union type instead of a table type). It also supports structs and strings in unions, besides tables. -.IP -For an example of these features, see \fB\fCtests/union_vector\fR, and \fB\fCUnionVectorTest\fR in \fB\fCtest.cpp\fR\&. -.IP -Since these features haven't been ported to other languages yet, if you choose to use them, you won't be able to use -these buffers in other languages (\fB\fCflatc\fR will refuse to compile a schema that uses these features). -.IP -These features reduce the amount of "table wrapping" that was previously needed to use unions. -.IP -To use scalars, simply wrap them in a struct. -.SH SEE ALSO -.PP -.BR flatc (1), -Official documentation \[la]http://google.github.io/flatbuffers\[ra] diff --git a/flatbuffers.spec b/flatbuffers.spec index 40722af1d11e630a94e8ba8bc8aabb1cbcb6811e..b742885dd2a7a868277d171665716a07ccadfec4 100644 --- a/flatbuffers.spec +++ b/flatbuffers.spec @@ -1,32 +1,29 @@ -%ifarch ppc64 s390x %{arm} -%bcond_with tests -%else -%bcond_without tests -%endif +%bcond cpp_tests 1 + Name: flatbuffers -Version: 2.0.0 -Release: 6 +Version: 23.5.26 +Release: 1 Summary: Memory efficient serialization library License: Apache-2.0 URL: https://github.com/google/flatbuffers -Source0: https://github.com/google/flatbuffers/archive/refs/tags/v%{version}.tar.gz +Source0: https://github.com/google/flatbuffers/archive/v%{version}/%{name}-%{version}.tar.gz Source1: flatc.1 -Source2: flatbuffers.7 - -Patch0: 0001-Fix-compiler-warning-Wredundant-parens.patch -Patch1: 0002-typo-fixes-in-comments.patch -Patch2: 0003-Changes-to-support-binary-schema-file-loading-and-pa.patch -Patch3: 0004-output-errors-instead-of-stdout.patch -Patch4: 0005-fix-undefined-behaviour.patch -Patch5: test-fix-undefined-order-of-functio-parameters.-6946.patch BuildRequires: gcc-c++ cmake >= 2.8.9 -Provides: bundled(grpc) -%description +BuildRequires: ninja-build +BuildRequires: python3-devel +BuildRequires: python3dist(numpy) +BuildRequires: python3-pip python3-wheel + +Provides: bundled(grpc) = 1.49.0 + +%global common_description %{expand: FlatBuffers is a serialization library for games and other memory constrained apps. FlatBuffers allows you to directly access serialized data without unpacking/parsing it first, while still having great forwards/backwards -compatibility. +compatibility.} + +%description %{common_description} %package devel Summary: Development files for %{name} @@ -34,43 +31,77 @@ Requires: %{name}%{?_isa} = %{version}-%{release} %description devel %{summary}. -%package -n python3-flatbuffers -Summary: The FlatBuffers serialization format for Python -BuildRequires: python3-devel -BuildRequires: python3-setuptools -%description -n python3-flatbuffers -Python runtime library for use with the Flatbuffers serialization format. +%package compiler +Summary: FlatBuffers compiler (flatc) +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description compiler %{common_description} + +This package contains flatc, the FlatBuffers compiler. + + +%package doc +Summary: Documentation and examples for FlatBuffers + +BuildArch: noarch + +%description doc %{common_description} + +%package -n python3-flatbuffers +Summary: FlatBuffers serialization format for Python + +BuildArch: noarch + +Recommends: python3dist(numpy) + +Provides: flatbuffers-python3 = %{version}-%{release} +Obsoletes: flatbuffers-python3 < 2.0.0-6 + +%description -n python3-flatbuffers %{common_description} + %prep %autosetup -p1 -rm -rf js net php docs go java js biicode {samples/,}android -chmod -x readme.md -%cmake -DCMAKE_BUILD_TYPE=Release \ - -DFLATBUFFERS_BUILD_SHAREDLIB=ON \ - -DFLATBUFFERS_BUILD_FLATLIB=OFF \ - -DFLATBUFFERS_BUILD_FLATC=ON \ - -DFLATBUFFERS_BUILD_TESTS=%{?with_tests:ON}%{!?with_tests:OFF} +rm -rvf android/ kotlin/ + +sed -r -i.upstream \ + -e 's|[^[:blank:]]*(/flatc)|%{buildroot}%{_bindir}\1|' \ + -e 's| python3 | %{python3} |' \ + -e 's|run_tests [^/]|# &|' \ + -e 's|PYTHONPATH=|&%{buildroot}%{python3_sitelib}:|' \ + -e 's|which coverage|/bin/false|' \ + tests/PythonTest.sh %build -%make_build +export VERSION='%{version}' +%cmake -GNinja \ + -DCMAKE_BUILD_TYPE=Release \ +%if %{with cpp_tests} + -DFLATBUFFERS_BUILD_TESTS:BOOL=ON \ +%else + -DFLATBUFFERS_BUILD_TESTS:BOOL=OFF \ + -DFLATBUFFERS_BUILD_GRPCTEST:BOOL=OFF \ +%endif + -DFLATBUFFERS_BUILD_SHAREDLIB=ON \ + -DFLATBUFFERS_BUILD_FLATLIB=OFF \ + -DFLATBUFFERS_BUILD_FLATC=ON +%ninja_build pushd python -%py3_build +%pyproject_build popd %install -%make_install -mkdir -p %{buildroot}%{_mandir}/man{1,7} -cp -p %SOURCE1 %{buildroot}%{_mandir}/man1/flatc.1 -cp -p %SOURCE2 %{buildroot}%{_mandir}/man7/flatbuffers.7 - +%ninja_install pushd python -%py3_install +%pyproject_install popd +mkdir -p %{buildroot}%{_mandir}/man1 +cp -p %SOURCE1 %{buildroot}%{_mandir}/man1/flatc.1 %check -%if %{with tests} -make test +%if %{with cpp_tests} +/usr/bin/ctest --output-on-failure --force-new-ctest-process %{?_smp_mflags} %endif %post -p /sbin/ldconfig @@ -78,23 +109,37 @@ make test %postun -p /sbin/ldconfig %files -%license LICENSE.txt -%doc readme.md -%{_bindir}/flatc +%license LICENSE %{_libdir}/libflatbuffers.so.* -%{_mandir}/man1/flatc.1* %files devel %{_includedir}/flatbuffers %{_libdir}/libflatbuffers.so -%{_mandir}/man7/flatbuffers.7* %{_libdir}/pkgconfig/flatbuffers.pc %{_libdir}/cmake/flatbuffers/*.cmake +%files compiler +%{_bindir}/flatc +%{_mandir}/man1/flatc.1* + +%files doc +%license LICENSE +%doc CHANGELOG.md +%doc SECURITY.md +%doc README.md + +%doc examples/ +%doc samples/ + %files -n python3-flatbuffers -%{python3_sitelib}/ +%license LICENSE +%{python3_sitelib}/* + %changelog +* Wed Jul 26 2023 chenchen - 23.5.26-1 +- Upgrade to version 23.5.26 + * Thu Jul 20 2023 chenchen - 2.0.0-6 - fix build error due to gcc upgrade to 12 diff --git a/flatc.1 b/flatc.1 index f5f13a57ae5c50064b6cd5727ce82d6fbca5364d..46f411f18d6ed4d585127db1d503bd711fa5469d 100644 --- a/flatc.1 +++ b/flatc.1 @@ -1,154 +1,461 @@ -.TH FLATC 1 "APRIL 2018" Linux "User Manuals" +.TH FLATC "1" "October 2022" "" "User Commands" .SH NAME -.PP -flatc \- flatbuffers compiler +.B flatc +\(en FlatBuffers compiler .SH SYNOPSIS -.PP -\fB\fCflatc\fR [\fIgenerator\-options\fP] [\fB\fC\-o\fR PATH] [\fB\fC\-I\fR=path] [\fB\fC\-S\fR] files... [\fB\fC\-\-\fR files...] -.PP -The files are read and parsed in order, and can contain either schemas or data (see below). Data files are processed according to the definitions of the most recent schema specified. \fB\fC\-\-\fR indicates that the following files are binary files in FlatBuffer format conforming to the schema indicated before it. Depending on the flags passed, additional files may be generated for each file processed. +.B flatc +.RI [ OPTION ]...\: +.IR FILE ...\: +.RI [\-\-\ BINARY_FILE ...] .SH OPTIONS -.PP -For any schema input files, one or more generators can be specified: -.PP -\fB\fC\-\-cpp\fR, \fB\fC\-c\fR - Generate a C++ header for all definitions in this file (as \fB\fCfilename_generated.h\fR). -.PP -\fB\fC\-\-java\fR, \fB\fC\-j\fR - Generate Java code. -.PP -\fB\fC\-\-csharp\fR, \fB\fC\-n\fR - Generate C# code. -.PP -\fB\fC\-\-go\fR, \fB\fC\-g\fR - Generate Go code. -.PP -\fB\fC\-\-python\fR, \fB\fC\-p\fR - Generate Python code. -.PP -\fB\fC\-\-js\fR, \fB\fC\-s\fR - Generate JavaScript code. -.PP -\fB\fC\-\-ts\fR - Generate TypeScript code. -.PP -\fB\fC\-\-php\fR - Generate PHP code. -.PP -\fB\fC\-\-grpc\fR - Generate RPC stub code for GRPC. -.PP -\fB\fC\-\-dart\fR - Generate Dart code. -.PP -\fB\fC\-\-lua\fR - Generate Lua code. -.PP -\fB\fC\-\-lobster\fR - Generate Lobster code. -.PP -\fB\fC\-\-rust\fR, \fB\fC\-r\fR - Generate Rust code. -.PP -For any data input files: -.PP -\fB\fC\-\-binary\fR, \fB\fC\-b\fR - If data is contained in this file, generate a \fB\fCfilename.bin\fR containing the binary flatbuffer (or a different extension if one is specified in the schema). -.PP -\fB\fC\-\-json\fR, \fB\fC\-t\fR - If data is contained in this file, generate a \fB\fCfilename.json\fR representing the data in the flatbuffer. -.PP -Additional options: -.PP -\fB\fC\-o PATH\fR - Output all generated files to PATH (either absolute, or relative to the current directory). If omitted, PATH will be the current directory. PATH should end in your systems path separator, e.g. \fB\fC/\fR or \fB\fC\\\fR\&. -.PP -\fB\fC\-I PATH\fR - when encountering \fB\fCinclude\fR statements, attempt to load the files from this path. Paths will be tried in the order given, and if all fail (or none are specified) it will try to load relative to the path of the schema file being parsed. -.PP -\fB\fC\-M\fR - Print make rules for generated files. -.PP -\fB\fC\-\-strict\-json\fR - Require & generate strict JSON (field names are enclosed in quotes, no trailing commas in tables/vectors). By default, no quotes are required/generated, and trailing commas are allowed. -.PP -\fB\fC\-\-defaults\-json\fR - Output fields whose value is equal to the default value when writing JSON text. -.PP -\fB\fC\-\-no\-prefix\fR - Don't prefix enum values in generated C++ by their enum type. -.PP -\fB\fC\-\-scoped\-enums\fR - Use C++11 style scoped and strongly typed enums in generated C++. This also implies \fB\fC\-\-no\-prefix\fR\&. -.PP -\fB\fC\-\-gen\-includes\fR - (deprecated), this is the default behavior. If the original behavior is required (no include statements) use \fB\fC\-\-no\-includes.\fR -.PP -\fB\fC\-\-no\-includes\fR - Don't generate include statements for included schemas the generated file depends on (C++). -.PP -\fB\fC\-\-gen\-mutable\fR - Generate additional non\-const accessors for mutating FlatBuffers in\-place. -.PP -\fB\fC\-\-gen\-object\-api\fR - Generate an additional object\-based API. This API is more convenient for object construction and mutation than the base API, at the cost of efficiency (object allocation). Recommended only to be used if other options are insufficient. -.PP -\fB\fC\-\-gen\-compare\fR - Generate operator== for object\-based API types. -.PP -\fB\fC\-\-gen\-onefile\fR - Generate single output file (useful for C#) -.PP -\fB\fC\-\-gen\-all\fR - Generate not just code for the current schema files, but for all files it includes as well. If the language uses a single file for output (by default the case for C++ and JS), all code will end up in this one file. -.PP -\fB\fC\-\-no\-js\-exports\fR - Removes Node.js style export lines (useful for JS) -.PP -\fB\fC\-\-goog\-js\-export\fR - Uses goog.exportsSymbol and goog.exportsProperty instead of Node.js style exporting. Needed for compatibility with the Google closure compiler (useful for JS). -.PP -\fB\fC\-\-es6\-js\-export\fR - Generates ECMAScript v6 style export definitions instead of Node.js style exporting. Useful when integrating flatbuffers with modern Javascript projects. -.PP -\fB\fC\-\-raw\-binary\fR - Allow binaries without a \fB\fCfile_indentifier\fR to be read. This may crash flatc given a mismatched schema. -.PP -\fB\fC\-\-proto\fR - Expect input files to be .proto files (protocol buffers). Output the corresponding .fbs file. Currently supports: \fB\fCpackage\fR, \fB\fCmessage\fR, \fB\fCenum\fR, nested declarations, \fB\fCimport\fR (use \fB\fC\-I\fR for paths), \fB\fCextend\fR, \fB\fConeof\fR, \fB\fCgroup\fR\&. Does not support, but will skip without error: \fB\fCoption\fR, \fB\fCservice\fR, \fB\fCextensions\fR, and most everything else. -.PP -\fB\fC\-\-schema\fR - Serialize schemas instead of JSON (use with \-b). This will output a binary version of the specified schema that itself corresponds to the reflection/reflection.fbs schema. Loading this binary file is the basis for reflection functionality. -.PP -\fB\fC\-\-bfbs\-comments\fR - Add doc comments to the binary schema files. -.PP -\fB\fC\-\-conform FILE\fR - Specify a schema the following schemas should be an evolution of. Gives errors if not. Useful to check if schema modifications don't break schema evolution rules. -.PP -\fB\fC\-\-include\-prefix PATH\fR - Prefix this path to any generated include statements. -.PP -\fB\fC\-\-keep\-prefix\fR - Keep original prefix of schema include statement. -.PP -\fB\fC\-\-reflect\-types\fR - Add minimal type reflection to code generation. -.PP -\fB\fC\-\-reflect\-names\fR - Add minimal type/name reflection. -.PP -\fB\fC\-\-root\-type T\fR - Select or override the default root_type. -.PP -\fB\fC\-\-force\-defaults\fR - Emit default values in binary output from JSON. -.PP -\fB\fC\-\-force\-empty\fR - When serializing from object API representation, force strings and vectors to empty rather than null. -.PP -NOTE: short\-form options for generators are deprecated, use the long form whenever possible. -.SH SEE ALSO -.PP -.BR flatbuffers (7), -Official documentation \[la]http://google.github.io/flatbuffers\[ra] +.IR FILE s +may be schemas (must end in +.BR .fbs ), +binary schemas (must end in +.BR .bfbs ), +or JSON files (conforming to preceding schema). +.IR BINARY_FILE s +after the +.B \-\- +must be binary flatbuffer format files. +.P +Output files are named using the base file name of the input, +and written to the current directory or the path given by +.BR \-o . +.TP +.B \-\-binary\fR, \fB\-b +Generate wire format binaries for any data definitions. +.TP +.B \-\-json\fR, \fB\-t +Generate text output for any data definitions. +.TP +.B \-\-cpp\fR, \fB\-c +Generate C++ headers for tables/structs. +.TP +.B \-\-go\fR, \fB\-g +Generate Go files for tables/structs. +.TP +.B \-\-java\fR, \fB\-j +Generate Java classes for tables/structs. +.TP +.B \-\-dart\fR, \fB\-d +Generate Dart classes for tables/structs. +.TP +.B \-\-ts\fR, \fB\-T +Generate TypeScript code for tables/structs. +.TP +.B \-\-csharp\fR, \fB\-n +Generate C# classes for tables/structs. +.TP +.B \-\-python\fR, \fB\-p +Generate Python files for tables/structs. +.TP +.B \-\-lobster +Generate Lobster files for tables/structs. +.TP +.B \-\-lua\fR, \fB\-l +Generate Lua files for tables/structs. +.TP +.B \-\-rust\fR, \fB\-r +Generate Rust files for tables/structs. +.TP +.B \-\-php +Generate PHP files for tables/structs. +.TP +.B \-\-kotlin +Generate Kotlin classes for tables/structs. +.TP +.B \-\-jsonschema +Generate Json schema. +.TP +.B \-\-swift +Generate Swift files for tables/structs. +.TP +.B \-\-nim +Generate Nim files for tables/structs. +.TP +.B \-o\ \fIPATH +Prefix +.I PATH +to all generated files. +.TP +.B \-I\ \fIPATH +Search for includes in the specified path. +.TP +.B \-M +Print +.BR make (1) +rules for generated files. +.TP +.B \-\-version +Print the version number of +.B flatc +and exit. +.TP +.B \-\-strict\-json +Strict JSON: field names must be\ / will be quoted, +no trailing commas in tables/vectors. +.TP +.B \-\-allow-non-utf8 +Pass non-UTF-8 input through parser and emit nonstandard +.BI \\\\\\\\ x +escapes in JSON. +(Default is to raise parse error on non-UTF-8 input.) +.TP +.B \-\-natural\-utf8 +Output strings with UTF-8 as human-readable strings. +By default, UTF-8 characters are printed as +.BI \\\\\\\\u XXXX +escapes. +.TP +.B \-\-defaults\-json +Output fields whose value is the default when writing JSON. +.TP +.B \-\-unknown\-json +Allow fields in JSON that are not defined in the schema. +These fields will be discared when generating binaries. +.TP +.B \-\-no\-prefix +Don\(cqt prefix enum values with the enum type in C++. +.TP +.B \-\-scoped\-enums +Use C++11 style scoped and strongly typed enums. +Also implies +.BR \-\-no\-prefix . +.TP +.B \-\-no\-emit\-min\-max\-enum\-values +Disable generation of +.B MIN +and +.B MAX +enumerated values for scoped enums and prefixed enums. +.TP +.B \-\-gen\-includes +.RI ( deprecated ), +this is the default behavior. +If the original behavior is required (no include statements) use +.BR \-\-no\-includes . +.TP +.B \-\-no\-includes +Don\(cqt generate include statements for included +schemas the generated file depends on (C++\ / Python). +.TP +.B \-\-gen\-mutable +Generate accessors that can mutate buffers in-place. +.TP +.B \-\-gen\-onefile +Generate single output file for C# and Go. +.TP +.B \-\-gen\-name\-strings +Generate type name functions for C++ and Rust. +.TP +.B \-\-gen\-object\-api +Generate an additional object-based API. +.TP +.B \-\-gen\-compare +Generate +.B operator== +for object-based API types. +.TP +.B \-\-gen\-nullable +Add Clang +.B _Nullable +for C++ pointer. +or +.B @Nullable +for Java +.TP +.B \-\-java\-package\-prefix +Add a prefix to the generated package name for Java. +.TP +.B \-\-java\-checkerframework +Add +.B @Pure +for Java. +.TP +.B \-\-gen\-generated +Add +.B @Generated +annotation for Java +.TP +.B \-\-gen\-jvmstatic +Add +.B @JvmStatic +annotation for Kotlin methods +in companion object for interop from Java to Kotlin. +.TP +.B \-\-gen\-all +Generate not just code for the current schema files, +but for all files it includes as well. +If the language uses a single file for output (by default +the case for C++ and JS), all code will end up in this one file. +.TP +.B \-\-gen\-json\-emit +Generates encoding code which emits Flatbuffers into JSON. +.TP +.B \-\-cpp\-include +Adds an +.B #include +in generated file. +.TP +.B \-\-cpp\-ptr\-type\ \fIT +Set object API pointer type +(default +.BR std::unique_ptr ). +.TP +.B \-\-cpp\-str\-type\ \fIT +Set object API string type +(default +.BR std::string ). +.BR \fIT\fB::c_str() , +.BR \fIT\fB::length() , +and +.BR \fIT\fB::empty() +must be supported. +The custom type also needs to be constructible from +.B std::string +(see the +.B \-\-cpp\-str\-flex\-ctor +option to change this behavior). +.TP +.B \-\-cpp-str-flex-ctor +Don\(cqt construct custom string types by passing +.B std::string +from Flatbuffers, but (\fBchar*\fR\ + \fIlength\fR). +.TP +.B \-\-cpp-std\ \fICPP_STD +Generate a C++ code using features of selected C++ standard. +.IP +.B Supported +.I CPP_STD +.B values: +.RS +7n +.IP \(bu 2n +.B c++0x +\(en generate code compatible with old compilers; +.IP \(bu 2n +.B c++11 +\(en use C++11 code generator +.RI ( default ); +.IP \(bu 2n +.B c++17 +\(en use C++17 features in generated code +.RI ( experimental ). +.RE +.TP +.B \-\-cpp\-static\-reflection +When using C++17, generate extra code to provide compile-time +(static) reflection of Flatbuffers types. +Requires +.B \-\-cpp\-std +to be +.RB \(lq c++17 \(rq +or higher. +.TP +.B \-\-object\-prefix +Customise class prefix for C++ object-based API. +.TP +.B \-\-object\-suffix +Customise class suffix for C++ object-based API. +Default value is +.RB \(lq T \(rq. +.TP +.B \-\-go\-namespace +Generate the overriding namespace in Golang. +.TP +.B \-\-go\-import +Generate the overriding import for flatbuffers in Golang +(default is +.RB \(lq github.com/google/flatbuffers/go \(rq). +.TP +.B \-\-go\-module\-name +Prefix local import paths of generated go code with the module name. +.TP +.B \-\-raw\-binary +Allow binaries without +.B file_identifier +to be read. +This may crash +.B flatc +given a mismatched schema. +.TP +.B \-\-size\-prefixed +Input binaries are size prefixed buffers. +.TP +.B \-\-proto\-namespace\-suffix\ \fISUFFIX +Add this namespace to any flatbuffers generated from protobufs. +.TP +.B \-\-oneof\-union +Translate +.B .proto +oneofs to flatbuffer unions. +.TP +.B \-\-keep\-proto\-id +Keep protobuf field ids in generated fbs file. +.TP +.B \-\-proto\-id\-gap +Action that should be taken when a gap between protobuf ids found. +.IP +.B Supported values: +.RS +7n +.IP \(bu 2n +.B nop +\(en do not care about gap +.IP \(bu 2n +.B warn +\(en A warning message will be shown about the gap in protobuf ids +.RI ( default ) +.IP \(bu 2n +.B error +\(en An error message will be shown and the fbs generation will be interrupted. +.RE +.TP +.B \-\-grpc +Generate GRPC interfaces for the specified languages. +.TP +.B \-\-schema +Serialize schemas instead of JSON (use with +.BR \-b ). +.TP +.B \-\-bfbs\-comments +Add doc comments to the binary schema files. +.TP +.B \-\-bfbs\-builtins +Add builtin attributes to the binary schema files. +.TP +.B \-\-bfbs\-gen\-embed +Generate code to embed the +.B bfbs +schema to the source. +.TP +.B \-\-conform\ \fIFILE +Specify a schema the following schemas should be an evolution of. +Gives errors if not. +.TP +.B \-\-conform\-includes +Include path for the schema given with +.BR \-\-conform\ \fIPATH . +.TP +.B \-\-filename\-suffix +The suffix appended to the generated file names. +Default is +.BR \(oq _generated \(cq. +.TP +.B \-\-filename\-ext +The extension appended to the generated file names. +Default is language-specific (e.g., +.RB \(oq .h \(cq +for C++) +.TP +.B \-\-include\-prefix\ \fIPATH +Prefix this path to any generated include statements. +.TP +.B \-\-keep\-prefix +Keep original prefix of schema include statement. +.TP +.B \-\-reflect\-types +Add minimal type reflection to code generation. +.TP +.B \-\-reflect\-names +Add minimal type/name reflection. +.TP +.B \-\-rust\-serialize +Implement +.B serde::Serialize +on generated Rust types. +.TP +.B \-\-rust\-module\-root\-file +Generate rust code in individual files with a module root file. +.TP +.B \-\-root\-type\ \fIT +Select or override the default root_type. +.TP +.B \-\-require\-explicit\-ids +When parsing schemas, require explicit ids +.RB ( id:\ \fIx ). +.TP +.B \-\-force\-defaults +Emit default values in binary output from JSON. +.TP +.B \-\-force\-empty +When serializing from object API representation, +force strings and vectors to empty rather than null. +.TP +.B \-\-force\-empty\-vectors +When serializing from object API representation, +force vectors to empty rather than null. +.TP +.B \-\-flexbuffers +Used with +.RB \(lq binary \(rq +and +.RB \(lq json \(rq +options, it generates +data using schema-less FlexBuffers. +.TP +.B \-\-no\-warnings +Inhibit all warning messages. +.TP +.B \-\-warnings\-as-errors +Treat all warnings as errors. +.TP +.B \-\-cs\-global\-alias +Prepend +.RB \(lq global:: \(rq +to all user generated csharp classes and structs. +.TP +.B \-\-cs\-gen\-json\-serializer +Allows (de)serialization of JSON text in the Object API. +(requires +.BR \-\-gen\-object\-api ). +.TP +.B \-\-json\-nested\-bytes +Allow a +.B nested_flatbuffer +field to be parsed as a vector of bytes in JSON, +which is unsafe unless checked by a verifier afterwards. +.TP +.B \-\-ts\-flat\-files +Generate a single typescript file per +.B .fbs +file. +Implies +.BR \-\-ts\-entry\-points . +.TP +.B \-\-ts\-entry\-points +Generate entry point typescript per namespace. +Implies +.BR \-\-gen\-all . +.TP +.B \-\-annotate\-sparse\-vectors\ \fISCHEMA +Don\(cqt annotate every vector element. +.TP +.B \-\-annotate\ \fISCHEMA +Annotate the provided +.I BINARY_FILE +with the specified +.I SCHEMA +file. +.TP +.B \-\-no\-leak\-private\-annotation +Prevents multiple type of annotations within a Fbs +.I SCHEMA +file. +Currently this is required to generate private types in Rust. +.TP +.B \-\-python\-no\-type\-prefix\-suffix +Skip emission of Python functions that are prefixed with typenames +.TP +.B \-\-python\-typing +Generate Python type annotations +.TP +.B \-\-file\-names\-only +Print out generated file names without writing to the files +.SH EXAMPLES +.EX +.B flatc\ \-c\ \-b\ schema1.fbs\ schema2.fbs\ data.json +.EE +.SH "SEE ALSO" +.UR https://google.github.io/flatbuffers +Official documentation +.UE diff --git a/test-fix-undefined-order-of-functio-parameters.-6946.patch b/test-fix-undefined-order-of-functio-parameters.-6946.patch deleted file mode 100644 index 82a61cd5ab5ed2023ff9d41d834bd60aeb87c8ed..0000000000000000000000000000000000000000 --- a/test-fix-undefined-order-of-functio-parameters.-6946.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 85b4effac69202fb360db16ffd0354ef76baa321 Mon Sep 17 00:00:00 2001 -From: Sergei Trofimovich -Date: Mon, 22 Nov 2021 20:14:31 +0000 -Subject: [PATCH] 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 - 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 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. ---- - tests/test_builder.h | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/tests/test_builder.h b/tests/test_builder.h -index 6d97ac00..75338b04 100644 ---- a/tests/test_builder.h -+++ b/tests/test_builder.h -@@ -61,8 +61,10 @@ void builder_move_assign_after_releaseraw_test(Builder b1) { - auto root_offset1 = populate1(b1); - b1.Finish(root_offset1); - size_t size, offset; -+ -+ uint8_t *rr = b1.ReleaseRaw(size, offset); - std::shared_ptr raw( -- b1.ReleaseRaw(size, offset), [size](uint8_t *ptr) { -+ rr, [size](uint8_t *ptr) { - flatbuffers::DefaultAllocator::dealloc(ptr, size); - }); - Builder src; --- -2.39.1 - diff --git a/v2.0.0.tar.gz b/v2.0.0.tar.gz deleted file mode 100644 index b8dd50bcf7a4b09ae230a1de767e48a0a57197d7..0000000000000000000000000000000000000000 Binary files a/v2.0.0.tar.gz and /dev/null differ