From 938383eda4175bfd759f8e3bed0ff01cf21e46c6 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Sun, 3 Nov 2024 20:22:40 -0800 Subject: [PATCH] Use C++17 deprecated attribute when supported (#219) --- .nuget/directxmath.nuspec | 2 +- Inc/DirectXMath.h | 6 ++++-- Inc/DirectXPackedVector.h | 38 +++++++++++++++++++++++++++++------ Inc/DirectXPackedVector.inl | 40 +++++++++++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 9 deletions(-) diff --git a/.nuget/directxmath.nuspec b/.nuget/directxmath.nuspec index fcf23d0..1c15fdb 100644 --- a/.nuget/directxmath.nuspec +++ b/.nuget/directxmath.nuspec @@ -8,7 +8,7 @@ microsoft,directxtk DirectXMath is an all inline SIMD C++ linear algebra library for use in games and graphics apps. The DirectXMath API provides SIMD-friendly C++ types and functions for common linear algebra and graphics math operations common to DirectX applications. The library provides optimized versions for Windows 32-bit (x86), Windows 64-bit (x64), and Windows on ARM through SSE2 and ARM-NEON intrinsics support in the Visual Studio compiler. - Matches the February 2024 release. + Matches the October 2024 release. http://go.microsoft.com/fwlink/?LinkID=615560 images\icon.jpg diff --git a/Inc/DirectXMath.h b/Inc/DirectXMath.h index dc9f565..256db66 100644 --- a/Inc/DirectXMath.h +++ b/Inc/DirectXMath.h @@ -32,7 +32,9 @@ #endif #ifndef XM_DEPRECATED -#ifdef __GNUC__ +#if (__cplusplus >= 201402L) +#define XM_DEPRECATED [[deprecated]] +#elif defined(__GNUC__) #define XM_DEPRECATED __attribute__ ((deprecated)) #else #define XM_DEPRECATED __declspec(deprecated("This is deprecated and will be removed in a future version.")) @@ -164,7 +166,7 @@ #pragma warning(pop) #endif -#if __cplusplus >= 201703L +#if (__cplusplus >= 201703L) #define XM_ALIGNED_DATA(x) alignas(x) #define XM_ALIGNED_STRUCT(x) struct alignas(x) #elif defined(__GNUC__) diff --git a/Inc/DirectXPackedVector.h b/Inc/DirectXPackedVector.h index 9a73cb4..1f7d1cd 100644 --- a/Inc/DirectXPackedVector.h +++ b/Inc/DirectXPackedVector.h @@ -1114,18 +1114,31 @@ namespace DirectX // C4996: ignore deprecation warning #endif +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif + #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif - XMVECTOR XM_DEPRECATED XM_CALLCONV XMLoadDecN4(_In_ const XMDECN4* pSource) noexcept; - XMVECTOR XM_DEPRECATED XM_CALLCONV XMLoadDec4(_In_ const XMDEC4* pSource) noexcept; - XMVECTOR XM_DEPRECATED XM_CALLCONV XMLoadXDec4(_In_ const XMXDEC4* pSource) noexcept; + XM_DEPRECATED + XMVECTOR XM_CALLCONV XMLoadDecN4(_In_ const XMDECN4* pSource) noexcept; + + XM_DEPRECATED + XMVECTOR XM_CALLCONV XMLoadDec4(_In_ const XMDEC4* pSource) noexcept; + + XM_DEPRECATED + XMVECTOR XM_CALLCONV XMLoadXDec4(_In_ const XMXDEC4* pSource) noexcept; #ifdef __GNUC__ #pragma GCC diagnostic pop #endif +#ifdef __clang__ +#pragma clang diagnostic pop +#endif #ifdef _MSC_VER #pragma warning(pop) #endif @@ -1174,18 +1187,31 @@ namespace DirectX // C4996: ignore deprecation warning #endif +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif + #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif - void XM_DEPRECATED XM_CALLCONV XMStoreDecN4(_Out_ XMDECN4* pDestination, _In_ FXMVECTOR V) noexcept; - void XM_DEPRECATED XM_CALLCONV XMStoreDec4(_Out_ XMDEC4* pDestination, _In_ FXMVECTOR V) noexcept; - void XM_DEPRECATED XM_CALLCONV XMStoreXDec4(_Out_ XMXDEC4* pDestination, _In_ FXMVECTOR V) noexcept; + XM_DEPRECATED + void XM_CALLCONV XMStoreDecN4(_Out_ XMDECN4* pDestination, _In_ FXMVECTOR V) noexcept; + + XM_DEPRECATED + void XM_CALLCONV XMStoreDec4(_Out_ XMDEC4* pDestination, _In_ FXMVECTOR V) noexcept; + + XM_DEPRECATED + void XM_CALLCONV XMStoreXDec4(_Out_ XMXDEC4* pDestination, _In_ FXMVECTOR V) noexcept; #ifdef __GNUC__ #pragma GCC diagnostic pop #endif +#ifdef __clang__ +#pragma clang diagnostic pop +#endif #ifdef _MSC_VER #pragma warning(pop) #endif diff --git a/Inc/DirectXPackedVector.inl b/Inc/DirectXPackedVector.inl index b564d2e..2be690d 100644 --- a/Inc/DirectXPackedVector.inl +++ b/Inc/DirectXPackedVector.inl @@ -1506,6 +1506,11 @@ inline XMVECTOR XM_CALLCONV XMLoadXDecN4(const XMXDECN4* pSource) noexcept // C4996: ignore deprecation warning #endif +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif + #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" @@ -1560,6 +1565,9 @@ inline XMVECTOR XM_CALLCONV XMLoadXDec4(const XMXDEC4* pSource) noexcept #ifdef __GNUC__ #pragma GCC diagnostic pop #endif +#ifdef __clang__ +#pragma clang diagnostic pop +#endif #ifdef _MSC_VER #pragma warning(pop) #endif @@ -1705,6 +1713,11 @@ inline XMVECTOR XM_CALLCONV XMLoadUDec4(const XMUDEC4* pSource) noexcept // C4996: ignore deprecation warning #endif +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif + #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" @@ -1806,6 +1819,9 @@ inline XMVECTOR XM_CALLCONV XMLoadDec4(const XMDEC4* pSource) noexcept #ifdef __GNUC__ #pragma GCC diagnostic pop #endif +#ifdef __clang__ +#pragma clang diagnostic pop +#endif #ifdef _MSC_VER #pragma warning(pop) #endif @@ -2915,6 +2931,11 @@ inline void XM_CALLCONV XMStoreXDecN4 // C4996: ignore deprecation warning #endif +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif + #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" @@ -2990,6 +3011,9 @@ inline void XM_CALLCONV XMStoreXDec4 #ifdef __GNUC__ #pragma GCC diagnostic pop #endif +#ifdef __clang__ +#pragma clang diagnostic pop +#endif #ifdef _MSC_VER #pragma warning(pop) #endif @@ -3209,6 +3233,11 @@ inline void XM_CALLCONV XMStoreUDec4 // C4996: ignore deprecation warning #endif +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif + #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" @@ -3338,6 +3367,9 @@ inline void XM_CALLCONV XMStoreDec4 #ifdef __GNUC__ #pragma GCC diagnostic pop #endif +#ifdef __clang__ +#pragma clang diagnostic pop +#endif #ifdef _MSC_VER #pragma warning(pop) #endif @@ -4160,6 +4192,11 @@ inline XMXDECN4::XMXDECN4(const float* pArray) noexcept // C4996: ignore deprecation warning #endif +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif + #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" @@ -4240,6 +4277,9 @@ inline XMDEC4::XMDEC4(const float* pArray) noexcept #ifdef __GNUC__ #pragma GCC diagnostic pop #endif +#ifdef __clang__ +#pragma clang diagnostic pop +#endif #ifdef _MSC_VER #pragma warning(pop) #endif