Revert the ppltasks change that introduced an `ole32.dll` dependency (#3607)

This commit is contained in:
Stephan T. Lavavej 2023-04-04 16:42:24 -07:00 коммит произвёл GitHub
Родитель 9231abe46d
Коммит 5d4aa49c07
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 24 добавлений и 14 удалений

Просмотреть файл

@ -576,7 +576,7 @@ function(add_stl_dlls D_SUFFIX REL_OR_DBG)
target_stl_compile_options(msvcp${D_SUFFIX}_eha_objects ${REL_OR_DBG})
add_library(msvcp${D_SUFFIX} SHARED)
target_link_libraries(msvcp${D_SUFFIX} PRIVATE msvcp${D_SUFFIX}_eha_objects msvcp${D_SUFFIX}_objects msvcp${D_SUFFIX}_init_objects "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib" "ole32.lib")
target_link_libraries(msvcp${D_SUFFIX} PRIVATE msvcp${D_SUFFIX}_eha_objects msvcp${D_SUFFIX}_objects msvcp${D_SUFFIX}_init_objects "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib")
set_target_properties(msvcp${D_SUFFIX} PROPERTIES ARCHIVE_OUTPUT_NAME "msvcp140_base${D_SUFFIX}${VCLIBS_SUFFIX}")
set_target_properties(msvcp${D_SUFFIX} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
set_target_properties(msvcp${D_SUFFIX} PROPERTIES OUTPUT_NAME "msvcp140${D_SUFFIX}${VCLIBS_SUFFIX}")

Просмотреть файл

@ -51,8 +51,6 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
<LinkAdditionalOptions Condition="$(DebugBuild) == 'true'">-opt:ref,noicf $(LinkAdditionalOptions)</LinkAdditionalOptions>
<LinkAdditionalOptions>-nodefaultlib:libcpmt$(BuildSuffix).lib $(LinkAdditionalOptions)</LinkAdditionalOptions>
<LinkAdditionalOptions>-nodefaultlib:$(LibOutputFile) $(LinkAdditionalOptions)</LinkAdditionalOptions>
<LinkingWithMinCore Condition="'$(MsvcpFlavor)' == 'app' or '$(MsvcpFlavor)' == 'onecore'">true</LinkingWithMinCore>
<LinkAdditionalOptions Condition="'$(LinkingWithMinCore)' != 'true'">ole32.lib $(LinkAdditionalOptions)</LinkAdditionalOptions>
<LinkGenerateMapFile>true</LinkGenerateMapFile>
<LinkRelease>true</LinkRelease>

Просмотреть файл

@ -7,6 +7,7 @@
#include <Windows.h>
#if defined(_CRT_APP) || defined(UNDOCKED_WINDOWS_UCRT)
#ifndef UNDOCKED_WINDOWS_UCRT
#pragma warning(push)
#pragma warning(disable : 4265) // non-virtual destructor in base class
@ -18,8 +19,7 @@
#include <ctxtcall.h>
#include <mutex>
#include <windows.foundation.diagnostics.h>
#pragma comment(lib, "ole32")
#endif
// This IID is exported by ole32.dll; we cannot depend on ole32.dll on OneCore.
static GUID const Local_IID_ICallbackWithNoReentrancyToApplicationSTA = {
@ -219,6 +219,7 @@ namespace Concurrency {
_CRTIMP2 void __thiscall _TaskEventLogger::_LogWorkItemCompleted() {}
#endif
#if defined(_CRT_APP) || defined(UNDOCKED_WINDOWS_UCRT)
using namespace ABI::Windows::Foundation;
using namespace ABI::Windows::Foundation::Diagnostics;
using namespace Microsoft::WRL;
@ -289,13 +290,6 @@ namespace Concurrency {
}
_CRTIMP2 bool __cdecl _Task_impl_base::_IsNonBlockingThread() {
// TRANSITION, ABI: This preprocessor directive attempts to fix VSO-1684985 (a bincompat issue affecting VS 2015 code)
// while preserving as much of GH-2654 as possible. When we can break ABI, we should:
// * Remove this preprocessor directive - it should be unnecessary after <ppltasks.h> was changed on 2018-01-12.
// * In <ppltasks.h>, reconsider whether _Task_impl_base::_Wait() should throw invalid_operation;
// it's questionable whether that's conforming, and if users want to block their UI threads, we should let them.
// * Investigate whether we can avoid the ppltasks dependency entirely, making all of these issues irrelevant.
#if defined(_CRT_APP) || defined(UNDOCKED_WINDOWS_UCRT)
APTTYPE _AptType;
APTTYPEQUALIFIER _AptTypeQualifier;
@ -321,10 +315,28 @@ namespace Concurrency {
break;
}
}
#endif // defined(_CRT_APP) || defined(UNDOCKED_WINDOWS_UCRT)
return false;
}
#else
_CRTIMP2 void __thiscall _ContextCallback::_CallInContext(_CallbackFunction _Func, bool) const {
_Func();
}
_CRTIMP2 void __thiscall _ContextCallback::_Capture() {}
_CRTIMP2 void __thiscall _ContextCallback::_Reset() {}
_CRTIMP2 void __thiscall _ContextCallback::_Assign(void*) {}
_CRTIMP2 bool __cdecl _ContextCallback::_IsCurrentOriginSTA() {
return false;
}
_CRTIMP2 bool __cdecl _Task_impl_base::_IsNonBlockingThread() {
return false;
}
#endif
} // namespace details
#ifdef _CRT_APP