New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lint filter specific warnings or wildcards/regexp #1649
Comments
Original Redmine Comment For the projects I personally lead, I require all disables to be inline code, as then it's all in one spot, making it visible to the person reading/auditing the code, and the suppressions will automatically float with any code changes. However I understand this isn't always possible. Anyhow, the current lint_off has the file and line as optional, and supports wildcards. What additionally do you suggest? |
Original Redmine Comment I mainly see it when I add Verilator to some IP that has not been used with Verilator before. It's probably a tradeoff between fixing the lint errors all at once vs. pushing a lot warnings upstream. Adding a configuration file may ease the adoption, with the risk of hiding potential for improvements. There are also still a couple of things that are hard to fix easily like loops on arrays. Not sure how representative this scenario is, but it can help with adoption without changing the main code (not that that is an issue of Verilator ;) The problem with file+lineno is that it has to be changed on file changes, plus we could go for a more generic use of regex's. I know from commercial tools that they have features to hide/waive "known" warnings to tolerate them and not trash logs. My personal experience is too limited tbh to say this is useful and worth the effort. I will try to get other people to comment about cases where it can be useful. It does not seem |
Thanks for opening this issue @wallento! This request comes from the use of Verilator together with proprietary lint solutions for the OpenTitan (https://github.com/lowRISC/opentitan) and Ibex (https://github.com/lowRISC/ibex) code bases. I agree that waivers within the source code are beneficial for discoverability. We still chose to use external waiver files for these three (arguably subjective) reasons:
Verilator already supports waivers with file/line and rule type. We are currently using this approach in Ibex, and that's the waiver file: https://github.com/lowRISC/ibex/blob/master/lint/verilator_waiver.vlt. Since we introduced this waiver I've learned two things:
Other tools support match/wildcard/regex waivers directly on the error message. Even though that doesn't seem to be a particularly beautiful approach, it works rather well. For example: That's the current waiver:
If we can match the error message, it could be something like:
(Side remark: I always found "-msg" slightly misnamed, other tools use "rule" for this piece of information.) So I'm proposing to add the ability to match a lint waiver against the error message. The specific type of match is up for discussion. In my experience, some kind of wildcard matching is very helpful (e.g. glob-style matches), full regex support is nice-to-have (especially since many people know the syntax). But if of course matters what you'd like to introduce as external dependency (e.g. depend on PCRE, or copy in a simple glob-style wildcard implementation). |
Good points.
|
A few thoughts that come to my mind: wouldn't it be sufficient to waive the triplet (module, sig, msg)? With wildcard of course. If msg is not unique number them? This stuff is sitting in a hot path, but even a regex can be implemented so that it doesn't impact users that don't have them. Anyhow it may be noticable to people using a few of those on a large design. As verilator generates the thing you want to regex against from all information it has at hand, it seems to me the favorable way to match against such triplets. |
I mean like: lint_off -module "t" -var "X" -msg UNUSED |
Ah, nevermind, spent too much time on linkparser. We would probably want to do it as a filter on the emitted messages simply. So, I propose to implement two things:
|
Thanks Stefan and Wilson! Two comments:
|
Opened #2068 for the msg -> rule argument renaming. |
@imphil I see, but you still only need wildcards only, right? No full blown regex matching in opposite, I mean. |
I will start implementing this soon:
Good? Things can still be easily renamed.. |
Yes, wildcards as in |
Maybe just --match and it does wildmatch? (Given python uses re.match, and signal nanes won't have ?/*.
…On December 29, 2019 5:17:40 PM GMT+03:00, Stefan Wallentowitz ***@***.***> wrote:
I will start implementing this soon:
waive -rule <rule> -file "<filename>" -match "<string>"
waive -rule <rule> -file "<filename>" -wildmatch "<wildcardstring>"
Good?
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#1649 (comment)
-Wilson
|
Works for me, and would be in line with the behavior of |
I have started adding this on top of #2072. I assume it makes sense to have it as
So any combination of rule and file or both not is valid? |
I did miss that before, but do you plan to add a new I wouldn't place additional requirements on the needed arguments, expect for "at least one argument must be provided". If more than one argument is provided, they are combined with AND.
I'm not sure how to best integrate/align that with |
I agree that overloading lint_off seems nicer. lint_on makes a lot of sense when used inline in the Verilog code. It was in the .vlt for symmetry, and for cases where a warning might be off by default but people want it on for specific files. Given the --match is applied AFTER a warning has actually been built it might make sense not to support --match on lint_on. |
A prototype can be found in https://github.com/verilator/verilator/tree/issue-1649, but it is based on the ongoing work of supporting more configuration directives. I think I will converge on both soon. |
Add configuration file switch '-match' for lint_off. It takes a string with wildcards allowed and warnings will be matched against it (if rule and file also match). If it matches, the warning is waived. Fixes #1649
Add configuration file switch '-match' for lint_off. It takes a string with wildcards allowed and warnings will be matched against it (if rule and file also match). If it matches, the warning is waived. Fixes #1649
Add configuration file switch '-match' for lint_off. It takes a string with wildcards allowed and warnings will be matched against it (if rule and file also match). If it matches, the warning is waived. Fixes #1649
Author Name: Stefan Wallentowitz (@wallento)
Original Redmine Issue: 1649 from https://www.veripool.org
Currently we can have linter on/off and specify them in the configuration file, but the latter works on a fileline basis. What we should have additionally is some kind of mechanism that commercial simulators have to filter out warning by adding them to the configuration file. Those could be like the existing ones but without fileline or maybe even a very generic regexp. It probably makes sense to ask a couple of people how they would want to use it. Philipp Wagner of the lowRISC project has proposed something along those lines for example.
The text was updated successfully, but these errors were encountered: