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.
This commit is contained in:
Campbell Barton 2022-06-24 08:54:48 +10:00
parent 93de6b912f
commit 9b5dda3b07
Notes: blender-bot 2023-02-14 05:12:59 +01:00
Referenced by commit 381fe684e2, GHOST: only use GHOST_PRINT when WITH_GHOST_DEBUG is enabled
Referenced by issue #99200, Multiple console warnings starting Blender: GHOST_SystemWin32::wndProc: GHOST window event before creation
1 changed files with 8 additions and 7 deletions

View File

@ -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))` */