From 44eca8e207ff2d982005b5a4a98cf29de1318637 Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Mon, 17 Nov 2014 12:45:40 +0300 Subject: [PATCH] Fixing JERRY_ASSERT macro for JERRY_NDEBUG build mode. The macro under !JERRY_NDEBUG was evaluting it's argument and called jerry_assert_fail if the argument was evaluated to false. Under JERRY_NDEBUG the macro still was evaluating it's argument but jerry_assert_fail wasn't called anyway. Now macro doesn't evaluate it's argument under JERRY_NDEBUG build. --- src/globals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals.h b/src/globals.h index af8d0ab83..23efec0fc 100644 --- a/src/globals.h +++ b/src/globals.h @@ -115,7 +115,7 @@ extern void __noreturn jerry_unimplemented (const char *comment, const char *fil #define JERRY_ASSERT(x) do { if (__builtin_expect (!(x), 0)) { \ jerry_assert_fail (#x, __FILE__, __FUNCTION__, __LINE__); } } while (0) #else /* !JERRY_NDEBUG */ -#define JERRY_ASSERT(x) (void) (x) +#define JERRY_ASSERT(x) do { if (false) { (void)(x); } } while (0) #endif /* !JERRY_NDEBUG */ /**