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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20041214-1.c] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
typedef long unsigned int size_t;
2
extern void abort (void);
3
extern char *strcpy (char *, const char *);
4
extern int strcmp (const char *, const char *);
5
typedef __builtin_va_list va_list;
6
static const char null[] = "(null)";
7
int g (char *s, const char *format, va_list ap)
8
{
9
  const char *f;
10
  const char *string;
11
  char spec;
12
  static const void *step0_jumps[] = {
13
    &&do_precision,
14
    &&do_form_integer,
15
    &&do_form_string,
16
  };
17
  f = format;
18
  if (*f == '\0')
19
    goto all_done;
20
  do
21
    {
22
      spec = (*++f);
23
      goto *(step0_jumps[2]);
24
 
25
    /* begin switch table. */
26
    do_precision:
27
      ++f;
28
      __builtin_va_arg (ap, int);
29
      spec = *f;
30
      goto *(step0_jumps[2]);
31
 
32
      do_form_integer:
33
        __builtin_va_arg (ap, unsigned long int);
34
        goto end;
35
 
36
      do_form_string:
37
        string = __builtin_va_arg (ap, const char *);
38
        strcpy (s, string);
39
 
40
      /* End of switch table. */
41
      end:
42
      ++f;
43
    }
44
  while (*f != '\0');
45
 
46
all_done:
47
  return 0;
48
}
49
 
50
void
51
f (char *s, const char *f, ...)
52
{
53
  va_list ap;
54
  __builtin_va_start (ap, f);
55
  g (s, f, ap);
56
  __builtin_va_end (ap);
57
}
58
 
59
int
60
main (void)
61
{
62
  char buf[10];
63
  f (buf, "%s", "asdf", 0);
64
  if (strcmp (buf, "asdf"))
65
    abort ();
66
  return 0;
67
}
68
 

powered by: WebSVN 2.1.0

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