From 9b5dda3b07496bda28970dfd23e4951a76d0f8ed Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 24 Jun 2022 08:54:48 +1000 Subject: GHOST: use GHOST_ASSERT for non-release builds GHOST_ASSERT now matches BLI_assert, which is only ignored for release builds. Otherwise it prints or asserts when WITH_ASSERT_ABORT is enabled. --- intern/ghost/intern/GHOST_Debug.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/intern/ghost/intern/GHOST_Debug.h b/intern/ghost/intern/GHOST_Debug.h index e6bdf974d59..6b1bd3785ae 100644 --- a/intern/ghost/intern/GHOST_Debug.h +++ b/intern/ghost/intern/GHOST_Debug.h @@ -15,12 +15,12 @@ # endif #endif -#ifdef WITH_GHOST_DEBUG +#if defined(WITH_GHOST_DEBUG) || (!defined(NDEBUG)) # include # include //for printf() #endif // WITH_GHOST_DEBUG -#ifdef WITH_GHOST_DEBUG +#if defined(WITH_GHOST_DEBUG) || (!defined(NDEBUG)) # define GHOST_PRINT(x) \ { \ std::cout << x; \ @@ -31,10 +31,10 @@ printf(x, __VA_ARGS__); \ } \ (void)0 -#else // WITH_GHOST_DEBUG +#else # define GHOST_PRINT(x) # define GHOST_PRINTF(x, ...) -#endif // WITH_GHOST_DEBUG +#endif /* `defined(WITH_GHOST_DEBUG) || (!defined(NDEBUG))` */ #ifdef WITH_ASSERT_ABORT # include //for fprintf() @@ -49,7 +49,8 @@ } \ } \ (void)0 -#elif defined(WITH_GHOST_DEBUG) +/* Assert in non-release builds too. */ +#elif defined(WITH_GHOST_DEBUG) || (!defined(NDEBUG)) # define GHOST_ASSERT(x, info) \ { \ if (!(x)) { \ @@ -59,6 +60,6 @@ } \ } \ (void)0 -#else // WITH_GHOST_DEBUG +#else /* `defined(WITH_GHOST_DEBUG) || (!defined(NDEBUG))` */ # define GHOST_ASSERT(x, info) ((void)0) -#endif // WITH_GHOST_DEBUG +#endif /* `defined(WITH_GHOST_DEBUG) || (!defined(NDEBUG))` */ -- cgit v1.2.3