Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Commit

Permalink
fix: #15, update crt.
Browse files Browse the repository at this point in the history
  • Loading branch information
MiroKaku committed Nov 9, 2022
1 parent f937cb0 commit 15049b2
Show file tree
Hide file tree
Showing 26 changed files with 2,012 additions and 549 deletions.
10 changes: 5 additions & 5 deletions src/crt/i386/trnsctrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ extern "C" _VCRTIMP __declspec(naked) DECLSPEC_GUARD_SUPPRESS EXCEPTION_DISPOSIT

EHTRACE_FMT1("pRN = 0x%p", pRN);

result = __InternalCxxFrameHandler<RENAME_EH_EXTERN(__FrameHandler3)>( pExcept, pRN, (PCONTEXT)pContext, pDC, pFuncInfo, 0, nullptr, FALSE );
result = __InternalCxxFrameHandlerWrapper<RENAME_EH_EXTERN(__FrameHandler3)>( pExcept, pRN, (PCONTEXT)pContext, pDC, pFuncInfo, 0, nullptr, FALSE );

EHTRACE_HANDLER_EXIT(result);

Expand Down Expand Up @@ -263,7 +263,7 @@ extern "C" _VCRTIMP __declspec(naked) DECLSPEC_GUARD_SUPPRESS EXCEPTION_DISPOSIT

EHTRACE_FMT1("pRN = 0x%p", pRN);

result = __InternalCxxFrameHandler<RENAME_EH_EXTERN(__FrameHandler3)>( pExcept, pRN, (PCONTEXT)pContext, pDC, pFuncInfo, 0, nullptr, FALSE );
result = __InternalCxxFrameHandlerWrapper<RENAME_EH_EXTERN(__FrameHandler3)>( pExcept, pRN, (PCONTEXT)pContext, pDC, pFuncInfo, 0, nullptr, FALSE );

EHTRACE_HANDLER_EXIT(result);

Expand Down Expand Up @@ -313,7 +313,7 @@ extern "C" _VCRTIMP __declspec(naked) DECLSPEC_GUARD_SUPPRESS EXCEPTION_DISPOSIT

EHTRACE_FMT1("pRN = 0x%p", pRN);

result = __InternalCxxFrameHandler<RENAME_EH_EXTERN(__FrameHandler3)>( pExcept, pRN, (PCONTEXT)pContext, pDC, pFuncInfo, 0, nullptr, FALSE );
result = __InternalCxxFrameHandlerWrapper<RENAME_EH_EXTERN(__FrameHandler3)>( pExcept, pRN, (PCONTEXT)pContext, pDC, pFuncInfo, 0, nullptr, FALSE );

EHTRACE_HANDLER_EXIT(result);

Expand Down Expand Up @@ -442,7 +442,7 @@ extern "C" EXCEPTION_DISPOSITION __cdecl _CatchGuardHandler(
__security_check_cookie(pRN->RandomCookie ^ (UINT_PTR)pRN);

EXCEPTION_DISPOSITION result =
__InternalCxxFrameHandler<RENAME_EH_EXTERN(__FrameHandler3)>( pExcept,
__InternalCxxFrameHandlerWrapper<RENAME_EH_EXTERN(__FrameHandler3)>( pExcept,
pRN->pRN,
(PCONTEXT)pContext,
nullptr,
Expand Down Expand Up @@ -667,7 +667,7 @@ extern "C" EXCEPTION_DISPOSITION __cdecl _TranslatorGuardHandler(
//
// Check for a handler:
//
__InternalCxxFrameHandler<RENAME_EH_EXTERN(__FrameHandler3)>( pExcept, pRN->pRN, (PCONTEXT)pContext, nullptr, pRN->pFuncInfo, pRN->CatchDepth, pRN->pMarkerRN, TRUE );
__InternalCxxFrameHandlerWrapper<RENAME_EH_EXTERN(__FrameHandler3)>( pExcept, pRN->pRN, (PCONTEXT)pContext, nullptr, pRN->pFuncInfo, pRN->CatchDepth, pRN->pMarkerRN, TRUE );

if (!pRN->DidUnwind) {
//
Expand Down
10 changes: 7 additions & 3 deletions src/crt/stl/excptptr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ extern "C" _CRTIMP2 void* __cdecl __AdjustPointer(void*, const PMD&); // defined

using namespace std;

#ifndef _MSVC_NOOP_DTOR
#define _MSVC_NOOP_DTOR [[msvc::noop_dtor]]
#endif

namespace {
#if defined(_M_CEE_PURE)
template <class _Ty>
Expand All @@ -53,10 +57,10 @@ namespace {

constexpr _Constexpr_excptptr_immortalize_impl() noexcept : _Storage{} {}

_Constexpr_excptptr_immortalize_impl(const _Constexpr_excptptr_immortalize_impl&) = delete;
_Constexpr_excptptr_immortalize_impl(const _Constexpr_excptptr_immortalize_impl&) = delete;
_Constexpr_excptptr_immortalize_impl& operator=(const _Constexpr_excptptr_immortalize_impl&) = delete;

[[msvc::noop_dtor]] ~_Constexpr_excptptr_immortalize_impl() {
_MSVC_NOOP_DTOR ~_Constexpr_excptptr_immortalize_impl() {
// do nothing, allowing _Ty to be used during shutdown
}
};
Expand All @@ -80,7 +84,7 @@ namespace {
_Ty& _Immortalize() { // return a reference to an object that will live forever
static once_flag _Flag;
alignas(_Ty) static unsigned char _Storage[sizeof(_Ty)];
if (_Execute_once(_Flag, _Immortalize_impl<_Ty>, &_Storage) == 0) {
if (!_Execute_once(_Flag, _Immortalize_impl<_Ty>, &_Storage)) {
// _Execute_once should never fail if the callback never fails
_STD terminate();
}
Expand Down
Loading

0 comments on commit 15049b2

Please sign in to comment.