Skip to content

Commit

Permalink
Revert "Add Variable Argument List macros for VS"
Browse files Browse the repository at this point in the history
This reverts commit 6f5dd60.
  • Loading branch information
Javagedes committed Aug 8, 2024
1 parent 82eb2d7 commit 0f2938d
Showing 1 changed file with 0 additions and 74 deletions.
74 changes: 0 additions & 74 deletions MdePkg/Include/Base.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,80 +663,6 @@ typedef __builtin_va_list VA_LIST;

#endif

// MU_CHANGE [BEGIN] - Add variable argument macros for Visual Studio
// VA macros for Visual Studio
// This comes from the VS header:
// Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\<version>\include\vadefs.h
#elif defined (_MSC_VER)

//
// Microsoft compilers
//
typedef char *VA_LIST;

#define _ADDRESSOF(v) (&(v))

#if defined (_M_ARM) || defined (_M_MS_ARM) // MU_CHANGE - BZ2029 due to BaseCryptLib changes
#define _VA_ALIGN 4
#define _SLOTSIZEOF(t) ((sizeof(t) + _VA_ALIGN - 1) & ~(_VA_ALIGN - 1))
#define _APALIGN(t, ap) (((VA_LIST)0 - (ap)) & (__alignof(t) - 1))
#elif defined (_M_ARM64) || defined (_M_MS_ARM64) // MU_CHANGE - BZ2029 due to BaseCryptLib changes
#define _VA_ALIGN 8
#define _SLOTSIZEOF(t) ((sizeof(t) + _VA_ALIGN - 1) & ~(_VA_ALIGN - 1))
#define _APALIGN(t, ap) (((VA_LIST)0 - (ap)) & (__alignof(t) - 1))
#else
#define _SLOTSIZEOF(t) (sizeof(t))
#define _APALIGN(t, ap) (__alignof(t))
#endif

#if defined _M_IX86

#define _INTSIZEOF(n) ((sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1))

#define VA_START(ap, v) ((void)(ap = (VA_LIST)_ADDRESSOF(v) + _INTSIZEOF(v)))
#define VA_ARG(ap, t) (*(t*)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)))
#define VA_END(ap) ((void)(ap = (VA_LIST)0))

#elif defined (_M_ARM) || defined (_M_MS_ARM) // MU_CHANGE - BZ2029 due to BaseCryptLib changes

#define VA_START(ap, v) ((void)(ap = (VA_LIST)_ADDRESSOF(v) + _SLOTSIZEOF(v)))
#define VA_ARG(ap, t) (*(t*)((ap += _SLOTSIZEOF(t) + _APALIGN(t,ap)) - _SLOTSIZEOF(t)))
#define VA_END(ap) ((void)(ap = (VA_LIST)0))

#elif defined (_M_ARM64) || defined (_M_MS_ARM64) // MU_CHANGE - BZ2029 due to BaseCryptLib changes

void __cdecl
__va_start (
VA_LIST *,
...
);

#define VA_START(ap, v) ((void)(__va_start(&ap, _ADDRESSOF(v), _SLOTSIZEOF(v), __alignof(v), _ADDRESSOF(v))))
#define VA_ARG(ap, t) \
((sizeof(t) > (2 * sizeof(__int64))) \
? **(t**)((ap += sizeof(__int64)) - sizeof(__int64)) \
: *(t*)((ap += _SLOTSIZEOF(t) + _APALIGN(t,ap)) - _SLOTSIZEOF(t)))
#define VA_END(ap) ((void)(ap = (VA_LIST)0))

#elif defined _M_X64

void __cdecl
__va_start (
VA_LIST *,
...
);

#define VA_START(ap, x) ((void)(__va_start(&ap, x)))
#define VA_ARG(ap, t) \
((sizeof(t) > sizeof(__int64) || (sizeof(t) & (sizeof(t) - 1)) != 0) \
? **(t**)((ap += sizeof(__int64)) - sizeof(__int64)) \
: *(t* )((ap += sizeof(__int64)) - sizeof(__int64)))
#define VA_END(ap) ((void)(ap = (VA_LIST)0))

#endif

#define VA_COPY(destination, source) ((destination) = (source))
// MU_CHANGE [END] - Add variable argument macros for Visual Studio
#else
///
/// Variable used to traverse the list of arguments. This type can vary by
Expand Down

0 comments on commit 0f2938d

Please sign in to comment.