diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2001-03-21 13:51:59 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2001-03-21 13:51:59 +0000 |
commit | c62ebad871264657a54a1e800fa00f2c82a61743 (patch) | |
tree | 51ae3d838b5e7e6a467e7f4b045eaac372c3b002 | |
parent | 7280b51d2100c6d581bd917fe7b042a5b2aaab45 (diff) |
__va_list is specified differently with the powerpc ABI than it is on
other platforms, the list is a pointer, thus va_copy should allocate data
(using alloca) for that pointer before copying the contents of the data.
This allows several gnu programs to build and run correctly which insist
on multiply parsing the vararg/stdarg data passed to a function.
-rw-r--r-- | sys/arch/powerpc/include/va-ppc.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/arch/powerpc/include/va-ppc.h b/sys/arch/powerpc/include/va-ppc.h index 54486c16a94..501d37d8cd0 100644 --- a/sys/arch/powerpc/include/va-ppc.h +++ b/sys/arch/powerpc/include/va-ppc.h @@ -242,7 +242,14 @@ __extension__ (*({ \ #define va_end(AP) ((void)0) /* Copy __gnuc_va_list into another variable of this type. */ -#define __va_copy(dest, src) *(dest) = *(src) +#define __va_copy(dest, src) \ +__extension__ ({ \ + (dest) = \ + (struct __va_list_tag *)__builtin_alloca(sizeof(__gnuc_va_list)); \ + *(dest) = *(src);\ + }) + + #endif /* __VA_PPC_H__ */ #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ |