Bug 1316978 - Suppress nullptr-to-bool cast warning - r?froydnj
MozReview-Commit-ID: BweUO5stduw
--- a/xpcom/glue/nsISupportsImpl.h
+++ b/xpcom/glue/nsISupportsImpl.h
@@ -125,19 +125,21 @@ do {
#define MOZ_LOG_DTOR(_ptr, _name, _size) \
do { \
NS_LogDtor((void*)_ptr, _name, _size); \
} while (0)
/* nsCOMPtr.h allows these macros to be defined by clients
* These logging functions require dynamic_cast<void*>, so they don't
- * do anything useful if we don't have dynamic_cast<void*>. */
+ * do anything useful if we don't have dynamic_cast<void*>.
+ * 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<nsISupports*>(_p))
#define NSCAP_LOG_RELEASE(_c, _p) \
if (_p) \
NS_LogCOMPtrRelease((_c), static_cast<nsISupports*>(_p))
#else /* !NS_BUILD_REFCNT_LOGGING */