diff --git a/Changes b/Changes index b44c6128c..468d9e1ef 100644 --- a/Changes +++ b/Changes @@ -127,6 +127,7 @@ Verilator 5.041 devel * 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 `-G` and `-pvalue` with `--hierarchical`. [Geza Lore] +* Fix waiving messages with empty contents (#6610). [Yoshitomo KANEDA] Verilator 5.040 2025-08-30 diff --git a/src/V3Control.cpp b/src/V3Control.cpp index 36debc804..6f2828ecc 100644 --- a/src/V3Control.cpp +++ b/src/V3Control.cpp @@ -143,18 +143,19 @@ class WildcardContents final { clearCacheImp(); } - bool resolveUncachedImp(const string& name) { + bool resolveUncachedImp(const string& contentsRegexp) { for (const string& i : m_lines) { - if (VString::wildmatch(i, name)) return true; + if (VString::wildmatch(i, contentsRegexp)) return true; } return false; } - bool resolveCachedImp(const string& name) { + bool resolveCachedImp(const string& contentsRegexp) { // 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; // Resolve entry when first requested, cache the result - if (pair.second) entryr = resolveUncachedImp(name); + if (pair.second) entryr = resolveUncachedImp(contentsRegexp); return entryr; } @@ -163,8 +164,10 @@ public: m_lines.emplace_back(""); // start with no leftover } ~WildcardContents() = default; - // Return true iff name in parsed contents - static bool resolve(const string& name) { return s().resolveCachedImp(name); } + // Return true iff contentsRegexp in parsed contents + static bool resolve(const string& contentsRegexp) { + return s().resolveCachedImp(contentsRegexp); + } // Add arbitrary text (need not be line-by-line) static void pushText(const string& text) { s().pushTextImp(text); } }; @@ -427,11 +430,12 @@ public: m_lastIgnore.lineno = filelinep->lastLineno(); } } - bool waive(V3ErrorCode code, const string& match) { + bool waive(V3ErrorCode code, const string& message) { if (code.hardError()) return false; 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)) - && VString::wildmatch(match, itr.m_match) + && VString::wildmatch(message, itr.m_match) && WildcardContents::resolve(itr.m_contents)) { return true; } diff --git a/test_regress/t/t_lint_eofnewline_vlt.vlt b/test_regress/t/t_lint_eofnewline_vlt.vlt index 7c575bb83..016032dea 100644 --- a/test_regress/t/t_lint_eofnewline_vlt.vlt +++ b/test_regress/t/t_lint_eofnewline_vlt.vlt @@ -6,4 +6,4 @@ `verilator_config -lint_off -rule EOFNEWLINE --file "*.v" +lint_off -rule EOFNEWLINE --file "*.v" -match "Missing newline at end of file*"