Skip to content

Commit f572e8e

Browse files
committed
Added an exit() to JSON_FAIL_MESSAGE to fix "no return" errors.
1 parent 2b853c4 commit f572e8e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: include/json/assertions.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
#define JSON_ASSERT( condition ) assert( condition );
2020

2121
// The call to assert() will show the failure message in debug builds. In
22-
// release bugs we write to invalid memory in order to crash hard instead of
23-
// calling exit(), so that a debugger or crash reporter gets the chance to take
24-
// over.
25-
#define JSON_FAIL_MESSAGE( message ) { assert(false && message); strcpy(reinterpret_cast<char*>(666), message); }
22+
// release bugs we write to invalid memory in order to crash hard, so that a
23+
// debugger or crash reporter gets the chance to take over. We still call exit()
24+
// afterward in order to tell the compiler that this macro doesn't return.
25+
#define JSON_FAIL_MESSAGE( message ) { assert(false && message); strcpy(reinterpret_cast<char*>(666), message); exit(123); }
2626

2727
#endif
2828

0 commit comments

Comments
 (0)