aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMichael Meissner <meissner@gcc.gnu.org>1996-08-14 15:49:57 +0000
committerMichael Meissner <meissner@gcc.gnu.org>1996-08-14 15:49:57 +0000
commit06737be4a366c8ae7368666e457dfdedafbe48be (patch)
treeab97906eed27fd1969c5a54489a2ceed357883a7 /gcc
parentc7c27cd3e267542ca6afbe5090d5a410bccfd0b2 (diff)
downloadgcc-06737be4a366c8ae7368666e457dfdedafbe48be.zip
gcc-06737be4a366c8ae7368666e457dfdedafbe48be.tar.gz
gcc-06737be4a366c8ae7368666e457dfdedafbe48be.tar.bz2
Fix varargs/stdarg on PowerPC Windows NT
From-SVN: r12637
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ginclude/stdarg.h2
-rw-r--r--gcc/ginclude/va-ppc.h57
-rw-r--r--gcc/ginclude/varargs.h2
3 files changed, 58 insertions, 3 deletions
diff --git a/gcc/ginclude/stdarg.h b/gcc/ginclude/stdarg.h
index 025694e..588bf66 100644
--- a/gcc/ginclude/stdarg.h
+++ b/gcc/ginclude/stdarg.h
@@ -38,7 +38,7 @@
#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
#include <va-h8300.h>
#else
-#if defined (__PPC__) && defined (_CALL_SYSV)
+#if defined (__PPC__) && (defined (_CALL_SYSV) || defined (__WIN32__))
#include <va-ppc.h>
#else
#ifdef __sh__
diff --git a/gcc/ginclude/va-ppc.h b/gcc/ginclude/va-ppc.h
index 57730b0..e502c2c 100644
--- a/gcc/ginclude/va-ppc.h
+++ b/gcc/ginclude/va-ppc.h
@@ -1,5 +1,7 @@
-/* GNU C varargs support for the PowerPC with V.4 calling sequence */
+/* GNU C varargs support for the PowerPC with either the V.4 or Windows NT calling sequences */
+#ifndef __WIN32__
+/* System V.4 support */
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
@@ -167,3 +169,56 @@ __extension__ (*({ \
#define va_end(AP) ((void)0)
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
+
+
+#else
+/* Windows NT */
+/* Define __gnuc_va_list. */
+
+#ifndef __GNUC_VA_LIST
+#define __GNUC_VA_LIST
+typedef char *__gnuc_va_list;
+#endif /* not __GNUC_VA_LIST */
+
+/* If this is for internal libc use, don't define anything but
+ __gnuc_va_list. */
+#if defined (_STDARG_H) || defined (_VARARGS_H)
+
+#define __va_start_common(AP, LASTARG, FAKE) \
+ ((__builtin_saveregs ()), ((AP) = ((char *) &LASTARG) + __va_rounded_size (AP)), 0)
+
+#ifdef _STDARG_H /* stdarg.h support */
+
+/* Calling __builtin_next_arg gives the proper error message if LASTARG is
+ not indeed the last argument. */
+#define va_start(AP,LASTARG) \
+ (__builtin_saveregs (), \
+ (AP) = __builtin_next_arg (LASTARG), \
+ 0)
+
+#else /* varargs.h support */
+
+#define va_start(AP) \
+ (__builtin_saveregs (), \
+ (AP) = __builtin_next_arg (__va_1st_arg) - sizeof (int), \
+ 0)
+
+#define va_alist __va_1st_arg
+#define va_dcl register int __va_1st_arg; ...
+
+#endif /* _STDARG_H */
+
+#define __va_rounded_size(TYPE) ((sizeof (TYPE) + 3) & ~3)
+#define __va_align(AP, TYPE) \
+ ((((unsigned long)(AP)) + ((sizeof (TYPE) >= 8) ? 7 : 3)) \
+ & ~((sizeof (TYPE) >= 8) ? 7 : 3))
+
+#define va_arg(AP,TYPE) \
+( *(TYPE *)((AP = (char *) (__va_align(AP, TYPE) \
+ + __va_rounded_size(TYPE))) \
+ - __va_rounded_size(TYPE)))
+
+#define va_end(AP) ((void)0)
+
+#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
+#endif /* Windows NT */
diff --git a/gcc/ginclude/varargs.h b/gcc/ginclude/varargs.h
index 16e8437..06ba8e8 100644
--- a/gcc/ginclude/varargs.h
+++ b/gcc/ginclude/varargs.h
@@ -36,7 +36,7 @@
#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
#include <va-h8300.h>
#else
-#if defined (__PPC__) && defined (_CALL_SYSV)
+#if defined (__PPC__) && (defined (_CALL_SYSV) || defined (__WIN32__))
#include <va-ppc.h>
#else
#ifdef __sh__