Vlt lint off now has optional msgname

This commit is contained in:
Wilson Snyder 2010-12-30 06:58:02 -05:00
parent acc4490370
commit 6283df7491
6 changed files with 36 additions and 27 deletions

View File

@ -1553,12 +1553,15 @@ or all files if omitted) and range of line numbers (or all lines if
omitted). Often used to ignore an entire module for coverage analysis
purposes.
=item lint_off -msg <message> [-file "<filename>" [-lines <line> [ - <line>]]]
=item lint_off [-msg <message>] [-file "<filename>" [-lines <line> [ - <line>]]]
Disables the specified lint warning in the specified filename (or wildcard
Disables the specified lint warning, in the specified filename (or wildcard
with '*' or '?', or all files if omitted) and range of line numbers (or all
lines if omitted).
If the -msg is omitted, all lint warnings are disabled. This will override
all later lint warning enables for the specified region.
=item tracing_off [-file "<filename>" [-lines <line> [ - <line> ]]]
Disable waveform tracing for all future signals declared in the specified

View File

@ -117,30 +117,6 @@ void FileLine::lineDirective(const char* textp, int& enterExitRef) {
//printf ("PPLINE %d '%s'\n", s_lineno, s_filename.c_str());
}
bool FileLine::warnOff(const string& msg, bool flag) {
V3ErrorCode code (msg.c_str());
if (code < V3ErrorCode::EC_FIRST_WARN) {
return false;
} else {
warnOff(code, flag);
return true;
}
}
void FileLine::warnLintOff(bool flag) {
for (int codei=V3ErrorCode::EC_FIRST_WARN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
V3ErrorCode code = (V3ErrorCode)codei;
if (code.lintError()) warnOff(code, flag);
}
}
void FileLine::warnStyleOff(bool flag) {
for (int codei=V3ErrorCode::EC_FIRST_WARN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
V3ErrorCode code = (V3ErrorCode)codei;
if (code.styleError()) warnOff(code, flag);
}
}
FileLine* FileLine::copyOrSameFileLine() {
// When a fileline is "used" to produce a node, calls this function.
// Return this, or a copy of this
@ -196,10 +172,35 @@ ostream& operator<<(ostream& os, FileLine* fileline) {
return(os);
}
bool FileLine::warnOff(const string& msg, bool flag) {
V3ErrorCode code (msg.c_str());
if (code < V3ErrorCode::EC_FIRST_WARN) {
return false;
} else {
warnOff(code, flag);
return true;
}
}
void FileLine::warnLintOff(bool flag) {
for (int codei=V3ErrorCode::EC_FIRST_WARN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
V3ErrorCode code = (V3ErrorCode)codei;
if (code.lintError()) warnOff(code, flag);
}
}
void FileLine::warnStyleOff(bool flag) {
for (int codei=V3ErrorCode::EC_FIRST_WARN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
V3ErrorCode code = (V3ErrorCode)codei;
if (code.styleError()) warnOff(code, flag);
}
}
bool FileLine::warnIsOff(V3ErrorCode code) const {
if (!m_warnOn.test(code)) return true;
// UNOPTFLAT implies UNOPT
if (code==V3ErrorCode::UNOPT && !m_warnOn.test(V3ErrorCode::UNOPTFLAT)) return true;
if ((code.lintError() || code.styleError()) && !m_warnOn.test(V3ErrorCode::I_LINT)) return true;
return false;
}

View File

@ -44,6 +44,7 @@ public:
// Boolean information we track per-line, but aren't errors
I_COVERAGE, // Coverage is on/off from /*verilator coverage_on/off*/
I_TRACING, // Tracing is on/off from /*verilator tracing_on/off*/
I_LINT, // All lint messages
I_DEF_NETTYPE_WIRE, // `default_nettype is WIRE (false=NONE)
// Error codes:
E_MULTITOP, // Error: Multiple top level modules
@ -97,7 +98,7 @@ public:
// Leading spaces indicate it can't be disabled.
" MIN", " SUPPRESS", " INFO", " FATAL", " FATALSRC", " ERROR",
// Boolean
" I_COVERAGE", " I_TRACING", " I_DEF_NETTYPE_WIRE",
" I_COVERAGE", " I_TRACING", " I_LINT", " I_DEF_NETTYPE_WIRE",
// Errors
"MULTITOP", "TASKNSVAR", "BLKLOOPINIT",
// Warnings

View File

@ -3056,6 +3056,7 @@ vltItem:
vltOffFront<errcodeen>:
yVLT_COVERAGE_OFF { $$ = V3ErrorCode::I_COVERAGE; }
| yVLT_TRACING_OFF { $$ = V3ErrorCode::I_TRACING; }
| yVLT_LINT_OFF { $$ = V3ErrorCode::I_LINT; }
| yVLT_LINT_OFF yVLT_D_MSG yaID__ETC
{ $$ = V3ErrorCode((*$3).c_str());
if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown Error Code: "<<*$3<<endl); } }

View File

@ -17,6 +17,7 @@
module t;
reg width_warn_var_line18 = 2'b11; // Width warning - must be line 18
reg width_warn2_var_line19 = 2'b11; // Width warning - must be line 19
reg width_warn3_var_line20 = 2'b11; // Width warning - must be line 20
initial begin
casex (1'b1)

View File

@ -9,6 +9,8 @@ lint_off -msg CASEINCOMPLETE -file "t/t_vlt_warn.v"
lint_off -msg WIDTH -file "t/t_vlt_warn.v" -lines 18
// Test wildcard filenames
lint_off -msg WIDTH -file "*/t_vlt_warn.v" -lines 19-19
// Test global disables
lint_off -file "*/t_vlt_warn.v" -lines 20-20
coverage_off -file "t/t_vlt_warn.v"
// Test --flag is also accepted