Permalink
Browse files

Fix _assert_ on Android to assert properly

  • Loading branch information...
hrydgard committed Nov 24, 2017
1 parent bfec850 commit cc3ba1bbf758f5fa117117872b8d304a7d410c8e
Showing with 11 additions and 6 deletions.
  1. +11 −6 Common/Log.h
View
@@ -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,22 +158,27 @@ 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__); \
}
#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(); \

1 comment on commit cc3ba1b

@hrydgard

This comment has been minimized.

Owner

hrydgard commented on cc3ba1b Nov 24, 2017

Turns out this uncovers bugs, surprise surprise :)

Please sign in to comment.