Merged revisions 143552,143554,143557,143560,143562,143564-143567,143570-143573,14357...
[official-gcc.git] / gcc / testsuite / gcc.target / x86_64 / abi / callabi / vaarg-1.c
bloba6d8463ed5c386bd3530ef653a46715c95c71f31
1 /* Test for cross x86_64<->w64 abi va_list calls.
2 */
3 /* Origin: Kai Tietz <kai.tietz@onevision.com> */
4 /* { dg-do run } */
5 /* { dg-options "-std=gnu99" } */
6 #include "callabi.h"
8 extern __SIZE_TYPE__ strlen (const char *);
9 extern int sprintf (char *,const char *, ...);
10 extern void abort (void);
12 static
13 void CALLABI_CROSS vdo_cpy (char *s, CROSS_VA_LIST argp)
15 __SIZE_TYPE__ len;
16 char *r = s;
17 char *e;
18 *r = 0;
19 for (;;) {
20 e = CROSS_VA_ARG (argp,char *);
21 if (*e == 0) break;
22 sprintf (r,"%s", e);
23 r += strlen (r);
27 static
28 void CALLABI_CROSS do_cpy (char *s, ...)
30 CROSS_VA_LIST argp;
31 CROSS_VA_START (argp, s);
32 vdo_cpy (s, argp);
33 CROSS_VA_END (argp);
36 int main ()
38 char s[256];
40 do_cpy (s, "1","2","3","4", "5", "6", "7", "");
42 if (s[0] != '1' || s[1] !='2' || s[2] != '3' || s[3] != '4'
43 || s[4] != '5' || s[5] != '6' || s[6] != '7' || s[7] != 0)
44 abort ();
46 return 0;