MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / HandleSehExceptionsInMethodIfSupported

Function HandleSehExceptionsInMethodIfSupported

test/common/gtest/gtest.cpp:3858–3879  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3856// wrapper function for handling SEH exceptions.)
3857template <class T, typename Result>
3858Result HandleSehExceptionsInMethodIfSupported(
3859 T* object, Result (T::*method)(), const char* location) {
3860#if GTEST_HAS_SEH
3861 __try {
3862 return (object->*method)();
3863 } __except (internal::UnitTestOptions::GTestShouldProcessSEH( // NOLINT
3864 GetExceptionCode())) {
3865 // We create the exception message on the heap because VC++ prohibits
3866 // creation of objects with destructors on stack in functions using __try
3867 // (see error C2712).
3868 std::string* exception_message = FormatSehExceptionMessage(
3869 GetExceptionCode(), location);
3870 internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure,
3871 *exception_message);
3872 delete exception_message;
3873 return static_cast<Result>(0);
3874 }
3875#else
3876 (void)location;
3877 return (object->*method)();
3878#endif // GTEST_HAS_SEH
3879}
3880
3881// Runs the given method and catches and reports C++ and/or SEH-style
3882// exceptions, if they are supported; returns the 0-value for type

Callers 1

Calls 2

Tested by

no test coverage detected