From 3cc8d95abbc0cf5369b2de6afa40bd72afaa3ffa Mon Sep 17 00:00:00 2001
From: Rajat Goel <rajatgoel2010@fb.com>
Date: Wed, 13 Feb 2013 12:38:02 -0800
Subject: [PATCH] value_ might be uninitialized

Summary: Compilation is failing in 'opt' build

Test Plan: compile

Reviewed By: andrewjcg@fb.com

FB internal diff: D707869
---
 folly/Optional.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/folly/Optional.h b/folly/Optional.h
index 8abbfbc0..5b574f5b 100644
--- a/folly/Optional.h
+++ b/folly/Optional.h
@@ -69,6 +69,17 @@ typedef int detail::NoneHelper::*None;
 
 const None none = nullptr;
 
+/**
+ * gcc-4.7 warns about use of uninitialized memory around the use of storage_
+ * even though this is explicitly initialized at each point.
+ */
+#ifdef __GNUC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wuninitialized"
+# pragma GCC diagnostic ignored "-Wpragmas"
+# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif // __GNUC__
+
 template<class Value>
 class Optional : boost::totally_ordered<Optional<Value>,
                  boost::totally_ordered<Optional<Value>, Value>> {
@@ -234,6 +245,8 @@ class Optional : boost::totally_ordered<Optional<Value>,
   bool hasValue_;
 };
 
+#pragma GCC diagnostic pop
+
 template<class T>
 const T* get_pointer(const Optional<T>& opt) {
   return opt ? &opt.value() : nullptr;
-- 
2.34.1