From 33ea8d877d6aab7224e46413a81e91d316b58a5f Mon Sep 17 00:00:00 2001 From: Gerald Squelart Date: Sat, 12 Nov 2016 09:53:39 +1100 Subject: [PATCH] Bug 1316978 - Suppress nullptr-to-bool cast warning - r=froydnj MozReview-Commit-ID: BweUO5stduw --HG-- extra : rebase_source : 9f61f969007dc5680cbc0f8edc4f15d5f119cd4f --- xpcom/glue/nsISupportsImpl.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xpcom/glue/nsISupportsImpl.h b/xpcom/glue/nsISupportsImpl.h index 914d75b2c130..26db3c525d8f 100644 --- a/xpcom/glue/nsISupportsImpl.h +++ b/xpcom/glue/nsISupportsImpl.h @@ -130,9 +130,11 @@ do { \ /* nsCOMPtr.h allows these macros to be defined by clients * These logging functions require dynamic_cast, so they don't - * do anything useful if we don't have dynamic_cast. */ + * do anything useful if we don't have dynamic_cast. + * Note: The explicit comparison to nullptr is needed to avoid warnings + * when _p is a nullptr itself. */ #define NSCAP_LOG_ASSIGNMENT(_c, _p) \ - if (_p) \ + if (_p != nullptr) \ NS_LogCOMPtrAddRef((_c),static_cast(_p)) #define NSCAP_LOG_RELEASE(_c, _p) \