From cc3ba1bbf758f5fa117117872b8d304a7d410c8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 24 Nov 2017 13:52:53 +0100 Subject: [PATCH] Fix _assert_ on Android to assert properly --- Common/Log.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Common/Log.h b/Common/Log.h index bd74c348b5..76f867923e 100644 --- a/Common/Log.h +++ b/Common/Log.h @@ -136,7 +136,7 @@ void AndroidAssertLog(const char *func, const char *file, int line, const char * if (!PanicYesNo(__VA_ARGS__)) AndroidAssertLog(__FUNCTION__, __FILENAME__, __LINE__, #_a_, __VA_ARGS__); \ } -#else // __ANDROID__ +#else // !defined(__ANDROID__) #define _dbg_assert_msg_(_t_, _a_, ...)\ if (!(_a_)) {\ @@ -158,15 +158,13 @@ void AndroidAssertLog(const char *func, const char *file, int line, const char * #endif // dbg_assert #endif // MAX_LOGLEVEL DEBUG +#if defined(__ANDROID__) + #define _assert_(_a_) \ if (!(_a_)) {\ - ERROR_LOG(SYSTEM, "Error...\n\n Line: %d\n File: %s\n\nIgnore and continue?", \ - __LINE__, __FILE__); \ - if (!PanicYesNo("*** Assertion ***\n")) { Crash(); } \ + AndroidAssertLog(__FUNCTION__, __FILENAME__, __LINE__, #_a_, "Assertion failed!"); \ } -#if defined(__ANDROID__) - #define _assert_msg_(_t_, _a_, ...) \ if (!(_a_) && !PanicYesNo(__VA_ARGS__)) { \ AndroidAssertLog(__FUNCTION__, __FILENAME__, __LINE__, #_a_, __VA_ARGS__); \ @@ -174,6 +172,13 @@ void AndroidAssertLog(const char *func, const char *file, int line, const char * #else // __ANDROID__ +#define _assert_(_a_) \ + if (!(_a_)) {\ + ERROR_LOG(SYSTEM, "Error...\n\n Line: %d\n File: %s\n\nIgnore and continue?", \ + __LINE__, __FILE__); \ + if (!PanicYesNo("*** Assertion ***\n")) { Crash(); } \ + } + #define _assert_msg_(_t_, _a_, ...) \ if (!(_a_) && !PanicYesNo(__VA_ARGS__)) { \ Crash(); \