Skip to content

verilog-warn-fatal ignored in batch mode #1886

Open
@techdude

Description

@techdude

I noticed that when running in batch mode even when verilog-warn-fatal is set to non-nil, warnings (like unused template lines) are still printed as warnings and not treated as fatal.

Steps to reproduce:

  1. Use a file with an AUTO_TEMPLATE that has an unused line. For example:
.unused        (this_is_unused),
  1. In batch mode, run verilog-batch-auto and confirm that this is printed as a warning.
  2. Set verilog-warn-fatal to t and run again.

Expected:
Batch mode should now print an error instead of a warning, and return a non-zero exit code

Actual:
The issue is still printed as a warning.

Digging into this, I determined the issue is with the handling of verilog-warn-fatal-internal which is set to nil when in batch mode by verilog-batch-error-wrapper. The wrapper is intended to add the error prefix to any errors, however because the verilog-warn-fatal-internal is set to nil, the unintended side effect is that verilog-warn-fatal has no effect when set in batch mode.

The most straightforward solution appears to be just removing the verilog-warn-fatal-internal non-nil condition. I'm not sure if this has any unintended side effects, but this does solve the issue for my purposes at least.

Before:

(defun verilog-warn-error (string &rest args)
  "Call `error' using STRING and optional ARGS.
If `verilog-warn-fatal' is non-nil, call `verilog-warn' instead."
  (apply (if (and verilog-warn-fatal verilog-warn-fatal-internal)
             #'error #'verilog-warn)
         string args))

After:

(defun verilog-warn-error (string &rest args)
  "Call `error' using STRING and optional ARGS.
If `verilog-warn-fatal' is non-nil, call `verilog-warn' instead."
  (apply (if (and verilog-warn-fatal)
             #'error #'verilog-warn)
         string args))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions