Implement C99's va_copy() macro.

This commit is contained in:
mike 2002-09-18 07:33:16 +00:00
parent 397f4349cf
commit e35c51c74c
8 changed files with 43 additions and 2 deletions

View File

@ -71,7 +71,7 @@ MLINKS+=queue.3 TAILQ_PREV.3
MLINKS+=queue.3 TAILQ_REMOVE.3
MLINKS+=stdarg.3 varargs.3 stdarg.3 va_arg.3 stdarg.3 va_end.3
MLINKS+=stdarg.3 va_start.3
MLINKS+=stdarg.3 va_copy.3 stdarg.3 va_start.3
MLINKS+=timeradd.3 timersub.3 timeradd.3 timerclear.3 timeradd.3 timerisset.3
MLINKS+=timeradd.3 timercmp.3

View File

@ -36,7 +36,7 @@
.\" @(#)stdarg.3 8.1 (Berkeley) 6/5/93
.\" $FreeBSD$
.\"
.Dd June 5, 1993
.Dd September 18, 2002
.Dt STDARG 3
.Os
.Sh NAME
@ -49,6 +49,8 @@
.Ft type
.Fn va_arg "va_list ap" type
.Ft void
.Fn va_copy "va_list dest" "va_list src"
.Ft void
.Fn va_end "va_list ap"
.Sh DESCRIPTION
A function may be called with a varying number of arguments of varying
@ -132,6 +134,27 @@ Successive invocations return the values of the remaining
arguments.
.Pp
The
.Fn va_copy
macro copies a variable argument list, previously initialized by
.Fn va_start ,
from
.Va src
to
.Va dest .
The state is preserved such that it is equivalent to calling
.Fn va_start
with the same second argument used with
.Va src ,
and calling
.Fn va_arg
the same number of times as called with
.Va src .
.Pp
The
.Fn va_copy
macro returns no value.
.Pp
The
.Fn va_end
macro handles a normal return from the function whose variable argument
list was initialized by

View File

@ -51,6 +51,9 @@ typedef __va_list va_list;
#define va_arg(ap, type) \
__builtin_va_arg((ap), type)
#define va_copy(dest, src) \
__builtin_va_copy((dest), (src))
#define va_end(ap) \
__builtin_va_end(ap)

View File

@ -41,6 +41,9 @@ typedef __va_list va_list;
#define va_arg(ap, type) \
__builtin_va_arg((ap), type)
#define va_copy(dest, src) \
__builtin_va_copy((dest), (src))
#define va_end(ap) \
__builtin_va_end(ap)

View File

@ -50,6 +50,9 @@ typedef __va_list va_list;
#define va_arg(ap, type) \
__builtin_va_arg((ap), type)
#define va_copy(dest, src) \
__builtin_va_copy((dest), (src))
#define va_end(ap) \
__builtin_va_end(ap)

View File

@ -50,6 +50,9 @@ typedef __va_list va_list;
#define va_arg(ap, type) \
__builtin_va_arg((ap), type)
#define va_copy(dest, src) \
__builtin_va_copy((dest), (src))
#define va_end(ap) \
__builtin_va_end(ap)

View File

@ -43,6 +43,9 @@ typedef __va_list va_list;
#define va_arg(ap, type) \
__builtin_va_arg((ap), type)
#define va_copy(dest, src) \
__builtin_va_copy((dest), (src))
#define va_end(ap) \
__builtin_va_end(ap)

View File

@ -53,6 +53,9 @@ typedef __va_list va_list;
#define va_arg(ap, type) \
__builtin_va_arg((ap), type)
#define va_copy(dest, src) \
__builtin_va_copy((dest), (src))
#define va_end(ap) \
__builtin_va_end(ap)