From 39da25c8c1b41bea5498a7be6e61c671eabdf3ed Mon Sep 17 00:00:00 2001 From: Mike Beaton Date: Wed, 27 Nov 2024 00:01:17 +0000 Subject: [PATCH] MdePkg/BaseOverflowLib: Support BASE_ALIGNAS on VS2019 Note: this must be combined with flag /wd4324 added to MSFT:*_CC_FLAGS to avoid spurious warnings when the macro is working as intended. --- MdePkg/Include/Library/BaseOverflowLib.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MdePkg/Include/Library/BaseOverflowLib.h b/MdePkg/Include/Library/BaseOverflowLib.h index 749b64d5b5..c32b0f2401 100644 --- a/MdePkg/Include/Library/BaseOverflowLib.h +++ b/MdePkg/Include/Library/BaseOverflowLib.h @@ -34,7 +34,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // // Force member alignment for the structure. // -#if (defined (__STDC__) && __STDC_VERSION__ >= 201112L) || defined (__GNUC__) || defined (__clang__) +#if defined (_MSC_VER) +#define BASE_ALIGNAS(Alignment) __declspec(align(Alignment)) +#elif (defined (__STDC__) && __STDC_VERSION__ >= 201112L) || defined (__GNUC__) || defined (__clang__) #define BASE_ALIGNAS(Alignment) _Alignas(Alignment) #else #define BASE_ALIGNAS(Alignment)