From 572f50126b93995cc9c58af9076a471530210640 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 4 Mar 2026 20:22:25 -0500 Subject: [PATCH] Improve function call argument error to show target function (rewording) --- src/V3Task.cpp | 10 +++++----- test_regress/t/t_class_new_bad.out | 4 ++-- .../t/t_covergroup_with_sample_args_too_many_bad.out | 2 +- test_regress/t/t_func_bad.out | 6 +++--- test_regress/t/t_let_arg_bad.out | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/V3Task.cpp b/src/V3Task.cpp index 37a0cd629..9eafa680d 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -1827,8 +1827,8 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp, << 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->warnMore() << "... Location of " << nodep->taskp()->verilogKwd() + << " " << nodep->taskp()->prettyNameQ() << " declaration\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); @@ -1856,9 +1856,9 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp, << nodep->taskp()->verilogKwd() << " " << nodep->taskp()->prettyNameQ() << '\n' << nodep->warnContextPrimary() << '\n' - << nodep->warnMore() << "... " - << ucfirst(nodep->taskp()->verilogKwd()) << " " - << nodep->taskp()->prettyNameQ() << " declared here:\n" + << nodep->warnMore() << "... Location of " + << nodep->taskp()->verilogKwd() << " " + << nodep->taskp()->prettyNameQ() << " declaration:\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); diff --git a/test_regress/t/t_class_new_bad.out b/test_regress/t/t_class_new_bad.out index 498800323..441d1fc11 100644 --- a/test_regress/t/t_class_new_bad.out +++ b/test_regress/t/t_class_new_bad.out @@ -15,14 +15,14 @@ : ... note: In instance 't' 47 | c1 = new(3); | ^~~ - : ... Function 'new' declared here: + : ... Location of function 'new' declaration: 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: + : ... Location of function 'new' declaration: 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' diff --git a/test_regress/t/t_covergroup_with_sample_args_too_many_bad.out b/test_regress/t/t_covergroup_with_sample_args_too_many_bad.out index c85a004d5..a42bb7bda 100644 --- a/test_regress/t/t_covergroup_with_sample_args_too_many_bad.out +++ b/test_regress/t/t_covergroup_with_sample_args_too_many_bad.out @@ -2,7 +2,7 @@ : ... note: In instance 't' 15 | cov1.sample(5, 1'b0, 42); | ^~~~~~ - : ... Function 'sample' declared here: + : ... Location of function 'sample' declaration: 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. diff --git a/test_regress/t/t_func_bad.out b/test_regress/t/t_func_bad.out index edd633921..2f8b13abc 100644 --- a/test_regress/t/t_func_bad.out +++ b/test_regress/t/t_func_bad.out @@ -7,7 +7,7 @@ : ... note: In instance 't' 10 | if (add(3'd1, 3'd2, 3'd3) != 0) $stop; | ^~~ - : ... Function 'add' declared here: + : ... Location of function 'add' declaration: 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' @@ -24,7 +24,7 @@ : ... note: In instance 't' 14 | f(.j(1), .no_such(2)); | ^ - : ... Function 'f' declared here: + : ... Location of function 'f' declaration 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' @@ -35,7 +35,7 @@ : ... note: In instance 't' 16 | f(1,2,3); | ^ - : ... Function 'f' declared here: + : ... Location of function 'f' declaration: 37 | function automatic int f( int j = 1, int dup = 0 ); | ^ %Error: Exiting due to diff --git a/test_regress/t/t_let_arg_bad.out b/test_regress/t/t_let_arg_bad.out index 10c05d875..1dccafd20 100644 --- a/test_regress/t/t_let_arg_bad.out +++ b/test_regress/t/t_let_arg_bad.out @@ -1,7 +1,7 @@ %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: + : ... Location of let 'NO_ARG' declaration: 9 | let NO_ARG = 10; | ^~~~~~ ... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance. @@ -14,13 +14,13 @@ %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; | ^~~~~~~ - : ... Let 'ONE_ARG' declared here: + : ... Location of let 'ONE_ARG' declaration: 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: + : ... Location of let 'ONE_ARG' declaration 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'