Improve function call argument error to show target function
This commit is contained in:
parent
7acd73fede
commit
1bf2ea7643
|
|
@ -1822,9 +1822,14 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp,
|
|||
const auto it = nameToIndex.find(argp->name());
|
||||
if (it == nameToIndex.end()) {
|
||||
if (makeChanges) {
|
||||
argp->v3error("No such argument " << argp->prettyNameQ()
|
||||
<< " in function call to "
|
||||
<< nodep->taskp()->prettyTypeName());
|
||||
argp->v3error(
|
||||
"No such argument "
|
||||
<< argp->prettyNameQ() << " in call to " << nodep->taskp()->verilogKwd()
|
||||
<< " " << nodep->taskp()->prettyNameQ() << '\n'
|
||||
<< nodep->warnContextPrimary() << '\n'
|
||||
<< nodep->warnMore() << "... " << ucfirst(nodep->taskp()->verilogKwd())
|
||||
<< " " << nodep->taskp()->prettyNameQ() << " declared here:\n"
|
||||
<< nodep->taskp()->warnContextSecondary());
|
||||
// We'll just delete it; seems less error prone than making a false argument
|
||||
VL_DO_DANGLING(argp->unlinkFrBack()->deleteTree(), argp);
|
||||
}
|
||||
|
|
@ -1847,8 +1852,14 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp,
|
|||
tconnects[ppinnum].second = argp;
|
||||
++tpinnum;
|
||||
} else if (makeChanges) {
|
||||
argp->v3error("Too many arguments in function call to "
|
||||
<< nodep->taskp()->prettyTypeName());
|
||||
argp->v3error("Too many arguments in call to "
|
||||
<< nodep->taskp()->verilogKwd() << " "
|
||||
<< nodep->taskp()->prettyNameQ() << '\n'
|
||||
<< nodep->warnContextPrimary() << '\n'
|
||||
<< nodep->warnMore() << "... "
|
||||
<< ucfirst(nodep->taskp()->verilogKwd()) << " "
|
||||
<< nodep->taskp()->prettyNameQ() << " declared here:\n"
|
||||
<< nodep->taskp()->warnContextSecondary());
|
||||
// We'll just delete it; seems less error prone than making a false argument
|
||||
VL_DO_DANGLING(argp->unlinkFrBack()->deleteTree(), argp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,14 +11,20 @@
|
|||
: ... note: In instance 't'
|
||||
39 | function ClsNew3::new();
|
||||
| ^~~
|
||||
%Error: t/t_class_new_bad.v:47:16: Too many arguments in function call to FUNC 'new'
|
||||
%Error: t/t_class_new_bad.v:47:16: Too many arguments in call to function 'new'
|
||||
: ... note: In instance 't'
|
||||
47 | c1 = new(3);
|
||||
| ^
|
||||
%Error: t/t_class_new_bad.v:48:16: Too many arguments in function call to FUNC 'new'
|
||||
| ^~~
|
||||
: ... Function 'new' declared here:
|
||||
10 | function new();
|
||||
| ^~~
|
||||
%Error: t/t_class_new_bad.v:48:16: Too many arguments in call to function 'new'
|
||||
: ... note: In instance 't'
|
||||
48 | c2 = new(3);
|
||||
| ^
|
||||
| ^~~
|
||||
: ... Function 'new' declared here:
|
||||
15 | class ClsNoNew;
|
||||
| ^~~~~
|
||||
%Error: t/t_class_new_bad.v:49:12: Missing argument on non-defaulted argument 'i' in function call to FUNC 'new'
|
||||
: ... note: In instance 't'
|
||||
49 | c3 = new();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
%Error: t/t_covergroup_with_sample_args_too_many_bad.v:15:26: Too many arguments in function call to FUNC 'sample'
|
||||
%Error: t/t_covergroup_with_sample_args_too_many_bad.v:15:26: Too many arguments in call to function 'sample'
|
||||
: ... note: In instance 't'
|
||||
15 | cov1.sample(5, 1'b0, 42);
|
||||
| ^~
|
||||
| ^~~~~~
|
||||
: ... Function 'sample' declared here:
|
||||
9 | covergroup cg_with_sample(int init) with function sample (int addr, bit is_read = 1'b0);
|
||||
| ^~~~~~~~~~~~~~
|
||||
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
|
||||
%Error: Exiting due to
|
||||
|
|
|
|||
|
|
@ -3,10 +3,13 @@
|
|||
9 | if (add(3'd1) != 0) $stop;
|
||||
| ^~~
|
||||
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
|
||||
%Error: t/t_func_bad.v:10:27: Too many arguments in function call to FUNC 'add'
|
||||
%Error: t/t_func_bad.v:10:27: Too many arguments in call to function 'add'
|
||||
: ... note: In instance 't'
|
||||
10 | if (add(3'd1, 3'd2, 3'd3) != 0) $stop;
|
||||
| ^~~~
|
||||
| ^~~
|
||||
: ... Function 'add' declared here:
|
||||
19 | function [2:0] add;
|
||||
| ^~~
|
||||
%Error: t/t_func_bad.v:11:7: Missing argument on non-defaulted argument 'y' in function call to TASK 'x'
|
||||
: ... note: In instance 't'
|
||||
11 | x;
|
||||
|
|
@ -17,16 +20,22 @@
|
|||
| ^
|
||||
... For warning description see https://verilator.org/warn/WIDTHTRUNC?v=latest
|
||||
... Use "/* verilator lint_off WIDTHTRUNC */" and lint_on around source to disable this message.
|
||||
%Error: t/t_func_bad.v:14:17: No such argument 'no_such' in function call to FUNC 'f'
|
||||
%Error: t/t_func_bad.v:14:17: No such argument 'no_such' in call to function 'f'
|
||||
: ... note: In instance 't'
|
||||
14 | f(.j(1), .no_such(2));
|
||||
| ^~~~~~~
|
||||
| ^
|
||||
: ... Function 'f' declared here:
|
||||
37 | function automatic int f( int j = 1, int dup = 0 );
|
||||
| ^
|
||||
%Error: t/t_func_bad.v:15:19: Duplicate argument 'dup' in function call to FUNC 'f'
|
||||
: ... note: In instance 't'
|
||||
15 | f(.dup(1), .dup(3));
|
||||
| ^~~
|
||||
%Error: t/t_func_bad.v:16:13: Too many arguments in function call to FUNC 'f'
|
||||
%Error: t/t_func_bad.v:16:13: Too many arguments in call to function 'f'
|
||||
: ... note: In instance 't'
|
||||
16 | f(1,2,3);
|
||||
| ^
|
||||
| ^
|
||||
: ... Function 'f' declared here:
|
||||
37 | function automatic int f( int j = 1, int dup = 0 );
|
||||
| ^
|
||||
%Error: Exiting due to
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
%Error: t/t_let_arg_bad.v:13:18: Too many arguments in function call to LET 'NO_ARG'
|
||||
%Error: t/t_let_arg_bad.v:13:18: Too many arguments in call to let 'NO_ARG'
|
||||
13 | if (NO_ARG(10) != 10) $stop;
|
||||
| ^~
|
||||
| ^~~~~~
|
||||
: ... Let 'NO_ARG' declared here:
|
||||
9 | let NO_ARG = 10;
|
||||
| ^~~~~~
|
||||
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
|
||||
%Error: t/t_let_arg_bad.v:14:11: Missing argument on non-defaulted argument 'a' in function call to LET 'ONE_ARG'
|
||||
14 | if (ONE_ARG != 10) $stop;
|
||||
|
|
@ -8,12 +11,18 @@
|
|||
%Error: t/t_let_arg_bad.v:15:11: Missing argument on non-defaulted argument 'a' in function call to LET 'ONE_ARG'
|
||||
15 | if (ONE_ARG() != 10) $stop;
|
||||
| ^~~~~~~
|
||||
%Error: t/t_let_arg_bad.v:16:23: Too many arguments in function call to LET 'ONE_ARG'
|
||||
%Error: t/t_let_arg_bad.v:16:23: Too many arguments in call to let 'ONE_ARG'
|
||||
16 | if (ONE_ARG(10, 20) != 10) $stop;
|
||||
| ^~
|
||||
%Error: t/t_let_arg_bad.v:17:20: No such argument 'b' in function call to LET 'ONE_ARG'
|
||||
| ^~~~~~~
|
||||
: ... Let 'ONE_ARG' declared here:
|
||||
10 | let ONE_ARG(a) = 10;
|
||||
| ^~~~~~~
|
||||
%Error: t/t_let_arg_bad.v:17:20: No such argument 'b' in call to let 'ONE_ARG'
|
||||
17 | if (ONE_ARG(.b(1)) != 10) $stop;
|
||||
| ^
|
||||
| ^~~~~~~
|
||||
: ... Let 'ONE_ARG' declared here:
|
||||
10 | let ONE_ARG(a) = 10;
|
||||
| ^~~~~~~
|
||||
%Error: t/t_let_arg_bad.v:17:11: Missing argument on non-defaulted argument 'a' in function call to LET 'ONE_ARG'
|
||||
17 | if (ONE_ARG(.b(1)) != 10) $stop;
|
||||
| ^~~~~~~
|
||||
|
|
|
|||
Loading…
Reference in New Issue