• Daniel Marinescu's avatar
    Added SCOPE_FAIL and SCOPE_SUCCESS macros in non-portable C++. · a57c72d7
    Daniel Marinescu authored
    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
    a57c72d7
ScopeGuard.h 6.6 KB