Skip to content

Commit 6a0f392

Browse files
authored
[asan] Avoid -Wtautological-pointer-compare (#164918)
#164906 converted a -Wpointer-bool-conversion warning into a -Wtautological-pointer-compare warning. Avoid both by using the bool cast.
1 parent 4a84f10 commit 6a0f392

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler-rt/lib/asan/asan_interceptors.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ namespace __asan {
5858

5959
static inline uptr MaybeRealStrnlen(const char *s, uptr maxlen) {
6060
#if SANITIZER_INTERCEPT_STRNLEN
61-
if (REAL(strnlen) != nullptr)
61+
if (static_cast<bool>(REAL(strnlen)))
6262
return REAL(strnlen)(s, maxlen);
6363
# endif
6464
return internal_strnlen(s, maxlen);
6565
}
6666

6767
static inline uptr MaybeRealWcsnlen(const wchar_t* s, uptr maxlen) {
6868
# if SANITIZER_INTERCEPT_WCSNLEN
69-
if (REAL(wcsnlen) != nullptr)
69+
if (static_cast<bool>(REAL(wcsnlen)))
7070
return REAL(wcsnlen)(s, maxlen);
7171
# endif
7272
return internal_wcsnlen(s, maxlen);

0 commit comments

Comments
 (0)