Skip to content

Commit

Permalink
MdePkg/BaseOverflowLib: Support BASE_ALIGNAS on VS2019
Browse files Browse the repository at this point in the history
Note: this must be combined with flag /wd4324 added to MSFT:*_CC_FLAGS
to avoid spurious warnings when the macro is working as intended.

Update comment since alignment in all architectures can be use to align
structure member or variable definition.
  • Loading branch information
mikebeaton committed Nov 27, 2024
1 parent bf8a429 commit fc28099
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions MdePkg/Include/Library/BaseOverflowLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define BASE_TYPE_ALIGNED(Type, Ptr) (BASE_POT_ALIGNED (BASE_ALIGNOF (Type), Ptr))

//
// Force member alignment for the structure.
// Force alignment for structure member or variable definition.
//
#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)
Expand Down

0 comments on commit fc28099

Please sign in to comment.