Internals: Add mutex to V3Error (#3680)

This commit is contained in:
Kamil Rakoczy
2023-02-09 22:15:37 -05:00
committed by GitHub
parent 4eb280601e
commit 93d50c4499
19 changed files with 505 additions and 267 deletions
+13 -5
View File
@@ -59,15 +59,23 @@ void V3LinkLevel::modSortByLevel() {
if (tops.size() >= 2) {
const AstNode* const secp = tops[1]; // Complain about second one, as first often intended
if (!secp->fileline()->warnIsOff(V3ErrorCode::MULTITOP)) {
auto warnTopModules = [](std::string warnMore, ModVec tops)
VL_REQUIRES(V3Error::s().m_mutex) -> std::string {
std::stringstream ss;
for (AstNode* alsop : tops) {
ss << warnMore << "... Top module " << alsop->prettyNameQ() << endl
<< alsop->warnContextSecondary();
}
return ss.str();
};
secp->v3warn(MULTITOP, "Multiple top level modules\n"
<< secp->warnMore()
<< "... Suggest see manual; fix the duplicates, or use "
"--top-module to select top."
<< V3Error::warnContextNone());
for (AstNode* alsop : tops) {
std::cerr << secp->warnMore() << "... Top module " << alsop->prettyNameQ() << endl
<< alsop->warnContextSecondary();
}
<< V3Error::s().warnContextNone()
<< V3Error::warnAdditionalInfo()
<< warnTopModules(secp->warnMore(), tops));
}
}