make extent_hooks static.
[folly.git] / folly / Expected.h
index b4e63ee9dc5222d2c996128c4f9e7163429f87fe..2b791c117810d73f6772e18645c90de2287d7546 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -233,6 +233,11 @@ struct ExpectedStorage {
   Value&& value() && {
     return std::move(value_);
   }
+  // TODO (t17322426): remove when VS2015 support is deprecated
+  // VS2015 static analyzer incorrectly flags these as unreachable in certain
+  // circumstances. VS2017 does not have this problem on the same code.
+  FOLLY_PUSH_WARNING
+  FOLLY_MSVC_DISABLE_WARNING(4702) // unreachable code
   Error& error() & {
     return error_;
   }
@@ -242,6 +247,7 @@ struct ExpectedStorage {
   Error&& error() && {
     return std::move(error_);
   }
+  FOLLY_POP_WARNING
 };
 
 template <class Value, class Error>
@@ -445,7 +451,7 @@ struct ExpectedStorage<Value, Error, StorageType::eUnion>
       this->which_ = Which::eError;
     }
   }
-  bool isThis(const ExpectedStorage* that) const {
+  bool isSelfAssign(const ExpectedStorage* that) const {
     return this == that;
   }
   constexpr bool isSelfAssign(const void*) const {
@@ -527,6 +533,11 @@ struct ExpectedStorage<Value, Error, StorageType::ePODStruct> {
   Value&& value() && {
     return std::move(value_);
   }
+  // TODO (t17322426): remove when VS2015 support is deprecated
+  // VS2015 static analyzer incorrectly flags these as unreachable in certain
+  // circumstances. VS2017 does not have this problem on the same code.
+  FOLLY_PUSH_WARNING
+  FOLLY_MSVC_DISABLE_WARNING(4702) // unreachable code
   Error& error() & {
     return error_;
   }
@@ -536,6 +547,7 @@ struct ExpectedStorage<Value, Error, StorageType::ePODStruct> {
   Error&& error() && {
     return std::move(error_);
   }
+  FOLLY_POP_WARNING
 };
 
 namespace expected_detail_ExpectedHelper {