Added SCOPE_FAIL and SCOPE_SUCCESS macros in non-portable C++.
Summary: Added SCOPE_FAIL and SCOPE_SUCCESS macros in non-portable C++. The macros are similar to D's scope(failure) and scope(success). Currently the supported platforms are GCC and MSVC. For all others, std::uncaught_exception() is used, which will fail if the macros are used in a destructor called during stack unwinding. @override-unit-failures Test Plan: 1. Added new unit test to ScopeGuardTest.cpp. 2. Ran fbconfig -r folly && fbmake dbg 3. Ran _build/dbg/folly/test/scope_guard_test to make sure my unit test was running and passing. Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D1033621
Showing
Please register or sign in to comment