fs/Traits, ...: work around -Wtautological-pointer-compare

New in clang 3.6.
This commit is contained in:
Max Kellermann 2014-12-26 14:28:01 +01:00
parent 9f7fd1fbfb
commit 95f84afd33
5 changed files with 32 additions and 1 deletions

View File

@ -76,7 +76,10 @@ idle_get_names(void)
unsigned unsigned
idle_parse_name(const char *name) idle_parse_name(const char *name)
{ {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(name != nullptr); assert(name != nullptr);
#endif
for (unsigned i = 0; idle_names[i] != nullptr; ++i) for (unsigned i = 0; idle_names[i] != nullptr; ++i)
if (StringEqualsCaseASCII(name, idle_names[i])) if (StringEqualsCaseASCII(name, idle_names[i]))

View File

@ -77,7 +77,10 @@ SongLoader::LoadFile(const char *path_utf8, Error &error) const
DetachedSong * DetachedSong *
SongLoader::LoadSong(const char *uri_utf8, Error &error) const SongLoader::LoadSong(const char *uri_utf8, Error &error) const
{ {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(uri_utf8 != nullptr); assert(uri_utf8 != nullptr);
#endif
if (memcmp(uri_utf8, "file:///", 8) == 0) if (memcmp(uri_utf8, "file:///", 8) == 0)
/* absolute path */ /* absolute path */

View File

@ -435,9 +435,12 @@ SimpleDatabase::Save(Error &error)
bool bool
SimpleDatabase::Mount(const char *uri, Database *db, Error &error) SimpleDatabase::Mount(const char *uri, Database *db, Error &error)
{ {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(uri != nullptr); assert(uri != nullptr);
assert(*uri != 0);
assert(db != nullptr); assert(db != nullptr);
#endif
assert(*uri != 0);
ScopeDatabaseLock protect; ScopeDatabaseLock protect;

View File

@ -57,7 +57,11 @@ struct PathTraitsFS {
gcc_pure gcc_nonnull_all gcc_pure gcc_nonnull_all
static const_pointer FindLastSeparator(const_pointer p) { static const_pointer FindLastSeparator(const_pointer p) {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(p != nullptr); assert(p != nullptr);
#endif
#ifdef WIN32 #ifdef WIN32
const_pointer pos = p + GetLength(p); const_pointer pos = p + GetLength(p);
while (p != pos && !IsSeparator(*pos)) while (p != pos && !IsSeparator(*pos))
@ -77,7 +81,11 @@ struct PathTraitsFS {
gcc_pure gcc_nonnull_all gcc_pure gcc_nonnull_all
static bool IsAbsolute(const_pointer p) { static bool IsAbsolute(const_pointer p) {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(p != nullptr); assert(p != nullptr);
#endif
#ifdef WIN32 #ifdef WIN32
if (IsDrive(p) && IsSeparator(p[2])) if (IsDrive(p) && IsSeparator(p[2]))
return true; return true;
@ -147,7 +155,11 @@ struct PathTraitsUTF8 {
gcc_pure gcc_nonnull_all gcc_pure gcc_nonnull_all
static const_pointer FindLastSeparator(const_pointer p) { static const_pointer FindLastSeparator(const_pointer p) {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(p != nullptr); assert(p != nullptr);
#endif
return strrchr(p, SEPARATOR); return strrchr(p, SEPARATOR);
} }
@ -160,7 +172,11 @@ struct PathTraitsUTF8 {
gcc_pure gcc_nonnull_all gcc_pure gcc_nonnull_all
static bool IsAbsolute(const_pointer p) { static bool IsAbsolute(const_pointer p) {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(p != nullptr); assert(p != nullptr);
#endif
#ifdef WIN32 #ifdef WIN32
if (IsDrive(p) && IsSeparator(p[2])) if (IsDrive(p) && IsSeparator(p[2]))
return true; return true;

View File

@ -121,8 +121,11 @@ gcc_pure
int int
IcuCollate(const char *a, const char *b) IcuCollate(const char *a, const char *b)
{ {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(a != nullptr); assert(a != nullptr);
assert(b != nullptr); assert(b != nullptr);
#endif
#ifdef HAVE_ICU #ifdef HAVE_ICU
assert(collator != nullptr); assert(collator != nullptr);
@ -159,7 +162,10 @@ IcuCaseFold(const char *src)
{ {
#ifdef HAVE_ICU #ifdef HAVE_ICU
assert(collator != nullptr); assert(collator != nullptr);
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(src != nullptr); assert(src != nullptr);
#endif
const auto u = UCharFromUTF8(src); const auto u = UCharFromUTF8(src);
if (u.IsNull()) if (u.IsNull())