summaryrefslogtreecommitdiff
path: root/EdkCompatibilityPkg/Foundation
diff options
context:
space:
mode:
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2010-06-15 02:46:03 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2010-06-15 02:46:03 +0000
commit5f68233c6f7cdbedff0bbd636cb8c3f8d731616c (patch)
treecb35f7cc44e015d929946936379d0045bac59613 /EdkCompatibilityPkg/Foundation
parent0e7e330262c29fd995a3ac4ea88b135d90587d96 (diff)
EdkCompatibilityPkg VA_LIST: Fix build issue with GCC 4.4
Merge from MdePkg/Include/Base.h to fix build issues with GCC 4.4. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10585 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkCompatibilityPkg/Foundation')
-rw-r--r--EdkCompatibilityPkg/Foundation/Include/EfiStdArg.h74
1 files changed, 58 insertions, 16 deletions
diff --git a/EdkCompatibilityPkg/Foundation/Include/EfiStdArg.h b/EdkCompatibilityPkg/Foundation/Include/EfiStdArg.h
index 9ff66e437..bbec17b6e 100644
--- a/EdkCompatibilityPkg/Foundation/Include/EfiStdArg.h
+++ b/EdkCompatibilityPkg/Foundation/Include/EfiStdArg.h
@@ -58,7 +58,14 @@ Abstract:
#ifndef _EFISTDARG_H_
#define _EFISTDARG_H_
-#define _EFI_INT_SIZE_OF(n) ((sizeof (n) + sizeof (UINTN) - 1) &~(sizeof (UINTN) - 1))
+/**
+ Return the size of argument that has been aligned to sizeof (UINTN).
+
+ @param n The parameter size to be aligned.
+
+ @return The aligned size.
+**/
+#define _INT_SIZE_OF(n) ((sizeof (n) + sizeof (UINTN) - 1) &~(sizeof (UINTN) - 1))
#if defined(__CC_ARM)
//
@@ -83,9 +90,7 @@ Abstract:
#define VA_END(Marker) ((void)0)
-#define VA_COPY(Dest, Start) __va_copy (Dest, Start)
-
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) && !defined(NO_BUILTIN_VA_FUNCS)
//
// Use GCC built-in macros for variable argument lists.
//
@@ -102,23 +107,60 @@ typedef __builtin_va_list VA_LIST;
#define VA_END(Marker) __builtin_va_end (Marker)
-#define VA_COPY(Dest, Start) __builtin_va_copy (Dest, Start)
-
#else
+///
+/// Variable used to traverse the list of arguments. This type can vary by
+/// implementation and could be an array or structure.
+///
+typedef CHAR8 *VA_LIST;
-//
-// Also support coding convention rules for var arg macros
-//
-#ifndef VA_START
+/**
+ Retrieves a pointer to the beginning of a variable argument list, based on
+ the name of the parameter that immediately precedes the variable argument list.
-typedef CHAR8 *VA_LIST;
-#define VA_START(ap, v) (ap = (VA_LIST) & (v) + _EFI_INT_SIZE_OF (v))
-#define VA_ARG(ap, t) (*(t *) ((ap += _EFI_INT_SIZE_OF (t)) - _EFI_INT_SIZE_OF (t)))
-#define VA_END(ap) (ap = (VA_LIST) 0)
-#define VA_COPY(dest, src) ((void)((dest) = (src)))
+ This function initializes Marker to point to the beginning of the variable
+ argument list that immediately follows Parameter. The method for computing the
+ pointer to the next argument in the argument list is CPU-specific following the
+ EFIAPI ABI.
-#endif
+ @param Marker The VA_LIST used to traverse the list of arguments.
+ @param Parameter The name of the parameter that immediately precedes
+ the variable argument list.
+
+ @return A pointer to the beginning of a variable argument list.
+
+**/
+#define VA_START(Marker, Parameter) (Marker = (VA_LIST) & (Parameter) + _INT_SIZE_OF (Parameter))
+/**
+ Returns an argument of a specified type from a variable argument list and updates
+ the pointer to the variable argument list to point to the next argument.
+
+ This function returns an argument of the type specified by TYPE from the beginning
+ of the variable argument list specified by Marker. Marker is then updated to point
+ to the next argument in the variable argument list. The method for computing the
+ pointer to the next argument in the argument list is CPU-specific following the EFIAPI ABI.
+
+ @param Marker VA_LIST used to traverse the list of arguments.
+ @param TYPE The type of argument to retrieve from the beginning
+ of the variable argument list.
+
+ @return An argument of the type specified by TYPE.
+
+**/
+#define VA_ARG(Marker, TYPE) (*(TYPE *) ((Marker += _INT_SIZE_OF (TYPE)) - _INT_SIZE_OF (TYPE)))
+
+/**
+ Terminates the use of a variable argument list.
+
+ This function initializes Marker so it can no longer be used with VA_ARG().
+ After this macro is used, the only way to access the variable argument list is
+ by using VA_START() again.
+
+ @param Marker VA_LIST used to traverse the list of arguments.
+
+**/
+#define VA_END(Marker) (Marker = (VA_LIST) 0)
#endif