Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions strings/base_activation.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace winrt::impl

if (hr == impl::error_not_initialized)
{
auto usage = static_cast<int32_t(__stdcall*)(void** cookie) noexcept>(WINRT_IMPL_GetProcAddress(WINRT_IMPL_LoadLibraryW(L"combase.dll"), "CoIncrementMTAUsage"));
auto usage = reinterpret_cast<int32_t(__stdcall*)(void** cookie) noexcept>(WINRT_IMPL_GetProcAddress(WINRT_IMPL_LoadLibraryW(L"combase.dll"), "CoIncrementMTAUsage"));

if (!usage)
{
Expand All @@ -59,7 +59,7 @@ namespace winrt::impl
std::wstring path{ static_cast<hstring const&>(name) };
std::size_t count{};

while (-1 != (count = path.rfind('.')))
while (std::wstring::npos != (count = path.rfind('.')))
{
path.resize(count);
path += L".dll";
Expand Down
18 changes: 9 additions & 9 deletions strings/base_agile_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ namespace winrt::impl
return;
}

result = static_cast<F>(WINRT_IMPL_GetProcAddress(WINRT_IMPL_LoadLibraryW(L"combase.dll"), name));
result = reinterpret_cast<F>(WINRT_IMPL_GetProcAddress(WINRT_IMPL_LoadLibraryW(L"combase.dll"), name));

if (result)
{
Expand All @@ -119,37 +119,37 @@ namespace winrt::impl
result = fallback;
}

inline hresult get_agile_reference(winrt::guid const& iid, void* object, void** result) noexcept
inline hresult get_agile_reference(winrt::guid const& iid, void* object, void** reference) noexcept
{
static int32_t(__stdcall * handler)(uint32_t options, winrt::guid const& iid, void* object, void** result) noexcept;
static int32_t(__stdcall * handler)(uint32_t options, winrt::guid const& iid, void* object, void** reference) noexcept;

load_runtime_function("RoGetAgileReference", handler,
[](uint32_t, winrt::guid const& iid, void* object, void** result) noexcept -> int32_t
[](uint32_t, winrt::guid const& iid, void* object, void** reference) noexcept -> int32_t
{
*result = nullptr;
*reference = nullptr;
static constexpr guid git_clsid{ 0x00000323, 0x0000, 0x0000, { 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 } };

com_ptr<IGlobalInterfaceTable> git;
hresult hr = WINRT_IMPL_CoCreateInstance(git_clsid, nullptr, 1 /*CLSCTX_INPROC_SERVER*/, guid_of<IGlobalInterfaceTable>(), git.put_void());

if (result < 0)
if (hr < 0)
{
return hr;
}

uint32_t cookie{};
hr = git->RegisterInterfaceInGlobal(object, iid, &cookie);

if (result < 0)
if (hr < 0)
{
return hr;
}

*result = new agile_ref_fallback(std::move(git), cookie);
*reference = new agile_ref_fallback(std::move(git), cookie);
return 0;
});

return handler(0, iid, object, result);
return handler(0, iid, object, reference);
}
}

Expand Down
2 changes: 1 addition & 1 deletion strings/base_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ WINRT_EXPORT namespace winrt
return pointer;
}

[[noreturn]] inline void terminate() noexcept
inline void terminate() noexcept
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? This one is surprising to me.

Copy link
Collaborator Author

@kennykerr kennykerr Jan 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Clang can't tell that the function won't return and thus rejects the [[noreturn]]. Unfortunately, there seems to be no way to mark a lambda as [[noreturn]] and even if there were, I'm not sure Clang would "see through" the load_runtime_function function to observe this since the RoFailFastWithErrorContext function isn't [[noreturn]] due to its dynamic nature.

{
static void(__stdcall * handler)(int32_t) noexcept;

Expand Down