Add an unconditional debug assertion failure macro
This commit is contained in:
parent
19b51df357
commit
2614be26ab
16
src/debug.rs
16
src/debug.rs
|
@ -45,6 +45,22 @@ macro_rules! nih_debug_assert {
|
|||
);
|
||||
}
|
||||
|
||||
/// An unconditional debug assertion failure, for if the condition has already been checked
|
||||
/// elsewhere.
|
||||
#[macro_export]
|
||||
macro_rules! nih_debug_assert_failure {
|
||||
() => (
|
||||
if cfg!(debug_assertions) {
|
||||
nih_log!("Debug assertion failed");
|
||||
}
|
||||
);
|
||||
($format:expr $(, $arg:tt)*) => (
|
||||
if cfg!(debug_assertions) {
|
||||
nih_log!(concat!("Debug assertion failed: ", $format) $(, $arg)*);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/// A `debug_assert_eq!()` analogue that prints the error with line number information instead of
|
||||
/// panicking.
|
||||
#[macro_export]
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#[macro_use]
|
||||
pub mod debug;
|
||||
pub mod params;
|
||||
pub mod plugin;
|
||||
|
|
Loading…
Reference in a new issue