]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/Include/stdarg.h
ShellPkg/UefiShellDebug1CommandsLib: remove I/O address limit from 'mm'
[mirror_edk2.git] / StdLib / Include / stdarg.h
index b966a5ce2b24016d43e96d2afa5c56884028e20a..9a30e28fbf183e7b01c1c395ca9e8a02e1d2f620 100644 (file)
@@ -1,54 +1,53 @@
 /** @file\r
 /** @file\r
-  The header <stdarg.h> declares a type and defines three macros, for advancing\r
-  through a list of arguments whose number and types are not known to the\r
-  called function when it is translated.\r
-\r
-  A function may be called with a variable number of arguments of varying types.\r
-  Its parameter list contains one or more parameters.  The rightmost parameter\r
-  plays a special role in the access mechanism, and will be designated paramN\r
-  in this description.\r
-\r
-  The type va_list is a type suitable for holding information needed by the\r
-  macros va_start, va_arg, and va_end.  If access to the varying arguments\r
-  is desired, the called function shall declare an object (referred to as ap\r
-  in these descriptions) having type va_list.  The object ap may be passed as\r
-  an argument to another function; if that function invokes the va_arg macro\r
-  with parameter ap, the value of ap in the calling function is indeterminate\r
-  and shall be passed to the va_end macro prior to any further reference to ap.\r
-\r
-  The va_start and va_arg macros shall be implemented as macros, not as actual\r
-  functions.  It is unspecified, by the C library standards, whether va_end\r
-  is a macro or an identifier declared with external linkage.  If a macro\r
-  definition is suppressed in order to access an actual function, or a\r
-  program defines an external identifier with the name va_end, the behavior\r
-  is undefined.  The va_start and va_end macros shall be invoked in the\r
-  function accepting a varying number of arguments, if access to the varying\r
-  arguments is desired.\r
-\r
-Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials are licensed and made available under\r
-the terms and conditions of the BSD License that accompanies this distribution.\r
-The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php.\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
+    This header, <stdarg.h>, declares type va_list and defines macros: va_start, va_arg, va_end;\r
+    for advancing through a list of arguments whose number and types are not known to the\r
+    called function when it is translated.\r
+\r
+    A function may be called with a variable number of arguments of varying types.\r
+    The rightmost argument plays a special role in the access mechanism, and will\r
+    be designated paramN in this and subsequent descriptions.\r
+\r
+    The type va_list is a type suitable for holding information needed by the\r
+    macros va_start, va_arg, and va_end.  If access to the varying arguments\r
+    is desired, the called function shall declare an object (referred to as ap\r
+    in these descriptions) having type va_list.  The object ap may be passed as\r
+    an argument to another function; if the receiving function invokes the va_arg macro\r
+    with parameter ap, the value of ap in the calling function becomes indeterminate\r
+    and must be passed to the va_end macro prior to any further reference to ap.\r
+\r
+    The va_start and va_arg macros must be implemented as macros, not as actual\r
+    functions.  The va_start and va_end macros must be invoked in the\r
+    function accepting a varying number of arguments, if access to the varying\r
+    arguments is desired.\r
+\r
+    Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>\r
+    This program and the accompanying materials are licensed and made available under\r
+    the terms and conditions of the BSD License that accompanies this distribution.\r
+    The full text of the license may be found at\r
+    http://opensource.org/licenses/bsd-license.\r
+\r
+    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 **/\r
 #ifndef _STDARG_H\r
 #define _STDARG_H\r
 #include  <sys/EfiCdefs.h>\r
 \r
 **/\r
 #ifndef _STDARG_H\r
 #define _STDARG_H\r
 #include  <sys/EfiCdefs.h>\r
 \r
-/** The type va_list is a type suitable for holding information needed by the\r
+/** @{\r
+    The type va_list is a type suitable for holding information needed by the\r
     macros va_start, va_arg, and va_end.\r
     macros va_start, va_arg, and va_end.\r
+\r
+    Depending upon compiler or CPU architecture, different definitions are required.\r
 **/\r
 #if defined(__GNUC__)\r
 typedef __builtin_va_list   va_list;\r
 #else\r
 #define va_list   VA_LIST\r
 #endif\r
 **/\r
 #if defined(__GNUC__)\r
 typedef __builtin_va_list   va_list;\r
 #else\r
 #define va_list   VA_LIST\r
 #endif\r
+/*@}*/\r
 \r
 \r
-/** The va_start macro shall be invoked before any access to the unnamed arguments.\r
+/** @{\r
+    The va_start macro must be invoked before any access to the unnamed arguments.\r
     The va_start macro initializes ap for subsequent use by va_arg and va_end.\r
 \r
     Synopsys: void va_start(va_list ap, paramN);\r
     The va_start macro initializes ap for subsequent use by va_arg and va_end.\r
 \r
     Synopsys: void va_start(va_list ap, paramN);\r
@@ -71,8 +70,10 @@ typedef __builtin_va_list   va_list;
 #else\r
 #define va_start    VA_START\r
 #endif\r
 #else\r
 #define va_start    VA_START\r
 #endif\r
+/*@}*/\r
 \r
 \r
-/** The va_arg macro expands to an expression that has the type and value of\r
+/** @{\r
+    The va_arg macro expands to an expression that has the type and value of\r
     the next argument in the call.  The parameter ap shall be the same as the\r
     va_list ap initialized by va_start.  Each invocation of va_arg modifies ap\r
     so that the values of successive arguments are returned in turn.  The\r
     the next argument in the call.  The parameter ap shall be the same as the\r
     va_list ap initialized by va_start.  Each invocation of va_arg modifies ap\r
     so that the values of successive arguments are returned in turn.  The\r
@@ -99,8 +100,10 @@ typedef __builtin_va_list   va_list;
 #else\r
 #define va_arg        VA_ARG\r
 #endif\r
 #else\r
 #define va_arg        VA_ARG\r
 #endif\r
+/*@}*/\r
 \r
 \r
-/** The va_end macro facillitates a normal return from the function whose\r
+/** @{\r
+    The va_end macro facillitates a normal return from the function whose\r
     variable argument list was referred to by the expansion of va_start that\r
     initialized the va_list ap.\r
 \r
     variable argument list was referred to by the expansion of va_start that\r
     initialized the va_list ap.\r
 \r
@@ -119,12 +122,25 @@ typedef __builtin_va_list   va_list;
 #else\r
 #define va_end              VA_END\r
 #endif\r
 #else\r
 #define va_end              VA_END\r
 #endif\r
+/*@}*/\r
 \r
 \r
-/** For BSD compatibility. **/\r
+/** @{\r
+    For BSD compatibility.\r
+**/\r
 #if defined(__GNUC__)\r
 #define va_copy         __builtin_va_copy\r
 #else\r
 #define va_copy(s,d)      (s) = (d)\r
 #endif\r
 #if defined(__GNUC__)\r
 #define va_copy         __builtin_va_copy\r
 #else\r
 #define va_copy(s,d)      (s) = (d)\r
 #endif\r
+/*@}*/\r
+\r
+/** Provide a generic version of the compiler-dependent __va_copy macro.\r
+    Some software, such as Python 2.7.2, relies upon the existence of __va_copy.\r
+    If this macro is not defined, it just assigns one va_list item to another.\r
+    This breaks for compiler environments that define va_list as an array or structure.\r
+**/\r
+#ifndef __va_copy\r
+  #define __va_copy       va_copy\r
+#endif\r
 \r
 #endif  /* _STDARG_H */\r
 \r
 #endif  /* _STDARG_H */\r