OSDN Git Service

OS: Use LOG_ALWAYS_FATAL for Android
authorMyles Watson <mylesgw@google.com>
Tue, 23 Jul 2019 20:35:40 +0000 (13:35 -0700)
committerMyles Watson <mylesgw@google.com>
Tue, 23 Jul 2019 20:36:00 +0000 (13:36 -0700)
Test: bluetooth_test_gd --gtest_filter=*Death*
Change-Id: I0aa4e85a7fd000eb90c65c51d3ac372634583c69

gd/os/log.h

index d7c6a8b..1c30686 100644 (file)
 #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();                                                                  \
-    }                                                                           \
+#define ASSERT(condition)                                                              \
+  do {                                                                                 \
+    if (!(condition)) {                                                                \
+      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();                                                                                 \
-    }                                                                                          \
+#define ASSERT_LOG(condition, fmt, args...)                                                           \
+  do {                                                                                                \
+    if (!(condition)) {                                                                               \
+      LOG_ALWAYS_FATAL("%s:%d assertion '" #condition "' failed - " fmt, __FILE__, __LINE__, ##args); \
+    }                                                                                                 \
   } while (false)