Skip to content

Commit 938383e

Browse files
authored
Use C++17 deprecated attribute when supported (#219)
1 parent d51ec67 commit 938383e

File tree

4 files changed

+77
-9
lines changed

4 files changed

+77
-9
lines changed

.nuget/directxmath.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<owners>microsoft,directxtk</owners>
99
<summary>DirectXMath is an all inline SIMD C++ linear algebra library for use in games and graphics apps.</summary>
1010
<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>
11-
<releaseNotes>Matches the February 2024 release.</releaseNotes>
11+
<releaseNotes>Matches the October 2024 release.</releaseNotes>
1212
<projectUrl>http://go.microsoft.com/fwlink/?LinkID=615560</projectUrl>
1313
<repository type="git" url="https://github.com/microsoft/DirectXMath.git" />
1414
<icon>images\icon.jpg</icon>

Inc/DirectXMath.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
#endif
3333

3434
#ifndef XM_DEPRECATED
35-
#ifdef __GNUC__
35+
#if (__cplusplus >= 201402L)
36+
#define XM_DEPRECATED [[deprecated]]
37+
#elif defined(__GNUC__)
3638
#define XM_DEPRECATED __attribute__ ((deprecated))
3739
#else
3840
#define XM_DEPRECATED __declspec(deprecated("This is deprecated and will be removed in a future version."))
@@ -164,7 +166,7 @@
164166
#pragma warning(pop)
165167
#endif
166168

167-
#if __cplusplus >= 201703L
169+
#if (__cplusplus >= 201703L)
168170
#define XM_ALIGNED_DATA(x) alignas(x)
169171
#define XM_ALIGNED_STRUCT(x) struct alignas(x)
170172
#elif defined(__GNUC__)

Inc/DirectXPackedVector.h

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,18 +1114,31 @@ namespace DirectX
11141114
// C4996: ignore deprecation warning
11151115
#endif
11161116

1117+
#ifdef __clang__
1118+
#pragma clang diagnostic push
1119+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
1120+
#endif
1121+
11171122
#ifdef __GNUC__
11181123
#pragma GCC diagnostic push
11191124
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
11201125
#endif
11211126

1122-
XMVECTOR XM_DEPRECATED XM_CALLCONV XMLoadDecN4(_In_ const XMDECN4* pSource) noexcept;
1123-
XMVECTOR XM_DEPRECATED XM_CALLCONV XMLoadDec4(_In_ const XMDEC4* pSource) noexcept;
1124-
XMVECTOR XM_DEPRECATED XM_CALLCONV XMLoadXDec4(_In_ const XMXDEC4* pSource) noexcept;
1127+
XM_DEPRECATED
1128+
XMVECTOR XM_CALLCONV XMLoadDecN4(_In_ const XMDECN4* pSource) noexcept;
1129+
1130+
XM_DEPRECATED
1131+
XMVECTOR XM_CALLCONV XMLoadDec4(_In_ const XMDEC4* pSource) noexcept;
1132+
1133+
XM_DEPRECATED
1134+
XMVECTOR XM_CALLCONV XMLoadXDec4(_In_ const XMXDEC4* pSource) noexcept;
11251135

11261136
#ifdef __GNUC__
11271137
#pragma GCC diagnostic pop
11281138
#endif
1139+
#ifdef __clang__
1140+
#pragma clang diagnostic pop
1141+
#endif
11291142
#ifdef _MSC_VER
11301143
#pragma warning(pop)
11311144
#endif
@@ -1174,18 +1187,31 @@ namespace DirectX
11741187
// C4996: ignore deprecation warning
11751188
#endif
11761189

1190+
#ifdef __clang__
1191+
#pragma clang diagnostic push
1192+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
1193+
#endif
1194+
11771195
#ifdef __GNUC__
11781196
#pragma GCC diagnostic push
11791197
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
11801198
#endif
11811199

1182-
void XM_DEPRECATED XM_CALLCONV XMStoreDecN4(_Out_ XMDECN4* pDestination, _In_ FXMVECTOR V) noexcept;
1183-
void XM_DEPRECATED XM_CALLCONV XMStoreDec4(_Out_ XMDEC4* pDestination, _In_ FXMVECTOR V) noexcept;
1184-
void XM_DEPRECATED XM_CALLCONV XMStoreXDec4(_Out_ XMXDEC4* pDestination, _In_ FXMVECTOR V) noexcept;
1200+
XM_DEPRECATED
1201+
void XM_CALLCONV XMStoreDecN4(_Out_ XMDECN4* pDestination, _In_ FXMVECTOR V) noexcept;
1202+
1203+
XM_DEPRECATED
1204+
void XM_CALLCONV XMStoreDec4(_Out_ XMDEC4* pDestination, _In_ FXMVECTOR V) noexcept;
1205+
1206+
XM_DEPRECATED
1207+
void XM_CALLCONV XMStoreXDec4(_Out_ XMXDEC4* pDestination, _In_ FXMVECTOR V) noexcept;
11851208

11861209
#ifdef __GNUC__
11871210
#pragma GCC diagnostic pop
11881211
#endif
1212+
#ifdef __clang__
1213+
#pragma clang diagnostic pop
1214+
#endif
11891215
#ifdef _MSC_VER
11901216
#pragma warning(pop)
11911217
#endif

Inc/DirectXPackedVector.inl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,11 @@ inline XMVECTOR XM_CALLCONV XMLoadXDecN4(const XMXDECN4* pSource) noexcept
15061506
// C4996: ignore deprecation warning
15071507
#endif
15081508

1509+
#ifdef __clang__
1510+
#pragma clang diagnostic push
1511+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
1512+
#endif
1513+
15091514
#ifdef __GNUC__
15101515
#pragma GCC diagnostic push
15111516
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@@ -1560,6 +1565,9 @@ inline XMVECTOR XM_CALLCONV XMLoadXDec4(const XMXDEC4* pSource) noexcept
15601565
#ifdef __GNUC__
15611566
#pragma GCC diagnostic pop
15621567
#endif
1568+
#ifdef __clang__
1569+
#pragma clang diagnostic pop
1570+
#endif
15631571
#ifdef _MSC_VER
15641572
#pragma warning(pop)
15651573
#endif
@@ -1705,6 +1713,11 @@ inline XMVECTOR XM_CALLCONV XMLoadUDec4(const XMUDEC4* pSource) noexcept
17051713
// C4996: ignore deprecation warning
17061714
#endif
17071715

1716+
#ifdef __clang__
1717+
#pragma clang diagnostic push
1718+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
1719+
#endif
1720+
17081721
#ifdef __GNUC__
17091722
#pragma GCC diagnostic push
17101723
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@@ -1806,6 +1819,9 @@ inline XMVECTOR XM_CALLCONV XMLoadDec4(const XMDEC4* pSource) noexcept
18061819
#ifdef __GNUC__
18071820
#pragma GCC diagnostic pop
18081821
#endif
1822+
#ifdef __clang__
1823+
#pragma clang diagnostic pop
1824+
#endif
18091825
#ifdef _MSC_VER
18101826
#pragma warning(pop)
18111827
#endif
@@ -2915,6 +2931,11 @@ inline void XM_CALLCONV XMStoreXDecN4
29152931
// C4996: ignore deprecation warning
29162932
#endif
29172933

2934+
#ifdef __clang__
2935+
#pragma clang diagnostic push
2936+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
2937+
#endif
2938+
29182939
#ifdef __GNUC__
29192940
#pragma GCC diagnostic push
29202941
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@@ -2990,6 +3011,9 @@ inline void XM_CALLCONV XMStoreXDec4
29903011
#ifdef __GNUC__
29913012
#pragma GCC diagnostic pop
29923013
#endif
3014+
#ifdef __clang__
3015+
#pragma clang diagnostic pop
3016+
#endif
29933017
#ifdef _MSC_VER
29943018
#pragma warning(pop)
29953019
#endif
@@ -3209,6 +3233,11 @@ inline void XM_CALLCONV XMStoreUDec4
32093233
// C4996: ignore deprecation warning
32103234
#endif
32113235

3236+
#ifdef __clang__
3237+
#pragma clang diagnostic push
3238+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
3239+
#endif
3240+
32123241
#ifdef __GNUC__
32133242
#pragma GCC diagnostic push
32143243
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@@ -3338,6 +3367,9 @@ inline void XM_CALLCONV XMStoreDec4
33383367
#ifdef __GNUC__
33393368
#pragma GCC diagnostic pop
33403369
#endif
3370+
#ifdef __clang__
3371+
#pragma clang diagnostic pop
3372+
#endif
33413373
#ifdef _MSC_VER
33423374
#pragma warning(pop)
33433375
#endif
@@ -4160,6 +4192,11 @@ inline XMXDECN4::XMXDECN4(const float* pArray) noexcept
41604192
// C4996: ignore deprecation warning
41614193
#endif
41624194

4195+
#ifdef __clang__
4196+
#pragma clang diagnostic push
4197+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
4198+
#endif
4199+
41634200
#ifdef __GNUC__
41644201
#pragma GCC diagnostic push
41654202
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@@ -4240,6 +4277,9 @@ inline XMDEC4::XMDEC4(const float* pArray) noexcept
42404277
#ifdef __GNUC__
42414278
#pragma GCC diagnostic pop
42424279
#endif
4280+
#ifdef __clang__
4281+
#pragma clang diagnostic pop
4282+
#endif
42434283
#ifdef _MSC_VER
42444284
#pragma warning(pop)
42454285
#endif

0 commit comments

Comments
 (0)