From 26d0f2ad35e356f3a0623c9ad7951893701f0d03 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sat, 23 Oct 2021 22:36:53 -0500 Subject: [PATCH] Add the va_copy macro (from C99). The previous changes to varargs handling enable this to work. --- ORCACDefs/stdarg.h | 1 + cc.notes | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/ORCACDefs/stdarg.h b/ORCACDefs/stdarg.h index dc74811..f99e497 100644 --- a/ORCACDefs/stdarg.h +++ b/ORCACDefs/stdarg.h @@ -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); diff --git a/cc.notes b/cc.notes index a04243f..8a9cd8f 100644 --- a/cc.notes +++ b/cc.notes @@ -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 +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