Allow building with -Wmissing-noreturn
[folly.git] / folly / Optional.h
index f00a40e14a0950bcd3f86096c23a234204e5f5c2..ed601ee7623c2c3ac6a67496332ac6cb494a9f0e 100644 (file)
@@ -59,6 +59,8 @@
 #include <type_traits>
 #include <utility>
 
+#include <folly/Portability.h>
+
 namespace folly {
 
 namespace detail { struct NoneHelper {}; }
@@ -292,10 +294,16 @@ class Optional {
       };
     };
 
+    FOLLY_PUSH_WARNING
+    // These are both informational warnings, but they trigger rare enough
+    // that we've left them enabled.
+    FOLLY_MSVC_DISABLE_WARNING(4587) // constructor of .value is not called
+    FOLLY_MSVC_DISABLE_WARNING(4588) // destructor of .value is not called
     StorageNonTriviallyDestructible() : hasValue{false} {}
     ~StorageNonTriviallyDestructible() {
       clear();
     }
+    FOLLY_POP_WARNING
 
     void clear() {
       if (hasValue) {