OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [x86_64/] [abi/] [callabi/] [vaarg-1.c] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 328 jeremybenn
/* 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"
7
 
8
extern __SIZE_TYPE__ strlen (const char *);
9
extern int sprintf (char *,const char *, ...);
10
extern void abort (void);
11
 
12
static
13
void CALLABI_CROSS vdo_cpy (char *s, CROSS_VA_LIST argp)
14
{
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);
24
  }
25
}
26
 
27
static
28
void CALLABI_CROSS do_cpy (char *s, ...)
29
{
30
  CROSS_VA_LIST argp;
31
  CROSS_VA_START (argp, s);
32
  vdo_cpy (s, argp);
33
  CROSS_VA_END (argp);
34
}
35
 
36
int main ()
37
{
38
  char s[256];
39
 
40
  do_cpy (s, "1","2","3","4", "5", "6", "7", "");
41
 
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 ();
45
 
46
  return 0;
47
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.