Export the debug assertion macros
This commit is contained in:
parent
97cdfd33dd
commit
922aa58a7a
|
@ -20,6 +20,7 @@
|
||||||
/// integrating some other crate with this function if we need to log to some other place than
|
/// integrating some other crate with this function if we need to log to some other place than
|
||||||
/// STDERR or if it needs to be done in release builds and we should thus try to avoid
|
/// STDERR or if it needs to be done in release builds and we should thus try to avoid
|
||||||
/// allocations.
|
/// allocations.
|
||||||
|
#[macro_export]
|
||||||
macro_rules! nih_log {
|
macro_rules! nih_log {
|
||||||
($format:expr $(, $arg:tt)*) => (
|
($format:expr $(, $arg:tt)*) => (
|
||||||
eprintln!(concat!("[", file!(), ":", line!(), "] ", $format), $($arg)*)
|
eprintln!(concat!("[", file!(), ":", line!(), "] ", $format), $($arg)*)
|
||||||
|
@ -30,6 +31,7 @@ macro_rules! nih_log {
|
||||||
/// panicking.
|
/// panicking.
|
||||||
///
|
///
|
||||||
/// TODO: Detect if we're running under a debugger, and trigger a break if we are
|
/// TODO: Detect if we're running under a debugger, and trigger a break if we are
|
||||||
|
#[macro_export]
|
||||||
macro_rules! nih_debug_assert {
|
macro_rules! nih_debug_assert {
|
||||||
($cond:expr) => (
|
($cond:expr) => (
|
||||||
if cfg!(debug_assertions) && !$cond {
|
if cfg!(debug_assertions) && !$cond {
|
||||||
|
@ -45,6 +47,7 @@ macro_rules! nih_debug_assert {
|
||||||
|
|
||||||
/// A `debug_assert_eq!()` analogue that prints the error with line number information instead of
|
/// A `debug_assert_eq!()` analogue that prints the error with line number information instead of
|
||||||
/// panicking.
|
/// panicking.
|
||||||
|
#[macro_export]
|
||||||
macro_rules! nih_debug_assert_eq {
|
macro_rules! nih_debug_assert_eq {
|
||||||
($left:expr, $right:expr) => (
|
($left:expr, $right:expr) => (
|
||||||
if cfg!(debug_assertions) && $left != $right {
|
if cfg!(debug_assertions) && $left != $right {
|
||||||
|
@ -60,6 +63,7 @@ macro_rules! nih_debug_assert_eq {
|
||||||
|
|
||||||
/// A `debug_assert_neq!()` analogue that prints the error with line number information instead of
|
/// A `debug_assert_neq!()` analogue that prints the error with line number information instead of
|
||||||
/// panicking.
|
/// panicking.
|
||||||
|
#[macro_export]
|
||||||
macro_rules! nih_debug_assert_neq {
|
macro_rules! nih_debug_assert_neq {
|
||||||
($left:expr, $right:expr) => (
|
($left:expr, $right:expr) => (
|
||||||
if cfg!(debug_assertions) && $left == $right {
|
if cfg!(debug_assertions) && $left == $right {
|
||||||
|
|
Loading…
Reference in a new issue