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.
This commit is contained in:
Geza Lore 2021-07-20 13:52:53 +01:00
parent da8930a57a
commit 32e99ba0d9

View File

@ -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");
}