From d912951120312fa14b5b9ade72b5c6aa04112c00 Mon Sep 17 00:00:00 2001 From: Duncan Horn Date: Mon, 22 Jan 2024 11:41:43 -0800 Subject: [PATCH 01/12] Sync with c027f28954dcfc8ce4b9040d57b94680cfe72971 --- include/wil/resource.h | 4 ++++ include/wil/result_macros.h | 4 ++-- include/wil/winrt.h | 22 +++++++++++----------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/include/wil/resource.h b/include/wil/resource.h index f23ca00ed..109a5dc9a 100644 --- a/include/wil/resource.h +++ b/include/wil/resource.h @@ -6214,14 +6214,18 @@ typedef weak_any weak_mdd_package_depende /// @cond #define __WIL_APISETLIBLOADER_ /// @endcond +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) typedef unique_any unique_dll_directory_cookie; +#endif #endif // __WIL_APISETLIBLOADER_ #if (defined(_APISETLIBLOADER_) && !defined(__WIL_APISETLIBLOADER_STL) && defined(WIL_RESOURCE_STL)) || defined(WIL_DOXYGEN) /// @cond #define __WIL_APISETLIBLOADER_STL /// @endcond +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) typedef shared_any shared_dll_directory_cookie; typedef weak_any weak_dll_directory_cookie; +#endif #endif // __WIL_APISETLIBLOADER_STL #if (defined(WDFAPI) && !defined(__WIL_WDFAPI)) || defined(WIL_DOXYGEN) diff --git a/include/wil/result_macros.h b/include/wil/result_macros.h index 4f01172fc..4bf55b287 100644 --- a/include/wil/result_macros.h +++ b/include/wil/result_macros.h @@ -1261,7 +1261,7 @@ WI_ODR_PRAGMA("WIL_FreeMemory", "0") } while ((void)0, 0) // Like 'FAIL_FAST_IF', but raises an assertion failure first for easier debugging -#define FAIL_FAST_ASSERT(condition) \ +#define WI_FAIL_FAST_ASSERT(condition) \ do \ { \ if (!wil::verify_bool(condition)) \ @@ -1270,7 +1270,7 @@ WI_ODR_PRAGMA("WIL_FreeMemory", "0") __RFF_FN(FailFast_Unexpected)(__RFF_INFO_ONLY(#condition)) \ } \ } while (0, 0) -#define FAIL_FAST_ASSERT_MSG(condition, msg) \ +#define WI_FAIL_FAST_ASSERT_MSG(condition, msg) \ do \ { \ if (!wil::verify_bool(condition)) \ diff --git a/include/wil/winrt.h b/include/wil/winrt.h index 8ee937ac6..2c452f855 100644 --- a/include/wil/winrt.h +++ b/include/wil/winrt.h @@ -827,9 +827,9 @@ class vector_range_nothrow WI_NODISCARD pointer operator->() const { #if WIL_ITERATOR_DEBUG_LEVEL > 0 - FAIL_FAST_ASSERT_MSG(m_version == m_range->m_version, "Dereferencing an out-of-date vector_iterator_nothrow"); - FAIL_FAST_ASSERT_MSG(SUCCEEDED(*m_range->m_result), "Dereferencing a vector_iterator_nothrow in a failed state"); - FAIL_FAST_ASSERT_MSG(m_i < m_range->m_size, "Dereferencing an 'end' iterator"); + WI_FAIL_FAST_ASSERT_MSG(m_version == m_range->m_version, "Dereferencing an out-of-date vector_iterator_nothrow"); + WI_FAIL_FAST_ASSERT_MSG(SUCCEEDED(*m_range->m_result), "Dereferencing a vector_iterator_nothrow in a failed state"); + WI_FAIL_FAST_ASSERT_MSG(m_i < m_range->m_size, "Dereferencing an 'end' iterator"); #endif return wistd::addressof(m_range->m_currentElement); } @@ -863,13 +863,13 @@ class vector_range_nothrow #if WIL_ITERATOR_DEBUG_LEVEL == 2 // This is _technically_ safe because we are not reading the out-of-date cached value, however having two active // copies of iterators is generally a sign of problematic code with a bug waiting to happen - FAIL_FAST_ASSERT_MSG( + WI_FAIL_FAST_ASSERT_MSG( m_version == m_range->m_version, "Incrementing/decrementing an out-of-date copy of a vector_iterator_nothrow"); #endif m_i += n; #if WIL_ITERATOR_DEBUG_LEVEL > 0 // NOTE: 'm_i' is unsigned, hence the single check for increment/decrement - FAIL_FAST_ASSERT_MSG(m_i <= m_range->m_size, "Incrementing/decrementing a vector_iterator_nothrow out of range"); + WI_FAIL_FAST_ASSERT_MSG(m_i <= m_range->m_size, "Incrementing/decrementing a vector_iterator_nothrow out of range"); #endif m_range->get_at_current(m_i); #if WIL_ITERATOR_DEBUG_LEVEL > 0 @@ -1205,9 +1205,9 @@ class iterable_range_nothrow WI_NODISCARD pointer operator->() const WI_NOEXCEPT { #if WIL_ITERATOR_DEBUG_LEVEL > 0 - FAIL_FAST_ASSERT_MSG(SUCCEEDED(*m_range->m_result), "Dereferencing an iterable_iterator_nothrow in a failed state"); - FAIL_FAST_ASSERT_MSG(m_i >= 0, "Dereferencing an 'end' iterator"); - FAIL_FAST_ASSERT_MSG(m_i == m_range->m_index, "Dereferencing an out-of-date iterable_iterator_nothrow"); + WI_FAIL_FAST_ASSERT_MSG(SUCCEEDED(*m_range->m_result), "Dereferencing an iterable_iterator_nothrow in a failed state"); + WI_FAIL_FAST_ASSERT_MSG(m_i >= 0, "Dereferencing an 'end' iterator"); + WI_FAIL_FAST_ASSERT_MSG(m_i == m_range->m_index, "Dereferencing an out-of-date iterable_iterator_nothrow"); #endif return wistd::addressof(m_range->m_element); } @@ -1216,8 +1216,8 @@ class iterable_range_nothrow { #if WIL_ITERATOR_DEBUG_LEVEL > 0 // Failing this check is always bad because the iterator object we hold always advances forward - FAIL_FAST_ASSERT_MSG(m_i >= 0, "Incrementing an end iterator"); - FAIL_FAST_ASSERT_MSG(m_i == m_range->m_index, "Incrementing an out-of-date copy of an iterable_iterator_nothrow"); + WI_FAIL_FAST_ASSERT_MSG(m_i >= 0, "Incrementing an end iterator"); + WI_FAIL_FAST_ASSERT_MSG(m_i == m_range->m_index, "Incrementing an out-of-date copy of an iterable_iterator_nothrow"); #endif boolean hasCurrent; *m_range->m_result = m_range->m_iterator->MoveNext(&hasCurrent); @@ -1260,7 +1260,7 @@ class iterable_range_nothrow #if WIL_ITERATOR_DEBUG_LEVEL == 2 // The IIterator we hold only advances forward; we can't reset it back to the beginning. Calling this method more than // once will very likely lead to unexpected behavior. - FAIL_FAST_ASSERT_MSG(m_index == 0, "Calling begin() on an already advanced iterable_range_nothrow"); + WI_FAIL_FAST_ASSERT_MSG(m_index == 0, "Calling begin() on an already advanced iterable_range_nothrow"); #endif return iterable_iterator_nothrow(this, this->m_iterator ? 0 : -1); } From 8e953697434e05b72324d0507326bef7d5c7edc4 Mon Sep 17 00:00:00 2001 From: Duncan Horn Date: Tue, 30 Jul 2024 13:20:51 -0700 Subject: [PATCH 02/12] Sync with OS commit 39bc95ee863de17875c268e451901be343c05894 --- include/wil/Tracelogging.h | 273 +++++++++++++++++++------------------ 1 file changed, 139 insertions(+), 134 deletions(-) diff --git a/include/wil/Tracelogging.h b/include/wil/Tracelogging.h index 915ac8771..e6dd70efe 100644 --- a/include/wil/Tracelogging.h +++ b/include/wil/Tracelogging.h @@ -743,7 +743,7 @@ class BasicThreadActivity __pragma(warning(push)) __pragma(warning(disable : 4127)) do \ { \ _tlgActivityDecl(activity) \ - TraceLoggingWriteActivity(TraceLoggingType::Provider(), (name), _tlgActivityRef(activity).Id(), NULL, __VA_ARGS__); \ + TraceLoggingWriteActivity(TraceLoggingType::Provider(), (name), _tlgActivityRef(activity).Id(), NULL, ##__VA_ARGS__); \ } \ while (0) \ __pragma(warning(pop)) /// @endcond @@ -1143,10 +1143,10 @@ class ActivityBase : public details::IFailureCallback return (m_sharedActivityData ? m_sharedActivityData->LockExclusive() : rwlock_release_exclusive_scope_exit()); } - template - class ActivityData : public _TlgActivityBase, keyword, level> + template + class ActivityData : public _TlgActivityBase, keyword, level> { - using BaseTy = _TlgActivityBase, keyword, level>; + using BaseTy = _TlgActivityBase, keyword, level>; friend BaseTy; void OnStarted() { @@ -1155,7 +1155,7 @@ class ActivityBase : public details::IFailureCallback { } - // SFINAE dispatching on presence of ActivityTraceLoggingType::CreateActivityId(_Out_ GUID& childActivityId, _In_opt_ const GUID* relatedActivityId) + // SFINAE dispatching on presence of ActivityTraceLoggingTypeOther::CreateActivityId(_Out_ GUID& childActivityId, _In_opt_ const GUID* relatedActivityId) template auto CreateActivityIdByProviderType(int, _Out_ GUID& childActivityId) -> decltype(ProviderType::CreateActivityId(childActivityId, this->GetRelatedId()), (void)0) @@ -1171,7 +1171,7 @@ class ActivityBase : public details::IFailureCallback void CreateActivityId(_Out_ GUID& childActivityId) { - CreateActivityIdByProviderType(0, childActivityId); + CreateActivityIdByProviderType(0, childActivityId); } public: @@ -1221,7 +1221,7 @@ class ActivityBase : public details::IFailureCallback static TraceLoggingHProvider Provider() { - return ActivityTraceLoggingType::Provider(); + return ActivityTraceLoggingTypeOther::Provider(); } WI_NODISCARD bool NeedsStopped() const WI_NOEXCEPT @@ -1299,15 +1299,17 @@ class ActivityBase : public details::IFailureCallback #define __WI_TraceLoggingWriteStart(activity, name, ...) \ __pragma(warning(push)) __pragma(warning(disable : 4127)) do \ { \ - _tlgActivityDecl(activity) static const UINT64 _tlgActivity_Keyword = _tlgActivityRef(activity).Keyword; \ - static const UINT8 _tlgActivity_Level = _tlgActivityRef(activity).Level; \ - static const UINT64 _tlgActivityPrivacyTag = _tlgActivityRef(activity).PrivacyTag; \ + _tlgActivityDecl(activity); \ + using _tlg_Activity_t = wistd::remove_reference_t; \ + static constexpr const UINT64 _tlgActivity_Keyword = _tlg_Activity_t::Keyword; \ + static constexpr const UINT8 _tlgActivity_Level = _tlg_Activity_t::Level; \ + static constexpr const UINT64 _tlgActivityPrivacyTag = _tlg_Activity_t::PrivacyTag; \ static_assert( \ - _tlgActivity_Keyword == (_tlgActivity_Keyword _tlg_FOREACH(_tlgKeywordVal, __VA_ARGS__)), \ + _tlgActivity_Keyword == (_tlgActivity_Keyword _tlg_FOREACH(_tlgKeywordVal, ##__VA_ARGS__)), \ "Do not use TraceLoggingKeyword in TraceLoggingWriteStart. Keywords for START events are " \ "specified in the activity type, e.g. TraceLoggingActivity."); \ static_assert( \ - _tlgActivity_Level == (_tlgActivity_Level _tlg_FOREACH(_tlgLevelVal, __VA_ARGS__)), \ + _tlgActivity_Level == (_tlgActivity_Level _tlg_FOREACH(_tlgLevelVal, ##__VA_ARGS__)), \ "Do not use TraceLoggingLevel in TraceLoggingWriteStart. The Level for START events is " \ "specified in the activity type, e.g. TraceLoggingActivity."); \ _tlgActivityRef(activity).zInternalStart(); \ @@ -1321,28 +1323,30 @@ class ActivityBase : public details::IFailureCallback TraceLoggingLevel(_tlgActivity_Level), \ TelemetryPrivacyDataTag(_tlgActivityPrivacyTag), \ TraceLoggingDescription("~^" _wiltlg_LSTRINGIZE(activity) L"^~"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } \ while (0) \ __pragma(warning(pop)) #define __WRITE_ACTIVITY_START(EventId, ...) \ __TRACELOGGING_TEST_HOOK_ACTIVITY_START(); \ - __WI_TraceLoggingWriteStart(*this, #EventId, __ACTIVITY_START_PARAMS(), __VA_ARGS__); \ + __WI_TraceLoggingWriteStart(*this, #EventId, __ACTIVITY_START_PARAMS(), ##__VA_ARGS__); \ EnsureWatchingCurrentThread() #define __WI_TraceLoggingWriteStop(activity, name, ...) \ __pragma(warning(push)) __pragma(warning(disable : 4127)) do \ { \ - _tlgActivityDecl(activity) static const UINT64 _tlgActivity_Keyword = _tlgActivityRef(activity).Keyword; \ - static const UINT8 _tlgActivity_Level = _tlgActivityRef(activity).Level; \ - static const UINT64 _tlgActivityPrivacyTag = _tlgActivityRef(activity).PrivacyTag; \ + _tlgActivityDecl(activity); \ + using _tlg_Activity_t = wistd::remove_reference_t; \ + static constexpr const UINT64 _tlgActivity_Keyword = _tlg_Activity_t::Keyword; \ + static constexpr const UINT8 _tlgActivity_Level = _tlg_Activity_t::Level; \ + static constexpr const UINT64 _tlgActivityPrivacyTag = _tlg_Activity_t::PrivacyTag; \ static_assert( \ - _tlgActivity_Keyword == (_tlgActivity_Keyword _tlg_FOREACH(_tlgKeywordVal, __VA_ARGS__)), \ + _tlgActivity_Keyword == (_tlgActivity_Keyword _tlg_FOREACH(_tlgKeywordVal, ##__VA_ARGS__)), \ "Do not use TraceLoggingKeyword in TraceLoggingWriteStop. Keywords for STOP events are " \ "specified in the activity type, e.g. TraceLoggingActivity."); \ static_assert( \ - _tlgActivity_Level == (_tlgActivity_Level _tlg_FOREACH(_tlgLevelVal, __VA_ARGS__)), \ + _tlgActivity_Level == (_tlgActivity_Level _tlg_FOREACH(_tlgLevelVal, ##__VA_ARGS__)), \ "Do not use TraceLoggingLevel in TraceLoggingWriteStop. The Level for STOP events is " \ "specified in the activity type, e.g. TraceLoggingActivity."); \ _tlgActivityRef(activity).zInternalStop(); \ @@ -1356,7 +1360,7 @@ class ActivityBase : public details::IFailureCallback TraceLoggingLevel(_tlgActivity_Level), \ TelemetryPrivacyDataTag(_tlgActivityPrivacyTag), \ TraceLoggingDescription("~^" _wiltlg_LSTRINGIZE(activity) L"^~"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } \ while (0) \ __pragma(warning(pop)) @@ -1369,23 +1373,23 @@ class ActivityBase : public details::IFailureCallback auto& failure = *pFailure; \ if (false, WI_IsAnyFlagSet(Keyword, (MICROSOFT_KEYWORD_TELEMETRY | MICROSOFT_KEYWORD_MEASURES | MICROSOFT_KEYWORD_CRITICAL_DATA))) \ { \ - __WI_TraceLoggingWriteStop(*this, #EventId, __ACTIVITY_STOP_TELEMETRY_FAILURE_PARAMS(failure), __VA_ARGS__); \ + __WI_TraceLoggingWriteStop(*this, #EventId, __ACTIVITY_STOP_TELEMETRY_FAILURE_PARAMS(failure), ##__VA_ARGS__); \ } \ else \ { \ - __WI_TraceLoggingWriteStop(*this, #EventId, __ACTIVITY_STOP_TRACELOGGING_FAILURE_PARAMS(failure), __VA_ARGS__); \ + __WI_TraceLoggingWriteStop(*this, #EventId, __ACTIVITY_STOP_TRACELOGGING_FAILURE_PARAMS(failure), ##__VA_ARGS__); \ } \ } \ else \ { \ __TRACELOGGING_TEST_HOOK_ACTIVITY_STOP(nullptr, GetResult()); \ - __WI_TraceLoggingWriteStop(*this, #EventId, __ACTIVITY_STOP_PARAMS(GetResult()), __VA_ARGS__); \ + __WI_TraceLoggingWriteStop(*this, #EventId, __ACTIVITY_STOP_PARAMS(GetResult()), ##__VA_ARGS__); \ } \ IgnoreCurrentThread(); // optional params are: KeyWord, Level, PrivacyTags, Options #define __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, ...) \ - class ActivityClassName final : public wil::ActivityBase \ + class ActivityClassName final : public wil::ActivityBase \ { \ protected: \ void StopActivity() WI_NOEXCEPT override \ @@ -1547,13 +1551,13 @@ public: \ #define DEFINE_TAGGED_TRACELOGGING_EVENT(EventId, ...) \ void EventId() \ { \ - __WI_TraceLoggingWriteTagged(*this, #EventId, _GENERIC_PARTB_FIELDS_ENABLED, __VA_ARGS__); \ + __WI_TraceLoggingWriteTagged(*this, #EventId, _GENERIC_PARTB_FIELDS_ENABLED, ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT(EventId, ...) \ void EventId() \ { \ - __WI_TraceLoggingWriteTagged(*this, #EventId, __VA_ARGS__); \ + __WI_TraceLoggingWriteTagged(*this, #EventId, ##__VA_ARGS__); \ } #endif @@ -1562,13 +1566,13 @@ public: \ void EventId(PCSTR correlationVector) \ { \ __WI_TraceLoggingWriteTagged( \ - *this, #EventId, _GENERIC_PARTB_FIELDS_ENABLED, TraceLoggingString(correlationVector, "__TlgCV__"), __VA_ARGS__); \ + *this, #EventId, _GENERIC_PARTB_FIELDS_ENABLED, TraceLoggingString(correlationVector, "__TlgCV__"), ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_CV(EventId, ...) \ void EventId(PCSTR correlationVector) \ { \ - __WI_TraceLoggingWriteTagged(*this, #EventId, TraceLoggingString(correlationVector, "__TlgCV__"), __VA_ARGS__); \ + __WI_TraceLoggingWriteTagged(*this, #EventId, TraceLoggingString(correlationVector, "__TlgCV__"), ##__VA_ARGS__); \ } #endif @@ -1582,7 +1586,7 @@ public: \ #EventId, \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM1(EventId, VarType1, varName1, ...) \ @@ -1590,7 +1594,7 @@ public: \ void EventId(T1&& varName1) \ { \ __WI_TraceLoggingWriteTagged( \ - *this, #EventId, TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), __VA_ARGS__); \ + *this, #EventId, TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), ##__VA_ARGS__); \ } #endif @@ -1605,7 +1609,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM1_CV(EventId, VarType1, varName1, ...) \ @@ -1617,7 +1621,7 @@ public: \ #EventId, \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1632,7 +1636,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM2(EventId, VarType1, varName1, VarType2, varName2, ...) \ @@ -1644,7 +1648,7 @@ public: \ #EventId, \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1660,7 +1664,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM2_CV(EventId, VarType1, varName1, VarType2, varName2, ...) \ @@ -1673,7 +1677,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1689,7 +1693,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM3(EventId, VarType1, varName1, VarType2, varName2, VarType3, varName3, ...) \ @@ -1702,7 +1706,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1719,7 +1723,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM3_CV(EventId, VarType1, varName1, VarType2, varName2, VarType3, varName3, ...) \ @@ -1733,7 +1737,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1751,7 +1755,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM4( \ @@ -1766,7 +1770,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1785,7 +1789,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM4_CV( \ @@ -1801,7 +1805,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1820,7 +1824,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM5( \ @@ -1836,7 +1840,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1856,7 +1860,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM5_CV( \ @@ -1873,7 +1877,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1893,7 +1897,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM6( \ @@ -1910,7 +1914,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1931,7 +1935,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM6_CV( \ @@ -1949,7 +1953,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1970,7 +1974,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM7( \ @@ -1988,7 +1992,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2010,7 +2014,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM7_CV( \ @@ -2029,7 +2033,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2051,7 +2055,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM8( \ @@ -2070,7 +2074,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2094,7 +2098,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM8_CV( \ @@ -2115,7 +2119,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2158,7 +2162,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ TraceLoggingValue(static_cast(wistd::forward(varName9)), _wiltlg_STRINGIZE(varName9)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM9( \ @@ -2198,16 +2202,16 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ TraceLoggingValue(static_cast(wistd::forward(varName9)), _wiltlg_STRINGIZE(varName9)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif #define DEFINE_TAGGED_TRACELOGGING_EVENT_UINT32(EventId, varName, ...) \ - DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM1(EventId, UINT32, varName, __VA_ARGS__) + DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM1(EventId, UINT32, varName, ##__VA_ARGS__) #define DEFINE_TAGGED_TRACELOGGING_EVENT_BOOL(EventId, varName, ...) \ - DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM1(EventId, bool, varName, __VA_ARGS__) + DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM1(EventId, bool, varName, ##__VA_ARGS__) #define DEFINE_TAGGED_TRACELOGGING_EVENT_STRING(EventId, varName, ...) \ - DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM1(EventId, PCWSTR, varName, __VA_ARGS__) + DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM1(EventId, PCWSTR, varName, ##__VA_ARGS__) // Internal MACRO implementation of TraceLogging classes. // Do NOT use these macros directly. @@ -2369,13 +2373,13 @@ protected: \ #define DEFINE_TRACELOGGING_EVENT(EventId, ...) \ static void EventId() \ { \ - TraceLoggingWrite(TraceLoggingType::Provider(), #EventId, _GENERIC_PARTB_FIELDS_ENABLED, __VA_ARGS__); \ + TraceLoggingWrite(TraceLoggingType::Provider(), #EventId, _GENERIC_PARTB_FIELDS_ENABLED, ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT(EventId, ...) \ static void EventId() \ { \ - TraceLoggingWrite(TraceLoggingType::Provider(), #EventId, __VA_ARGS__); \ + TraceLoggingWrite(TraceLoggingType::Provider(), #EventId, ##__VA_ARGS__); \ } #endif @@ -2384,13 +2388,13 @@ protected: \ static void EventId(PCSTR correlationVector) \ { \ TraceLoggingWrite( \ - TraceLoggingType::Provider(), #EventId, _GENERIC_PARTB_FIELDS_ENABLED, TraceLoggingString(correlationVector, "__TlgCV__"), __VA_ARGS__); \ + TraceLoggingType::Provider(), #EventId, _GENERIC_PARTB_FIELDS_ENABLED, TraceLoggingString(correlationVector, "__TlgCV__"), ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_CV(EventId, ...) \ static void EventId(PCSTR correlationVector) \ { \ - TraceLoggingWrite(TraceLoggingType::Provider(), #EventId, TraceLoggingString(correlationVector, "__TlgCV__"), __VA_ARGS__); \ + TraceLoggingWrite(TraceLoggingType::Provider(), #EventId, TraceLoggingString(correlationVector, "__TlgCV__"), ##__VA_ARGS__); \ } #endif @@ -2404,7 +2408,7 @@ protected: \ #EventId, \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM1(EventId, VarType1, varName1, ...) \ @@ -2415,7 +2419,7 @@ protected: \ TraceLoggingType::Provider(), \ #EventId, \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2430,7 +2434,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM1_CV(EventId, VarType1, varName1, ...) \ @@ -2442,7 +2446,7 @@ protected: \ #EventId, \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2457,7 +2461,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM2(EventId, VarType1, varName1, VarType2, varName2, ...) \ @@ -2469,7 +2473,7 @@ protected: \ #EventId, \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2485,7 +2489,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM2_CV(EventId, VarType1, varName1, VarType2, varName2, ...) \ @@ -2498,7 +2502,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2514,7 +2518,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM3(EventId, VarType1, varName1, VarType2, varName2, VarType3, varName3, ...) \ @@ -2527,7 +2531,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2544,7 +2548,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM3_CV(EventId, VarType1, varName1, VarType2, varName2, VarType3, varName3, ...) \ @@ -2558,7 +2562,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2575,7 +2579,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM4(EventId, VarType1, varName1, VarType2, varName2, VarType3, varName3, VarType4, varName4, ...) \ @@ -2589,7 +2593,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2607,7 +2611,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM4_CV(EventId, VarType1, varName1, VarType2, varName2, VarType3, varName3, VarType4, varName4, ...) \ @@ -2622,7 +2626,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2641,7 +2645,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM5( \ @@ -2657,7 +2661,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2677,7 +2681,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM5_CV( \ @@ -2694,7 +2698,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2714,7 +2718,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM6( \ @@ -2731,7 +2735,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2752,7 +2756,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM6_CV( \ @@ -2770,7 +2774,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2791,7 +2795,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM7( \ @@ -2809,7 +2813,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2832,7 +2836,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM7_CV( \ @@ -2852,7 +2856,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2874,7 +2878,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM8( \ @@ -2893,7 +2897,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2917,7 +2921,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM8_CV( \ @@ -2938,7 +2942,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2981,7 +2985,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ TraceLoggingValue(static_cast(wistd::forward(varName9)), _wiltlg_STRINGIZE(varName9)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM9( \ @@ -3021,7 +3025,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ TraceLoggingValue(static_cast(wistd::forward(varName9)), _wiltlg_STRINGIZE(varName9)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -3065,7 +3069,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName9)), _wiltlg_STRINGIZE(varName9)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM9_CV( \ @@ -3106,7 +3110,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ TraceLoggingValue(static_cast(wistd::forward(varName9)), _wiltlg_STRINGIZE(varName9)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -3152,7 +3156,7 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName9)), _wiltlg_STRINGIZE(varName9)), \ TraceLoggingValue(static_cast(wistd::forward(varName10)), _wiltlg_STRINGIZE(varName10)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM10( \ @@ -3195,16 +3199,16 @@ protected: \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ TraceLoggingValue(static_cast(wistd::forward(varName9)), _wiltlg_STRINGIZE(varName9)), \ TraceLoggingValue(static_cast(wistd::forward(varName10)), _wiltlg_STRINGIZE(varName10)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif #define DEFINE_TRACELOGGING_EVENT_UINT32(EventId, varName, ...) \ - DEFINE_TRACELOGGING_EVENT_PARAM1(EventId, UINT32, varName, __VA_ARGS__) + DEFINE_TRACELOGGING_EVENT_PARAM1(EventId, UINT32, varName, ##__VA_ARGS__) #define DEFINE_TRACELOGGING_EVENT_BOOL(EventId, varName, ...) \ - DEFINE_TRACELOGGING_EVENT_PARAM1(EventId, bool, varName, __VA_ARGS__) + DEFINE_TRACELOGGING_EVENT_PARAM1(EventId, bool, varName, ##__VA_ARGS__) #define DEFINE_TRACELOGGING_EVENT_STRING(EventId, varName, ...) \ - DEFINE_TRACELOGGING_EVENT_PARAM1(EventId, PCWSTR, varName, __VA_ARGS__) + DEFINE_TRACELOGGING_EVENT_PARAM1(EventId, PCWSTR, varName, ##__VA_ARGS__) // Declaring a pure TraceLogging class // To declare a tracelogging class, declare your class derived from wil::TraceLoggingProvider, populate the uuid @@ -3244,34 +3248,35 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") // within your Tracelogging class using one of the macros below. #define TraceLoggingProviderWrite(TraceLoggingClassName, EventId, ...) \ - TraceLoggingWrite(TraceLoggingClassName::TraceLoggingType::Provider(), EventId, __VA_ARGS__) + TraceLoggingWrite(TraceLoggingClassName::TraceLoggingType::Provider(), EventId, ##__VA_ARGS__) #define TraceLoggingProviderWriteTelemetry(TraceLoggingClassName, EventId, ...) \ TraceLoggingWrite( \ - TraceLoggingClassName::TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), __VA_ARGS__) + TraceLoggingClassName::TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), ##__VA_ARGS__) #define TraceLoggingProviderWriteMeasure(TraceLoggingClassName, EventId, ...) \ - TraceLoggingWrite(TraceLoggingClassName::TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), __VA_ARGS__) + TraceLoggingWrite( \ + TraceLoggingClassName::TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), ##__VA_ARGS__) #define TraceLoggingProviderWriteCriticalData(TraceLoggingClassName, EventId, ...) \ TraceLoggingWrite( \ - TraceLoggingClassName::TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), __VA_ARGS__) + TraceLoggingClassName::TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), ##__VA_ARGS__) // [Optional] Custom Events // Use these macros to define a Custom Event for a Provider. Use the TraceLoggingClassWrite or TraceLoggingClassWriteTelemetry // from within a custom event to issue the event. Methods will be a no-op (and not be called) if the provider is not // enabled. -#define TraceLoggingClassWrite(EventId, ...) TraceLoggingWrite(TraceLoggingType::Provider(), EventId, __VA_ARGS__) +#define TraceLoggingClassWrite(EventId, ...) TraceLoggingWrite(TraceLoggingType::Provider(), EventId, ##__VA_ARGS__) #define TraceLoggingClassWriteTelemetry(EventId, ...) \ - TraceLoggingWrite(TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), __VA_ARGS__) + TraceLoggingWrite(TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), ##__VA_ARGS__) #define TraceLoggingClassWriteMeasure(EventId, ...) \ - TraceLoggingWrite(TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), __VA_ARGS__) + TraceLoggingWrite(TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), ##__VA_ARGS__) #define TraceLoggingClassWriteCriticalData(EventId, ...) \ - TraceLoggingWrite(TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), __VA_ARGS__) + TraceLoggingWrite(TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), ##__VA_ARGS__) #define DEFINE_EVENT_METHOD(MethodName) \ template \ @@ -5051,7 +5056,7 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") // [optional] params are: Options, Keyword, Level, PrivacyTag #define BEGIN_CUSTOM_ACTIVITY_CLASS(ActivityClassName, ...) \ - __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, __VA_ARGS__) \ + __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, ##__VA_ARGS__) \ __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) // [optional] param is: Level, PrivacyTag @@ -5150,7 +5155,7 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") // [optional] params are: Options, Keyword, Level #ifndef DISABLE_NONCOMPLIANT_TELEMETRY #define DEFINE_CUSTOM_ACTIVITY(ActivityClassName, ...) \ - BEGIN_CUSTOM_ACTIVITY_CLASS(ActivityClassName, __VA_ARGS__) \ + BEGIN_CUSTOM_ACTIVITY_CLASS(ActivityClassName, ##__VA_ARGS__) \ END_ACTIVITY_CLASS() #define DEFINE_TRACELOGGING_ACTIVITY(ActivityClassName) \ @@ -5229,16 +5234,16 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") // TraceLoggingClassWriteTagged or TraceLoggingClassWriteTaggedTelemetry macros from within a custom event // to write the event. -#define TraceLoggingClassWriteTagged(EventId, ...) __WI_TraceLoggingWriteTagged(*this, #EventId, __VA_ARGS__) +#define TraceLoggingClassWriteTagged(EventId, ...) __WI_TraceLoggingWriteTagged(*this, #EventId, ##__VA_ARGS__) #define TraceLoggingClassWriteTaggedTelemetry(EventId, ...) \ - __WI_TraceLoggingWriteTagged(*this, #EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), __VA_ARGS__) + __WI_TraceLoggingWriteTagged(*this, #EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), ##__VA_ARGS__) #define TraceLoggingClassWriteTaggedMeasure(EventId, ...) \ - __WI_TraceLoggingWriteTagged(*this, #EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), __VA_ARGS__) + __WI_TraceLoggingWriteTagged(*this, #EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), ##__VA_ARGS__) #define TraceLoggingClassWriteTaggedCriticalData(EventId, ...) \ - __WI_TraceLoggingWriteTagged(*this, #EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), __VA_ARGS__) + __WI_TraceLoggingWriteTagged(*this, #EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), ##__VA_ARGS__) // [Optional] Simple Tagged Events for Activities // Use these methods to define very simple tagged events for a Custom Activity. @@ -6253,10 +6258,10 @@ class ActivityErrorTracer using TelemetryBase = wil::TraceLoggingProvider; #define TRACELOGGING_WRITE_EVENT(TraceLoggingClassName, EventId, ...) \ - TraceLoggingWrite(TraceLoggingClassName::TraceLoggingType::Provider(), EventId, __VA_ARGS__) + TraceLoggingWrite(TraceLoggingClassName::TraceLoggingType::Provider(), EventId, ##__VA_ARGS__) #define TELEMETRY_WRITE_EVENT(EventId, ...) \ - TraceLoggingWrite(TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), __VA_ARGS__) + TraceLoggingWrite(TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), ##__VA_ARGS__) #define DEFINE_TAGGED_EVENT_METHOD(MethodName) \ public: \ @@ -6597,15 +6602,15 @@ namespace details #else m_fireEventDelay = __TRACELOGGING_TEST_HOOK_API_TELEMETRY_EVENT_DELAY_MS; #endif - m_fireEventThreadPoolTimer.reset(::CreateThreadpoolTimer( - [](PTP_CALLBACK_INSTANCE, PVOID, PTP_TIMER) { - FireEvent(); - }, - nullptr, - nullptr)); + m_fireEventThreadPoolTimer.reset(::CreateThreadpoolTimer(&FireEventCallback, nullptr, nullptr)); ScheduleFireEventCallback(); } + static void __stdcall FireEventCallback(PTP_CALLBACK_INSTANCE, PVOID, PTP_TIMER) + { + FireEvent(); + } + ~ApiTelemetryLogger() WI_NOEXCEPT override { FireEvent(); @@ -6685,9 +6690,9 @@ namespace details #define __WI_LOG_API_USE1(apiName) __WI_LOG_CLASS_API_USE3(InternalGetRuntimeClassName(), apiName, nullptr) /// @endcond -#define WI_LOG_CLASS_API_USE(...) WI_MACRO_DISPATCH(__WI_LOG_CLASS_API_USE, __VA_ARGS__) +#define WI_LOG_CLASS_API_USE(...) WI_MACRO_DISPATCH(__WI_LOG_CLASS_API_USE, ##__VA_ARGS__) -#define WI_LOG_API_USE(...) WI_MACRO_DISPATCH(__WI_LOG_API_USE, __VA_ARGS__) +#define WI_LOG_API_USE(...) WI_MACRO_DISPATCH(__WI_LOG_API_USE, ##__VA_ARGS__) #ifdef __clang__ #pragma clang diagnostic pop From 1b790c7a869309a793bb8df850565c11fe2b6865 Mon Sep 17 00:00:00 2001 From: Duncan Horn Date: Tue, 30 Jul 2024 14:51:35 -0700 Subject: [PATCH 03/12] Fix break --- include/wil/result.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/wil/result.h b/include/wil/result.h index 990a40b2c..178fde36e 100644 --- a/include/wil/result.h +++ b/include/wil/result.h @@ -435,7 +435,7 @@ namespace details_abi private: struct Node { - DWORD threadId = MAXDWORD; + DWORD threadId = 0xffffffff; // MAXDWORD Node* pNext = nullptr; T value{}; }; From 031fa1ee07882e6065bdd62d861d5e1783205cc0 Mon Sep 17 00:00:00 2001 From: Duncan Horn Date: Wed, 13 Nov 2024 16:10:32 -0800 Subject: [PATCH 04/12] Sync with OS commit 6e3099ac18718043334c9e8277b772aa1c46cedd --- include/wil/Tracelogging.h | 2 +- include/wil/result.h | 2 +- include/wil/result_macros.h | 4 ++-- include/wil/safecast.h | 22 ++++++++++++++++++++++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/include/wil/Tracelogging.h b/include/wil/Tracelogging.h index 7542d5231..b2067b5d8 100644 --- a/include/wil/Tracelogging.h +++ b/include/wil/Tracelogging.h @@ -65,7 +65,7 @@ #define _wiltlg_STRINGIZE_imp(x) #x #define _wiltlg_LSTRINGIZE(x) _wiltlg_LSTRINGIZE_imp1(x) #define _wiltlg_LSTRINGIZE_imp1(x) _wiltlg_LSTRINGIZE_imp2(#x) -#define _wiltlg_LSTRINGIZE_imp2(s) L##s +#define _wiltlg_LSTRINGIZE_imp2(s) L"" #s /* Macro __TRACELOGGING_DEFINE_PROVIDER_STORAGE_LINK(name1, name2): diff --git a/include/wil/result.h b/include/wil/result.h index 178fde36e..b1094fa80 100644 --- a/include/wil/result.h +++ b/include/wil/result.h @@ -435,7 +435,7 @@ namespace details_abi private: struct Node { - DWORD threadId = 0xffffffff; // MAXDWORD + DWORD threadId = 0xffffffffu; Node* pNext = nullptr; T value{}; }; diff --git a/include/wil/result_macros.h b/include/wil/result_macros.h index 776afcf17..1d6769008 100644 --- a/include/wil/result_macros.h +++ b/include/wil/result_macros.h @@ -3419,7 +3419,7 @@ class ResultException : public std::exception } //! Returns the failed HRESULT that this exception represents. - _Always_(_Post_satisfies_(return < 0)) WI_NODISCARD HRESULT GetErrorCode() const WI_NOEXCEPT + WI_NODISCARD _Always_(_Post_satisfies_(return < 0)) HRESULT GetErrorCode() const WI_NOEXCEPT { HRESULT const hr = m_failure.GetFailureInfo().hr; __analysis_assume(hr < 0); @@ -3427,7 +3427,7 @@ class ResultException : public std::exception } //! Returns the failed NTSTATUS that this exception represents. - _Always_(_Post_satisfies_(return < 0)) WI_NODISCARD NTSTATUS GetStatusCode() const WI_NOEXCEPT + WI_NODISCARD _Always_(_Post_satisfies_(return < 0)) NTSTATUS GetStatusCode() const WI_NOEXCEPT { NTSTATUS const status = m_failure.GetFailureInfo().status; __analysis_assume(status < 0); diff --git a/include/wil/safecast.h b/include/wil/safecast.h index e3690975b..659dc15e6 100644 --- a/include/wil/safecast.h +++ b/include/wil/safecast.h @@ -44,6 +44,12 @@ namespace details template constexpr bool both_integral_v = wistd::is_integral::value && wistd::is_integral::value; + // Helper template to determine that the cast from OldT to NewT is going to sign extend the + // value. This is only true when the size of NewT is larger than OldT and OldT is signed. + template + constexpr bool is_sign_extending_cast_v = + (sizeof(NewT) >= sizeof(OldT)) && both_integral_v && wistd::is_signed_v; + // Note on native wchar_t (__wchar_t): // Intsafe.h does not currently handle native wchar_t. When compiling with /Zc:wchar_t-, this is fine as wchar_t is // typedef'd to unsigned short. However, when compiling with /Zc:wchar_t or wchar_t as a native type, the lack of @@ -374,6 +380,22 @@ HRESULT safe_cast_nothrow(const OldT var, NewT* newTResult) *newTResult = static_cast(var); return S_OK; } + +// This conversion takes a signed integer value and grows it with the upper bits set to zero. This is +// useful when the resulting value is cast to a pointer type as it prevents the upper bits from being fill +// which would adjust the pointed-to address. +// +// For example: +// wil::safe_zero_extending_cast(-1) +// will return 0x00000000`FFFFFFFF on a 64-bit system. +template , int> = 0> +NewT safe_zero_extending_cast(const OldT var) +{ + // The first cast is to an unsigned type of the same size as the original. The second cast is to the + // larger type. Being an unsigned cast, the upper bits are zeroed out. + using unsigned_old_t = wistd::make_unsigned_t; + return static_cast(static_cast(var)); +} } // namespace wil #endif // __WIL_SAFECAST_INCLUDED From af192f5482bf7d7ce2e9fc8db91f6756521ea34f Mon Sep 17 00:00:00 2001 From: Duncan Horn Date: Thu, 14 Nov 2024 12:26:22 -0800 Subject: [PATCH 05/12] Format --- include/wil/common.h | 2 +- include/wil/nt_result_macros.h | 11 +++--- include/wil/registry_helpers.h | 10 +++--- include/wil/result.h | 4 +-- include/wil/result_macros.h | 62 ++++++++++++++------------------ include/wil/win32_helpers.h | 2 +- include/wil/winrt.h | 15 ++++---- include/wil/wistd_type_traits.h | 10 ++---- tests/ComTests.cpp | 10 +++--- tests/CppWinRTAuthoringTests.cpp | 4 +-- tests/ResourceTests.cpp | 2 +- 11 files changed, 61 insertions(+), 71 deletions(-) diff --git a/include/wil/common.h b/include/wil/common.h index 2448624a1..2aa231f69 100644 --- a/include/wil/common.h +++ b/include/wil/common.h @@ -819,7 +819,7 @@ namespace details : sizeof(val) == 2 ? static_cast(val) \ : sizeof(val) == 4 ? static_cast(val) \ : static_cast(val)) __pragma(warning(pop))) -#define __WI_IS_UNSIGNED_SINGLE_FLAG_SET(val) ((val) && !((val) & ((val)-1))) +#define __WI_IS_UNSIGNED_SINGLE_FLAG_SET(val) ((val) && !((val) & ((val) - 1))) #define __WI_IS_SINGLE_FLAG_SET(val) __WI_IS_UNSIGNED_SINGLE_FLAG_SET(__WI_MAKE_UNSIGNED(val)) template diff --git a/include/wil/nt_result_macros.h b/include/wil/nt_result_macros.h index 627061f52..2682382df 100644 --- a/include/wil/nt_result_macros.h +++ b/include/wil/nt_result_macros.h @@ -138,11 +138,11 @@ _Always_(_Post_satisfies_(return < 0)) __declspec(noinline) inline NTSTATUS Stat namespace details { template - __declspec(noinline) inline NTSTATUS - ReportStatus_CaughtException(__R_FN_PARAMS_FULL, SupportedExceptions supported = SupportedExceptions::Default); + __declspec(noinline) inline NTSTATUS ReportStatus_CaughtException( + __R_FN_PARAMS_FULL, SupportedExceptions supported = SupportedExceptions::Default); template - __declspec(noinline) inline NTSTATUS - ReportStatus_CaughtExceptionMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList); + __declspec(noinline) inline NTSTATUS ReportStatus_CaughtExceptionMsg( + __R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList); namespace __R_NS_NAME { @@ -191,8 +191,7 @@ namespace details } template - __declspec(noinline) inline NTSTATUS - ReportStatus_CaughtExceptionMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline NTSTATUS ReportStatus_CaughtExceptionMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) { // Pre-populate the buffer with our message, the exception message will be added to it... wchar_t message[2048]; diff --git a/include/wil/registry_helpers.h b/include/wil/registry_helpers.h index 48a8eb0eb..d7c148784 100644 --- a/include/wil/registry_helpers.h +++ b/include/wil/registry_helpers.h @@ -1052,7 +1052,7 @@ namespace reg { return REG_SZ; } -#endif // #if defined(__WIL_OBJBASE_H_STL) +#endif // #if defined(__WIL_OBJBASE_H_STL) } // namespace reg_value_type_info template @@ -1286,8 +1286,8 @@ namespace reg #if defined(WIL_ENABLE_EXCEPTIONS) using reg_view = ::wil::reg::reg_view_details::reg_view_t<::wil::err_exception_policy>; #endif // #if defined(WIL_ENABLE_EXCEPTIONS) - } // namespace reg_view_details - /// @endcond + } // namespace reg_view_details + /// @endcond /// @cond namespace reg_iterator_details @@ -1418,8 +1418,8 @@ namespace reg return ::wil::unique_bstr{::SysAllocStringLen(name.get(), static_cast(length))}; } #endif // #if defined(__WIL_OLEAUTO_H_) - } // namespace reg_iterator_details - /// @endcond + } // namespace reg_iterator_details + /// @endcond // forward declaration to allow friend-ing the template iterator class #if defined(WIL_ENABLE_EXCEPTIONS) diff --git a/include/wil/result.h b/include/wil/result.h index b1094fa80..7dd1b990d 100644 --- a/include/wil/result.h +++ b/include/wil/result.h @@ -1166,8 +1166,8 @@ inline void WilInitialize_Result(WilInitializeCommand state) namespace details { #ifndef RESULT_SUPPRESS_STATIC_INITIALIZERS - __declspec(selectany)::wil::details_abi::ProcessLocalStorage<::wil::details_abi::ProcessLocalData> g_processLocalData("WilError_03"); - __declspec(selectany)::wil::details_abi::ThreadLocalStorage g_threadFailureCallbacks; + __declspec(selectany) ::wil::details_abi::ProcessLocalStorage<::wil::details_abi::ProcessLocalData> g_processLocalData("WilError_03"); + __declspec(selectany) ::wil::details_abi::ThreadLocalStorage g_threadFailureCallbacks; WI_HEADER_INITIALIZATION_FUNCTION(InitializeResultHeader, [] { g_pfnGetContextAndNotifyFailure = GetContextAndNotifyFailure; diff --git a/include/wil/result_macros.h b/include/wil/result_macros.h index 41adca173..1b193dd1e 100644 --- a/include/wil/result_macros.h +++ b/include/wil/result_macros.h @@ -1991,8 +1991,7 @@ namespace details __declspec(selectany) void(__stdcall* g_pfnRaiseFailFastException)(PEXCEPTION_RECORD, PCONTEXT, DWORD) = nullptr; // Exception-based compiled additions - __declspec(selectany) - HRESULT(__stdcall* g_pfnRunFunctorWithExceptionFilter)(IFunctor& functor, IFunctorHost& host, void* returnAddress) = nullptr; + __declspec(selectany) HRESULT(__stdcall* g_pfnRunFunctorWithExceptionFilter)(IFunctor& functor, IFunctorHost& host, void* returnAddress) = nullptr; __declspec(selectany) void(__stdcall* g_pfnRethrow)() = nullptr; __declspec(selectany) void(__stdcall* g_pfnThrowResultException)(const FailureInfo& failure) = nullptr; extern "C" __declspec(selectany) ResultStatus(__stdcall* g_pfnResultFromCaughtExceptionInternal)( @@ -2213,8 +2212,8 @@ namespace details template __declspec(noinline) inline void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr, FailureFlags flags = FailureFlags::None); template - __declspec(noinline) inline HRESULT - ReportFailure_CaughtException(__R_FN_PARAMS_FULL, SupportedExceptions supported = SupportedExceptions::Default); + __declspec(noinline) inline HRESULT ReportFailure_CaughtException( + __R_FN_PARAMS_FULL, SupportedExceptions supported = SupportedExceptions::Default); //***************************************************************************** // Fail fast helpers (for use only internally to WIL) @@ -3133,7 +3132,7 @@ namespace details g_pfnRaiseFailFastException = ::RaiseFailFastException; return 1; }); -} +} // namespace details #endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM) //***************************************************************************** @@ -4119,8 +4118,7 @@ namespace details } } - __declspec(noinline) inline HRESULT - ResultFromException(const DiagnosticsInfo& diagnostics, SupportedExceptions supported, IFunctor& functor) WI_NOEXCEPT + __declspec(noinline) inline HRESULT ResultFromException(const DiagnosticsInfo& diagnostics, SupportedExceptions supported, IFunctor& functor) WI_NOEXCEPT { #ifdef RESULT_DEBUG // We can't do debug SEH handling if the caller also wants a shot at mapping the exceptions @@ -4140,8 +4138,8 @@ namespace details } } - __declspec(noinline) inline HRESULT - ResultFromExceptionDebug(const DiagnosticsInfo& diagnostics, SupportedExceptions supported, IFunctor& functor) WI_NOEXCEPT + __declspec(noinline) inline HRESULT ResultFromExceptionDebug( + const DiagnosticsInfo& diagnostics, SupportedExceptions supported, IFunctor& functor) WI_NOEXCEPT { return wil::details::ResultFromExceptionSeh(diagnostics, _ReturnAddress(), supported, functor); } @@ -4579,8 +4577,8 @@ namespace details } template - inline __declspec(noinline) RESULT_NORETURN - void ReportFailure_NoReturn(__R_FN_PARAMS_FULL, const ResultStatus& resultPair, PCWSTR message, ReportFailureOptions options) + inline __declspec(noinline) RESULT_NORETURN void ReportFailure_NoReturn( + __R_FN_PARAMS_FULL, const ResultStatus& resultPair, PCWSTR message, ReportFailureOptions options) { bool needPlatformException = ((T == FailureType::Exception) && WI_IsFlagClear(options, ReportFailureOptions::MayRethrow) && @@ -4814,15 +4812,13 @@ namespace details } template <> - __declspec(noinline) inline RESULT_NORETURN - void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr, FailureFlags) + __declspec(noinline) inline RESULT_NORETURN void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr, FailureFlags) { ReportFailure_Base(__R_FN_CALL_FULL, ResultStatus::FromResult(hr)); } template <> - __declspec(noinline) inline RESULT_NORETURN - void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr, FailureFlags) + __declspec(noinline) inline RESULT_NORETURN void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr, FailureFlags) { ReportFailure_Base(__R_FN_CALL_FULL, ResultStatus::FromResult(hr)); } @@ -4973,7 +4969,7 @@ namespace details template <> __declspec(noinline) inline RESULT_NORETURN HRESULT - ReportFailure_CaughtException(__R_FN_PARAMS_FULL, SupportedExceptions supported) + ReportFailure_CaughtException(__R_FN_PARAMS_FULL, SupportedExceptions supported) { wchar_t message[2048]{}; RESULT_NORETURN_RESULT( @@ -4982,7 +4978,7 @@ namespace details template <> __declspec(noinline) inline RESULT_NORETURN HRESULT - ReportFailure_CaughtException(__R_FN_PARAMS_FULL, SupportedExceptions supported) + ReportFailure_CaughtException(__R_FN_PARAMS_FULL, SupportedExceptions supported) { wchar_t message[2048]{}; RESULT_NORETURN_RESULT( @@ -4996,15 +4992,15 @@ namespace details } template <> - __declspec(noinline) inline RESULT_NORETURN - void ReportFailure_HrMsg(__R_FN_PARAMS_FULL, HRESULT hr, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline RESULT_NORETURN void ReportFailure_HrMsg( + __R_FN_PARAMS_FULL, HRESULT hr, _Printf_format_string_ PCSTR formatString, va_list argList) { ReportFailure_Msg(__R_FN_CALL_FULL, ResultStatus::FromResult(hr), formatString, argList); } template <> - __declspec(noinline) inline RESULT_NORETURN - void ReportFailure_HrMsg(__R_FN_PARAMS_FULL, HRESULT hr, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline RESULT_NORETURN void ReportFailure_HrMsg( + __R_FN_PARAMS_FULL, HRESULT hr, _Printf_format_string_ PCSTR formatString, va_list argList) { ReportFailure_Msg(__R_FN_CALL_FULL, ResultStatus::FromResult(hr), formatString, argList); } @@ -5012,8 +5008,7 @@ namespace details template _Success_(true) _Translates_Win32_to_HRESULT_(err) - __declspec(noinline) inline HRESULT - ReportFailure_Win32Msg(__R_FN_PARAMS_FULL, DWORD err, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline HRESULT ReportFailure_Win32Msg(__R_FN_PARAMS_FULL, DWORD err, _Printf_format_string_ PCSTR formatString, va_list argList) { auto hr = __HRESULT_FROM_WIN32(err); ReportFailure_Msg(__R_FN_CALL_FULL, ResultStatus::FromResult(hr), formatString, argList); @@ -5043,8 +5038,7 @@ namespace details } template - __declspec(noinline) inline DWORD - ReportFailure_GetLastErrorMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline DWORD ReportFailure_GetLastErrorMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) { auto err = GetLastErrorFail(__R_FN_CALL_FULL); auto hr = __HRESULT_FROM_WIN32(err); @@ -5054,8 +5048,8 @@ namespace details } template <> - __declspec(noinline) inline RESULT_NORETURN DWORD ReportFailure_GetLastErrorMsg( - __R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline RESULT_NORETURN DWORD + ReportFailure_GetLastErrorMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) { auto err = GetLastErrorFail(__R_FN_CALL_FULL); auto hr = __HRESULT_FROM_WIN32(err); @@ -5076,8 +5070,7 @@ namespace details template _Success_(true) _Translates_last_error_to_HRESULT_ - __declspec(noinline) inline HRESULT - ReportFailure_GetLastErrorHrMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline HRESULT ReportFailure_GetLastErrorHrMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) { auto hr = GetLastErrorFailHr(__R_FN_CALL_FULL); ReportFailure_Msg(__R_FN_CALL_FULL, ResultStatus::FromResult(hr), formatString, argList); @@ -5109,8 +5102,8 @@ namespace details template _Success_(true) _Translates_NTSTATUS_to_HRESULT_(status) - __declspec(noinline) inline HRESULT - ReportFailure_NtStatusMsg(__R_FN_PARAMS_FULL, NTSTATUS status, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline HRESULT ReportFailure_NtStatusMsg( + __R_FN_PARAMS_FULL, NTSTATUS status, _Printf_format_string_ PCSTR formatString, va_list argList) { const auto resultPair = ResultStatus::FromStatus(status); ReportFailure_Msg(__R_FN_CALL_FULL, resultPair, formatString, argList); @@ -5140,8 +5133,7 @@ namespace details } template - __declspec(noinline) inline HRESULT - ReportFailure_CaughtExceptionMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline HRESULT ReportFailure_CaughtExceptionMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) { // Pre-populate the buffer with our message, the exception message will be added to it... wchar_t message[2048]; @@ -5250,8 +5242,8 @@ namespace details } template - __declspec(noinline) RESULT_NORETURN - inline void ReportFailure_CustomExceptionMsg(__R_FN_PARAMS _In_ T exception, _In_ _Printf_format_string_ PCSTR formatString, ...) + __declspec(noinline) RESULT_NORETURN inline void ReportFailure_CustomExceptionMsg( + __R_FN_PARAMS _In_ T exception, _In_ _Printf_format_string_ PCSTR formatString, ...) { va_list argList; va_start(argList, formatString); diff --git a/include/wil/win32_helpers.h b/include/wil/win32_helpers.h index 592ada374..fb9595823 100644 --- a/include/wil/win32_helpers.h +++ b/include/wil/win32_helpers.h @@ -206,7 +206,7 @@ namespace filetime_duration long long const one_minute = 10000000LL * 60; // 600000000 or 600000000LL long long const one_hour = 10000000LL * 60 * 60; // 36000000000 or 36000000000LL long long const one_day = 10000000LL * 60 * 60 * 24; // 864000000000 or 864000000000LL -}; // namespace filetime_duration +} // namespace filetime_duration namespace filetime { diff --git a/include/wil/winrt.h b/include/wil/winrt.h index 0bcfda4f4..c099fea92 100644 --- a/include/wil/winrt.h +++ b/include/wil/winrt.h @@ -184,41 +184,42 @@ namespace details } template - static auto equals(LhsT&& lhs, RhsT&& rhs) WI_NOEXCEPT->decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) + static auto equals(LhsT&& lhs, RhsT&& rhs) + WI_NOEXCEPT -> decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) { return compare(wistd::forward(lhs), wistd::forward(rhs)) == CSTR_EQUAL; } template static auto not_equals(LhsT&& lhs, RhsT&& rhs) - WI_NOEXCEPT->decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) + WI_NOEXCEPT -> decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) { return compare(wistd::forward(lhs), wistd::forward(rhs)) != CSTR_EQUAL; } template - static auto less(LhsT&& lhs, RhsT&& rhs) WI_NOEXCEPT->decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) + static auto less(LhsT&& lhs, RhsT&& rhs) WI_NOEXCEPT -> decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) { return compare(wistd::forward(lhs), wistd::forward(rhs)) == CSTR_LESS_THAN; } template static auto less_equals(LhsT&& lhs, RhsT&& rhs) - WI_NOEXCEPT->decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) + WI_NOEXCEPT -> decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) { return compare(wistd::forward(lhs), wistd::forward(rhs)) != CSTR_GREATER_THAN; } template static auto greater(LhsT&& lhs, RhsT&& rhs) - WI_NOEXCEPT->decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) + WI_NOEXCEPT -> decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) { return compare(wistd::forward(lhs), wistd::forward(rhs)) == CSTR_GREATER_THAN; } template static auto greater_equals(LhsT&& lhs, RhsT&& rhs) - WI_NOEXCEPT->decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) + WI_NOEXCEPT -> decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) { return compare(wistd::forward(lhs), wistd::forward(rhs)) != CSTR_LESS_THAN; } @@ -1402,7 +1403,7 @@ namespace Windows return typename wil::iterable_range::iterable_iterator(); } } // namespace Collections - } // namespace Foundation + } // namespace Foundation } // namespace Windows #if defined(MIDL_NS_PREFIX) || defined(____x_ABI_CWindows_CFoundation_CIClosable_FWD_DEFINED__) } // namespace ABI diff --git a/include/wil/wistd_type_traits.h b/include/wil/wistd_type_traits.h index d79211e7a..417f7fc96 100644 --- a/include/wil/wistd_type_traits.h +++ b/include/wil/wistd_type_traits.h @@ -1194,9 +1194,7 @@ using type_identity_t = typename type_identity<_Tp>::type; // is_signed template ::value> -struct __libcpp_is_signed_impl : public __WI_LIBCPP_BOOL_CONSTANT(_Tp(-1) < _Tp(0)) -{ -}; +struct __libcpp_is_signed_impl : public __WI_LIBCPP_BOOL_CONSTANT(_Tp(-1) < _Tp(0)){}; template struct __libcpp_is_signed_impl<_Tp, false> : public true_type @@ -1226,9 +1224,7 @@ __WI_LIBCPP_INLINE_VAR __WI_LIBCPP_CONSTEXPR bool is_signed_v = is_signed<_Tp>:: // is_unsigned template ::value> -struct __libcpp_is_unsigned_impl : public __WI_LIBCPP_BOOL_CONSTANT(_Tp(0) < _Tp(-1)) -{ -}; +struct __libcpp_is_unsigned_impl : public __WI_LIBCPP_BOOL_CONSTANT(_Tp(0) < _Tp(-1)){}; template struct __libcpp_is_unsigned_impl<_Tp, false> : public false_type @@ -4693,7 +4689,7 @@ namespace __detail { static const bool value = #ifndef __WI_LIBCPP_HAS_NO_NOEXCEPT - noexcept(swap_wil(declval<_Tp>(), declval<_Up>()))&& noexcept(swap_wil(declval<_Up>(), declval<_Tp>())); + noexcept(swap_wil(declval<_Tp>(), declval<_Up>())) && noexcept(swap_wil(declval<_Up>(), declval<_Tp>())); #else false; #endif diff --git a/tests/ComTests.cpp b/tests/ComTests.cpp index 0ede5ff9b..e6bc228e5 100644 --- a/tests/ComTests.cpp +++ b/tests/ComTests.cpp @@ -638,8 +638,9 @@ interface __declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20a05")) IAlways : pub STDMETHOD_(void, Always)() = 0; }; -class __declspec(empty_bases) __declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20b00")) // non-implemented to allow QI for the class to be attempted (and fail) - ComObject +class __declspec(empty_bases) +__declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20b00")) // non-implemented to allow QI for the class to be attempted (and fail) +ComObject : witest::AllocatedObject, public Microsoft::WRL::RuntimeClass, Microsoft::WRL::ChainInterfaces, IAlways> { @@ -655,8 +656,9 @@ class __declspec(empty_bases) __declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20 } }; -class __declspec(empty_bases) __declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20b01")) // non-implemented to allow QI for the class to be attempted (and fail) - WinRtObject +class __declspec(empty_bases) +__declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20b01")) // non-implemented to allow QI for the class to be attempted (and fail) +WinRtObject : witest::AllocatedObject, public Microsoft::WRL:: RuntimeClass, ITest, IDerivedTest, ITestInspectable, IDerivedTestInspectable, IAlways, Microsoft::WRL::FtmBase> diff --git a/tests/CppWinRTAuthoringTests.cpp b/tests/CppWinRTAuthoringTests.cpp index 6053587e4..56b8a294f 100644 --- a/tests/CppWinRTAuthoringTests.cpp +++ b/tests/CppWinRTAuthoringTests.cpp @@ -19,8 +19,8 @@ struct my_async_status : winrt::implements ErrorCode; wil::single_threaded_property Id{16}; - void Cancel(){}; - void Close(){}; + void Cancel() {}; + void Close() {}; }; // This type has a settable property diff --git a/tests/ResourceTests.cpp b/tests/ResourceTests.cpp index 19ca2b1a3..6658265d6 100644 --- a/tests/ResourceTests.cpp +++ b/tests/ResourceTests.cpp @@ -147,7 +147,7 @@ class __declspec(empty_bases) PointerTestObject public Microsoft::WRL::RuntimeClass, ITest> { public: - STDMETHOD_(void, Test)(){}; + STDMETHOD_(void, Test)() {}; }; TEST_CASE("ResourceTests::TestOperationsOnGenericSmartPointerClasses", "[resource]") From 99abdab67321cab95c9877093d168fa8876e501f Mon Sep 17 00:00:00 2001 From: Duncan Horn Date: Thu, 14 Nov 2024 16:02:37 -0800 Subject: [PATCH 06/12] Use most recent version of Clang for formatting --- scripts/azure-pipelines.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/azure-pipelines.yml b/scripts/azure-pipelines.yml index 616f6a4c2..54d6a69c7 100644 --- a/scripts/azure-pipelines.yml +++ b/scripts/azure-pipelines.yml @@ -10,6 +10,12 @@ jobs: vmImage: 'windows-2022' steps: + - script: | + choco upgrade llvm -y + if %ERRORLEVEL% NEQ 0 goto :eof + echo ##vso[task.setvariable variable=PATH]%PATH%;C:\Program Files\LLVM\bin + displayName: 'Install Clang' + - script: | :: The architecture is not important; we just need VCINSTALLDIR set call scripts\call-vcvars.cmd x64 From 5d20ecb3acea571da2d79eb15a4af841fc203466 Mon Sep 17 00:00:00 2001 From: Duncan Horn Date: Thu, 14 Nov 2024 16:26:40 -0800 Subject: [PATCH 07/12] Apparently there was a breaking change in clang-format :( --- scripts/azure-pipelines.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/scripts/azure-pipelines.yml b/scripts/azure-pipelines.yml index 54d6a69c7..616f6a4c2 100644 --- a/scripts/azure-pipelines.yml +++ b/scripts/azure-pipelines.yml @@ -10,12 +10,6 @@ jobs: vmImage: 'windows-2022' steps: - - script: | - choco upgrade llvm -y - if %ERRORLEVEL% NEQ 0 goto :eof - echo ##vso[task.setvariable variable=PATH]%PATH%;C:\Program Files\LLVM\bin - displayName: 'Install Clang' - - script: | :: The architecture is not important; we just need VCINSTALLDIR set call scripts\call-vcvars.cmd x64 From a23becc792e06f956a4d927442af096168ea6b2e Mon Sep 17 00:00:00 2001 From: Duncan Horn Date: Thu, 14 Nov 2024 16:32:34 -0800 Subject: [PATCH 08/12] Print changes --- scripts/azure-pipelines.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/azure-pipelines.yml b/scripts/azure-pipelines.yml index 616f6a4c2..d9469fddd 100644 --- a/scripts/azure-pipelines.yml +++ b/scripts/azure-pipelines.yml @@ -31,6 +31,9 @@ jobs: echo NOTE: As an additional note, given that different versions of 'clang-format' may have different behaviors, this echo may be a false positive. If you believe that to be the case ^(e.g. none of the above resulted in modifications echo to the code you have changed^), please note this in your PR. + echo ---------------------------------------------- + echo See below for the file(s) that have changed: + git status exit /b 1 ) displayName: 'Check Formatting of Changes' From 7f81fa01c68b72dcea2c90850bb0af834a9747e0 Mon Sep 17 00:00:00 2001 From: Duncan Horn Date: Thu, 14 Nov 2024 16:36:06 -0800 Subject: [PATCH 09/12] Escape parens --- scripts/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/azure-pipelines.yml b/scripts/azure-pipelines.yml index d9469fddd..92b64274d 100644 --- a/scripts/azure-pipelines.yml +++ b/scripts/azure-pipelines.yml @@ -32,7 +32,7 @@ jobs: echo may be a false positive. If you believe that to be the case ^(e.g. none of the above resulted in modifications echo to the code you have changed^), please note this in your PR. echo ---------------------------------------------- - echo See below for the file(s) that have changed: + echo See below for the file^(s^) that have changed: git status exit /b 1 ) From c6928d09e476120a181a125b242be4c5e249ad94 Mon Sep 17 00:00:00 2001 From: Duncan Horn Date: Thu, 14 Nov 2024 16:38:25 -0800 Subject: [PATCH 10/12] Helps if I run the correct command... --- scripts/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/azure-pipelines.yml b/scripts/azure-pipelines.yml index 92b64274d..bc99e2ee6 100644 --- a/scripts/azure-pipelines.yml +++ b/scripts/azure-pipelines.yml @@ -33,7 +33,7 @@ jobs: echo to the code you have changed^), please note this in your PR. echo ---------------------------------------------- echo See below for the file^(s^) that have changed: - git status + git diff exit /b 1 ) displayName: 'Check Formatting of Changes' From 06c6131a711995357a4282b6b71f8de7d7d1edff Mon Sep 17 00:00:00 2001 From: Duncan Horn Date: Thu, 14 Nov 2024 16:46:09 -0800 Subject: [PATCH 11/12] Revert "Format" This reverts commit af192f5482bf7d7ce2e9fc8db91f6756521ea34f. --- include/wil/common.h | 2 +- include/wil/nt_result_macros.h | 11 +++--- include/wil/registry_helpers.h | 10 +++--- include/wil/result.h | 4 +-- include/wil/result_macros.h | 62 ++++++++++++++++++-------------- include/wil/win32_helpers.h | 2 +- include/wil/winrt.h | 15 ++++---- include/wil/wistd_type_traits.h | 10 ++++-- tests/ComTests.cpp | 10 +++--- tests/CppWinRTAuthoringTests.cpp | 4 +-- tests/ResourceTests.cpp | 2 +- 11 files changed, 71 insertions(+), 61 deletions(-) diff --git a/include/wil/common.h b/include/wil/common.h index 2aa231f69..2448624a1 100644 --- a/include/wil/common.h +++ b/include/wil/common.h @@ -819,7 +819,7 @@ namespace details : sizeof(val) == 2 ? static_cast(val) \ : sizeof(val) == 4 ? static_cast(val) \ : static_cast(val)) __pragma(warning(pop))) -#define __WI_IS_UNSIGNED_SINGLE_FLAG_SET(val) ((val) && !((val) & ((val) - 1))) +#define __WI_IS_UNSIGNED_SINGLE_FLAG_SET(val) ((val) && !((val) & ((val)-1))) #define __WI_IS_SINGLE_FLAG_SET(val) __WI_IS_UNSIGNED_SINGLE_FLAG_SET(__WI_MAKE_UNSIGNED(val)) template diff --git a/include/wil/nt_result_macros.h b/include/wil/nt_result_macros.h index 2682382df..627061f52 100644 --- a/include/wil/nt_result_macros.h +++ b/include/wil/nt_result_macros.h @@ -138,11 +138,11 @@ _Always_(_Post_satisfies_(return < 0)) __declspec(noinline) inline NTSTATUS Stat namespace details { template - __declspec(noinline) inline NTSTATUS ReportStatus_CaughtException( - __R_FN_PARAMS_FULL, SupportedExceptions supported = SupportedExceptions::Default); + __declspec(noinline) inline NTSTATUS + ReportStatus_CaughtException(__R_FN_PARAMS_FULL, SupportedExceptions supported = SupportedExceptions::Default); template - __declspec(noinline) inline NTSTATUS ReportStatus_CaughtExceptionMsg( - __R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList); + __declspec(noinline) inline NTSTATUS + ReportStatus_CaughtExceptionMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList); namespace __R_NS_NAME { @@ -191,7 +191,8 @@ namespace details } template - __declspec(noinline) inline NTSTATUS ReportStatus_CaughtExceptionMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline NTSTATUS + ReportStatus_CaughtExceptionMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) { // Pre-populate the buffer with our message, the exception message will be added to it... wchar_t message[2048]; diff --git a/include/wil/registry_helpers.h b/include/wil/registry_helpers.h index d7c148784..48a8eb0eb 100644 --- a/include/wil/registry_helpers.h +++ b/include/wil/registry_helpers.h @@ -1052,7 +1052,7 @@ namespace reg { return REG_SZ; } -#endif // #if defined(__WIL_OBJBASE_H_STL) +#endif // #if defined(__WIL_OBJBASE_H_STL) } // namespace reg_value_type_info template @@ -1286,8 +1286,8 @@ namespace reg #if defined(WIL_ENABLE_EXCEPTIONS) using reg_view = ::wil::reg::reg_view_details::reg_view_t<::wil::err_exception_policy>; #endif // #if defined(WIL_ENABLE_EXCEPTIONS) - } // namespace reg_view_details - /// @endcond + } // namespace reg_view_details + /// @endcond /// @cond namespace reg_iterator_details @@ -1418,8 +1418,8 @@ namespace reg return ::wil::unique_bstr{::SysAllocStringLen(name.get(), static_cast(length))}; } #endif // #if defined(__WIL_OLEAUTO_H_) - } // namespace reg_iterator_details - /// @endcond + } // namespace reg_iterator_details + /// @endcond // forward declaration to allow friend-ing the template iterator class #if defined(WIL_ENABLE_EXCEPTIONS) diff --git a/include/wil/result.h b/include/wil/result.h index 7dd1b990d..b1094fa80 100644 --- a/include/wil/result.h +++ b/include/wil/result.h @@ -1166,8 +1166,8 @@ inline void WilInitialize_Result(WilInitializeCommand state) namespace details { #ifndef RESULT_SUPPRESS_STATIC_INITIALIZERS - __declspec(selectany) ::wil::details_abi::ProcessLocalStorage<::wil::details_abi::ProcessLocalData> g_processLocalData("WilError_03"); - __declspec(selectany) ::wil::details_abi::ThreadLocalStorage g_threadFailureCallbacks; + __declspec(selectany)::wil::details_abi::ProcessLocalStorage<::wil::details_abi::ProcessLocalData> g_processLocalData("WilError_03"); + __declspec(selectany)::wil::details_abi::ThreadLocalStorage g_threadFailureCallbacks; WI_HEADER_INITIALIZATION_FUNCTION(InitializeResultHeader, [] { g_pfnGetContextAndNotifyFailure = GetContextAndNotifyFailure; diff --git a/include/wil/result_macros.h b/include/wil/result_macros.h index 1b193dd1e..41adca173 100644 --- a/include/wil/result_macros.h +++ b/include/wil/result_macros.h @@ -1991,7 +1991,8 @@ namespace details __declspec(selectany) void(__stdcall* g_pfnRaiseFailFastException)(PEXCEPTION_RECORD, PCONTEXT, DWORD) = nullptr; // Exception-based compiled additions - __declspec(selectany) HRESULT(__stdcall* g_pfnRunFunctorWithExceptionFilter)(IFunctor& functor, IFunctorHost& host, void* returnAddress) = nullptr; + __declspec(selectany) + HRESULT(__stdcall* g_pfnRunFunctorWithExceptionFilter)(IFunctor& functor, IFunctorHost& host, void* returnAddress) = nullptr; __declspec(selectany) void(__stdcall* g_pfnRethrow)() = nullptr; __declspec(selectany) void(__stdcall* g_pfnThrowResultException)(const FailureInfo& failure) = nullptr; extern "C" __declspec(selectany) ResultStatus(__stdcall* g_pfnResultFromCaughtExceptionInternal)( @@ -2212,8 +2213,8 @@ namespace details template __declspec(noinline) inline void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr, FailureFlags flags = FailureFlags::None); template - __declspec(noinline) inline HRESULT ReportFailure_CaughtException( - __R_FN_PARAMS_FULL, SupportedExceptions supported = SupportedExceptions::Default); + __declspec(noinline) inline HRESULT + ReportFailure_CaughtException(__R_FN_PARAMS_FULL, SupportedExceptions supported = SupportedExceptions::Default); //***************************************************************************** // Fail fast helpers (for use only internally to WIL) @@ -3132,7 +3133,7 @@ namespace details g_pfnRaiseFailFastException = ::RaiseFailFastException; return 1; }); -} // namespace details +} #endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM) //***************************************************************************** @@ -4118,7 +4119,8 @@ namespace details } } - __declspec(noinline) inline HRESULT ResultFromException(const DiagnosticsInfo& diagnostics, SupportedExceptions supported, IFunctor& functor) WI_NOEXCEPT + __declspec(noinline) inline HRESULT + ResultFromException(const DiagnosticsInfo& diagnostics, SupportedExceptions supported, IFunctor& functor) WI_NOEXCEPT { #ifdef RESULT_DEBUG // We can't do debug SEH handling if the caller also wants a shot at mapping the exceptions @@ -4138,8 +4140,8 @@ namespace details } } - __declspec(noinline) inline HRESULT ResultFromExceptionDebug( - const DiagnosticsInfo& diagnostics, SupportedExceptions supported, IFunctor& functor) WI_NOEXCEPT + __declspec(noinline) inline HRESULT + ResultFromExceptionDebug(const DiagnosticsInfo& diagnostics, SupportedExceptions supported, IFunctor& functor) WI_NOEXCEPT { return wil::details::ResultFromExceptionSeh(diagnostics, _ReturnAddress(), supported, functor); } @@ -4577,8 +4579,8 @@ namespace details } template - inline __declspec(noinline) RESULT_NORETURN void ReportFailure_NoReturn( - __R_FN_PARAMS_FULL, const ResultStatus& resultPair, PCWSTR message, ReportFailureOptions options) + inline __declspec(noinline) RESULT_NORETURN + void ReportFailure_NoReturn(__R_FN_PARAMS_FULL, const ResultStatus& resultPair, PCWSTR message, ReportFailureOptions options) { bool needPlatformException = ((T == FailureType::Exception) && WI_IsFlagClear(options, ReportFailureOptions::MayRethrow) && @@ -4812,13 +4814,15 @@ namespace details } template <> - __declspec(noinline) inline RESULT_NORETURN void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr, FailureFlags) + __declspec(noinline) inline RESULT_NORETURN + void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr, FailureFlags) { ReportFailure_Base(__R_FN_CALL_FULL, ResultStatus::FromResult(hr)); } template <> - __declspec(noinline) inline RESULT_NORETURN void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr, FailureFlags) + __declspec(noinline) inline RESULT_NORETURN + void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr, FailureFlags) { ReportFailure_Base(__R_FN_CALL_FULL, ResultStatus::FromResult(hr)); } @@ -4969,7 +4973,7 @@ namespace details template <> __declspec(noinline) inline RESULT_NORETURN HRESULT - ReportFailure_CaughtException(__R_FN_PARAMS_FULL, SupportedExceptions supported) + ReportFailure_CaughtException(__R_FN_PARAMS_FULL, SupportedExceptions supported) { wchar_t message[2048]{}; RESULT_NORETURN_RESULT( @@ -4978,7 +4982,7 @@ namespace details template <> __declspec(noinline) inline RESULT_NORETURN HRESULT - ReportFailure_CaughtException(__R_FN_PARAMS_FULL, SupportedExceptions supported) + ReportFailure_CaughtException(__R_FN_PARAMS_FULL, SupportedExceptions supported) { wchar_t message[2048]{}; RESULT_NORETURN_RESULT( @@ -4992,15 +4996,15 @@ namespace details } template <> - __declspec(noinline) inline RESULT_NORETURN void ReportFailure_HrMsg( - __R_FN_PARAMS_FULL, HRESULT hr, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline RESULT_NORETURN + void ReportFailure_HrMsg(__R_FN_PARAMS_FULL, HRESULT hr, _Printf_format_string_ PCSTR formatString, va_list argList) { ReportFailure_Msg(__R_FN_CALL_FULL, ResultStatus::FromResult(hr), formatString, argList); } template <> - __declspec(noinline) inline RESULT_NORETURN void ReportFailure_HrMsg( - __R_FN_PARAMS_FULL, HRESULT hr, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline RESULT_NORETURN + void ReportFailure_HrMsg(__R_FN_PARAMS_FULL, HRESULT hr, _Printf_format_string_ PCSTR formatString, va_list argList) { ReportFailure_Msg(__R_FN_CALL_FULL, ResultStatus::FromResult(hr), formatString, argList); } @@ -5008,7 +5012,8 @@ namespace details template _Success_(true) _Translates_Win32_to_HRESULT_(err) - __declspec(noinline) inline HRESULT ReportFailure_Win32Msg(__R_FN_PARAMS_FULL, DWORD err, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline HRESULT + ReportFailure_Win32Msg(__R_FN_PARAMS_FULL, DWORD err, _Printf_format_string_ PCSTR formatString, va_list argList) { auto hr = __HRESULT_FROM_WIN32(err); ReportFailure_Msg(__R_FN_CALL_FULL, ResultStatus::FromResult(hr), formatString, argList); @@ -5038,7 +5043,8 @@ namespace details } template - __declspec(noinline) inline DWORD ReportFailure_GetLastErrorMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline DWORD + ReportFailure_GetLastErrorMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) { auto err = GetLastErrorFail(__R_FN_CALL_FULL); auto hr = __HRESULT_FROM_WIN32(err); @@ -5048,8 +5054,8 @@ namespace details } template <> - __declspec(noinline) inline RESULT_NORETURN DWORD - ReportFailure_GetLastErrorMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline RESULT_NORETURN DWORD ReportFailure_GetLastErrorMsg( + __R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) { auto err = GetLastErrorFail(__R_FN_CALL_FULL); auto hr = __HRESULT_FROM_WIN32(err); @@ -5070,7 +5076,8 @@ namespace details template _Success_(true) _Translates_last_error_to_HRESULT_ - __declspec(noinline) inline HRESULT ReportFailure_GetLastErrorHrMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline HRESULT + ReportFailure_GetLastErrorHrMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) { auto hr = GetLastErrorFailHr(__R_FN_CALL_FULL); ReportFailure_Msg(__R_FN_CALL_FULL, ResultStatus::FromResult(hr), formatString, argList); @@ -5102,8 +5109,8 @@ namespace details template _Success_(true) _Translates_NTSTATUS_to_HRESULT_(status) - __declspec(noinline) inline HRESULT ReportFailure_NtStatusMsg( - __R_FN_PARAMS_FULL, NTSTATUS status, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline HRESULT + ReportFailure_NtStatusMsg(__R_FN_PARAMS_FULL, NTSTATUS status, _Printf_format_string_ PCSTR formatString, va_list argList) { const auto resultPair = ResultStatus::FromStatus(status); ReportFailure_Msg(__R_FN_CALL_FULL, resultPair, formatString, argList); @@ -5133,7 +5140,8 @@ namespace details } template - __declspec(noinline) inline HRESULT ReportFailure_CaughtExceptionMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) + __declspec(noinline) inline HRESULT + ReportFailure_CaughtExceptionMsg(__R_FN_PARAMS_FULL, _Printf_format_string_ PCSTR formatString, va_list argList) { // Pre-populate the buffer with our message, the exception message will be added to it... wchar_t message[2048]; @@ -5242,8 +5250,8 @@ namespace details } template - __declspec(noinline) RESULT_NORETURN inline void ReportFailure_CustomExceptionMsg( - __R_FN_PARAMS _In_ T exception, _In_ _Printf_format_string_ PCSTR formatString, ...) + __declspec(noinline) RESULT_NORETURN + inline void ReportFailure_CustomExceptionMsg(__R_FN_PARAMS _In_ T exception, _In_ _Printf_format_string_ PCSTR formatString, ...) { va_list argList; va_start(argList, formatString); diff --git a/include/wil/win32_helpers.h b/include/wil/win32_helpers.h index fb9595823..592ada374 100644 --- a/include/wil/win32_helpers.h +++ b/include/wil/win32_helpers.h @@ -206,7 +206,7 @@ namespace filetime_duration long long const one_minute = 10000000LL * 60; // 600000000 or 600000000LL long long const one_hour = 10000000LL * 60 * 60; // 36000000000 or 36000000000LL long long const one_day = 10000000LL * 60 * 60 * 24; // 864000000000 or 864000000000LL -} // namespace filetime_duration +}; // namespace filetime_duration namespace filetime { diff --git a/include/wil/winrt.h b/include/wil/winrt.h index c099fea92..0bcfda4f4 100644 --- a/include/wil/winrt.h +++ b/include/wil/winrt.h @@ -184,42 +184,41 @@ namespace details } template - static auto equals(LhsT&& lhs, RhsT&& rhs) - WI_NOEXCEPT -> decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) + static auto equals(LhsT&& lhs, RhsT&& rhs) WI_NOEXCEPT->decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) { return compare(wistd::forward(lhs), wistd::forward(rhs)) == CSTR_EQUAL; } template static auto not_equals(LhsT&& lhs, RhsT&& rhs) - WI_NOEXCEPT -> decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) + WI_NOEXCEPT->decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) { return compare(wistd::forward(lhs), wistd::forward(rhs)) != CSTR_EQUAL; } template - static auto less(LhsT&& lhs, RhsT&& rhs) WI_NOEXCEPT -> decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) + static auto less(LhsT&& lhs, RhsT&& rhs) WI_NOEXCEPT->decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) { return compare(wistd::forward(lhs), wistd::forward(rhs)) == CSTR_LESS_THAN; } template static auto less_equals(LhsT&& lhs, RhsT&& rhs) - WI_NOEXCEPT -> decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) + WI_NOEXCEPT->decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) { return compare(wistd::forward(lhs), wistd::forward(rhs)) != CSTR_GREATER_THAN; } template static auto greater(LhsT&& lhs, RhsT&& rhs) - WI_NOEXCEPT -> decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) + WI_NOEXCEPT->decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) { return compare(wistd::forward(lhs), wistd::forward(rhs)) == CSTR_GREATER_THAN; } template static auto greater_equals(LhsT&& lhs, RhsT&& rhs) - WI_NOEXCEPT -> decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) + WI_NOEXCEPT->decltype(compare(wistd::forward(lhs), wistd::forward(rhs)), bool()) { return compare(wistd::forward(lhs), wistd::forward(rhs)) != CSTR_LESS_THAN; } @@ -1403,7 +1402,7 @@ namespace Windows return typename wil::iterable_range::iterable_iterator(); } } // namespace Collections - } // namespace Foundation + } // namespace Foundation } // namespace Windows #if defined(MIDL_NS_PREFIX) || defined(____x_ABI_CWindows_CFoundation_CIClosable_FWD_DEFINED__) } // namespace ABI diff --git a/include/wil/wistd_type_traits.h b/include/wil/wistd_type_traits.h index 417f7fc96..d79211e7a 100644 --- a/include/wil/wistd_type_traits.h +++ b/include/wil/wistd_type_traits.h @@ -1194,7 +1194,9 @@ using type_identity_t = typename type_identity<_Tp>::type; // is_signed template ::value> -struct __libcpp_is_signed_impl : public __WI_LIBCPP_BOOL_CONSTANT(_Tp(-1) < _Tp(0)){}; +struct __libcpp_is_signed_impl : public __WI_LIBCPP_BOOL_CONSTANT(_Tp(-1) < _Tp(0)) +{ +}; template struct __libcpp_is_signed_impl<_Tp, false> : public true_type @@ -1224,7 +1226,9 @@ __WI_LIBCPP_INLINE_VAR __WI_LIBCPP_CONSTEXPR bool is_signed_v = is_signed<_Tp>:: // is_unsigned template ::value> -struct __libcpp_is_unsigned_impl : public __WI_LIBCPP_BOOL_CONSTANT(_Tp(0) < _Tp(-1)){}; +struct __libcpp_is_unsigned_impl : public __WI_LIBCPP_BOOL_CONSTANT(_Tp(0) < _Tp(-1)) +{ +}; template struct __libcpp_is_unsigned_impl<_Tp, false> : public false_type @@ -4689,7 +4693,7 @@ namespace __detail { static const bool value = #ifndef __WI_LIBCPP_HAS_NO_NOEXCEPT - noexcept(swap_wil(declval<_Tp>(), declval<_Up>())) && noexcept(swap_wil(declval<_Up>(), declval<_Tp>())); + noexcept(swap_wil(declval<_Tp>(), declval<_Up>()))&& noexcept(swap_wil(declval<_Up>(), declval<_Tp>())); #else false; #endif diff --git a/tests/ComTests.cpp b/tests/ComTests.cpp index e6bc228e5..0ede5ff9b 100644 --- a/tests/ComTests.cpp +++ b/tests/ComTests.cpp @@ -638,9 +638,8 @@ interface __declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20a05")) IAlways : pub STDMETHOD_(void, Always)() = 0; }; -class __declspec(empty_bases) -__declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20b00")) // non-implemented to allow QI for the class to be attempted (and fail) -ComObject +class __declspec(empty_bases) __declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20b00")) // non-implemented to allow QI for the class to be attempted (and fail) + ComObject : witest::AllocatedObject, public Microsoft::WRL::RuntimeClass, Microsoft::WRL::ChainInterfaces, IAlways> { @@ -656,9 +655,8 @@ ComObject } }; -class __declspec(empty_bases) -__declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20b01")) // non-implemented to allow QI for the class to be attempted (and fail) -WinRtObject +class __declspec(empty_bases) __declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20b01")) // non-implemented to allow QI for the class to be attempted (and fail) + WinRtObject : witest::AllocatedObject, public Microsoft::WRL:: RuntimeClass, ITest, IDerivedTest, ITestInspectable, IDerivedTestInspectable, IAlways, Microsoft::WRL::FtmBase> diff --git a/tests/CppWinRTAuthoringTests.cpp b/tests/CppWinRTAuthoringTests.cpp index 56b8a294f..6053587e4 100644 --- a/tests/CppWinRTAuthoringTests.cpp +++ b/tests/CppWinRTAuthoringTests.cpp @@ -19,8 +19,8 @@ struct my_async_status : winrt::implements ErrorCode; wil::single_threaded_property Id{16}; - void Cancel() {}; - void Close() {}; + void Cancel(){}; + void Close(){}; }; // This type has a settable property diff --git a/tests/ResourceTests.cpp b/tests/ResourceTests.cpp index 6658265d6..19ca2b1a3 100644 --- a/tests/ResourceTests.cpp +++ b/tests/ResourceTests.cpp @@ -147,7 +147,7 @@ class __declspec(empty_bases) PointerTestObject public Microsoft::WRL::RuntimeClass, ITest> { public: - STDMETHOD_(void, Test)() {}; + STDMETHOD_(void, Test)(){}; }; TEST_CASE("ResourceTests::TestOperationsOnGenericSmartPointerClasses", "[resource]") From ac54c33ed03a3e26d5c5fd4cde386723e0cfb58f Mon Sep 17 00:00:00 2001 From: Duncan Horn Date: Thu, 2 Jan 2025 12:18:37 -0800 Subject: [PATCH 12/12] Update with OS --- include/wil/Tracelogging.h | 8 +++++++- include/wil/com.h | 2 +- include/wil/win32_helpers.h | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/wil/Tracelogging.h b/include/wil/Tracelogging.h index bf2831e7b..e8934e5a0 100644 --- a/include/wil/Tracelogging.h +++ b/include/wil/Tracelogging.h @@ -6444,7 +6444,13 @@ namespace details if (*lastNamespaceNode) { - root.swap((*lastNamespaceNode)->next); + // Delete everything from the current root to the lastNamespaceNode + // (inclusive), considering the possibility that they are the same. Continue + // processing from the node following lastNamespaceNode, if any. root will + // be made to point to that. + auto newRoot = wistd::move((*lastNamespaceNode)->next); + const auto toDelete = wistd::move(root); + root = wistd::move(newRoot); } else { diff --git a/include/wil/com.h b/include/wil/com.h index 5f38143b8..80c6d1e70 100644 --- a/include/wil/com.h +++ b/include/wil/com.h @@ -3331,7 +3331,7 @@ namespace details { inline void CoDisableCallCancellationNull() { - ::CoDisableCallCancellation(nullptr); + (void)::CoDisableCallCancellation(nullptr); } } // namespace details diff --git a/include/wil/win32_helpers.h b/include/wil/win32_helpers.h index 592ada374..0baed75a5 100644 --- a/include/wil/win32_helpers.h +++ b/include/wil/win32_helpers.h @@ -49,6 +49,8 @@ #endif /// @endcond +EXTERN_C IMAGE_DOS_HEADER __ImageBase; + /// @cond namespace wistd { @@ -686,6 +688,7 @@ inline DWORD GetCurrentProcessExecutionOption(PCWSTR valueName, DWORD defaultVal return defaultValue; } +#ifndef DebugBreak // Some code defines 'DebugBreak' to garbage to force build breaks in release builds // Waits for a debugger to attach to the current process based on registry configuration. // // Example: @@ -717,6 +720,7 @@ inline void WaitForDebuggerPresent(bool checkRegistryConfig = true) Sleep(500); } } +#endif #endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM) #endif @@ -724,7 +728,6 @@ inline void WaitForDebuggerPresent(bool checkRegistryConfig = true) /** Retrieve the HINSTANCE for the current DLL or EXE using this symbol that the linker provides for every module. This avoids the need for a global HINSTANCE variable and provides access to this value for static libraries. */ -EXTERN_C IMAGE_DOS_HEADER __ImageBase; inline HINSTANCE GetModuleInstanceHandle() WI_NOEXCEPT { return reinterpret_cast(&__ImageBase);