Skip to content

Commit

Permalink
Fix implicit conversion warning
Browse files Browse the repository at this point in the history
Fix "implicit conversion turns string literal into bool: 'char [14]' to
'_Bool' [-Wstring-conversion]" warning in assert usage.
  • Loading branch information
wonder-mice committed Apr 27, 2016
1 parent 24aec99 commit 4c15e67
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions zf_log/zf_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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 */;
}
}
Expand Down Expand Up @@ -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 '?';
}
}
Expand Down

0 comments on commit 4c15e67

Please sign in to comment.