mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
parent
eb3f10399a
commit
1b15509a9c
@ -336,6 +336,7 @@ public:
|
||||
}
|
||||
}
|
||||
bool waive(V3ErrorCode code, const string& match) {
|
||||
if (code.hardError()) return false;
|
||||
for (const auto& itr : m_waivers) {
|
||||
if ((code.isUnder(itr.first) || (itr.first == V3ErrorCode::I_LINT))
|
||||
&& VString::wildmatch(match, itr.second)) {
|
||||
|
@ -53,25 +53,11 @@ V3ErrorCode::V3ErrorCode(const char* msgp) {
|
||||
//
|
||||
|
||||
bool V3ErrorGuarded::isError(V3ErrorCode code, bool supp) VL_REQUIRES(m_mutex) {
|
||||
if (supp) {
|
||||
return false;
|
||||
} else if (code == V3ErrorCode::USERINFO) {
|
||||
return false;
|
||||
} else if (code == V3ErrorCode::EC_INFO) {
|
||||
return false;
|
||||
} else if (code == V3ErrorCode::EC_FATAL) {
|
||||
return true;
|
||||
} else if (code == V3ErrorCode::EC_FATALEXIT) {
|
||||
return true;
|
||||
} else if (code == V3ErrorCode::EC_FATALSRC) {
|
||||
return true;
|
||||
} else if (code == V3ErrorCode::EC_ERROR) {
|
||||
return true;
|
||||
} else if (code < V3ErrorCode::EC_FIRST_WARN || pretendError(code)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (code.hardError()) return true;
|
||||
if (supp) return false;
|
||||
if (code == V3ErrorCode::USERINFO || code == V3ErrorCode::EC_INFO) return false;
|
||||
if (pretendError(code)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
string V3ErrorGuarded::msgPrefix() VL_REQUIRES(m_mutex) {
|
||||
@ -180,7 +166,7 @@ void V3ErrorGuarded::v3errorEnd(std::ostringstream& sstr, const string& extra)
|
||||
}
|
||||
if (!m_describedEachWarn[m_errorCode] && !m_pretendError[m_errorCode]) {
|
||||
m_describedEachWarn[m_errorCode] = true;
|
||||
if (m_errorCode >= V3ErrorCode::EC_FIRST_WARN && !m_describedWarnings) {
|
||||
if (!m_errorCode.hardError() && !m_describedWarnings) {
|
||||
m_describedWarnings = true;
|
||||
std::cerr << warnMore() << "... Use \"/* verilator lint_off "
|
||||
<< m_errorCode.ascii()
|
||||
|
@ -226,6 +226,10 @@ public:
|
||||
}
|
||||
// Warnings that warn about nasty side effects
|
||||
bool dangerous() const VL_MT_SAFE { return (m_e == COMBDLY); }
|
||||
// Insuppressible error codes that should always stop elaboration
|
||||
bool hardError() const VL_MT_SAFE {
|
||||
return (m_e != EC_INFO && m_e < V3ErrorCode::EC_FIRST_WARN);
|
||||
}
|
||||
// Warnings we'll present to the user as errors
|
||||
// Later -Werror- options may make more of these.
|
||||
bool pretendError() const VL_MT_SAFE {
|
||||
|
@ -371,7 +371,7 @@ bool FileLine::warnOff(const string& msg, bool flag) {
|
||||
return true;
|
||||
}
|
||||
const V3ErrorCode code{cmsg};
|
||||
if (code < V3ErrorCode::EC_FIRST_WARN) {
|
||||
if (code.hardError()) {
|
||||
return false;
|
||||
} else {
|
||||
warnOff(code, flag);
|
||||
|
23
test_regress/t/t_vlt_match_error.v
Normal file
23
test_regress/t/t_vlt_match_error.v
Normal file
@ -0,0 +1,23 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||
// any use, without warranty, 2024 by Ethan Sifferman.
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
module DECLFILENAME;
|
||||
logic UNUSEDSIGNAL;
|
||||
logic [0:1] ASCRANGE_UNDRIVEN;
|
||||
always_comb begin
|
||||
case (ASCRANGE_UNDRIVEN)
|
||||
2'b0x: UNUSEDSIGNAL = 1;
|
||||
endcase
|
||||
end
|
||||
|
||||
`ifdef T_VLT_MATCH_ERROR_1
|
||||
import hi::*;
|
||||
`elsif T_VLT_MATCH_ERROR_2
|
||||
initial $readmemh("", EC_ERROR);
|
||||
`elsif T_VLT_MATCH_ERROR_3
|
||||
initial #1;
|
||||
`endif
|
||||
endmodule
|
9
test_regress/t/t_vlt_match_error.vlt
Normal file
9
test_regress/t/t_vlt_match_error.vlt
Normal file
@ -0,0 +1,9 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||
// any use, without warranty, 2024 by Ethan Sifferman.
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
`verilator_config
|
||||
|
||||
lint_off -file "*/t_vlt_match_error.v" -match "*"
|
8
test_regress/t/t_vlt_match_error_1.out
Normal file
8
test_regress/t/t_vlt_match_error_1.out
Normal file
@ -0,0 +1,8 @@
|
||||
%Error-PKGNODECL: t/t_vlt_match_error.v:17:12: Package/class 'hi' not found, and needs to be predeclared (IEEE 1800-2023 26.3)
|
||||
17 | import hi::*;
|
||||
| ^~
|
||||
... For error description see https://verilator.org/warn/PKGNODECL?v=latest
|
||||
%Error: t/t_vlt_match_error.v:17:12: Importing from missing package 'hi'
|
||||
17 | import hi::*;
|
||||
| ^~
|
||||
%Error: Exiting due to
|
22
test_regress/t/t_vlt_match_error_1.pl
Executable file
22
test_regress/t/t_vlt_match_error_1.pl
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2024 by Wilson Snyder and Ethan Sifferman. 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_vlt_match_error.v");
|
||||
|
||||
lint(
|
||||
verilator_flags2 => ["-DT_VLT_MATCH_ERROR_1 --lint-only -Wall t/t_vlt_match_error.v t/t_vlt_match_error.vlt"],
|
||||
fails => 1,
|
||||
expect_filename => $Self->{golden_filename},
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
4
test_regress/t/t_vlt_match_error_2.out
Normal file
4
test_regress/t/t_vlt_match_error_2.out
Normal file
@ -0,0 +1,4 @@
|
||||
%Error: t/t_vlt_match_error.v:19:27: Can't find definition of variable: 'EC_ERROR'
|
||||
19 | initial $readmemh("", EC_ERROR);
|
||||
| ^~~~~~~~
|
||||
%Error: Exiting due to
|
22
test_regress/t/t_vlt_match_error_2.pl
Executable file
22
test_regress/t/t_vlt_match_error_2.pl
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2024 by Wilson Snyder and Ethan Sifferman. 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_vlt_match_error.v");
|
||||
|
||||
lint(
|
||||
verilator_flags2 => ["-DT_VLT_MATCH_ERROR_2 --lint-only -Wall t/t_vlt_match_error.v t/t_vlt_match_error.vlt"],
|
||||
fails => 1,
|
||||
expect_filename => $Self->{golden_filename},
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
6
test_regress/t/t_vlt_match_error_3.out
Normal file
6
test_regress/t/t_vlt_match_error_3.out
Normal file
@ -0,0 +1,6 @@
|
||||
%Error-NEEDTIMINGOPT: t/t_vlt_match_error.v:21:13: Use --timing or --no-timing to specify how delays should be handled
|
||||
: ... note: In instance 'DECLFILENAME'
|
||||
21 | initial #1;
|
||||
| ^
|
||||
... For error description see https://verilator.org/warn/NEEDTIMINGOPT?v=latest
|
||||
%Error: Exiting due to
|
22
test_regress/t/t_vlt_match_error_3.pl
Executable file
22
test_regress/t/t_vlt_match_error_3.pl
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2024 by Wilson Snyder and Ethan Sifferman. 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_vlt_match_error.v");
|
||||
|
||||
lint(
|
||||
verilator_flags2 => ["-DT_VLT_MATCH_ERROR_3 --lint-only -Wall t/t_vlt_match_error.v t/t_vlt_match_error.vlt"],
|
||||
fails => 1,
|
||||
expect_filename => $Self->{golden_filename},
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
Loading…
Reference in New Issue
Block a user