Bug 1633809 - Suppress -Wpointer-bool-conversion in WrapNotNullUnchecked. r=miko
authorSimon Giesecke <sgiesecke@mozilla.com>
Wed, 29 Apr 2020 14:04:09 +0000
changeset 526668 878dc21be21147dd8e9f51a318aa72a92dd76d9e
parent 526667 74edce9ec6a3c94bcb00410d66493eccc738738f
child 526669 5142b1244ac27bfd58035fb041754d91a01e3111
push id37361
push usermalexandru@mozilla.com
push dateWed, 29 Apr 2020 21:55:39 +0000
treeherdermozilla-central@bc0932b38478 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmiko
bugs1633809
milestone77.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1633809 - Suppress -Wpointer-bool-conversion in WrapNotNullUnchecked. r=miko Differential Revision: https://phabricator.services.mozilla.com/D73013
mfbt/NotNull.h
--- a/mfbt/NotNull.h
+++ b/mfbt/NotNull.h
@@ -208,22 +208,27 @@ constexpr NotNull<T> WrapNotNull(const T
 // WrapNotNullUnchecked should only be used in situations, where it is
 // statically known that aBasePtr is non-null, and redundant release assertions
 // should be avoided. It is only defined for raw base pointers, since it is only
 // needed for those right now. There is no fundamental reason not to allow
 // arbitrary base pointers here.
 template <typename T>
 MOZ_NONNULL(1)
 constexpr NotNull<T*> WrapNotNullUnchecked(T* const aBasePtr) {
-#if defined(__GNUC__)
+#if defined(__clang__)
+#  pragma clang diagnostic push
+#  pragma clang diagnostic ignored "-Wpointer-bool-conversion"
+#elif defined(__GNUC__)
 #  pragma GCC diagnostic push
 #  pragma GCC diagnostic ignored "-Wnonnull-compare"
 #endif
   MOZ_ASSERT(aBasePtr);
-#if defined(__GNUC__)
+#if defined(__clang__)
+#  pragma clang diagnostic pop
+#elif defined(__GNUC__)
 #  pragma GCC diagnostic pop
 #endif
   return NotNull<T*>{aBasePtr};
 }
 
 namespace detail {
 
 // Extract the pointed-to type from a pointer type (be it raw or smart).