Function: verilog-surelint-off

verilog-surelint-off is an interactive and byte-compiled function defined in verilog-mode.el.gz.

Signature

(verilog-surelint-off)

Documentation

Convert a SureLint warning line into a disable statement.

Run from Verilog source window; assumes there is a *compile* buffer with point set appropriately.

For example:
        WARNING [STD-UDDONX]: xx.v, line 8: output out is never assigned.
becomes:
        // surefire lint_line_off UDDONX

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
(defun verilog-surelint-off ()
  "Convert a SureLint warning line into a disable statement.
Run from Verilog source window; assumes there is a *compile* buffer
with point set appropriately.

For example:
        WARNING [STD-UDDONX]: xx.v, line 8: output out is never assigned.
becomes:
        // surefire lint_line_off UDDONX"
  (interactive)
  (let ((buff (if (boundp 'next-error-last-buffer)  ; Added to Emacs-22.1
                  next-error-last-buffer
                (verilog--suppressed-warnings
                    ((obsolete compilation-last-buffer))
                  compilation-last-buffer))))
    (when (buffer-live-p buff)
      (save-excursion
        (switch-to-buffer buff)
        (beginning-of-line)
        (when
            (looking-at "\\(INFO\\|WARNING\\|ERROR\\) \\[[^-]+-\\([^]]+\\)\\]: \\([^,]+\\), line \\([0-9]+\\): \\(.*\\)$")
          (let* ((code (match-string 2))
                 (file (match-string 3))
                 (line (match-string 4))
                 (buffer (get-file-buffer file)))
            (unless buffer
              (progn
                (setq buffer
                      (and (file-exists-p file)
                           (find-file-noselect file)))
                (or buffer
                    (let* ((pop-up-windows t))
                      (let ((name (expand-file-name
                                   (read-file-name
                                    ;; `format-prompt' is new in Emacs 28.1.
                                    (if (fboundp 'format-prompt)
                                        (format-prompt "Find this error in" file)
                                      (format "Find this error in (default %s): "
                                              file))
                                    nil ;; dir
                                    file t))))
                        (setq buffer
                              (and (file-exists-p name)
                                   (find-file-noselect name))))))))
            (switch-to-buffer buffer)
            (goto-char (point-min))
            (forward-line (- (string-to-number line)))
            (end-of-line)
            (catch 'already
              (cond
               ((verilog-in-slash-comment-p)
                (re-search-backward "//")
                (cond
                 ((looking-at "// surefire lint_off_line ")
                  (goto-char (match-end 0))
                  (let ((lim (line-end-position)))
                    (if (re-search-forward code lim 'move)
                        (throw 'already t)
                      (insert (concat " " code)))))
                 (t
                  )))
               ((verilog-in-star-comment-p)
                (re-search-backward "/\\*")
                (insert (format " // surefire lint_off_line %6s" code )))
               (t
                (insert (format " // surefire lint_off_line %6s" code ))
                )))))))))