aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4b.c
blob: f33906bd29356b919a672e7256166761b4309141 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* Test for cross x86_64<->w64 abi va_list calls.  */
/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin" } */

#include <stdarg.h>

extern __SIZE_TYPE__ __attribute__ ((sysv_abi)) strlen (const char *);
extern int __attribute__ ((sysv_abi)) sprintf (char *, const char *, ...);

static void
vdo_cpy (char *s, va_list argp)
{
  __SIZE_TYPE__ len;
  char *r = s;
  char *e;
  *r = 0;
  for (;;) {
    e = va_arg (argp, char *);
    if (*e == 0) break;
    sprintf (r,"%s", e);
    r += strlen (r);
  }
}

void
do_cpy (char *s, ...)
{
  va_list argp;
  va_start (argp, s);
  vdo_cpy (s, argp);
  va_end (argp);
}