Fix waiving messages with empty contents (#6610).

This commit is contained in:
Wilson Snyder 2025-10-30 18:41:18 -04:00
parent d81da042cd
commit 85119cb32e
3 changed files with 15 additions and 10 deletions

View File

@ -127,6 +127,7 @@ Verilator 5.041 devel
* Fix mis-ignoring virtual interface member triggers (#5116 reopened) (#6613). [Geza Lore] * Fix mis-ignoring virtual interface member triggers (#5116 reopened) (#6613). [Geza Lore]
* Fix ENUMVALUE warning when overriding parameter using `-G/-pvalue` options. [Geza Lore] * Fix ENUMVALUE warning when overriding parameter using `-G/-pvalue` options. [Geza Lore]
* Fix `-G` and `-pvalue` with `--hierarchical`. [Geza Lore] * Fix `-G` and `-pvalue` with `--hierarchical`. [Geza Lore]
* Fix waiving messages with empty contents (#6610). [Yoshitomo KANEDA]
Verilator 5.040 2025-08-30 Verilator 5.040 2025-08-30

View File

@ -143,18 +143,19 @@ class WildcardContents final {
clearCacheImp(); clearCacheImp();
} }
bool resolveUncachedImp(const string& name) { bool resolveUncachedImp(const string& contentsRegexp) {
for (const string& i : m_lines) { for (const string& i : m_lines) {
if (VString::wildmatch(i, name)) return true; if (VString::wildmatch(i, contentsRegexp)) return true;
} }
return false; return false;
} }
bool resolveCachedImp(const string& name) { bool resolveCachedImp(const string& contentsRegexp) {
// Lookup if it was resolved before, typically is // Lookup if it was resolved before, typically is
const auto pair = m_mapPatterns.emplace(name, false); if (contentsRegexp.empty()) return true;
const auto pair = m_mapPatterns.emplace(contentsRegexp, false);
bool& entryr = pair.first->second; bool& entryr = pair.first->second;
// Resolve entry when first requested, cache the result // Resolve entry when first requested, cache the result
if (pair.second) entryr = resolveUncachedImp(name); if (pair.second) entryr = resolveUncachedImp(contentsRegexp);
return entryr; return entryr;
} }
@ -163,8 +164,10 @@ public:
m_lines.emplace_back(""); // start with no leftover m_lines.emplace_back(""); // start with no leftover
} }
~WildcardContents() = default; ~WildcardContents() = default;
// Return true iff name in parsed contents // Return true iff contentsRegexp in parsed contents
static bool resolve(const string& name) { return s().resolveCachedImp(name); } static bool resolve(const string& contentsRegexp) {
return s().resolveCachedImp(contentsRegexp);
}
// Add arbitrary text (need not be line-by-line) // Add arbitrary text (need not be line-by-line)
static void pushText(const string& text) { s().pushTextImp(text); } static void pushText(const string& text) { s().pushTextImp(text); }
}; };
@ -427,11 +430,12 @@ public:
m_lastIgnore.lineno = filelinep->lastLineno(); m_lastIgnore.lineno = filelinep->lastLineno();
} }
} }
bool waive(V3ErrorCode code, const string& match) { bool waive(V3ErrorCode code, const string& message) {
if (code.hardError()) return false; if (code.hardError()) return false;
for (const auto& itr : m_waivers) { for (const auto& itr : m_waivers) {
if ((code.isUnder(itr.m_code) || (itr.m_code == V3ErrorCode::I_LINT)))
if ((code.isUnder(itr.m_code) || (itr.m_code == V3ErrorCode::I_LINT)) if ((code.isUnder(itr.m_code) || (itr.m_code == V3ErrorCode::I_LINT))
&& VString::wildmatch(match, itr.m_match) && VString::wildmatch(message, itr.m_match)
&& WildcardContents::resolve(itr.m_contents)) { && WildcardContents::resolve(itr.m_contents)) {
return true; return true;
} }

View File

@ -6,4 +6,4 @@
`verilator_config `verilator_config
lint_off -rule EOFNEWLINE --file "*.v" lint_off -rule EOFNEWLINE --file "*.v" -match "Missing newline at end of file*"