Skip to content

Commit 832d0c5

Browse files
authored
Sync with c027f28954dcfc8ce4b9040d57b94680cfe72971 (#427)
1 parent 8501377 commit 832d0c5

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

include/wil/resource.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6214,14 +6214,18 @@ typedef weak_any<shared_mdd_package_dependency_context> weak_mdd_package_depende
62146214
/// @cond
62156215
#define __WIL_APISETLIBLOADER_
62166216
/// @endcond
6217+
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM)
62176218
typedef unique_any<DLL_DIRECTORY_COOKIE, decltype(&::RemoveDllDirectory), ::RemoveDllDirectory> unique_dll_directory_cookie;
6219+
#endif
62186220
#endif // __WIL_APISETLIBLOADER_
62196221
#if (defined(_APISETLIBLOADER_) && !defined(__WIL_APISETLIBLOADER_STL) && defined(WIL_RESOURCE_STL)) || defined(WIL_DOXYGEN)
62206222
/// @cond
62216223
#define __WIL_APISETLIBLOADER_STL
62226224
/// @endcond
6225+
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM)
62236226
typedef shared_any<unique_dll_directory_cookie> shared_dll_directory_cookie;
62246227
typedef weak_any<shared_dll_directory_cookie> weak_dll_directory_cookie;
6228+
#endif
62256229
#endif // __WIL_APISETLIBLOADER_STL
62266230

62276231
#if (defined(WDFAPI) && !defined(__WIL_WDFAPI)) || defined(WIL_DOXYGEN)

include/wil/result_macros.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ WI_ODR_PRAGMA("WIL_FreeMemory", "0")
12611261
} while ((void)0, 0)
12621262

12631263
// Like 'FAIL_FAST_IF', but raises an assertion failure first for easier debugging
1264-
#define FAIL_FAST_ASSERT(condition) \
1264+
#define WI_FAIL_FAST_ASSERT(condition) \
12651265
do \
12661266
{ \
12671267
if (!wil::verify_bool(condition)) \
@@ -1270,7 +1270,7 @@ WI_ODR_PRAGMA("WIL_FreeMemory", "0")
12701270
__RFF_FN(FailFast_Unexpected)(__RFF_INFO_ONLY(#condition)) \
12711271
} \
12721272
} while (0, 0)
1273-
#define FAIL_FAST_ASSERT_MSG(condition, msg) \
1273+
#define WI_FAIL_FAST_ASSERT_MSG(condition, msg) \
12741274
do \
12751275
{ \
12761276
if (!wil::verify_bool(condition)) \

include/wil/winrt.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -827,9 +827,9 @@ class vector_range_nothrow
827827
WI_NODISCARD pointer operator->() const
828828
{
829829
#if WIL_ITERATOR_DEBUG_LEVEL > 0
830-
FAIL_FAST_ASSERT_MSG(m_version == m_range->m_version, "Dereferencing an out-of-date vector_iterator_nothrow");
831-
FAIL_FAST_ASSERT_MSG(SUCCEEDED(*m_range->m_result), "Dereferencing a vector_iterator_nothrow in a failed state");
832-
FAIL_FAST_ASSERT_MSG(m_i < m_range->m_size, "Dereferencing an 'end' iterator");
830+
WI_FAIL_FAST_ASSERT_MSG(m_version == m_range->m_version, "Dereferencing an out-of-date vector_iterator_nothrow");
831+
WI_FAIL_FAST_ASSERT_MSG(SUCCEEDED(*m_range->m_result), "Dereferencing a vector_iterator_nothrow in a failed state");
832+
WI_FAIL_FAST_ASSERT_MSG(m_i < m_range->m_size, "Dereferencing an 'end' iterator");
833833
#endif
834834
return wistd::addressof(m_range->m_currentElement);
835835
}
@@ -863,13 +863,13 @@ class vector_range_nothrow
863863
#if WIL_ITERATOR_DEBUG_LEVEL == 2
864864
// This is _technically_ safe because we are not reading the out-of-date cached value, however having two active
865865
// copies of iterators is generally a sign of problematic code with a bug waiting to happen
866-
FAIL_FAST_ASSERT_MSG(
866+
WI_FAIL_FAST_ASSERT_MSG(
867867
m_version == m_range->m_version, "Incrementing/decrementing an out-of-date copy of a vector_iterator_nothrow");
868868
#endif
869869
m_i += n;
870870
#if WIL_ITERATOR_DEBUG_LEVEL > 0
871871
// NOTE: 'm_i' is unsigned, hence the single check for increment/decrement
872-
FAIL_FAST_ASSERT_MSG(m_i <= m_range->m_size, "Incrementing/decrementing a vector_iterator_nothrow out of range");
872+
WI_FAIL_FAST_ASSERT_MSG(m_i <= m_range->m_size, "Incrementing/decrementing a vector_iterator_nothrow out of range");
873873
#endif
874874
m_range->get_at_current(m_i);
875875
#if WIL_ITERATOR_DEBUG_LEVEL > 0
@@ -1205,9 +1205,9 @@ class iterable_range_nothrow
12051205
WI_NODISCARD pointer operator->() const WI_NOEXCEPT
12061206
{
12071207
#if WIL_ITERATOR_DEBUG_LEVEL > 0
1208-
FAIL_FAST_ASSERT_MSG(SUCCEEDED(*m_range->m_result), "Dereferencing an iterable_iterator_nothrow in a failed state");
1209-
FAIL_FAST_ASSERT_MSG(m_i >= 0, "Dereferencing an 'end' iterator");
1210-
FAIL_FAST_ASSERT_MSG(m_i == m_range->m_index, "Dereferencing an out-of-date iterable_iterator_nothrow");
1208+
WI_FAIL_FAST_ASSERT_MSG(SUCCEEDED(*m_range->m_result), "Dereferencing an iterable_iterator_nothrow in a failed state");
1209+
WI_FAIL_FAST_ASSERT_MSG(m_i >= 0, "Dereferencing an 'end' iterator");
1210+
WI_FAIL_FAST_ASSERT_MSG(m_i == m_range->m_index, "Dereferencing an out-of-date iterable_iterator_nothrow");
12111211
#endif
12121212
return wistd::addressof(m_range->m_element);
12131213
}
@@ -1216,8 +1216,8 @@ class iterable_range_nothrow
12161216
{
12171217
#if WIL_ITERATOR_DEBUG_LEVEL > 0
12181218
// Failing this check is always bad because the iterator object we hold always advances forward
1219-
FAIL_FAST_ASSERT_MSG(m_i >= 0, "Incrementing an end iterator");
1220-
FAIL_FAST_ASSERT_MSG(m_i == m_range->m_index, "Incrementing an out-of-date copy of an iterable_iterator_nothrow");
1219+
WI_FAIL_FAST_ASSERT_MSG(m_i >= 0, "Incrementing an end iterator");
1220+
WI_FAIL_FAST_ASSERT_MSG(m_i == m_range->m_index, "Incrementing an out-of-date copy of an iterable_iterator_nothrow");
12211221
#endif
12221222
boolean hasCurrent;
12231223
*m_range->m_result = m_range->m_iterator->MoveNext(&hasCurrent);
@@ -1260,7 +1260,7 @@ class iterable_range_nothrow
12601260
#if WIL_ITERATOR_DEBUG_LEVEL == 2
12611261
// The IIterator we hold only advances forward; we can't reset it back to the beginning. Calling this method more than
12621262
// once will very likely lead to unexpected behavior.
1263-
FAIL_FAST_ASSERT_MSG(m_index == 0, "Calling begin() on an already advanced iterable_range_nothrow");
1263+
WI_FAIL_FAST_ASSERT_MSG(m_index == 0, "Calling begin() on an already advanced iterable_range_nothrow");
12641264
#endif
12651265
return iterable_iterator_nothrow(this, this->m_iterator ? 0 : -1);
12661266
}

0 commit comments

Comments
 (0)