Skip to content

Commit

Permalink
Use C++17 deprecated attribute when supported (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn authored Nov 4, 2024
1 parent d51ec67 commit 938383e
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .nuget/directxmath.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<owners>microsoft,directxtk</owners>
<summary>DirectXMath is an all inline SIMD C++ linear algebra library for use in games and graphics apps.</summary>
<description>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.</description>
<releaseNotes>Matches the February 2024 release.</releaseNotes>
<releaseNotes>Matches the October 2024 release.</releaseNotes>
<projectUrl>http://go.microsoft.com/fwlink/?LinkID=615560</projectUrl>
<repository type="git" url="https://github.com/microsoft/DirectXMath.git" />
<icon>images\icon.jpg</icon>
Expand Down
6 changes: 4 additions & 2 deletions Inc/DirectXMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -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."))
Expand Down Expand Up @@ -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__)
Expand Down
38 changes: 32 additions & 6 deletions Inc/DirectXPackedVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
40 changes: 40 additions & 0 deletions Inc/DirectXPackedVector.inl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 938383e

Please sign in to comment.