From d0aa012b0a451f52409a5d4df33dcdcac2763562 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 19 Dec 2011 03:06:44 +0000 Subject: [PATCH] change BLI_assert() so it can be included in other defines. --- source/blender/blenlib/BLI_utildefines.h | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index a6b4f2c9b92..94189af34fa 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -279,24 +279,22 @@ # endif # if defined(__GNUC__) || defined(_MSC_VER) /* check __func__ is available */ # define BLI_assert(a) \ -do { \ - if (!(a)) { \ + (void)((!(a)) ? ( \ + ( \ fprintf(stderr, \ "BLI_assert failed: %s, %s(), %d at \'%s\'\n", \ - __FILE__, __func__, __LINE__, STRINGIFY(a)); \ - _dummy_abort(); \ - } \ -} while (0) + __FILE__, __func__, __LINE__, STRINGIFY(a)), \ + _dummy_abort(), \ + NULL)) : NULL) # else -# define BLI_assert(a) \ -do { \ - if (0 == (a)) { \ +# define BLI_assert(a) \ + (void)((!(a)) ? ( \ + ( \ fprintf(stderr, \ "BLI_assert failed: %s, %d at \'%s\'\n", \ - __FILE__, __LINE__, STRINGIFY(a)); \ - _dummy_abort(); \ - } \ -} while (0) + __FILE__, __LINE__, STRINGIFY(a)), \ + _dummy_abort(), \ + NULL)) : NULL) # endif #else # define BLI_assert(a) (void)0