Bug 1430729 - Ignore an incorrect warning with gcc (-Wuninitialized) r=froydnj
authorSylvestre Ledru <sledru@mozilla.com>
Tue, 16 Jan 2018 16:19:33 +0100
changeset 453774 263b74db7a7cd9d6e35a82e0ec3b75d907f8cacc
parent 453773 3a2a6750304e360bf80df95c149b5ed52414bae1
child 453775 c2239403f21ae4c0df28d5457c69b51b966f65cc
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1430729
milestone59.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 1430729 - Ignore an incorrect warning with gcc (-Wuninitialized) r=froydnj MozReview-Commit-ID: 2VfQ8E5d0gZ
xpcom/base/StaticPtr.h
--- a/xpcom/base/StaticPtr.h
+++ b/xpcom/base/StaticPtr.h
@@ -99,17 +99,25 @@ class MOZ_ONLY_USED_TO_AVOID_STATIC_CONS
 {
 public:
   // In debug builds, check that mRawPtr is initialized for us as we expect
   // by the compiler.  In non-debug builds, don't declare a constructor
   // so that the compiler can see that the constructor is trivial.
 #ifdef DEBUG
   StaticRefPtr()
   {
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wuninitialized"
+  // False positive with gcc. See bug 1430729
+#endif
     MOZ_ASSERT(!mRawPtr);
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
   }
 #endif
 
   StaticRefPtr<T>& operator=(T* aRhs)
   {
     AssignWithAddref(aRhs);
     return *this;
   }