From e1e45cf13cf72a8c4e6e2fc9ce145de80a38ff8e Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Thu, 3 Oct 2019 22:18:29 -0400 Subject: [PATCH] Internals: Move option checks to notify(). --- src/V3Options.cpp | 14 ++++++++++++++ src/V3Options.h | 1 + src/Verilator.cpp | 9 ++------- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/V3Options.cpp b/src/V3Options.cpp index 14cd82afb..397b51318 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -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 diff --git a/src/V3Options.h b/src/V3Options.h index c4e6e9735..5b2dd44ce 100644 --- a/src/V3Options.h +++ b/src/V3Options.h @@ -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; } diff --git a/src/Verilator.cpp b/src/Verilator.cpp index 1b1109b9e..c130a7878 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -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?