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.
This commit is contained in:
Wouter van Oortmerssen 2016-01-08 11:39:56 -08:00
parent 514d274a45
commit 63b526db52
1 changed files with 5 additions and 2 deletions

View File

@ -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);