Catching Extra Semicolons After UVM Macros with UVMLint
A solution‑first guide to preventing the classic dangling else error caused by UVM reporting macros. UVMLint Rule: No Trailing Semicolon After UVM Reporting Macros Define a lint rule that flags any UVM reporting macro invocation immediately followed by a semicolon. Implementation detail: This rule should be parser‑aware . Avoid pure regex; require an AST/token stream so comments, strings, and macro line breaks are handled correctly. Why This Rule Exists Consider a simple user code as below: // Buggy code if (debug_on) `uvm_info("DEBUG", "state info", UVM_LOW); // semicolon here else $display("Doing something else"); The UVM BCL defines `uvm_info as a complete begin...end block . Adding a semicolon after the macro turns into a null statement that terminates the if prematurely, leaving the else orphaned. // UVM BCL (abridged) `define uvm_info(I...