[Bf-blender-cvs] [9b5dda3b074] master: GHOST: use GHOST_ASSERT for non-release builds
Campbell Barton
noreply at git.blender.org
Fri Jun 24 01:01:33 CEST 2022
Commit: 9b5dda3b07496bda28970dfd23e4951a76d0f8ed
Author: Campbell Barton
Date: Fri Jun 24 08:54:48 2022 +1000
Branches: master
https://developer.blender.org/rB9b5dda3b07496bda28970dfd23e4951a76d0f8ed
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.
===================================================================
M intern/ghost/intern/GHOST_Debug.h
===================================================================
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 <iostream>
# include <stdio.h> //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 <stdio.h> //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))` */
More information about the Bf-blender-cvs
mailing list