Skip to content

Commit b6ec76a

Browse files
dunhorjonwis
andauthored
Sync with OS commit e49da3383412c8ae51acb09f6f1efdd5760a0733 (#486)
* Sync with c027f28954dcfc8ce4b9040d57b94680cfe72971 * Sync with OS commit 39bc95ee863de17875c268e451901be343c05894 * Fix break * Sync with OS commit 6e3099ac18718043334c9e8277b772aa1c46cedd * Format * Use most recent version of Clang for formatting * Apparently there was a breaking change in clang-format :( * Print changes * Escape parens * Helps if I run the correct command... * Revert "Format" This reverts commit af192f5. * Update with OS * Sync with DEEP branch * Sync with e49da3383412c8ae51acb09f6f1efdd5760a0733 * format --------- Co-authored-by: Jon Wiswall <jonwis@microsoft.com>
1 parent e8f67c3 commit b6ec76a

7 files changed

Lines changed: 31 additions & 14 deletions

File tree

include/wil/Tracelogging.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
#define _wiltlg_STRINGIZE_imp(x) #x
6666
#define _wiltlg_LSTRINGIZE(x) _wiltlg_LSTRINGIZE_imp1(x)
6767
#define _wiltlg_LSTRINGIZE_imp1(x) _wiltlg_LSTRINGIZE_imp2(#x)
68-
#define _wiltlg_LSTRINGIZE_imp2(s) L##s
68+
#define _wiltlg_LSTRINGIZE_imp2(s) L"" #s
6969

7070
/*
7171
Macro __TRACELOGGING_DEFINE_PROVIDER_STORAGE_LINK(name1, name2):
@@ -6445,7 +6445,13 @@ namespace details
64456445

64466446
if (*lastNamespaceNode)
64476447
{
6448-
root.swap((*lastNamespaceNode)->next);
6448+
// Delete everything from the current root to the lastNamespaceNode
6449+
// (inclusive), considering the possibility that they are the same. Continue
6450+
// processing from the node following lastNamespaceNode, if any. root will
6451+
// be made to point to that.
6452+
auto newRoot = wistd::move((*lastNamespaceNode)->next);
6453+
const auto toDelete = wistd::move(root);
6454+
root = wistd::move(newRoot);
64496455
}
64506456
else
64516457
{

include/wil/com.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3322,7 +3322,7 @@ WI_NODISCARD auto make_range(IEnumXxx* enumPtr)
33223322
return iterator_range(enumPtr);
33233323
}
33243324

3325-
template <typename TEnum, typename = std::enable_if_t<wil::details::has_next_v<TEnum*>>>
3325+
template <typename TEnum, typename = wistd::enable_if_t<wil::details::has_next_v<TEnum*>>>
33263326
auto make_range(const wil::com_ptr<TEnum>& e)
33273327
{
33283328
using Enumerated = typename wil::details::com_enumerator_traits<TEnum>::smart_result;
@@ -3352,7 +3352,7 @@ namespace details
33523352
{
33533353
inline void CoDisableCallCancellationNull()
33543354
{
3355-
::CoDisableCallCancellation(nullptr);
3355+
(void)::CoDisableCallCancellation(nullptr);
33563356
}
33573357
} // namespace details
33583358

include/wil/common.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -712,32 +712,32 @@ boolean, BOOLEAN, and classes with an explicit bool cast.
712712
@param val The logical bool expression
713713
@return A C++ bool representing the evaluation of `val`. */
714714
template <typename T, __R_ENABLE_IF_IS_CLASS(T)>
715-
_Post_satisfies_(return == static_cast<bool>(val)) __forceinline constexpr bool verify_bool(const T& val) WI_NOEXCEPT
715+
_Post_satisfies_(return == static_cast<bool>(val)) inline constexpr bool verify_bool(const T& val) WI_NOEXCEPT
716716
{
717717
return static_cast<bool>(val);
718718
}
719719

720720
template <typename T, __R_ENABLE_IF_IS_NOT_CLASS(T)>
721-
__forceinline constexpr bool verify_bool(T /*val*/) WI_NOEXCEPT
721+
inline constexpr bool verify_bool(T /*val*/) WI_NOEXCEPT
722722
{
723723
static_assert(!wistd::is_same<T, T>::value, "Wrong Type: bool/BOOL/BOOLEAN/boolean expected");
724724
return false;
725725
}
726726

727727
template <>
728-
_Post_satisfies_(return == val) __forceinline constexpr bool verify_bool<bool>(bool val) WI_NOEXCEPT
728+
_Post_satisfies_(return == val) inline constexpr bool verify_bool<bool>(bool val) WI_NOEXCEPT
729729
{
730730
return val;
731731
}
732732

733733
template <>
734-
_Post_satisfies_(return == (val != 0)) __forceinline constexpr bool verify_bool<int>(int val) WI_NOEXCEPT
734+
_Post_satisfies_(return == (val != 0)) inline constexpr bool verify_bool<int>(int val) WI_NOEXCEPT
735735
{
736736
return (val != 0);
737737
}
738738

739739
template <>
740-
_Post_satisfies_(return == (val != 0)) __forceinline constexpr bool verify_bool<unsigned char>(unsigned char val) WI_NOEXCEPT
740+
_Post_satisfies_(return == (val != 0)) inline constexpr bool verify_bool<unsigned char>(unsigned char val) WI_NOEXCEPT
741741
{
742742
return (val != 0);
743743
}
@@ -748,7 +748,7 @@ accept any `int` value as long as that is the underlying typedef behind `BOOL`.
748748
@param val The Win32 BOOL returning expression
749749
@return A Win32 BOOL representing the evaluation of `val`. */
750750
template <typename T>
751-
_Post_satisfies_(return == val) __forceinline constexpr int verify_BOOL(T val) WI_NOEXCEPT
751+
_Post_satisfies_(return == val) inline constexpr int verify_BOOL(T val) WI_NOEXCEPT
752752
{
753753
// Note: Written in terms of 'int' as BOOL is actually: typedef int BOOL;
754754
static_assert((wistd::is_same<T, int>::value), "Wrong Type: BOOL expected");

include/wil/result.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ namespace details_abi
435435
private:
436436
struct Node
437437
{
438-
DWORD threadId = 0xffffffff; // MAXDWORD
438+
DWORD threadId = 0xffffffffu;
439439
Node* pNext = nullptr;
440440
T value{};
441441
};

include/wil/result_macros.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2521,6 +2521,8 @@ namespace details
25212521
#if __clang_major__ >= 13
25222522
__WI_CLANG_DISABLE_WARNING(-Wunused-but-set-variable) // s_hrErrorLast used for debugging. We intentionally only assign to it
25232523
#endif
2524+
__WI_MSVC_DISABLE_WARNING(4746) // s_hrErrorLast' is subject to /volatile:<iso|ms> setting; consider using __iso_volatile_load/store intrinsic functions
2525+
25242526
__declspec(noinline) inline int RecordException(HRESULT hr) WI_NOEXCEPT
25252527
{
25262528
static HRESULT volatile s_hrErrorLast = S_OK;
@@ -2602,6 +2604,8 @@ namespace details
26022604
return true;
26032605
}
26042606

2607+
__WI_PUSH_WARNINGS
2608+
__WI_MSVC_DISABLE_WARNING(4746) // s_fModuleValid' is subject to /volatile:<iso|ms> setting; consider using __iso_volatile_load/store intrinsic functions
26052609
inline PCSTR __stdcall GetCurrentModuleName() WI_NOEXCEPT
26062610
{
26072611
static char s_szModule[64] = {};
@@ -2613,6 +2617,7 @@ namespace details
26132617
}
26142618
return s_szModule;
26152619
}
2620+
__WI_POP_WARNINGS
26162621

26172622
inline void __stdcall DebugBreak() WI_NOEXCEPT
26182623
{
@@ -3431,15 +3436,15 @@ class ResultException : public std::exception
34313436
}
34323437

34333438
//! Returns the failed HRESULT that this exception represents.
3434-
_Always_(_Post_satisfies_(return < 0)) WI_NODISCARD HRESULT GetErrorCode() const WI_NOEXCEPT
3439+
WI_NODISCARD _Always_(_Post_satisfies_(return < 0)) HRESULT GetErrorCode() const WI_NOEXCEPT
34353440
{
34363441
HRESULT const hr = m_failure.GetFailureInfo().hr;
34373442
__analysis_assume(hr < 0);
34383443
return hr;
34393444
}
34403445

34413446
//! Returns the failed NTSTATUS that this exception represents.
3442-
_Always_(_Post_satisfies_(return < 0)) WI_NODISCARD NTSTATUS GetStatusCode() const WI_NOEXCEPT
3447+
WI_NODISCARD _Always_(_Post_satisfies_(return < 0)) NTSTATUS GetStatusCode() const WI_NOEXCEPT
34433448
{
34443449
NTSTATUS const status = m_failure.GetFailureInfo().status;
34453450
__analysis_assume(status < 0);

include/wil/win32_helpers.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
#include "wistd_functional.h"
5151
#include "wistd_type_traits.h"
5252

53+
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
54+
5355
/// @cond
5456
namespace wistd
5557
{
@@ -681,6 +683,7 @@ inline DWORD GetCurrentProcessExecutionOption(PCWSTR valueName, DWORD defaultVal
681683
return defaultValue;
682684
}
683685

686+
#ifndef DebugBreak // Some code defines 'DebugBreak' to garbage to force build breaks in release builds
684687
// Waits for a debugger to attach to the current process based on registry configuration.
685688
//
686689
// Example:
@@ -712,14 +715,14 @@ inline void WaitForDebuggerPresent(bool checkRegistryConfig = true)
712715
Sleep(500);
713716
}
714717
}
718+
#endif
715719
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
716720

717721
#endif
718722

719723
/** Retrieve the HINSTANCE for the current DLL or EXE using this symbol that
720724
the linker provides for every module. This avoids the need for a global HINSTANCE variable
721725
and provides access to this value for static libraries. */
722-
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
723726
inline HINSTANCE GetModuleInstanceHandle() WI_NOEXCEPT
724727
{
725728
return reinterpret_cast<HINSTANCE>(&__ImageBase);

scripts/azure-pipelines.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ jobs:
3131
echo NOTE: As an additional note, given that different versions of 'clang-format' may have different behaviors, this
3232
echo may be a false positive. If you believe that to be the case ^(e.g. none of the above resulted in modifications
3333
echo to the code you have changed^), please note this in your PR.
34+
echo ----------------------------------------------
35+
echo See below for the file^(s^) that have changed:
36+
git diff
3437
exit /b 1
3538
)
3639
displayName: 'Check Formatting of Changes'

0 commit comments

Comments
 (0)