mirror of
https://github.com/verilator/verilator.git
synced 2025-04-05 04:02:37 +00:00
Tests: test class IGNOREDRETURN.
This commit is contained in:
parent
1e7611edea
commit
434896d50c
@ -1,6 +1,9 @@
|
||||
%Warning-IGNOREDRETURN: t/t_func_void_bad.v:26:7: Ignoring return value of non-void function (IEEE 1800-2023 13.4.1)
|
||||
26 | f1(20);
|
||||
%Warning-IGNOREDRETURN: t/t_func_void_bad.v:21:7: Ignoring return value of non-void function (IEEE 1800-2023 13.4.1)
|
||||
21 | f1();
|
||||
| ^~
|
||||
... For warning description see https://verilator.org/warn/IGNOREDRETURN?v=latest
|
||||
... Use "/* verilator lint_off IGNOREDRETURN */" and lint_on around source to disable this message.
|
||||
%Warning-IGNOREDRETURN: t/t_func_void_bad.v:24:9: Ignoring return value of non-void function (IEEE 1800-2023 13.4.1)
|
||||
24 | c.fi();
|
||||
| ^~
|
||||
%Error: Exiting due to
|
||||
|
@ -4,30 +4,24 @@
|
||||
// any use, without warranty, 2003 by Wilson Snyder.
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
module t (clk);
|
||||
input clk;
|
||||
|
||||
int side_effect;
|
||||
class Cls;
|
||||
function int fi();
|
||||
return 10;
|
||||
endfunction
|
||||
endclass
|
||||
|
||||
module t;
|
||||
function int f1;
|
||||
input int in;
|
||||
f1 = in + 1;
|
||||
side_effect += in + 1;
|
||||
return 20;
|
||||
endfunction
|
||||
|
||||
initial begin
|
||||
int got;
|
||||
side_effect = 1;
|
||||
Cls c;
|
||||
//
|
||||
got = f1(10);
|
||||
if (got != 11) $stop;
|
||||
if (side_effect != 12) $stop;
|
||||
f1(); // Bad - ignored result
|
||||
//
|
||||
f1(20);
|
||||
if (side_effect != 33) $stop;
|
||||
//
|
||||
// void'f1(30);
|
||||
// if (side_effect != 64) $stop;
|
||||
c = new;
|
||||
c.fi(); // Bad - ignored result
|
||||
//
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
|
Loading…
Reference in New Issue
Block a user