diff --git a/bin/verilator b/bin/verilator index dc992dfed..7ca399a73 100755 --- a/bin/verilator +++ b/bin/verilator @@ -1548,20 +1548,22 @@ Verilator configuration commands. =item coverage_off [-file "" [-lines [ - ]]] -Disable coverage for the specified filename (or all files if omitted) and -range of line numbers (or all lines if omitted). Often used to ignore an -entire module for coverage analysis purposes. +Disable coverage for the specified filename (or wildcard with '*' or '?', +or all files if omitted) and range of line numbers (or all lines if +omitted). Often used to ignore an entire module for coverage analysis +purposes. =item lint_off -msg [-file "" [-lines [ - ]]] -Disables the specified lint warning in the specified filename (or all files -if omitted) and range of line numbers (or all lines if omitted). +Disables the specified lint warning in the specified filename (or wildcard +with '*' or '?', or all files if omitted) and range of line numbers (or all +lines if omitted). =item tracing_off [-file "" [-lines [ - ]]] Disable waveform tracing for all future signals declared in the specified -filename (or all files if omitted) and range of line numbers (or all lines -if omitted). +filename (or wildcard with '*' or '?', or all files if omitted) and range +of line numbers (or all lines if omitted). =back diff --git a/src/V3Config.cpp b/src/V3Config.cpp index d2cce953c..66be5b12a 100644 --- a/src/V3Config.cpp +++ b/src/V3Config.cpp @@ -60,7 +60,8 @@ class V3ConfigIgnores { IgnLines::const_iterator m_lastIt; // Point with next linenumber > current line number IgnLines::const_iterator m_lastEnd; // Point with end() - IgnFiles m_ignFiles; // Ignores for each filename + IgnFiles m_ignWilds; // Ignores for each wildcarded filename + IgnFiles m_ignFiles; // Ignores for each non-wildcarded filename static V3ConfigIgnores s_singleton; // Singleton (not via local static, as that's slow) @@ -68,13 +69,13 @@ class V3ConfigIgnores { ~V3ConfigIgnores() {} // METHODS - inline IgnLines* findLines(const string& filename) { - IgnFiles::iterator it = m_ignFiles.find(filename); - if (it != m_ignFiles.end()) { + inline IgnLines* findWilds(const string& wildname) { + IgnFiles::iterator it = m_ignWilds.find(wildname); + if (it != m_ignWilds.end()) { return &(it->second); } else { - m_ignFiles.insert(make_pair(filename, IgnLines())); - it = m_ignFiles.find(filename); + m_ignWilds.insert(make_pair(wildname, IgnLines())); + it = m_ignWilds.find(wildname); return &(it->second); } } @@ -82,23 +83,35 @@ class V3ConfigIgnores { // Given a filename, find all wildcard matches against it and build // hash with the specific filename. This avoids having to wildmatch // more than once against any filename. - IgnLines* linesp = findLines(filename); - m_lastIt = linesp->begin(); - m_lastEnd = linesp->end(); + IgnFiles::iterator it = m_ignFiles.find(filename); + if (it == m_ignFiles.end()) { + // Haven't seen this filename before + m_ignFiles.insert(make_pair(filename, IgnLines())); + it = m_ignFiles.find(filename); + // Make new list for this file of all matches + for (IgnFiles::iterator fnit = m_ignWilds.begin(); fnit != m_ignWilds.end(); ++fnit) { + if (V3Options::wildmatch(filename.c_str(), fnit->first.c_str())) { + for (IgnLines::iterator lit = fnit->second.begin(); lit != fnit->second.end(); ++lit) { + it->second.insert(*lit); + } + } + } + } + m_lastIt = it->second.begin(); + m_lastEnd = it->second.end(); } public: inline static V3ConfigIgnores& singleton() { return s_singleton; } - void addIgnore(V3ErrorCode code, string filename, int lineno, bool on) { + void addIgnore(V3ErrorCode code, string wildname, int lineno, bool on) { // Insert - IgnLines* linesp = findLines(filename); - UINFO(9,"config addIgnore "<insert(V3ConfigLine(code, lineno, on)); - if (m_lastFilename == filename) { - // Flush the match cache, due to a change in the rules. - m_lastFilename = " "; - } + // Flush the match cache, due to a change in the rules. + m_ignFiles.clear(); + m_lastFilename = " "; } inline void applyIgnores(FileLine* filelinep) { // HOT routine, called each parsed token line diff --git a/test_regress/t/t_vlt_warn.vlt b/test_regress/t/t_vlt_warn.vlt index 6c8eda2a6..cf457c9b0 100644 --- a/test_regress/t/t_vlt_warn.vlt +++ b/test_regress/t/t_vlt_warn.vlt @@ -7,7 +7,8 @@ lint_off -msg CASEINCOMPLETE -file "t/t_vlt_warn.v" lint_off -msg WIDTH -file "t/t_vlt_warn.v" -lines 18 -lint_off -msg WIDTH -file "t/t_vlt_warn.v" -lines 19-19 +// Test wildcard filenames +lint_off -msg WIDTH -file "*/t_vlt_warn.v" -lines 19-19 coverage_off -file "t/t_vlt_warn.v" // Test --flag is also accepted