From 4c15e6704edffdafe289d4b84c2db89009368626 Mon Sep 17 00:00:00 2001 From: wonder-mice Date: Wed, 27 Apr 2016 09:35:41 -0700 Subject: [PATCH] Fix implicit conversion warning Fix "implicit conversion turns string literal into bool: 'char [14]' to '_Bool' [-Wstring-conversion]" warning in assert usage. --- zf_log/zf_log.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zf_log/zf_log.c b/zf_log/zf_log.c index a0bb50b..a73131f 100644 --- a/zf_log/zf_log.c +++ b/zf_log/zf_log.c @@ -187,6 +187,7 @@ #define RETVAL_UNUSED(expr) do { while(expr) break; } while(0) #define STATIC_ASSERT(name, cond) \ typedef char assert_##name[(cond)? 1: -1] +#define ASSERT_UNREACHABLE(why) assert(!sizeof(why)) #ifndef _countof #define _countof(xs) (sizeof(xs) / sizeof((xs)[0])) #endif @@ -275,7 +276,7 @@ static INSTRUMENTED_CONST buffer_cb g_buffer_cb = buffer_callback; case ZF_LOG_FATAL: return ANDROID_LOG_FATAL; default: - assert(!"Bad log level"); + ASSERT_UNREACHABLE("Bad log level"); return ANDROID_LOG_UNKNOWN; } } @@ -318,7 +319,7 @@ static INSTRUMENTED_CONST buffer_cb g_buffer_cb = buffer_callback; case ZF_LOG_FATAL: return 0; /* ASL_LEVEL_EMERG / kCFLogLevelEmergency */; default: - assert(!"Bad log level"); + ASSERT_UNREACHABLE("Bad log level"); return 0; /* ASL_LEVEL_EMERG / kCFLogLevelEmergency */; } } @@ -421,7 +422,7 @@ static char lvl_char(const int lvl) case ZF_LOG_FATAL: return 'F'; default: - assert(!"Bad log level"); + ASSERT_UNREACHABLE("Bad log level"); return '?'; } }