mirror of
https://github.com/verilator/verilator.git
synced 2025-01-19 12:54:02 +00:00
Allow wildcards in vlt config files
This commit is contained in:
parent
d261c4cd27
commit
dce245da5a
@ -1548,20 +1548,22 @@ Verilator configuration commands.
|
||||
|
||||
=item coverage_off [-file "<filename>" [-lines <line> [ - <line> ]]]
|
||||
|
||||
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 <message> [-file "<filename>" [-lines <line> [ - <line>]]]
|
||||
|
||||
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 "<filename>" [-lines <line> [ - <line> ]]]
|
||||
|
||||
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
|
||||
|
||||
|
@ -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 "<<filename<<":"<<lineno<<", "<<code<<", "<<on<<endl);
|
||||
IgnLines* linesp = findWilds(wildname);
|
||||
UINFO(9,"config addIgnore "<<wildname<<":"<<lineno<<", "<<code<<", "<<on<<endl);
|
||||
linesp->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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user