mirror of
https://github.com/reactos/reactos.git
synced 2025-05-19 17:14:32 +00:00
[UCRT] Improve __crt_seh_guarded_call
This is a workaround for an MSVC compiler bug, which would result in degraded performance. See https://developercommunity.visualstudio.com/t/_local_unwind-generated-when-returning-f/10673261?
This commit is contained in:
parent
a58b713a5e
commit
c2b1271dbe
1 changed files with 22 additions and 1 deletions
|
@ -206,10 +206,31 @@ struct __crt_seh_guarded_call
|
||||||
template<typename Init, typename Action, typename Cleanup>
|
template<typename Init, typename Action, typename Cleanup>
|
||||||
T operator()(Init init, Action action, Cleanup cleanup)
|
T operator()(Init init, Action action, Cleanup cleanup)
|
||||||
{
|
{
|
||||||
|
T result;
|
||||||
init();
|
init();
|
||||||
__try
|
__try
|
||||||
{
|
{
|
||||||
return action();
|
result = action();
|
||||||
|
}
|
||||||
|
__finally
|
||||||
|
{
|
||||||
|
cleanup();
|
||||||
|
}
|
||||||
|
__endtry
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct __crt_seh_guarded_call<void>
|
||||||
|
{
|
||||||
|
template<typename Init, typename Action, typename Cleanup>
|
||||||
|
void operator()(Init init, Action action, Cleanup cleanup)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
__try
|
||||||
|
{
|
||||||
|
action();
|
||||||
}
|
}
|
||||||
__finally
|
__finally
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue