From f572e8e42e22cfcf5ab0aea26574f408943edfa4 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Sun, 8 Jan 2012 23:49:55 +0000 Subject: [PATCH] Added an exit() to JSON_FAIL_MESSAGE to fix "no return" errors. --- include/json/assertions.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/json/assertions.h b/include/json/assertions.h index 2a22cc4..a480585 100644 --- a/include/json/assertions.h +++ b/include/json/assertions.h @@ -19,10 +19,10 @@ #define JSON_ASSERT( condition ) assert( condition ); // The call to assert() will show the failure message in debug builds. In -// release bugs we write to invalid memory in order to crash hard instead of -// calling exit(), so that a debugger or crash reporter gets the chance to take -// over. -#define JSON_FAIL_MESSAGE( message ) { assert(false && message); strcpy(reinterpret_cast(666), message); } +// release bugs we write to invalid memory in order to crash hard, so that a +// debugger or crash reporter gets the chance to take over. We still call exit() +// afterward in order to tell the compiler that this macro doesn't return. +#define JSON_FAIL_MESSAGE( message ) { assert(false && message); strcpy(reinterpret_cast(666), message); exit(123); } #endif