mirror of
https://github.com/libretro/RetroArch
synced 2025-03-24 13:43:32 +00:00
Improved code quality of retro_assert macro
Macros without do{}while() wrapping behave more like regular C expressions. The macro can now be nested/embedded inside of other similar compound statements and conditionals without introducing syntax errors. This change has no risk of negatively impacting existing code.
This commit is contained in:
parent
debb9c6b0a
commit
ad12cc089c
@ -27,9 +27,7 @@
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#include <stdio.h>
|
||||
#define retro_assert(cond) do { \
|
||||
if (!(cond)) { printf("Assertion failed at %s:%d.\n", __FILE__, __LINE__); abort(); } \
|
||||
} while(0)
|
||||
#define retro_assert(cond) ((void)( (cond) || (printf("Assertion failed at %s:%d.\n", __FILE__, __LINE__), abort(), 0) ))
|
||||
#else
|
||||
#define retro_assert(cond) assert(cond)
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user