From 32e99ba0d942683fb1f0975a54f4fd7b2cd385d8 Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Tue, 20 Jul 2021 13:52:53 +0100 Subject: [PATCH] Emit: Attach VL_ATTR_COLD to definitions as well as declarations. This is required by clang if the definition precedes the declaration (which can happen when building via __ALL.cpp), otherwise we get a warning. --- src/V3EmitCBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/V3EmitCBase.cpp b/src/V3EmitCBase.cpp index 0e740bbb2..ce087ff6f 100644 --- a/src/V3EmitCBase.cpp +++ b/src/V3EmitCBase.cpp @@ -82,6 +82,7 @@ string EmitCBaseVisitor::cFuncArgs(const AstCFunc* nodep) { void EmitCBaseVisitor::emitCFuncHeader(const AstCFunc* funcp, const AstNodeModule* modp, bool withScope) { + if (funcp->slow()) puts("VL_ATTR_COLD "); if (!funcp->isConstructor() && !funcp->isDestructor()) { puts(funcp->rtnTypeVoid()); puts(" "); @@ -109,7 +110,6 @@ void EmitCBaseVisitor::emitCFuncDecl(const AstCFunc* funcp, const AstNodeModule* puts("virtual "); } emitCFuncHeader(funcp, modp, /* withScope: */ false); - if (funcp->slow()) puts(" VL_ATTR_COLD"); puts(";\n"); if (!funcp->ifdef().empty()) puts("#endif // " + funcp->ifdef() + "\n"); }