Added SCOPE_FAIL and SCOPE_SUCCESS macros in non-portable C++.
authorDaniel Marinescu <danielm@fb.com>
Thu, 14 Nov 2013 04:41:24 +0000 (20:41 -0800)
committerPeter Griess <pgriess@fb.com>
Tue, 26 Nov 2013 15:05:17 +0000 (07:05 -0800)
commita57c72d7c5d712b95aa1bad48a507f026437a1f8
tree230688185403d37087208161204eba91b9bd5c7e
parent4962ea0c6f0214969efcd24eca1ca043a2040475
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
folly/ScopeGuard.h
folly/detail/UncaughtExceptionCounter.h [new file with mode: 0644]
folly/experimental/exception_tracer/ExceptionAbi.h
folly/test/ScopeGuardTest.cpp