From d2760be0d4271b9bb8d46d695e00fa491dba462c Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 23 Aug 2026 15:17:33 -0400 Subject: [PATCH] Fix fork no-timing and constructor no-timing message --- src/V3AstNodeStmt.h | 2 ++ src/V3Width.cpp | 22 ++++++++-------------- test_regress/t/t_disable_fork_notiming.out | 2 +- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/V3AstNodeStmt.h b/src/V3AstNodeStmt.h index 84003c2cb..8bae51d2c 100644 --- a/src/V3AstNodeStmt.h +++ b/src/V3AstNodeStmt.h @@ -623,6 +623,7 @@ public: explicit AstDisableFork(FileLine* fl) : ASTGEN_SUPER_DisableFork(fl) {} ASTGEN_MEMBERS_AstDisableFork; + string verilogKwd() const override { return "disable fork"; } }; class AstDisplay final : public AstNodeStmt { // Parents: stmtlist @@ -1456,6 +1457,7 @@ public: : ASTGEN_SUPER_WaitFork(fl) {} ASTGEN_MEMBERS_AstWaitFork; bool isTimingControl() const override { return true; } + string verilogKwd() const override { return "wait fork"; } }; // === AstNodeAssign === diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 59532b758..ee9a48ef4 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -849,28 +849,22 @@ class WidthVisitor final : public VNVisitor { "Use --timing or --no-timing to specify how forks should be handled"); } } - void visit(AstDisableFork* nodep) override { + void visitWaitOrDisableFork(AstNode* nodep) { if (nodep->fileline()->timingOn()) { if (v3Global.opt.timing().isSetFalse()) { - nodep->v3warn(E_NOTIMING, "Support for disable fork statement requires --timing"); - VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); - } else if (!v3Global.opt.timing().isSetTrue()) { - nodep->v3warn(E_NEEDTIMINGOPT, "Use --timing or --no-timing to specify how " - << "disable fork should be handled"); - } - } - } - void visit(AstWaitFork* nodep) override { - if (nodep->fileline()->timingOn()) { - if (v3Global.opt.timing().isSetFalse()) { - nodep->v3warn(E_NOTIMING, "Support for disable fork statement requires --timing"); + nodep->v3warn(E_NOTIMING, "Support for '" << nodep->verilogKwd() + << "' statement requires --timing"); VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); + return; } else if (!v3Global.opt.timing().isSetTrue()) { nodep->v3warn(E_NEEDTIMINGOPT, "Use --timing or --no-timing to specify how " << "disable fork should be handled"); } } + iterateChildren(nodep); } + void visit(AstDisableFork* nodep) override { visitWaitOrDisableFork(nodep); } + void visit(AstWaitFork* nodep) override { visitWaitOrDisableFork(nodep); } void visit(AstToLowerN* nodep) override { assertAtExpr(nodep); if (m_vup->prelim()) { @@ -4967,7 +4961,7 @@ class WidthVisitor final : public VNVisitor { void methodCallWarnTiming(AstNodeFTaskRef* const nodep, const std::string& className) { if (v3Global.opt.timing().isSetFalse()) { nodep->v3warn(E_NOTIMING, - className << "::" << nodep->name() << "() requires --timing"); + className << "::" << nodep->prettyName() << "() requires --timing"); } else if (!v3Global.opt.timing().isSetTrue()) { nodep->v3warn(E_NEEDTIMINGOPT, "Use --timing or --no-timing to specify how " << className << "::" << nodep->name() diff --git a/test_regress/t/t_disable_fork_notiming.out b/test_regress/t/t_disable_fork_notiming.out index 36f89ca23..47f17b625 100644 --- a/test_regress/t/t_disable_fork_notiming.out +++ b/test_regress/t/t_disable_fork_notiming.out @@ -1,4 +1,4 @@ -%Error-NOTIMING: t/t_disable_fork_notiming.v:8:11: Support for disable fork statement requires --timing +%Error-NOTIMING: t/t_disable_fork_notiming.v:8:11: Support for 'disable fork' statement requires --timing : ... note: In instance 't' 8 | initial disable fork; | ^~~~~~~