diff --git a/include/wil/Tracelogging.h b/include/wil/Tracelogging.h index e32599bf..e8934e5a 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): @@ -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 be3fdd95..5d40f903 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/common.h b/include/wil/common.h index ec420e94..55fc4d38 100644 --- a/include/wil/common.h +++ b/include/wil/common.h @@ -712,32 +712,32 @@ boolean, BOOLEAN, and classes with an explicit bool cast. @param val The logical bool expression @return A C++ bool representing the evaluation of `val`. */ template -_Post_satisfies_(return == static_cast(val)) __forceinline constexpr bool verify_bool(const T& val) WI_NOEXCEPT +_Post_satisfies_(return == static_cast(val)) inline constexpr bool verify_bool(const T& val) WI_NOEXCEPT { return static_cast(val); } template -__forceinline constexpr bool verify_bool(T /*val*/) WI_NOEXCEPT +inline constexpr bool verify_bool(T /*val*/) WI_NOEXCEPT { static_assert(!wistd::is_same::value, "Wrong Type: bool/BOOL/BOOLEAN/boolean expected"); return false; } template <> -_Post_satisfies_(return == val) __forceinline constexpr bool verify_bool(bool val) WI_NOEXCEPT +_Post_satisfies_(return == val) inline constexpr bool verify_bool(bool val) WI_NOEXCEPT { return val; } template <> -_Post_satisfies_(return == (val != 0)) __forceinline constexpr bool verify_bool(int val) WI_NOEXCEPT +_Post_satisfies_(return == (val != 0)) inline constexpr bool verify_bool(int val) WI_NOEXCEPT { return (val != 0); } template <> -_Post_satisfies_(return == (val != 0)) __forceinline constexpr bool verify_bool(unsigned char val) WI_NOEXCEPT +_Post_satisfies_(return == (val != 0)) inline constexpr bool verify_bool(unsigned char val) WI_NOEXCEPT { return (val != 0); } @@ -748,7 +748,7 @@ accept any `int` value as long as that is the underlying typedef behind `BOOL`. @param val The Win32 BOOL returning expression @return A Win32 BOOL representing the evaluation of `val`. */ template -_Post_satisfies_(return == val) __forceinline constexpr int verify_BOOL(T val) WI_NOEXCEPT +_Post_satisfies_(return == val) inline constexpr int verify_BOOL(T val) WI_NOEXCEPT { // Note: Written in terms of 'int' as BOOL is actually: typedef int BOOL; static_assert((wistd::is_same::value), "Wrong Type: BOOL expected"); diff --git a/include/wil/result.h b/include/wil/result.h index 178fde36..b1094fa8 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 66ab5381..41adca17 100644 --- a/include/wil/result_macros.h +++ b/include/wil/result_macros.h @@ -3432,7 +3432,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); @@ -3440,7 +3440,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/win32_helpers.h b/include/wil/win32_helpers.h index c68891ce..3c339ae0 100644 --- a/include/wil/win32_helpers.h +++ b/include/wil/win32_helpers.h @@ -49,6 +49,8 @@ #include "wistd_functional.h" #include "wistd_type_traits.h" +EXTERN_C IMAGE_DOS_HEADER __ImageBase; + /// @cond namespace wistd { @@ -680,6 +682,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: @@ -711,6 +714,7 @@ inline void WaitForDebuggerPresent(bool checkRegistryConfig = true) Sleep(500); } } +#endif #endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM) #endif @@ -718,7 +722,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); diff --git a/scripts/azure-pipelines.yml b/scripts/azure-pipelines.yml index 616f6a4c..bc99e2ee 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 diff exit /b 1 ) displayName: 'Check Formatting of Changes'