Bug 1431109 - Ignore a second incorrect warning with gcc (-Wuninitialized) r?froydnj draft
authorSylvestre Ledru <sledru@mozilla.com>
Wed, 17 Jan 2018 15:58:00 +0100
changeset 721604 e1e80d86539c0f40e003ce645d2167234a1854d0
parent 721495 4e429d313fd2e0f9202271ee8f3fb798817ec3e7
child 746381 01b7625ee32edb5f7c3fc0d56e891a1783051138
push id95889
push usersledru@mozilla.com
push dateWed, 17 Jan 2018 15:03:10 +0000
reviewersfroydnj
bugs1431109
milestone59.0a1
Bug 1431109 - Ignore a second incorrect warning with gcc (-Wuninitialized) r?froydnj MozReview-Commit-ID: 1QiA78wR9xB
xpcom/base/StaticPtr.h
--- a/xpcom/base/StaticPtr.h
+++ b/xpcom/base/StaticPtr.h
@@ -40,17 +40,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
   StaticAutoPtr()
   {
+#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
 
   StaticAutoPtr<T>& operator=(T* aRhs)
   {
     Assign(aRhs);
     return *this;
   }