Add check for conflicting options e.g. binary+lintonly (#4409)
This commit is contained in:
parent
2a30bbe493
commit
8d1570db28
|
|
@ -125,9 +125,12 @@ Summary:
|
||||||
|
|
||||||
After generating the SystemC/C++ code, Verilator will invoke the
|
After generating the SystemC/C++ code, Verilator will invoke the
|
||||||
toolchain to build the model library (and executable when :vlopt:`--exe`
|
toolchain to build the model library (and executable when :vlopt:`--exe`
|
||||||
is also used). Verilator manages the build itself, and for this --build
|
is also used). Verilator manages the build itself, and for this --build
|
||||||
requires GNU Make to be available on the platform.
|
requires GNU Make to be available on the platform.
|
||||||
|
|
||||||
|
:vlopt:`--build` cannot be specified when using :vlopt:`-E`,
|
||||||
|
:vlopt:`--dpi-hdr-only`, :vlopt:`--lint-only`, or :vlopt:`--xml-only`.
|
||||||
|
|
||||||
.. option:: --build-dep-bin <filename>
|
.. option:: --build-dep-bin <filename>
|
||||||
|
|
||||||
Rarely needed. When a dependency (.d) file is created, this filename
|
Rarely needed. When a dependency (.d) file is created, this filename
|
||||||
|
|
|
||||||
|
|
@ -806,6 +806,24 @@ void V3Options::notify() {
|
||||||
cmdfl->v3error("--make cannot be used together with --build. Suggest see manual");
|
cmdfl->v3error("--make cannot be used together with --build. Suggest see manual");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// m_build, m_preprocOnly, m_dpiHdrOnly, m_lintOnly, and m_xmlOnly are mutually exclusive
|
||||||
|
std::vector<std::string> backendFlags;
|
||||||
|
if (m_build) {
|
||||||
|
if (m_binary) backendFlags.push_back("--binary");
|
||||||
|
else backendFlags.push_back("--build");
|
||||||
|
}
|
||||||
|
if (m_preprocOnly) backendFlags.push_back("-E");
|
||||||
|
if (m_dpiHdrOnly) backendFlags.push_back("--dpi-hdr-only");
|
||||||
|
if (m_lintOnly) backendFlags.push_back("--lint-only");
|
||||||
|
if (m_xmlOnly) backendFlags.push_back("--xml-only");
|
||||||
|
if (backendFlags.size() > 1) {
|
||||||
|
std::string backendFlagsString = backendFlags.front();
|
||||||
|
for (size_t i = 1; i < backendFlags.size(); i++) {
|
||||||
|
backendFlagsString += ", " + backendFlags[i];
|
||||||
|
}
|
||||||
|
v3error("The following cannot be used together: " + backendFlagsString + ". Suggest see manual");
|
||||||
|
}
|
||||||
|
|
||||||
if (m_exe && !v3Global.opt.libCreate().empty()) {
|
if (m_exe && !v3Global.opt.libCreate().empty()) {
|
||||||
cmdfl->v3error("--exe cannot be used together with --lib-create. Suggest see manual");
|
cmdfl->v3error("--exe cannot be used together with --lib-create. Suggest see manual");
|
||||||
}
|
}
|
||||||
|
|
@ -1081,6 +1099,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
|
||||||
FileLine::globalWarnOff(V3ErrorCode::E_UNSUPPORTED, true);
|
FileLine::globalWarnOff(V3ErrorCode::E_UNSUPPORTED, true);
|
||||||
});
|
});
|
||||||
DECL_OPTION("-binary", CbCall, [this]() {
|
DECL_OPTION("-binary", CbCall, [this]() {
|
||||||
|
m_binary = true;
|
||||||
m_build = true;
|
m_build = true;
|
||||||
m_exe = true;
|
m_exe = true;
|
||||||
m_main = true;
|
m_main = true;
|
||||||
|
|
|
||||||
|
|
@ -223,6 +223,7 @@ private:
|
||||||
bool m_autoflush = false; // main switch: --autoflush
|
bool m_autoflush = false; // main switch: --autoflush
|
||||||
bool m_bboxSys = false; // main switch: --bbox-sys
|
bool m_bboxSys = false; // main switch: --bbox-sys
|
||||||
bool m_bboxUnsup = false; // main switch: --bbox-unsup
|
bool m_bboxUnsup = false; // main switch: --bbox-unsup
|
||||||
|
bool m_binary = false; // main switch: --binary
|
||||||
bool m_build = false; // main switch: --build
|
bool m_build = false; // main switch: --build
|
||||||
bool m_cmake = false; // main switch: --make cmake
|
bool m_cmake = false; // main switch: --make cmake
|
||||||
bool m_context = true; // main switch: --Wcontext
|
bool m_context = true; // main switch: --Wcontext
|
||||||
|
|
@ -442,6 +443,7 @@ public:
|
||||||
bool autoflush() const { return m_autoflush; }
|
bool autoflush() const { return m_autoflush; }
|
||||||
bool bboxSys() const { return m_bboxSys; }
|
bool bboxSys() const { return m_bboxSys; }
|
||||||
bool bboxUnsup() const { return m_bboxUnsup; }
|
bool bboxUnsup() const { return m_bboxUnsup; }
|
||||||
|
bool binary() const { return m_binary; }
|
||||||
bool build() const { return m_build; }
|
bool build() const { return m_build; }
|
||||||
string buildDepBin() const { return m_buildDepBin; }
|
string buildDepBin() const { return m_buildDepBin; }
|
||||||
void buildDepBin(const string& flag) { m_buildDepBin = flag; }
|
void buildDepBin(const string& flag) { m_buildDepBin = flag; }
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
%Error: The following cannot be used together: --binary, -E, --dpi-hdr-only, --lint-only, --xml-only. Suggest see manual
|
||||||
|
%Error: Exiting due to
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/env perl
|
||||||
|
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||||
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||||
|
#
|
||||||
|
# Copyright 2003 by Wilson Snyder. This program is free software; you
|
||||||
|
# can redistribute it and/or modify it under the terms of either the GNU
|
||||||
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
|
# Version 2.0.
|
||||||
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||||
|
|
||||||
|
scenarios(vlt => 1);
|
||||||
|
top_filename("t/t_flag_main.v");
|
||||||
|
|
||||||
|
compile(
|
||||||
|
verilator_make_cmake => 0,
|
||||||
|
verilator_make_gmake => 0,
|
||||||
|
verilator_flags2 => ["--binary -E --dpi-hdr-only --lint-only --xml-only -Wall"],
|
||||||
|
fails => 1,
|
||||||
|
expect_filename => $Self->{golden_filename},
|
||||||
|
);
|
||||||
|
|
||||||
|
ok(1);
|
||||||
|
1;
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
%Error: The following cannot be used together: --build, -E, --dpi-hdr-only, --lint-only, --xml-only. Suggest see manual
|
||||||
|
%Error: Exiting due to
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/env perl
|
||||||
|
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||||
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||||
|
#
|
||||||
|
# Copyright 2003 by Wilson Snyder. This program is free software; you
|
||||||
|
# can redistribute it and/or modify it under the terms of either the GNU
|
||||||
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
|
# Version 2.0.
|
||||||
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||||
|
|
||||||
|
scenarios(vlt => 1);
|
||||||
|
top_filename("t/t_flag_main.v");
|
||||||
|
|
||||||
|
compile(
|
||||||
|
verilator_make_cmake => 0,
|
||||||
|
verilator_make_gmake => 0,
|
||||||
|
verilator_flags2 => ["--build -E -Wno-fatal --dpi-hdr-only --lint-only --xml-only"],
|
||||||
|
fails => 1,
|
||||||
|
expect_filename => $Self->{golden_filename},
|
||||||
|
);
|
||||||
|
|
||||||
|
ok(1);
|
||||||
|
1;
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
%Error: The following cannot be used together: --dpi-hdr-only, --lint-only, --xml-only. Suggest see manual
|
||||||
|
%Error: Exiting due to
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/env perl
|
||||||
|
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||||
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||||
|
#
|
||||||
|
# Copyright 2003 by Wilson Snyder. This program is free software; you
|
||||||
|
# can redistribute it and/or modify it under the terms of either the GNU
|
||||||
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
|
# Version 2.0.
|
||||||
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||||
|
|
||||||
|
scenarios(vlt => 1);
|
||||||
|
top_filename("t/t_flag_main.v");
|
||||||
|
|
||||||
|
compile(
|
||||||
|
verilator_make_cmake => 0,
|
||||||
|
verilator_make_gmake => 0,
|
||||||
|
verilator_flags2 => ["-Wall --lint-only -Wno-fatal --dpi-hdr-only --xml-only"],
|
||||||
|
fails => 1,
|
||||||
|
expect_filename => $Self->{golden_filename},
|
||||||
|
);
|
||||||
|
|
||||||
|
ok(1);
|
||||||
|
1;
|
||||||
|
|
@ -26,7 +26,7 @@ top_filename("$Self->{obj_dir}/t_lint_eofline_bad.v");
|
||||||
gen($Self->{top_filename});
|
gen($Self->{top_filename});
|
||||||
|
|
||||||
lint(
|
lint(
|
||||||
verilator_flags2 => ["--lint-only -Wall -Wno-DECLFILENAME -E"],
|
verilator_flags2 => ["-E -Wall -Wno-DECLFILENAME"],
|
||||||
expect_filename => $Self->{golden_filename},
|
expect_filename => $Self->{golden_filename},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue