Open fangism opened 4 years ago
b/72410891
Thinking about this more, we could also maintain a std::set
of rules-by-name to disable (unconditionally) when a source is being evaluated in kVerilog
mode. const std::set<absl::string_view> kNotApplicableToVerilog
? This might be more maintainable, especially if this list is short.
A subset of the lint rules shouldn't apply to Verilog (2009) source files, e.g.
forbid-defparam
.This multi-part task is to introduce a mapping of lint rule to dialects. For now, I think two dialects is sufficient: verilog (assume 2009), and systemverilog (assume 2017). Left unspecified, a rule should be enabled for all dialects, which should be most rules.
Introduce a mode/enum:
Another part of this task will be to introduce a
--lang=[verilog|systemverilog|auto]
flag to override.The mode, once determined as Verilog/SystemVerilog will affect the linter configuration initialization. Use of the Verilog mode will automatically and silently disable a subset of lint rules (even if they are explicitly requested).
Non-goals: We do not intend to distinguish/fork parsers for the different dialects at this time. This means that even old Verilog files will be lexed/parsed as SystemVerilog, and produce compatible concrete syntax trees (same node enumerations). The consequence is that some SystemVerilog constructs may be accepted where they should be rejected, but that can be handled at a later time.