Skip to content
Open
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
47 changes: 45 additions & 2 deletions include/wil/Tracelogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,8 @@ class TraceLoggingProvider : public details::IFailureCallback
static bool WasAlreadyReportedToTelemetry(long failureId) WI_NOEXCEPT
{
static long volatile s_lastFailureSeen = -1;
auto wasSeen = (s_lastFailureSeen == failureId);
s_lastFailureSeen = failureId;
long oldValue = InterlockedExchange(&s_lastFailureSeen, failureId);
auto wasSeen = (oldValue == failureId);
return wasSeen;
}

Expand Down Expand Up @@ -4731,6 +4731,49 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS")
varName8, \
TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), \
TelemetryPrivacyDataTag(PrivacyTag))
#define DEFINE_COMPLIANT_CRITICAL_DATA_EVENT_PARAM9( \
EventId, \
PrivacyTag, \
VarType1, \
varName1, \
VarType2, \
varName2, \
VarType3, \
varName3, \
VarType4, \
varName4, \
VarType5, \
varName5, \
VarType6, \
varName6, \
VarType7, \
varName7, \
VarType8, \
varName8, \
VarType9, \
varName9) \
DEFINE_TRACELOGGING_EVENT_PARAM9( \
EventId, \
VarType1, \
varName1, \
VarType2, \
varName2, \
VarType3, \
varName3, \
VarType4, \
varName4, \
VarType5, \
varName5, \
VarType6, \
varName6, \
VarType7, \
varName7, \
VarType8, \
varName8, \
VarType9, \
varName9, \
TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), \
TelemetryPrivacyDataTag(PrivacyTag))

#define DEFINE_COMPLIANT_CRITICAL_DATA_EVENT_CV(EventId, PrivacyTag) \
DEFINE_TRACELOGGING_EVENT_CV(EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), TelemetryPrivacyDataTag(PrivacyTag))
Expand Down
23 changes: 18 additions & 5 deletions include/wil/coroutine.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ struct result_holder
result_holder(result_holder const&) = delete;
void operator=(result_holder const&) = delete;

~result_holder() noexcept(false)
~result_holder() noexcept
{
if (restricted_error && g_pfnDestroyRestrictedErrorInformation)
{
Expand All @@ -342,10 +342,9 @@ struct result_holder
result.wrap.~result_wrapper();
break;
case result_status::error:
// Rethrow unobserved exception. Delete this line to
// discard unobserved exceptions.
if (result.error)
std::rethrow_exception(result.error);
// Discard unobserved exception. There is nowhere to report it,
// and abandonment might validly happen if an exception occurs
// before the owner of the task can await it.
result.error.~exception_ptr();
}
}
Expand Down Expand Up @@ -532,11 +531,25 @@ struct task_promise : promise_base<T>
this->emplace_value(wistd::forward<U>(value));
}

// Workaround a bug in MSVC where it does not properly deduce the return type.
// Using a constraint is simpler and does not have the issue.
#if _HAS_CXX20

void return_value(T const& value)
requires(!wistd::is_reference_v<T>)
{
this->emplace_value(value);
}

#else

template <typename Dummy = void>
wistd::enable_if_t<!wistd::is_reference_v<T>, Dummy> return_value(T const& value)
{
this->emplace_value(value);
}

#endif
};

template <>
Expand Down
Loading