Add the va_copy macro (from C99).

The previous changes to varargs handling enable this to work.
This commit is contained in:
Stephen Heumann 2021-10-23 22:36:53 -05:00
parent a20d69a211
commit 26d0f2ad35
2 changed files with 8 additions and 0 deletions

View File

@ -35,6 +35,7 @@ typedef __va_list va_list;
#define va_arg(ap,type) _Generic(*(type *)0, \
double: (type)((long double *)((ap)[0] += sizeof(long double)))[-1], \
default: ((type *)((ap)[0] += sizeof(type)))[-1])
#define va_copy(dest,src) ((void)((dest)[0]=(src)[0],(dest)[1]=(src)[1]))
void __record_va_info(va_list);

View File

@ -838,6 +838,13 @@ These functions convert from a UTF-16-encoded or UTF-32-encoded Unicode characte
In ORCA/C, multibyte characters are always one byte and are considered to be encoded in the character set used by the IIGS desktop environment (known as Mac OS Roman), so these functions convert between that character set and Unicode.
17. (C99) The function-like macro va_copy has been added:
#include <stdarg.h>
void va_copy(va_list dest, va_list src);
The va_copy macro makes a copy of the va_list src, which must have been initialized by a call to va_start in a function taking variable arguments (plus possibly some number of calls to va_arg). After a call to va_copy, dest can be used to access the variable arguments in the same way as src. A corresponding call to va_end(dest) must be made in the function that called va_copy.
-- Compiler changes introduced in C 2.1.0 -----------------------------------
The Default .h File