Add --warnings-as-errors to flatc compiler. (#7034)

* Add --warnings-as-errors to flatc compiler.

With this option set, flatc will return an error on parsing if
any warnings occurred.

* Add unit test for opts.warnings_as_errors.

* Change explicit option setting to default.
This commit is contained in:
Jon Simantov
2022-01-25 17:01:16 -05:00
committed by GitHub
parent 9ef1524d3f
commit a2d38fbb98
4 changed files with 34 additions and 1 deletions

View File

@@ -591,6 +591,7 @@ struct IDLOptions {
std::string filename_suffix;
std::string filename_extension;
bool no_warnings;
bool warnings_as_errors;
std::string project_root;
bool cs_global_alias;
bool json_nested_flatbuffers;
@@ -681,6 +682,7 @@ struct IDLOptions {
filename_suffix("_generated"),
filename_extension(),
no_warnings(false),
warnings_as_errors(false),
project_root(""),
cs_global_alias(false),
json_nested_flatbuffers(true),
@@ -787,6 +789,7 @@ class Parser : public ParserState {
root_struct_def_(nullptr),
opts(options),
uses_flexbuffers_(false),
has_warning_(false),
advanced_features_(0),
source_(nullptr),
anonymous_counter_(0),
@@ -1021,6 +1024,7 @@ class Parser : public ParserState {
IDLOptions opts;
bool uses_flexbuffers_;
bool has_warning_;
uint64_t advanced_features_;