Silence a couple of warnings for MSVC in Optional.h
authorChristopher Dykes <cdykes@fb.com>
Tue, 1 Nov 2016 18:23:40 +0000 (11:23 -0700)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Tue, 1 Nov 2016 18:38:40 +0000 (11:38 -0700)
Summary: Silence a couple of warnings that get very spammy for MSVC.

Reviewed By: yfeldblum

Differential Revision: D4098682

fbshipit-source-id: b410b56062cdf82367675ea9c3dd22975e7b91bd

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) {