diff --git a/src/debug.rs b/src/debug.rs index 4dafe873..0931a281 100644 --- a/src/debug.rs +++ b/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] diff --git a/src/lib.rs b/src/lib.rs index 781aa164..68ffaaeb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#[macro_use] pub mod debug; pub mod params; pub mod plugin;