Fix duplicate warnings/errors, bug516.

This commit is contained in:
Wilson Snyder 2012-05-21 21:31:52 -04:00
parent 53f50463bc
commit 1bc1ee9e08
9 changed files with 95 additions and 54 deletions

View File

@ -23,6 +23,8 @@ indicates the contributor was also the author of the fix; Thanks!
*** Fix parameters not supported in constant functions, bug474. [Alex Solomatnikov]
**** Fix duplicate warnings/errors, bug516. [Alex Solomatnikov]
**** Fix signed extending biops with WIDTH warning off, bug511. [Junji Hashimoto]
**** Fix ITOD internal error on real conversions, bug491. [Alex Solomatnikov]

View File

@ -45,6 +45,7 @@ bool V3Error::s_errorSuppressed = false;
bool V3Error::s_describedEachWarn[V3ErrorCode::_ENUM_MAX];
bool V3Error::s_describedWarnings = false;
bool V3Error::s_pretendError[V3ErrorCode::_ENUM_MAX];
V3Error::MessagesSet V3Error::s_messages;
struct v3errorIniter {
v3errorIniter() { V3Error::init(); }
@ -420,59 +421,62 @@ void V3Error::v3errorEnd (ostringstream& sstr) {
#if defined(__COVERITY__) || defined(__cppcheck__)
if (s_errorCode==V3ErrorCode::EC_FATAL) __coverity_panic__(x);
#endif
if (!s_errorSuppressed
// Skip suppressed messages
if (s_errorSuppressed
// On debug, show only non default-off warning to prevent pages of warnings
|| (debug() && !s_errorCode.defaultsOff())) {
cerr<<msgPrefix()<<sstr.str();
if (sstr.str()[sstr.str().length()-1] != '\n') {
cerr<<endl;
}
if (!s_errorSuppressed && s_errorCode!=V3ErrorCode::EC_INFO) {
if (!s_describedEachWarn[s_errorCode]
&& !s_pretendError[s_errorCode]) {
s_describedEachWarn[s_errorCode] = true;
if (s_errorCode>=V3ErrorCode::EC_FIRST_WARN && !s_describedWarnings) {
cerr<<msgPrefix()<<"Use \"/* verilator lint_off "<<s_errorCode.ascii()
<<" */\" and lint_on around source to disable this message."<<endl;
s_describedWarnings = true;
}
if (s_errorCode.dangerous()) {
cerr<<msgPrefix()<<"*** See the manual before disabling this,"<<endl;
cerr<<msgPrefix()<<"else you may end up with different sim results."<<endl;
}
&& (!debug() || s_errorCode.defaultsOff())) return;
string msg = msgPrefix()+sstr.str();
if (msg[msg.length()-1] != '\n') msg += '\n';
// Suppress duplicates
if (s_messages.find(msg) != s_messages.end()) return;
s_messages.insert(msg);
// Output
cerr<<msg;
if (!s_errorSuppressed && s_errorCode!=V3ErrorCode::EC_INFO) {
if (!s_describedEachWarn[s_errorCode]
&& !s_pretendError[s_errorCode]) {
s_describedEachWarn[s_errorCode] = true;
if (s_errorCode>=V3ErrorCode::EC_FIRST_WARN && !s_describedWarnings) {
cerr<<msgPrefix()<<"Use \"/* verilator lint_off "<<s_errorCode.ascii()
<<" */\" and lint_on around source to disable this message."<<endl;
s_describedWarnings = true;
}
// If first warning is not the user's fault (internal/unsupported) then give the website
// Not later warnings, as a internal may be caused by an earlier problem
if (s_tellManual == 0) {
if (s_errorCode.mentionManual()
|| sstr.str().find("Unsupported") != string::npos) {
s_tellManual = 1;
} else {
if (s_errorCode.dangerous()) {
cerr<<msgPrefix()<<"*** See the manual before disabling this,"<<endl;
cerr<<msgPrefix()<<"else you may end up with different sim results."<<endl;
}
}
// If first warning is not the user's fault (internal/unsupported) then give the website
// Not later warnings, as a internal may be caused by an earlier problem
if (s_tellManual == 0) {
if (s_errorCode.mentionManual()
|| sstr.str().find("Unsupported") != string::npos) {
s_tellManual = 1;
} else {
s_tellManual = 2;
}
}
if (isError(s_errorCode, s_errorSuppressed)) incErrors();
else incWarnings();
if (s_errorCode==V3ErrorCode::EC_FATAL
|| s_errorCode==V3ErrorCode::EC_FATALSRC) {
static bool inFatal = false;
if (!inFatal) {
inFatal = true;
if (s_tellManual==1) {
cerr<<msgPrefix()<<"See the manual and http://www.veripool.org/verilator for more assistance."<<endl;
s_tellManual = 2;
}
}
if (isError(s_errorCode, s_errorSuppressed)) incErrors();
else incWarnings();
if (s_errorCode==V3ErrorCode::EC_FATAL
|| s_errorCode==V3ErrorCode::EC_FATALSRC) {
static bool inFatal = false;
if (!inFatal) {
inFatal = true;
if (s_tellManual==1) {
cerr<<msgPrefix()<<"See the manual and http://www.veripool.org/verilator for more assistance."<<endl;
s_tellManual = 2;
}
#ifndef _V3ERROR_NO_GLOBAL_
if (debug()) {
v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("final.tree",99));
V3Stats::statsFinalAll(v3Global.rootp());
V3Stats::statsReport();
}
#endif
if (debug()) {
v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("final.tree",99));
V3Stats::statsFinalAll(v3Global.rootp());
V3Stats::statsReport();
}
vlAbort();
#endif
}
vlAbort();
}
}
}

View File

@ -29,6 +29,7 @@
#include <sstream>
#include <bitset>
#include <map>
#include <set>
#include <deque>
//######################################################################
@ -176,6 +177,9 @@ public:
class V3Error {
// Base class for any object that wants debugging and error reporting
typedef set<string> MessagesSet;
private:
static bool s_describedWarnings; // Told user how to disable warns
static bool s_describedEachWarn[V3ErrorCode::_ENUM_MAX]; // Told user specifics about this warning
@ -187,6 +191,7 @@ class V3Error {
static ostringstream s_errorStr; // Error string being formed
static V3ErrorCode s_errorCode; // Error string being formed will abort
static bool s_errorSuppressed; // Error being formed should be suppressed
static MessagesSet s_messages; // What errors we've outputted
enum MaxErrors { MAX_ERRORS = 50 }; // Fatal after this may errors
V3Error() { cerr<<("Static class"); abort(); }

View File

@ -12,12 +12,8 @@ compile (
fails=>1,
expect=>
q{%Error: t/t_func_bad.v:\d+: Too few arguments in function call to FUNC 'add'
%Error: t/t_func_bad.v:\d+: Too few arguments in function call to FUNC 'add'
%Error: t/t_func_bad.v:\d+: Too few arguments in function call to FUNC 'add'
%Error: t/t_func_bad.v:\d+: Too many arguments in function call to FUNC 'add'
%Error: t/t_func_bad.v:\d+: Too few arguments in function call to TASK 'x'
%Error: t/t_func_bad.v:\d+: Too few arguments in function call to TASK 'x'
%Error: t/t_func_bad.v:\d+: Too few arguments in function call to TASK 'x'
%Error: Exiting due to},
);

View File

@ -21,8 +21,6 @@ compile (
%Error: t/t_lint_pindup_bad.v:\d+: Pin not found: __pinNumber4
%Error: t/t_lint_pindup_bad.v:\d+: Duplicate pin connection: P
%Error: t/t_lint_pindup_bad.v:\d+: ... Location of original pin connection
%Error: t/t_lint_pindup_bad.v:\d+: Duplicate pin connection: P
%Error: t/t_lint_pindup_bad.v:\d+: ... Location of original pin connection
%Error: Exiting due to.*',
);

View File

@ -0,0 +1,20 @@
#!/usr/bin/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.
compile (
v_flags2 => ["--lint-only"],
fails=>1,
expect=>
q{%Warning-WIDTH: t/t_lint_repeat_bad.v:17: Operator ASSIGNW expects 1 bits on the Assign RHS, but Assign RHS's VARREF 'a' generates 2 bits.
%Warning-WIDTH: Use \"\/\* verilator lint_off WIDTH \*\/\" and lint_on around source to disable this message.
%Error: Exiting due to 1 warning}
);
ok(1);
1;

View File

@ -0,0 +1,18 @@
// DESCRIPTION: Verilator: Test of select from constant
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Wilson Snyder.
module t ();
sub #(.Z(0)) sub1 ();
sub #(.Z(1)) sub2 ();
sub #(.Z(2)) sub3 ();
endmodule
module sub;
parameter Z = 0;
wire [1:0] a = 2'b11;
wire [0:0] b = a;
endmodule

View File

@ -16,7 +16,6 @@ compile (
'%Error: t/t_mem_slice_bad.v:\d+: Slices of arrays in assignments must have the same unpacked dimensions
%Error: t/t_mem_slice_bad.v:\d+: Slices of arrays in assignments must have the same unpacked dimensions
%Error: t/t_mem_slice_bad.v:\d+: Slices of arrays in assignments must have the same unpacked dimensions
%Error: t/t_mem_slice_bad.v:\d+: Slices of arrays in assignments must have the same unpacked dimensions
%Error: t/t_mem_slice_bad.v:\d+: Unsupported: Slices in a non-delayed assignment with the same Var on both sides
%Error: t/t_mem_slice_bad.v:\d+: Slices of arrays in assignments must have the same unpacked dimensions
%Error: t/t_mem_slice_bad.v:\d+: Slices of arrays in assignments must have the same unpacked dimensions

View File

@ -13,7 +13,6 @@ compile (
fails=>$Self->{vlt},
expect=>
'%Error: t/t_udp.v:\d+: Unsupported: Verilog 1995 UDP Tables. Use --bbox-unsup to ignore tables.
%Error: t/t_udp.v:\d+: Unsupported: Verilog 1995 UDP Tables. Use --bbox-unsup to ignore tables.
%Error: Exiting due to '
);