]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Base.h
MdePkg: Add a new macro VA_COPY for variable argument support. Fix a bug in the UefiL...
[mirror_edk2.git] / MdePkg / Include / Base.h
index 4fcc3a1bf651ecca2d22a7d981fcb23eaebab3c1..66fc5d271b23e01b9ebacc305bd9eb8135d8e11e 100644 (file)
@@ -6,7 +6,7 @@
   environment. There are a set of base libraries in the Mde Package that can\r
   be used to implement base modules.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
@@ -393,6 +393,7 @@ struct _LIST_ENTRY {
 //  VA_END (VA_LIST Marker) - Clear Marker\r
 //  VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argument from\r
 //    the ... list. You must know the size and pass it in this macro.\r
+//  VA_COPY (VA_LIST Dest, VA_LIST Start) - Initialize Dest as a copy of Start.\r
 //\r
 //  example:\r
 //\r
@@ -454,6 +455,8 @@ struct _LIST_ENTRY {
 \r
 #define VA_END(Marker)                ((void)0)\r
 \r
+#define VA_COPY(Dest, Start)          __va_copy (Dest, Start)\r
+\r
 #elif defined(__GNUC__) && !defined(NO_BUILTIN_VA_FUNCS)\r
 //\r
 // Use GCC built-in macros for variable argument lists.\r
@@ -471,6 +474,8 @@ typedef __builtin_va_list VA_LIST;
 \r
 #define VA_END(Marker)               __builtin_va_end (Marker)\r
 \r
+#define VA_COPY(Dest, Start)         __builtin_va_copy (Dest, Start)\r
+\r
 #else\r
 ///\r
 /// Variable used to traverse the list of arguments. This type can vary by\r
@@ -526,6 +531,19 @@ typedef CHAR8 *VA_LIST;
 **/\r
 #define VA_END(Marker)      (Marker = (VA_LIST) 0)\r
 \r
+/**\r
+  Initializes a VA_LIST as a copy of an existing VA_LIST.\r
+\r
+  This macro initializes Dest as a copy of Start, as if the VA_START macro had been applied to Dest\r
+  followed by the same sequence of uses of the VA_ARG macro as had previously been used to reach\r
+  the present state of Start. \r
+\r
+  @param   Dest   VA_LIST used to traverse the list of arguments.\r
+  @param   Start  VA_LIST used to traverse the list of arguments.\r
+\r
+**/\r
+#define VA_COPY(Dest, Start)  ((void)((Dest) = (Start)))\r
+\r
 #endif\r
 \r
 ///\r