Ensured code is not generated directly from .proto files.

The parser state generated from the .proto conversion process is
not exactly the same as what you get by parsing the generated
schema, which can cause problems. This check enforces that you
first convert the .proto, then generate code from the new schema.

Change-Id: I04b53af9288d87e256d1cc109388332fefb3a09f
Tested: on Linux.
parent 514d274a
......@@ -183,7 +183,6 @@ int main(int argc, const char *argv[]) {
binary_files_from = filenames.size();
} else if(arg == "--proto") {
opts.proto_mode = true;
any_generator = true;
} else if(arg == "--schema") {
schema_binary = true;
} else if(arg == "-M") {
......@@ -208,8 +207,12 @@ int main(int argc, const char *argv[]) {
if (!filenames.size()) Error("missing input files", false, true);
if (!any_generator)
if (opts.proto_mode) {
if (any_generator)
Error("cannot generate code directly from .proto files", true);
} else if (!any_generator) {
Error("no options: specify at least one generator.", true);
}
// Now process the files:
parser = new flatbuffers::Parser(opts);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment