Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf34fd95 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "OS: Use LOG_ALWAYS_FATAL for Android"

parents 9872bad3 e17bfab0
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
@@ -46,21 +46,24 @@
#define LOG_INFO(...) LOGWRAPPER(__VA_ARGS__)
#define LOG_WARN(...) LOGWRAPPER(__VA_ARGS__)
#define LOG_ERROR(...) LOGWRAPPER(__VA_ARGS__)
#define LOG_ALWAYS_FATAL(...) \
  do {                        \
    LOGWRAPPER(__VA_ARGS__);  \
    abort();                  \
  } while (false)

#endif /* defined(OS_ANDROID) */

#define ASSERT(condition)                                                              \
  do {                                                                                 \
    if (!(condition)) {                                                                \
      LOG_ERROR("%s:%d assertion '" #condition "' failed", __FILE__, __LINE__); \
      abort();                                                                  \
      LOG_ALWAYS_FATAL("%s:%d assertion '" #condition "' failed", __FILE__, __LINE__); \
    }                                                                                  \
  } while (false)

#define ASSERT_LOG(condition, fmt, args...)                                                           \
  do {                                                                                                \
    if (!(condition)) {                                                                               \
      LOG_ERROR("%s:%d assertion '" #condition "' failed - " fmt, __FILE__, __LINE__, ##args); \
      abort();                                                                                 \
      LOG_ALWAYS_FATAL("%s:%d assertion '" #condition "' failed - " fmt, __FILE__, __LINE__, ##args); \
    }                                                                                                 \
  } while (false)