mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-24 23:06:10 +00:00
* 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 * Add option --no-warnings to inhibit all warnings * Fix order of member initialization * Add documentation for --no-warnings
This commit is contained in:
@@ -229,5 +229,10 @@ Additional options:
|
|||||||
- `--force-empty-vectors` : When serializing from object API representation, force
|
- `--force-empty-vectors` : When serializing from object API representation, force
|
||||||
vectors to empty rather than null.
|
vectors to empty rather than null.
|
||||||
|
|
||||||
|
- `--flexbuffers` : Used with "binary" and "json" options, it generates
|
||||||
|
data using schema-less FlexBuffers.
|
||||||
|
|
||||||
|
- `--no-warnings` : Inhibit all warning messages.
|
||||||
|
|
||||||
NOTE: short-form options for generators are deprecated, use the long form
|
NOTE: short-form options for generators are deprecated, use the long form
|
||||||
whenever possible.
|
whenever possible.
|
||||||
|
|||||||
@@ -572,6 +572,7 @@ struct IDLOptions {
|
|||||||
std::string proto_namespace_suffix;
|
std::string proto_namespace_suffix;
|
||||||
std::string filename_suffix;
|
std::string filename_suffix;
|
||||||
std::string filename_extension;
|
std::string filename_extension;
|
||||||
|
bool no_warnings;
|
||||||
|
|
||||||
// Possible options for the more general generator below.
|
// Possible options for the more general generator below.
|
||||||
enum Language {
|
enum Language {
|
||||||
@@ -662,6 +663,7 @@ struct IDLOptions {
|
|||||||
cs_gen_json_serializer(false),
|
cs_gen_json_serializer(false),
|
||||||
filename_suffix("_generated"),
|
filename_suffix("_generated"),
|
||||||
filename_extension(),
|
filename_extension(),
|
||||||
|
no_warnings(false),
|
||||||
lang(IDLOptions::kJava),
|
lang(IDLOptions::kJava),
|
||||||
mini_reflect(IDLOptions::kNone),
|
mini_reflect(IDLOptions::kNone),
|
||||||
require_explicit_ids(false),
|
require_explicit_ids(false),
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ std::string FlatCompiler::GetUsageString(const char *program_name) const {
|
|||||||
" force vectors to empty rather than null.\n"
|
" force vectors to empty rather than null.\n"
|
||||||
" --flexbuffers Used with \"binary\" and \"json\" options, it generates\n"
|
" --flexbuffers Used with \"binary\" and \"json\" options, it generates\n"
|
||||||
" data using schema-less FlexBuffers.\n"
|
" data using schema-less FlexBuffers.\n"
|
||||||
|
" --no-warnings Inhibit all warning messages.\n"
|
||||||
"FILEs may be schemas (must end in .fbs), binary schemas (must end in .bfbs),\n"
|
"FILEs may be schemas (must end in .fbs), binary schemas (must end in .bfbs),\n"
|
||||||
"or JSON files (conforming to preceding schema). FILEs after the -- must be\n"
|
"or JSON files (conforming to preceding schema). FILEs after the -- must be\n"
|
||||||
"binary flatbuffer format files.\n"
|
"binary flatbuffer format files.\n"
|
||||||
@@ -372,6 +373,8 @@ int FlatCompiler::Compile(int argc, const char **argv) {
|
|||||||
opts.use_flexbuffers = true;
|
opts.use_flexbuffers = true;
|
||||||
} else if (arg == "--gen-jvmstatic") {
|
} else if (arg == "--gen-jvmstatic") {
|
||||||
opts.gen_jvmstatic = true;
|
opts.gen_jvmstatic = true;
|
||||||
|
} else if (arg == "--no-warnings") {
|
||||||
|
opts.no_warnings = true;
|
||||||
} else if (arg == "--cpp-std") {
|
} else if (arg == "--cpp-std") {
|
||||||
if (++argi >= argc)
|
if (++argi >= argc)
|
||||||
Error("missing C++ standard specification" + arg, true);
|
Error("missing C++ standard specification" + arg, true);
|
||||||
|
|||||||
@@ -142,7 +142,10 @@ void Parser::Message(const std::string &msg) {
|
|||||||
error_ += ": " + msg;
|
error_ += ": " + msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parser::Warning(const std::string &msg) { Message("warning: " + msg); }
|
void Parser::Warning(const std::string &msg) {
|
||||||
|
if (!opts.no_warnings)
|
||||||
|
Message("warning: " + msg);
|
||||||
|
}
|
||||||
|
|
||||||
CheckedError Parser::Error(const std::string &msg) {
|
CheckedError Parser::Error(const std::string &msg) {
|
||||||
Message("error: " + msg);
|
Message("error: " + msg);
|
||||||
|
|||||||
Reference in New Issue
Block a user