mirror of
https://github.com/verilator/verilator.git
synced 2025-01-22 14:24:18 +00:00
Add better suggestions on some bad options.
This commit is contained in:
parent
d4d87ef300
commit
05db4e41cd
@ -1498,7 +1498,9 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
|
||||
m_threadsDpiPure = true;
|
||||
m_threadsDpiUnpure = false;
|
||||
} else {
|
||||
fl->v3fatal("Unknown setting for --threads-dpi: " << valp);
|
||||
fl->v3fatal("Unknown setting for --threads-dpi: '"
|
||||
<< valp << "'\n"
|
||||
<< fl->warnMore() << "... Suggest 'all', 'none', or 'pure'");
|
||||
}
|
||||
});
|
||||
DECL_OPTION("-threads-max-mtasks", CbVal, [this, fl](const char* valp) {
|
||||
@ -1636,7 +1638,9 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
|
||||
} else if (!strcmp(valp, "unique")) {
|
||||
m_xAssign = "unique";
|
||||
} else {
|
||||
fl->v3fatal("Unknown setting for --x-assign: " << valp);
|
||||
fl->v3fatal("Unknown setting for --x-assign: '"
|
||||
<< valp << "'\n"
|
||||
<< fl->warnMore() << "... Suggest '0', '1', 'fast', or 'unique'");
|
||||
}
|
||||
});
|
||||
DECL_OPTION("-x-initial", CbVal, [this, fl](const char* valp) {
|
||||
@ -1647,7 +1651,9 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
|
||||
} else if (!strcmp(valp, "unique")) {
|
||||
m_xInitial = "unique";
|
||||
} else {
|
||||
fl->v3fatal("Unknown setting for --x-initial: " << valp);
|
||||
fl->v3fatal("Unknown setting for --x-initial: '"
|
||||
<< valp << "'\n"
|
||||
<< fl->warnMore() << "... Suggest '0', 'fast', or 'unique'");
|
||||
}
|
||||
});
|
||||
DECL_OPTION("-x-initial-edge", OnOff, &m_xInitialEdge);
|
||||
|
@ -70,8 +70,6 @@ void VlcOptions::parseOptsList(int argc, char** argv) {
|
||||
// Parse parameters
|
||||
// Note argc and argv DO NOT INCLUDE the filename in [0]!!!
|
||||
// May be called recursively when there are -f files.
|
||||
#define shift \
|
||||
do { ++i; } while (false)
|
||||
for (int i = 0; i < argc;) {
|
||||
UINFO(9, " Option: " << argv[i] << endl);
|
||||
if (argv[i][0] == '-') {
|
||||
@ -89,15 +87,15 @@ void VlcOptions::parseOptsList(int argc, char** argv) {
|
||||
}
|
||||
// Parameterized switches
|
||||
else if (!strcmp(sw, "-annotate-min") && (i + 1) < argc) {
|
||||
shift;
|
||||
++i;
|
||||
m_annotateMin = atoi(argv[i]);
|
||||
} else if (!strcmp(sw, "-annotate") && (i + 1) < argc) {
|
||||
shift;
|
||||
++i;
|
||||
m_annotateOut = argv[i];
|
||||
} else if (!strcmp(sw, "-debug")) {
|
||||
V3Error::debugDefault(3);
|
||||
} else if (!strcmp(sw, "-debugi") && (i + 1) < argc) {
|
||||
shift;
|
||||
++i;
|
||||
V3Error::debugDefault(atoi(argv[i]));
|
||||
} else if (!strcmp(sw, "-V")) {
|
||||
showVersion(true);
|
||||
@ -106,22 +104,21 @@ void VlcOptions::parseOptsList(int argc, char** argv) {
|
||||
showVersion(false);
|
||||
std::exit(0);
|
||||
} else if (!strcmp(sw, "-write") && (i + 1) < argc) {
|
||||
shift;
|
||||
++i;
|
||||
m_writeFile = argv[i];
|
||||
} else if (!strcmp(sw, "-write-info") && (i + 1) < argc) {
|
||||
shift;
|
||||
++i;
|
||||
m_writeInfoFile = argv[i];
|
||||
} else {
|
||||
v3fatal("Invalid option: " << argv[i]);
|
||||
}
|
||||
shift;
|
||||
++i;
|
||||
} // - options
|
||||
else {
|
||||
addReadFile(argv[i]);
|
||||
shift;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
#undef shift
|
||||
}
|
||||
|
||||
void VlcOptions::showVersion(bool verbose) {
|
||||
|
2
test_regress/t/t_flag_compiler_bad.out
Normal file
2
test_regress/t/t_flag_compiler_bad.out
Normal file
@ -0,0 +1,2 @@
|
||||
%Error: Unknown setting for --compiler: 'bad_one'
|
||||
... Suggest 'clang', 'gcc', or 'msvc'
|
20
test_regress/t/t_flag_compiler_bad.pl
Executable file
20
test_regress/t/t_flag_compiler_bad.pl
Executable file
@ -0,0 +1,20 @@
|
||||
#!/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);
|
||||
|
||||
lint(
|
||||
verilator_flags2 => ["--compiler bad_one"],
|
||||
fails => 1,
|
||||
expect_filename => $Self->{golden_filename},
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
2
test_regress/t/t_flag_threads_dpi_bad.out
Normal file
2
test_regress/t/t_flag_threads_dpi_bad.out
Normal file
@ -0,0 +1,2 @@
|
||||
%Error: Unknown setting for --threads-dpi: 'bad_one'
|
||||
... Suggest 'all', 'none', or 'pure'
|
20
test_regress/t/t_flag_threads_dpi_bad.pl
Executable file
20
test_regress/t/t_flag_threads_dpi_bad.pl
Executable file
@ -0,0 +1,20 @@
|
||||
#!/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);
|
||||
|
||||
lint(
|
||||
verilator_flags2 => ["--threads-dpi bad_one"],
|
||||
fails => 1,
|
||||
expect_filename => $Self->{golden_filename},
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
2
test_regress/t/t_flag_x_assign_bad.out
Normal file
2
test_regress/t/t_flag_x_assign_bad.out
Normal file
@ -0,0 +1,2 @@
|
||||
%Error: Unknown setting for --x-assign: 'bad_one'
|
||||
... Suggest '0', '1', 'fast', or 'unique'
|
20
test_regress/t/t_flag_x_assign_bad.pl
Executable file
20
test_regress/t/t_flag_x_assign_bad.pl
Executable file
@ -0,0 +1,20 @@
|
||||
#!/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);
|
||||
|
||||
lint(
|
||||
verilator_flags2 => ["--x-assign bad_one"],
|
||||
fails => 1,
|
||||
expect_filename => $Self->{golden_filename},
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
2
test_regress/t/t_flag_x_initial_bad.out
Normal file
2
test_regress/t/t_flag_x_initial_bad.out
Normal file
@ -0,0 +1,2 @@
|
||||
%Error: Unknown setting for --x-initial: 'bad_one'
|
||||
... Suggest '0', 'fast', or 'unique'
|
20
test_regress/t/t_flag_x_initial_bad.pl
Executable file
20
test_regress/t/t_flag_x_initial_bad.pl
Executable file
@ -0,0 +1,20 @@
|
||||
#!/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);
|
||||
|
||||
lint(
|
||||
verilator_flags2 => ["--x-initial bad_one"],
|
||||
fails => 1,
|
||||
expect_filename => $Self->{golden_filename},
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
Loading…
Reference in New Issue
Block a user