Skip to content

Commit cbf677f

Browse files
authored
Sync with OS (#609)
* Sync with OS commit 84854a6c2beef7430ac8886c7553166e9153d825 * Run clang-format on changes * Sync build break fix * Another round of build fixes * Test fix * Work around an unfortunate linker issue * Accidental duplicate
1 parent ddf3bc3 commit cbf677f

9 files changed

Lines changed: 590 additions & 41 deletions

File tree

include/wil/Tracelogging.h

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,8 @@ class TraceLoggingProvider : public details::IFailureCallback
530530
static bool WasAlreadyReportedToTelemetry(long failureId) WI_NOEXCEPT
531531
{
532532
static long volatile s_lastFailureSeen = -1;
533-
auto wasSeen = (s_lastFailureSeen == failureId);
534-
s_lastFailureSeen = failureId;
533+
long oldValue = InterlockedExchange(&s_lastFailureSeen, failureId);
534+
auto wasSeen = (oldValue == failureId);
535535
return wasSeen;
536536
}
537537

@@ -4731,6 +4731,49 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS")
47314731
varName8, \
47324732
TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), \
47334733
TelemetryPrivacyDataTag(PrivacyTag))
4734+
#define DEFINE_COMPLIANT_CRITICAL_DATA_EVENT_PARAM9( \
4735+
EventId, \
4736+
PrivacyTag, \
4737+
VarType1, \
4738+
varName1, \
4739+
VarType2, \
4740+
varName2, \
4741+
VarType3, \
4742+
varName3, \
4743+
VarType4, \
4744+
varName4, \
4745+
VarType5, \
4746+
varName5, \
4747+
VarType6, \
4748+
varName6, \
4749+
VarType7, \
4750+
varName7, \
4751+
VarType8, \
4752+
varName8, \
4753+
VarType9, \
4754+
varName9) \
4755+
DEFINE_TRACELOGGING_EVENT_PARAM9( \
4756+
EventId, \
4757+
VarType1, \
4758+
varName1, \
4759+
VarType2, \
4760+
varName2, \
4761+
VarType3, \
4762+
varName3, \
4763+
VarType4, \
4764+
varName4, \
4765+
VarType5, \
4766+
varName5, \
4767+
VarType6, \
4768+
varName6, \
4769+
VarType7, \
4770+
varName7, \
4771+
VarType8, \
4772+
varName8, \
4773+
VarType9, \
4774+
varName9, \
4775+
TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), \
4776+
TelemetryPrivacyDataTag(PrivacyTag))
47344777

47354778
#define DEFINE_COMPLIANT_CRITICAL_DATA_EVENT_CV(EventId, PrivacyTag) \
47364779
DEFINE_TRACELOGGING_EVENT_CV(EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), TelemetryPrivacyDataTag(PrivacyTag))

include/wil/coroutine.h

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ struct result_holder
328328
result_holder(result_holder const&) = delete;
329329
void operator=(result_holder const&) = delete;
330330

331-
~result_holder() noexcept(false)
331+
~result_holder() noexcept
332332
{
333333
if (restricted_error && g_pfnDestroyRestrictedErrorInformation)
334334
{
@@ -342,10 +342,9 @@ struct result_holder
342342
result.wrap.~result_wrapper();
343343
break;
344344
case result_status::error:
345-
// Rethrow unobserved exception. Delete this line to
346-
// discard unobserved exceptions.
347-
if (result.error)
348-
std::rethrow_exception(result.error);
345+
// Discard unobserved exception. There is nowhere to report it,
346+
// and abandonment might validly happen if an exception occurs
347+
// before the owner of the task can await it.
349348
result.error.~exception_ptr();
350349
}
351350
}
@@ -532,11 +531,25 @@ struct task_promise : promise_base<T>
532531
this->emplace_value(wistd::forward<U>(value));
533532
}
534533

534+
// Workaround a bug in MSVC where it does not properly deduce the return type.
535+
// Using a constraint is simpler and does not have the issue.
536+
#if _HAS_CXX20
537+
538+
void return_value(T const& value)
539+
requires(!wistd::is_reference_v<T>)
540+
{
541+
this->emplace_value(value);
542+
}
543+
544+
#else
545+
535546
template <typename Dummy = void>
536547
wistd::enable_if_t<!wistd::is_reference_v<T>, Dummy> return_value(T const& value)
537548
{
538549
this->emplace_value(value);
539550
}
551+
552+
#endif
540553
};
541554

542555
template <>

0 commit comments

Comments
 (0)