Internals: Move option checks to notify().

This commit is contained in:
Wilson Snyder 2019-10-03 22:18:29 -04:00
parent bd89c71694
commit e1e45cf13c
3 changed files with 17 additions and 7 deletions

View File

@ -522,6 +522,20 @@ string V3Options::getenvVERILATOR_ROOT() {
return var;
}
//######################################################################
// V3 Options notification methods
void V3Options::notify() {
// Notify that all arguments have been passed and final modification can be made.
if (!outFormatOk()
&& !preprocOnly()
&& !lintOnly()
&& !xmlOnly()
&& !cdc()) {
v3fatal("verilator: Need --cc, --sc, --cdc, --lint-only, --xml_only or --E option");
}
}
//######################################################################
// V3 Options accessors

View File

@ -257,6 +257,7 @@ class V3Options {
void addNoClocker(const string& signame);
void addVFile(const string& filename);
void addForceInc(const string& filename);
void notify();
// ACCESSORS (options)
bool preprocOnly() const { return m_preprocOnly; }

View File

@ -585,14 +585,9 @@ int main(int argc, char** argv, char** env) {
string argString = V3Options::argString(argc-1, argv+1);
v3Global.opt.parseOpts(new FileLine(FileLine::commandLineFilename()),
argc-1, argv+1);
if (!v3Global.opt.outFormatOk()
&& !v3Global.opt.preprocOnly()
&& !v3Global.opt.lintOnly()
&& !v3Global.opt.xmlOnly()
&& !v3Global.opt.cdc()) {
v3fatal("verilator: Need --cc, --sc, --cdc, --lint-only, --xml_only or --E option");
}
// Validate settings (aka Boost.Program_options)
v3Global.opt.notify();
V3Error::abortIfErrors();
// Can we skip doing everything if times are ok?