Allow folly::io::Cursor to move backwards.
[folly.git] / folly / ScopeGuard.h
index 3822e4d130d777f81edb060d5df583ee4bc21581..940a34855aa0602f3e5cc8ab2f7aa320088de3dd 100644 (file)
@@ -14,8 +14,7 @@
  * limitations under the License.
  */
 
-#ifndef FOLLY_SCOPEGUARD_H_
-#define FOLLY_SCOPEGUARD_H_
+#pragma once
 
 #include <cstddef>
 #include <functional>
@@ -38,7 +37,8 @@ namespace folly {
  * a functor, or a void(*)() function pointer.
  *
  *
- * Usage example: Add a friend to memory iff it is also added to the db.
+ * Usage example: Add a friend to memory if and only if it is also added
+ * to the db.
  *
  * void User::addFriend(User& newFriend) {
  *   // add the friend to memory
@@ -173,7 +173,8 @@ typedef ScopeGuardImplBase&& ScopeGuard;
 namespace detail {
 
 #if defined(FOLLY_EXCEPTION_COUNT_USE_CXA_GET_GLOBALS) || \
-    defined(FOLLY_EXCEPTION_COUNT_USE_GETPTD)
+    defined(FOLLY_EXCEPTION_COUNT_USE_GETPTD) ||          \
+    defined(FOLLY_EXCEPTION_COUNT_USE_STD)
 
 /**
  * ScopeGuard used for executing a function when leaving the current scope
@@ -265,7 +266,8 @@ operator+(detail::ScopeGuardOnExit, FunctionType&& fn) {
   = ::folly::detail::ScopeGuardOnExit() + [&]() noexcept
 
 #if defined(FOLLY_EXCEPTION_COUNT_USE_CXA_GET_GLOBALS) || \
-    defined(FOLLY_EXCEPTION_COUNT_USE_GETPTD)
+    defined(FOLLY_EXCEPTION_COUNT_USE_GETPTD) ||          \
+    defined(FOLLY_EXCEPTION_COUNT_USE_STD)
 #define SCOPE_FAIL \
   auto FB_ANONYMOUS_VARIABLE(SCOPE_FAIL_STATE) \
   = ::folly::detail::ScopeGuardOnFail() + [&]() noexcept
@@ -274,5 +276,3 @@ operator+(detail::ScopeGuardOnExit, FunctionType&& fn) {
   auto FB_ANONYMOUS_VARIABLE(SCOPE_SUCCESS_STATE) \
   = ::folly::detail::ScopeGuardOnSuccess() + [&]()
 #endif // native uncaught_exception() supported
-
-#endif // FOLLY_SCOPEGUARD_H_