Fix false UNUSED warning on file system calls.
This commit is contained in:
parent
a82cdcfe48
commit
ee1643ce39
2
Changes
2
Changes
|
|
@ -39,6 +39,8 @@ indicates the contributor was also the author of the fix; Thanks!
|
|||
|
||||
**** Fix loop error message to report line, bug513. [Jeremy Bennett]
|
||||
|
||||
**** Fix false UNUSED warning on file system calls. [Holger Waechtler]
|
||||
|
||||
|
||||
* Verilator 3.833 2012/04/15
|
||||
|
||||
|
|
|
|||
|
|
@ -274,8 +274,9 @@ private:
|
|||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
||||
// Any variable
|
||||
UndrivenVarEntry* entryp = getEntryp (nodep->varp());
|
||||
bool fdrv = nodep->lvalue() && nodep->varp()->attrFileDescr(); // FD's are also being read from
|
||||
if (m_markBoth || nodep->lvalue()) entryp->drivenWhole();
|
||||
if (m_markBoth || !nodep->lvalue()) entryp->usedWhole();
|
||||
if (m_markBoth || !nodep->lvalue() || fdrv) entryp->usedWhole();
|
||||
}
|
||||
|
||||
// Don't know what black boxed calls do, assume in+out
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2008 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.
|
||||
|
||||
$Self->{vlt} or $Self->skip("Verilator only test");
|
||||
|
||||
compile (
|
||||
v_flags2 => ["--lint-only --bbox-sys --bbox-unsup -Wall -Wno-DECLFILENAME"],
|
||||
fails=>0,
|
||||
verilator_make_gcc => 0,
|
||||
make_top_shell => 0,
|
||||
make_main => 0,
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2010 by Wilson Snyder.
|
||||
|
||||
module t (/*AUTOARG*/
|
||||
// Outputs
|
||||
out,
|
||||
// Inputs
|
||||
in
|
||||
);
|
||||
|
||||
input in; // inputs don't get flagged as undriven
|
||||
output out; // outputs don't get flagged as unused
|
||||
|
||||
sub sub ();
|
||||
|
||||
// Check we don't warn about unused UDP signals
|
||||
udp_mux2 udpsub (out, in, in, in);
|
||||
|
||||
// Check ignoreds mark as used
|
||||
reg sysused;
|
||||
initial $bboxed(sysused);
|
||||
|
||||
// Check file IO. The fopen is the "driver" all else a usage.
|
||||
integer infile;
|
||||
integer outfile;
|
||||
initial begin
|
||||
outfile = $fopen("obj_dir/t_lint_unused_bad/open.log", "w");
|
||||
$fwrite(outfile, "1\n");
|
||||
$fclose(outfile);
|
||||
infile = $fopen("obj_dir/t_lint_unused_bad/open.log", "r");
|
||||
if ($fgetc(infile) != "1") begin end
|
||||
end
|
||||
|
||||
wire _unused_ok;
|
||||
|
||||
endmodule
|
||||
|
||||
module sub;
|
||||
|
||||
wire pub /*verilator public*/; // Ignore publics
|
||||
|
||||
localparam THREE = 3;
|
||||
|
||||
endmodule
|
||||
|
||||
primitive udp_mux2 (q, a, b, s);
|
||||
output q;
|
||||
input a, b, s;
|
||||
table
|
||||
//a b s : out
|
||||
1 ? 0 : 1 ;
|
||||
0 ? 0 : 0 ;
|
||||
? 1 1 : 1 ;
|
||||
? 0 1 : 0 ;
|
||||
0 0 x : 0 ;
|
||||
1 1 x : 1 ;
|
||||
endtable
|
||||
endprimitive
|
||||
|
|
@ -3,27 +3,10 @@
|
|||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2010 by Wilson Snyder.
|
||||
|
||||
module t (/*AUTOARG*/
|
||||
// Outputs
|
||||
out,
|
||||
// Inputs
|
||||
in
|
||||
);
|
||||
|
||||
input in; // inputs don't get flagged as undriven
|
||||
output out; // outputs don't get flagged as unused
|
||||
module t (/*AUTOARG*/);
|
||||
|
||||
sub sub ();
|
||||
|
||||
// Check we don't warn about unused UDP signals
|
||||
udp_mux2 udpsub (out, in, in, in);
|
||||
|
||||
// Check ignoreds mark as used
|
||||
reg sysused;
|
||||
initial $bboxed(sysused);
|
||||
|
||||
wire _unused_ok;
|
||||
|
||||
endmodule
|
||||
|
||||
module sub;
|
||||
|
|
@ -53,17 +36,3 @@ module sub;
|
|||
if (0 && mixed[1:0] != 0) begin end
|
||||
end
|
||||
endmodule
|
||||
|
||||
primitive udp_mux2 (q, a, b, s);
|
||||
output q;
|
||||
input a, b, s;
|
||||
table
|
||||
//a b s : out
|
||||
1 ? 0 : 1 ;
|
||||
0 ? 0 : 0 ;
|
||||
? 1 1 : 1 ;
|
||||
? 0 1 : 0 ;
|
||||
0 0 x : 0 ;
|
||||
1 1 x : 1 ;
|
||||
endtable
|
||||
endprimitive
|
||||
|
|
|
|||
Loading…
Reference in New Issue