Add error/warning suppression with suppress_msg and unsuppress_msg commands (#157)

* Add error/warning suppression with `suppress_msg` and `unsuppress_msg` commands

* Fixes

* Merge docs

* Fixes

* Remove optional arg from class

* Add where to find message codes

* Update docs

* Requested fixes

* Deal with errors on the TCL side instead of C++ side

* Update ok file

* Add back in C++ side error suppression and have tests for both C++/TCL side suppression

* Requested fixes to ChangeLog and unifying suppression in C++/TCL

* Requested fixes

* Requested test adjustments

* Smallfixes

* Smallfixes

* Another smallfix
This commit is contained in:
Akash Levy
2025-01-17 11:20:19 -08:00
committed by GitHub
parent cc3b911b6d
commit fbb4b8c6e6
13 changed files with 201 additions and 39 deletions

View File

@@ -135,6 +135,7 @@ record_sta_tests {
report_checks_src_attr
report_json1
report_json2
suppress_msg
verilog_attribute
}

12
test/suppress_msg.ok Normal file
View File

@@ -0,0 +1,12 @@
Warning: suppress_msg.tcl line 18, cmd warn 1
caught Error: suppress_msg.tcl line 18, cmd error 1
Warning: cmd warn 2
caught Error: cmd error 2
after error
caught
caught
after error
Warning: suppress_msg.tcl line 51, cmd warn 7
caught Error: suppress_msg.tcl line 51, cmd error 7
Warning: cmd warn 8
caught Error: cmd error 8

56
test/suppress_msg.tcl Normal file
View File

@@ -0,0 +1,56 @@
# suppress and unsuppress message ids
# Run sta_warn/sta_error to test TCL side suppression
proc sta_cmd { msg } {
sta::sta_warn 1 "cmd warn $msg"
sta::sta_error 2 "cmd error $msg"
puts "after error"
}
# Run report_warn/report_error to test C++ side suppression
proc report_cmd { msg } {
sta::report_warn 1 "cmd warn $msg"
sta::report_error 2 "cmd error $msg"
puts "after error"
}
# Ensure that TCL side messages are displayed as usual
catch { sta_cmd 1 } error
puts "caught $error"
# Ensure that C++ side messages are displayed as usual
catch { report_cmd 2 } error
puts "caught $error"
# Suppress messages
suppress_msg 1 2
# Ensure that TCL side messages are suppressed
catch { sta_cmd 3 } error
puts "caught $error"
# Ensure that C++ side messages are suppressed
catch { report_cmd 4 } error
puts "caught $error"
# Continue on error to avoid having to catch
set sta_continue_on_error 1
# Ensure that TCL side messages are suppressed
# TCL side will make it to "after error"
sta_cmd 5
# Ensure that C++ side messages are suppressed
# C++ will not make it to "after error" as the whole cmd is cancelled
report_cmd 6
# Unsuppress messages
unsuppress_msg 1 2
# Ensure that TCL side messages are displayed as usual
catch { sta_cmd 7 } error
puts "caught $error"
# Ensure that C++ side messages are displayed as usual
catch { report_cmd 8 } error
puts "caught $error"