ref: a654b94db8a3574b7a774edfd77b8612c0b642cd
parent: 7364a96b289c24637db802fca6c57d8024ca2359
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Mar 22 13:31:39 EDT 2020
add va_copy macro, conforming to c99 7.15.1.2
--- a/386/include/ape/stdarg.h
+++ b/386/include/ape/stdarg.h
@@ -7,5 +7,5 @@
(char *)(&(start)+1))
#define va_end(list)
#define va_arg(list, mode) ((mode*)(list += sizeof(mode)))[-1]
-
+#define va_copy(dst, src) ((dst) = (src))
#endif /* __STDARG */
--- a/68020/include/ape/stdarg.h
+++ b/68020/include/ape/stdarg.h
@@ -7,5 +7,6 @@
#define va_end(list)
#define va_arg(list, mode) (sizeof(mode)==1 ? ((mode *) (list += 4))[-4] : \
sizeof(mode)==2 ? ((mode *) (list += 4))[-2] : ((mode *) (list += sizeof(mode)))[-1])
+#define va_copy(dst, src) ((dst) = (src))
#endif /* __STDARG */
--- a/amd64/include/ape/stdarg.h
+++ b/amd64/include/ape/stdarg.h
@@ -3,8 +3,10 @@
typedef char *va_list;
-#define va_start(list, start) list = (sizeof(start)<8 ? (char *)((long long *)&(start)+1) : \
-(char *)(&(start)+1))
+#define va_start(list, start) \
+ (list = (sizeof(start)<8 ? \
+ (char *)((long long *)&(start)+1) : \
+ (char *)(&(start)+1)))
#define va_end(list)
#define va_arg(list, mode)\
((sizeof(mode) == 1)?\
@@ -14,5 +16,7 @@
(sizeof(mode) == 4)?\
((mode*)(list += 8))[-2]:\
((mode*)(list += sizeof(mode)))[-1])
+#define va_copy(dst, src) \
+ ((dst) = (src))
#endif /* __STDARG */
--- a/arm/include/ape/stdarg.h
+++ b/arm/include/ape/stdarg.h
@@ -7,5 +7,6 @@
(char *)(&(start)+1))
#define va_end(list)
#define va_arg(list, mode) ((mode*)(list += sizeof(mode)))[-1]
+#define va_copy(dst, src) ((dst) = (src))
#endif /* __STDARG */
--- a/arm64/include/ape/stdarg.h
+++ b/arm64/include/ape/stdarg.h
@@ -14,5 +14,6 @@
(sizeof(mode) == 4)?\
((mode*)(list += 8))[-2]:\
((mode*)(list += sizeof(mode)))[-1])
+#define va_copy(dst, src) ((dst) = (src))
#endif /* __STDARG */
--- a/mips/include/ape/stdarg.h
+++ b/mips/include/ape/stdarg.h
@@ -7,5 +7,6 @@
#define va_end(list)
#define va_arg(list, mode) (sizeof(mode)==1 ? ((mode *) (list += 4))[-4] : \
sizeof(mode)==2 ? ((mode *) (list += 4))[-2] : ((mode *) (list += sizeof(mode)))[-1])
+#define va_copy(dst, src) ((dst) = (src))
#endif /* __STDARG */
--- a/power/include/ape/stdarg.h
+++ b/power/include/ape/stdarg.h
@@ -7,5 +7,6 @@
#define va_end(list)
#define va_arg(list, mode) (sizeof(mode)==1 ? ((mode *) (list += 4))[-4] : \
sizeof(mode)==2 ? ((mode *) (list += 4))[-2] : ((mode *) (list += sizeof(mode)))[-1])
+#define va_copy(dst, src) ((dst) = (src))
#endif /* __STDARG */
--- a/sparc64/include/ape/stdarg.h
+++ b/sparc64/include/ape/stdarg.h
@@ -7,5 +7,6 @@
#define va_end(list)
#define va_arg(list, mode) (sizeof(mode)==1 ? ((mode *) (list += 4))[-4] : \
sizeof(mode)==2 ? ((mode *) (list += 4))[-2] : ((mode *) (list += sizeof(mode)))[-1])
+#define va_copy(dst, src) ((dst) = (src))
#endif /* __STDARG */