Bug 1430729 - Ignore an incorrect warning with gcc (-Wuninitialized) r?froydnj
MozReview-Commit-ID: 2VfQ8E5d0gZ
--- 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;
}