From abedd5cbda3507900cd94c7f2574be68da560c95 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 12 Oct 2023 13:55:40 -0700 Subject: [PATCH 01/12] Revert GH 1318, GH 1356, and GH 1398 (xonce.cpp only) while preserving GH 1194's change to directly call InitOnceExecuteOnce(). --- stl/src/xonce.cpp | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/stl/src/xonce.cpp b/stl/src/xonce.cpp index f63352c3c9..09c5d5a0de 100644 --- a/stl/src/xonce.cpp +++ b/stl/src/xonce.cpp @@ -7,33 +7,14 @@ #include -namespace { - struct _Xfg_trampoline_parameter { - void* _Pv; - _STD _Execute_once_fp_t _Callback; - }; -} // unnamed namespace - _STD_BEGIN - // TRANSITION, ABI _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Execute_once( once_flag& _Flag, _Execute_once_fp_t _Callback, void* _Pv) noexcept { // wrap Win32 InitOnceExecuteOnce() static_assert(sizeof(_Flag._Opaque) == sizeof(INIT_ONCE), "invalid size"); - // _Execute_once_fp_t and PINIT_ONCE_FN differ in type signature, therefore - // we introduce _Xfg_trampoline which has PINIT_ONCE_FN's type signature and - // calls into _Callback as an _Execute_once_fp_t for XFG compatibility. - - _Xfg_trampoline_parameter _Trampoline_parameter = {_Pv, _Callback}; - - PINIT_ONCE_FN _Xfg_trampoline = [](PINIT_ONCE _InitOnce, PVOID _Parameter, PVOID* _Context) { - const auto _Trampoline_parameter = static_cast<_Xfg_trampoline_parameter*>(_Parameter); - return static_cast(_Trampoline_parameter->_Callback(_InitOnce, _Trampoline_parameter->_Pv, _Context)); - }; - return InitOnceExecuteOnce( - reinterpret_cast(&_Flag._Opaque), _Xfg_trampoline, &_Trampoline_parameter, nullptr); + reinterpret_cast(&_Flag._Opaque), reinterpret_cast(_Callback), _Pv, nullptr); } [[noreturn]] _CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL From 3f401b295e8104c1f24ea0436e7a637ef2d6d9b0 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 12 Oct 2023 14:42:33 -0700 Subject: [PATCH 02/12] Use call_once() instead of _Execute_once() in ppltasks.cpp. After GH 3861, they're both declared by xcall_once.h, so we don't need to use the internal _Execute_once() (with a worse interface) anymore. Drop the "TRANSITION, ABI" comment which referred to _Execute_once(). Qualify std::call_once() like std::once_flag above. (_Execute_once() lives in namespace std and was being found through ADL!) Since call_once() handles stateful lambdas, we can directly capture `this` and use it. Finally, call_once() doesn't care about the return value, so we don't need to `return 1;`. --- stl/src/ppltasks.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/stl/src/ppltasks.cpp b/stl/src/ppltasks.cpp index c0bbdad466..ef3eac39ba 100644 --- a/stl/src/ppltasks.cpp +++ b/stl/src/ppltasks.cpp @@ -113,23 +113,15 @@ namespace Concurrency { } bool isCausalitySupported() { - // TRANSITION, ABI - _Execute_once( - m_stateFlag, - [](void*, void* _This_raw, void**) -> int { - const auto _This = static_cast(_This_raw); - ComPtr causalityAPIs; - if (SUCCEEDED(GetActivationFactory( - HStringReference(RuntimeClass_Windows_Foundation_Diagnostics_AsyncCausalityTracer) - .Get(), - &causalityAPIs))) { - _This->m_causalityAPIs = causalityAPIs.Detach(); - _This->m_isSupported = true; - } - - return 1; - }, - this); + std::call_once(m_stateFlag, [this] { + ComPtr causalityAPIs; + if (SUCCEEDED(GetActivationFactory( + HStringReference(RuntimeClass_Windows_Foundation_Diagnostics_AsyncCausalityTracer).Get(), + &causalityAPIs))) { + this->m_causalityAPIs = causalityAPIs.Detach(); + this->m_isSupported = true; + } + }); return m_isSupported; } }; From 80d0ec24eba55023557068345bf96535ba9faa42 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 12 Oct 2023 15:02:31 -0700 Subject: [PATCH 03/12] Use call_once() instead of _Execute_once() in excptptr.cpp. We're `using namespace std;` so we don't need qualification. Because call_once() supports stateful lambdas, we can simply capture `_Storage` by reference. We're in stl/src so we don't really need to worry about True Placement New being hijacked, but let's `static_cast` to preserve the original code and make it clear that we are indeed invoking True Placement New. --- stl/src/excptptr.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/stl/src/excptptr.cpp b/stl/src/excptptr.cpp index b36a2cf699..723666d2cc 100644 --- a/stl/src/excptptr.cpp +++ b/stl/src/excptptr.cpp @@ -68,22 +68,11 @@ namespace { return _Immortalize_impl<_Ty>._Storage; } #else // ^^^ !defined(_M_CEE) / defined(_M_CEE), TRANSITION, VSO-1153256 vvv - template - int __stdcall _Immortalize_impl(void*, void* _Storage_ptr, void**) noexcept { - // adapt True Placement New to _Execute_once - ::new (_Storage_ptr) _Ty(); - return 1; - } - template _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)) { - // _Execute_once should never fail if the callback never fails - _CSTD abort(); - } - + call_once(_Flag, [&_Storage] { ::new (static_cast(&_Storage)) _Ty(); }); return reinterpret_cast<_Ty&>(_Storage); } #endif // ^^^ !defined(_M_CEE_PURE) && defined(_M_CEE), TRANSITION, VSO-1153256 ^^^ From fc28d44b4fc4b0b19f8180c20545331fdc880cb6 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 12 Oct 2023 15:24:24 -0700 Subject: [PATCH 04/12] Remove declarations from xcall_once.h. They were guarded by `_CRTBLD` after GH 3935, so this doesn't affect users. The definition of `_Execute_once()` exactly repeated the declaration, except for `extern "C++"` which is fine to drop because stl/src is always built classically. --- stl/inc/xcall_once.h | 9 --------- stl/src/xonce.cpp | 3 +++ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/stl/inc/xcall_once.h b/stl/inc/xcall_once.h index 5b9954a0d8..3a99d9bc03 100644 --- a/stl/inc/xcall_once.h +++ b/stl/inc/xcall_once.h @@ -28,15 +28,6 @@ _EXPORT_STD struct once_flag { // opaque data structure for call_once() void* _Opaque; }; -#ifdef _CRTBLD -// Returns BOOL, nonzero to indicate success, zero for failure -using _Execute_once_fp_t = int(__stdcall*)(void*, void*, void**); - -// Returns BOOL, nonzero to indicate success, zero for failure -extern "C++" _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Execute_once( - once_flag& _Flag, _Execute_once_fp_t _Callback, void* _Pv) noexcept; -#endif // _CRTBLD - template union _Immortalizer_impl { // constructs _Ty, never destroys constexpr _Immortalizer_impl() noexcept : _Storage{} {} diff --git a/stl/src/xonce.cpp b/stl/src/xonce.cpp index 09c5d5a0de..76782ed571 100644 --- a/stl/src/xonce.cpp +++ b/stl/src/xonce.cpp @@ -8,6 +8,9 @@ #include _STD_BEGIN +// Returns BOOL, nonzero to indicate success, zero for failure +using _Execute_once_fp_t = int(__stdcall*)(void*, void*, void**); + // TRANSITION, ABI _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Execute_once( once_flag& _Flag, _Execute_once_fp_t _Callback, void* _Pv) noexcept { // wrap Win32 InitOnceExecuteOnce() From 565e9dbfe723b9334d746de3bb149c9b5f30a170 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 12 Oct 2023 15:52:08 -0700 Subject: [PATCH 05/12] Update comment now that _Execute_once() is unused. Also drop pointless "_Execute_once function" comment. --- stl/src/xonce.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stl/src/xonce.cpp b/stl/src/xonce.cpp index 76782ed571..486c602bf9 100644 --- a/stl/src/xonce.cpp +++ b/stl/src/xonce.cpp @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// _Execute_once function - #include #include @@ -11,7 +9,7 @@ _STD_BEGIN // Returns BOOL, nonzero to indicate success, zero for failure using _Execute_once_fp_t = int(__stdcall*)(void*, void*, void**); -// TRANSITION, ABI +// TRANSITION, ABI: _Execute_once() is preserved for binary compatibility _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Execute_once( once_flag& _Flag, _Execute_once_fp_t _Callback, void* _Pv) noexcept { // wrap Win32 InitOnceExecuteOnce() static_assert(sizeof(_Flag._Opaque) == sizeof(INIT_ONCE), "invalid size"); From 039cadddece4b0a40b561a62cfb1b1ec4a3f57c3 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 19 Oct 2023 22:37:30 -0700 Subject: [PATCH 06/12] Step 1: Suppose we can never get the causality APIs. In `AsyncCausalityTracer`, `m_causalityAPIs` and `m_isSupported` are private data members, initialized to `nullptr` and `false`. Let's pretend that `GetActivationFactory()` fails. In that case, the data members remain `nullptr` and `false` forever. Accordingly, we can hardcode the return values of `get()` and `isCausalitySupported()`. Also, `release()` becomes a no-op. --- stl/src/ppltasks.cpp | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/stl/src/ppltasks.cpp b/stl/src/ppltasks.cpp index ef3eac39ba..e7f9c34d98 100644 --- a/stl/src/ppltasks.cpp +++ b/stl/src/ppltasks.cpp @@ -94,35 +94,15 @@ namespace Concurrency { public: IAsyncCausalityTracerStatics* get() const { - return m_causalityAPIs; + return nullptr; } AsyncCausalityTracer() : m_causalityAPIs(nullptr), m_isSupported(false) {} - void release() { - if (m_causalityAPIs) { - APTTYPE aptType; - APTTYPEQUALIFIER aptTypeQualifier; - if (CoGetApartmentType(&aptType, &aptTypeQualifier) == S_OK) { - // Release causality APIs only if current apartment is still RoInitialized - m_causalityAPIs->Release(); - m_causalityAPIs = nullptr; - m_isSupported = false; - } - } - } + void release() {} bool isCausalitySupported() { - std::call_once(m_stateFlag, [this] { - ComPtr causalityAPIs; - if (SUCCEEDED(GetActivationFactory( - HStringReference(RuntimeClass_Windows_Foundation_Diagnostics_AsyncCausalityTracer).Get(), - &causalityAPIs))) { - this->m_causalityAPIs = causalityAPIs.Detach(); - this->m_isSupported = true; - } - }); - return m_isSupported; + return false; } }; AsyncCausalityTracer asyncCausalityTracer; From 885f5f48bfeb0094ca6b68427034b45e1e36666b Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 19 Oct 2023 22:37:33 -0700 Subject: [PATCH 07/12] Step 2: There are no causality static factories to cleanup. Now that `asyncCausalityTracer.release()` is a no-op, `__crtCleanupCausalityStaticFactories()` does nothing. Note that it wasn't exported - it was used only for cross-TU interaction between ppltasks.cpp and dllmain.cpp in stl/src, so we can remove this function outright. Then, dllmain.cpp becomes a stub. --- stl/src/dllmain.cpp | 14 +------------- stl/src/ppltasks.cpp | 6 ------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/stl/src/dllmain.cpp b/stl/src/dllmain.cpp index 23968536e8..313f8fa37b 100644 --- a/stl/src/dllmain.cpp +++ b/stl/src/dllmain.cpp @@ -5,18 +5,6 @@ #include -#ifdef _CRT_APP -// free static resource used by causality -extern "C" void __cdecl __crtCleanupCausalityStaticFactories(); -#endif // defined(_CRT_APP) - -extern "C" BOOL APIENTRY DllMain(HMODULE /* hModule */, DWORD ul_reason_for_call, [[maybe_unused]] LPVOID lpReserved) { - if (ul_reason_for_call == DLL_PROCESS_DETACH) { -#ifdef _CRT_APP - if (lpReserved == nullptr) { // only when the process is not terminating - __crtCleanupCausalityStaticFactories(); - } -#endif // defined(_CRT_APP) - } +extern "C" BOOL APIENTRY DllMain(HMODULE /* hModule */, DWORD /* ul_reason_for_call */, LPVOID /* lpReserved */) { return TRUE; } diff --git a/stl/src/ppltasks.cpp b/stl/src/ppltasks.cpp index e7f9c34d98..7a71b51cf5 100644 --- a/stl/src/ppltasks.cpp +++ b/stl/src/ppltasks.cpp @@ -320,9 +320,3 @@ namespace Concurrency { #endif // ^^^ !defined(_CRT_APP) ^^^ } // namespace Concurrency - -#ifdef _CRT_APP -extern "C" void __cdecl __crtCleanupCausalityStaticFactories() { - Concurrency::details::asyncCausalityTracer.release(); -} -#endif From 5f6d9cc09ab446e15659c947db7134855fa7f3a4 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 19 Oct 2023 22:37:34 -0700 Subject: [PATCH 08/12] Step 3: `asyncCausalityTracer.isCausalitySupported()` is always `false` now. Accordingly, we can drop all of these branches. Note that this drops `_M_scheduled = true;`. --- stl/src/ppltasks.cpp | 53 +++++--------------------------------------- 1 file changed, 5 insertions(+), 48 deletions(-) diff --git a/stl/src/ppltasks.cpp b/stl/src/ppltasks.cpp index 7a71b51cf5..da04735f00 100644 --- a/stl/src/ppltasks.cpp +++ b/stl/src/ppltasks.cpp @@ -111,17 +111,7 @@ namespace Concurrency { const GUID PPLTaskCausalityPlatformID = { 0x7A76B220, 0xA758, 0x4E6E, 0xB0, 0xE0, 0xD7, 0xC6, 0xD7, 0x4A, 0x88, 0xFE}; - _CRTIMP2 void __thiscall _TaskEventLogger::_LogScheduleTask(bool _IsContinuation) { - if (asyncCausalityTracer.isCausalitySupported()) { - asyncCausalityTracer.get()->TraceOperationCreation(CausalityTraceLevel_Required, - CausalitySource_Library, PPLTaskCausalityPlatformID, reinterpret_cast(_M_task), - HStringReference(_IsContinuation ? L"Concurrency::PPLTask::ScheduleContinuationTask" - : L"Concurrency::PPLTask::ScheduleTask") - .Get(), - 0); - _M_scheduled = true; - } - } + _CRTIMP2 void __thiscall _TaskEventLogger::_LogScheduleTask(bool _IsContinuation) {} _CRTIMP2 void __thiscall _TaskEventLogger::_LogTaskCompleted() { if (_M_scheduled) { AsyncStatus status; @@ -132,49 +122,16 @@ namespace Concurrency { } else { status = AsyncStatus::Canceled; } - - if (asyncCausalityTracer.isCausalitySupported()) { - asyncCausalityTracer.get()->TraceOperationCompletion(CausalityTraceLevel_Required, - CausalitySource_Library, PPLTaskCausalityPlatformID, - reinterpret_cast(_M_task), status); - } } } - _CRTIMP2 void __thiscall _TaskEventLogger::_LogCancelTask() { - if (asyncCausalityTracer.isCausalitySupported()) { - asyncCausalityTracer.get()->TraceOperationRelation(CausalityTraceLevel_Important, - CausalitySource_Library, PPLTaskCausalityPlatformID, reinterpret_cast(_M_task), - CausalityRelation_Cancel); - } - } - - _CRTIMP2 void __thiscall _TaskEventLogger::_LogTaskExecutionCompleted() { - if (asyncCausalityTracer.isCausalitySupported()) { - asyncCausalityTracer.get()->TraceSynchronousWorkCompletion(CausalityTraceLevel_Required, - CausalitySource_Library, CausalitySynchronousWork_CompletionNotification); - } - } + _CRTIMP2 void __thiscall _TaskEventLogger::_LogCancelTask() {} - _CRTIMP2 void __thiscall _TaskEventLogger::_LogWorkItemStarted() { - if (asyncCausalityTracer.isCausalitySupported()) { - asyncCausalityTracer.get()->TraceSynchronousWorkStart(CausalityTraceLevel_Required, - CausalitySource_Library, PPLTaskCausalityPlatformID, reinterpret_cast(_M_task), - CausalitySynchronousWork_Execution); - } - } + _CRTIMP2 void __thiscall _TaskEventLogger::_LogTaskExecutionCompleted() {} - _CRTIMP2 void __thiscall _TaskEventLogger::_LogWorkItemCompleted() { - if (asyncCausalityTracer.isCausalitySupported()) { - asyncCausalityTracer.get()->TraceSynchronousWorkCompletion( - CausalityTraceLevel_Required, CausalitySource_Library, CausalitySynchronousWork_Execution); + _CRTIMP2 void __thiscall _TaskEventLogger::_LogWorkItemStarted() {} - asyncCausalityTracer.get()->TraceSynchronousWorkStart(CausalityTraceLevel_Required, - CausalitySource_Library, PPLTaskCausalityPlatformID, reinterpret_cast(_M_task), - CausalitySynchronousWork_CompletionNotification); - _M_taskPostEventStarted = true; - } - } + _CRTIMP2 void __thiscall _TaskEventLogger::_LogWorkItemCompleted() {} #else // ^^^ defined(_CRT_APP) / !defined(_CRT_APP) vvv _CRTIMP2 void __thiscall _TaskEventLogger::_LogScheduleTask(bool) {} From 4cb616bc41ac88e2efe958971908a34be7d8753c Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 19 Oct 2023 22:37:34 -0700 Subject: [PATCH 09/12] Step 4: `_M_scheduled` is always `false` now. In ``, `_TaskEventLogger`'s constructor assigned `_M_scheduled = false;`, and we previously removed the only way for it to be set to `true`. Accordingly, we can drop this branch. --- stl/src/ppltasks.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/stl/src/ppltasks.cpp b/stl/src/ppltasks.cpp index da04735f00..0007fef9ba 100644 --- a/stl/src/ppltasks.cpp +++ b/stl/src/ppltasks.cpp @@ -112,18 +112,7 @@ namespace Concurrency { 0x7A76B220, 0xA758, 0x4E6E, 0xB0, 0xE0, 0xD7, 0xC6, 0xD7, 0x4A, 0x88, 0xFE}; _CRTIMP2 void __thiscall _TaskEventLogger::_LogScheduleTask(bool _IsContinuation) {} - _CRTIMP2 void __thiscall _TaskEventLogger::_LogTaskCompleted() { - if (_M_scheduled) { - AsyncStatus status; - if (_M_task->_IsCompleted()) { - status = AsyncStatus::Completed; - } else if (_M_task->_HasUserException()) { - status = AsyncStatus::Error; - } else { - status = AsyncStatus::Canceled; - } - } - } + _CRTIMP2 void __thiscall _TaskEventLogger::_LogTaskCompleted() {} _CRTIMP2 void __thiscall _TaskEventLogger::_LogCancelTask() {} From acf2bc348a0d7a72e8ad4fdcdea1387b6b27db9f Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 19 Oct 2023 22:37:35 -0700 Subject: [PATCH 10/12] Step 5: Remove unused code. From bottom to top: `const GUID PPLTaskCausalityPlatformID` wasn't exported. It had internal linkage, so we can definitely drop it. Nothing mentions the `AsyncCausalityTracer` type or the `asyncCausalityTracer` global variable anymore. Finally, we don't need the using-directives here. --- stl/src/ppltasks.cpp | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/stl/src/ppltasks.cpp b/stl/src/ppltasks.cpp index 0007fef9ba..9b29cac12f 100644 --- a/stl/src/ppltasks.cpp +++ b/stl/src/ppltasks.cpp @@ -82,35 +82,6 @@ namespace Concurrency { } // namespace platform #if defined(_CRT_APP) - using namespace ABI::Windows::Foundation; - using namespace ABI::Windows::Foundation::Diagnostics; - using namespace Microsoft::WRL; - using namespace Microsoft::WRL::Wrappers; - - class AsyncCausalityTracer { - IAsyncCausalityTracerStatics* m_causalityAPIs; - std::once_flag m_stateFlag; - bool m_isSupported; - - public: - IAsyncCausalityTracerStatics* get() const { - return nullptr; - } - - AsyncCausalityTracer() : m_causalityAPIs(nullptr), m_isSupported(false) {} - - void release() {} - - bool isCausalitySupported() { - return false; - } - }; - AsyncCausalityTracer asyncCausalityTracer; - - // GUID used for identifying causality logs from PPLTask - const GUID PPLTaskCausalityPlatformID = { - 0x7A76B220, 0xA758, 0x4E6E, 0xB0, 0xE0, 0xD7, 0xC6, 0xD7, 0x4A, 0x88, 0xFE}; - _CRTIMP2 void __thiscall _TaskEventLogger::_LogScheduleTask(bool _IsContinuation) {} _CRTIMP2 void __thiscall _TaskEventLogger::_LogTaskCompleted() {} From 8dd0a519d8bb6145c57dcf01a6f034580416e459 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 19 Oct 2023 22:37:35 -0700 Subject: [PATCH 11/12] Step 6: Unify Vulcan and Romulus. The app implementation of `_TaskEventLogger` is now identical to the desktop implementation (after we drop the `_IsContinuation` parameter name). Unify them. --- stl/src/ppltasks.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/stl/src/ppltasks.cpp b/stl/src/ppltasks.cpp index 9b29cac12f..48b9a5d576 100644 --- a/stl/src/ppltasks.cpp +++ b/stl/src/ppltasks.cpp @@ -81,19 +81,6 @@ namespace Concurrency { } // namespace platform -#if defined(_CRT_APP) - _CRTIMP2 void __thiscall _TaskEventLogger::_LogScheduleTask(bool _IsContinuation) {} - _CRTIMP2 void __thiscall _TaskEventLogger::_LogTaskCompleted() {} - - _CRTIMP2 void __thiscall _TaskEventLogger::_LogCancelTask() {} - - _CRTIMP2 void __thiscall _TaskEventLogger::_LogTaskExecutionCompleted() {} - - _CRTIMP2 void __thiscall _TaskEventLogger::_LogWorkItemStarted() {} - - _CRTIMP2 void __thiscall _TaskEventLogger::_LogWorkItemCompleted() {} - -#else // ^^^ defined(_CRT_APP) / !defined(_CRT_APP) vvv _CRTIMP2 void __thiscall _TaskEventLogger::_LogScheduleTask(bool) {} _CRTIMP2 void __thiscall _TaskEventLogger::_LogTaskCompleted() {} @@ -105,7 +92,6 @@ namespace Concurrency { _CRTIMP2 void __thiscall _TaskEventLogger::_LogWorkItemStarted() {} _CRTIMP2 void __thiscall _TaskEventLogger::_LogWorkItemCompleted() {} -#endif // ^^^ !defined(_CRT_APP) ^^^ #if defined(_CRT_APP) || defined(UNDOCKED_WINDOWS_UCRT) using namespace ABI::Windows::Foundation; From e6bc917533d8b5cc2ac14e5649871f88da764ae6 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 24 Oct 2023 14:36:54 -0700 Subject: [PATCH 12/12] Pre-merge with GH 4106 by marking `extern "C"` `DllMain()` as `noexcept`. Also drop the commented-out parameter names to avoid wrapping; they aren't useful when the function does nothing. --- stl/src/dllmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stl/src/dllmain.cpp b/stl/src/dllmain.cpp index 313f8fa37b..3b1c647ae2 100644 --- a/stl/src/dllmain.cpp +++ b/stl/src/dllmain.cpp @@ -5,6 +5,6 @@ #include -extern "C" BOOL APIENTRY DllMain(HMODULE /* hModule */, DWORD /* ul_reason_for_call */, LPVOID /* lpReserved */) { +extern "C" BOOL APIENTRY DllMain(HMODULE, DWORD, LPVOID) noexcept { return TRUE; }