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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [compat/] [struct-by-value-8_y.c] - Blame information for rev 154

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
#include <stdarg.h>
2
 
3
#include "compat-common.h"
4
 
5
#ifdef SKIP_VA
6
const int test_va = 0;
7
#else
8
const int test_va = 1;
9
#endif
10
 
11
typedef struct { char c; } Sc;
12
typedef struct { short s; } Ss;
13
typedef struct { int i; } Si;
14
typedef struct { short s; char c; } Ssc;
15
typedef struct { int i; short s; } Sis;
16
typedef struct { char c; short s; int i; } Scsi;
17
typedef struct { char c; int i; short s; } Scis;
18
 
19
void initSc (Sc *p, int i) { p->c = i/16; }
20
void initSs (Ss *p, int i) { p->s = i; }
21
void initSi (Si *p, int i) { p->i = i; }
22
void initSsc (Ssc *p, int i) { p->s = i; p->c = (i/16)+1; }
23
void initSis (Sis *p, int i) { p->i = i; p->s = i+1; }
24
void initScsi (Scsi *p, int i) { p->c = i/16; p->s = i+1; p->i = i+2; }
25
void initScis (Scis *p, int i) { p->c = i/16; p->i = i+1; p->s = i+2; }
26
 
27
#define T(N, TYPE)                                              \
28
struct S##TYPE##N { TYPE i[N]; };                               \
29
                                                                \
30
extern struct S##TYPE##N g1s##TYPE##N, g2s##TYPE##N;            \
31
extern struct S##TYPE##N g3s##TYPE##N, g4s##TYPE##N;            \
32
extern struct S##TYPE##N g5s##TYPE##N, g6s##TYPE##N;            \
33
extern struct S##TYPE##N g7s##TYPE##N, g8s##TYPE##N;            \
34
extern struct S##TYPE##N g9s##TYPE##N, g10s##TYPE##N;           \
35
extern struct S##TYPE##N g11s##TYPE##N, g12s##TYPE##N;          \
36
extern struct S##TYPE##N g13s##TYPE##N, g14s##TYPE##N;          \
37
extern struct S##TYPE##N g15s##TYPE##N, g16s##TYPE##N;          \
38
                                                                \
39
extern void check##TYPE (TYPE x, int i);                        \
40
extern void                                                     \
41
check##TYPE##N (struct S##TYPE##N *p, int i);                   \
42
                                                                \
43
void                                                            \
44
checkg##TYPE##N (void)                                          \
45
{                                                               \
46
  check##TYPE##N ( &g1s##TYPE##N,  1*16);                       \
47
  check##TYPE##N ( &g2s##TYPE##N,  2*16);                       \
48
  check##TYPE##N ( &g3s##TYPE##N,  3*16);                       \
49
  check##TYPE##N ( &g4s##TYPE##N,  4*16);                       \
50
  check##TYPE##N ( &g5s##TYPE##N,  5*16);                       \
51
  check##TYPE##N ( &g6s##TYPE##N,  6*16);                       \
52
  check##TYPE##N ( &g7s##TYPE##N,  7*16);                       \
53
  check##TYPE##N ( &g8s##TYPE##N,  8*16);                       \
54
  check##TYPE##N ( &g9s##TYPE##N,  9*16);                       \
55
  check##TYPE##N (&g10s##TYPE##N, 10*16);                       \
56
  check##TYPE##N (&g11s##TYPE##N, 11*16);                       \
57
  check##TYPE##N (&g12s##TYPE##N, 12*16);                       \
58
  check##TYPE##N (&g13s##TYPE##N, 13*16);                       \
59
  check##TYPE##N (&g14s##TYPE##N, 14*16);                       \
60
  check##TYPE##N (&g15s##TYPE##N, 15*16);                       \
61
  check##TYPE##N (&g16s##TYPE##N, 16*16);                       \
62
}                                                               \
63
                                                                \
64
void                                                            \
65
test##TYPE##N (struct S##TYPE##N s1, struct S##TYPE##N s2,      \
66
               struct S##TYPE##N s3, struct S##TYPE##N s4,      \
67
               struct S##TYPE##N s5, struct S##TYPE##N s6,      \
68
               struct S##TYPE##N s7, struct S##TYPE##N s8,      \
69
               struct S##TYPE##N s9, struct S##TYPE##N s10,     \
70
               struct S##TYPE##N s11, struct S##TYPE##N s12,    \
71
               struct S##TYPE##N s13, struct S##TYPE##N s14,    \
72
               struct S##TYPE##N s15, struct S##TYPE##N s16)    \
73
{                                                               \
74
  check##TYPE##N (&s1, 1*16);                                   \
75
  check##TYPE##N (&s2, 2*16);                                   \
76
  check##TYPE##N (&s3, 3*16);                                   \
77
  check##TYPE##N (&s4, 4*16);                                   \
78
  check##TYPE##N (&s5, 5*16);                                   \
79
  check##TYPE##N (&s6, 6*16);                                   \
80
  check##TYPE##N (&s7, 7*16);                                   \
81
  check##TYPE##N (&s8, 8*16);                                   \
82
  check##TYPE##N (&s9, 9*16);                                   \
83
  check##TYPE##N (&s10, 10*16);                                 \
84
  check##TYPE##N (&s11, 11*16);                                 \
85
  check##TYPE##N (&s12, 12*16);                                 \
86
  check##TYPE##N (&s13, 13*16);                                 \
87
  check##TYPE##N (&s14, 14*16);                                 \
88
  check##TYPE##N (&s15, 15*16);                                 \
89
  check##TYPE##N (&s16, 16*16);                                 \
90
}                                                               \
91
                                                                \
92
void                                                            \
93
testva##TYPE##N (int n, ...)                                    \
94
{                                                               \
95
  int i;                                                        \
96
  va_list ap;                                                   \
97
  if (test_va)                                                  \
98
    {                                                           \
99
      va_start (ap, n);                                         \
100
      for (i = 0; i < n; i++)                                    \
101
        {                                                       \
102
          struct S##TYPE##N t = va_arg (ap, struct S##TYPE##N); \
103
          check##TYPE##N (&t, (i+1)*16);                        \
104
        }                                                       \
105
      va_end (ap);                                              \
106
    }                                                           \
107
}
108
 
109
#ifndef SKIP_ZERO_ARRAY
110
T(0, Ssc)
111
#endif
112
T(1, Ssc)
113
T(2, Ssc)
114
T(3, Ssc)
115
T(4, Ssc)
116
T(5, Ssc)
117
T(6, Ssc)
118
T(7, Ssc)
119
T(8, Ssc)
120
T(9, Ssc)
121
T(10, Ssc)
122
T(11, Ssc)
123
T(12, Ssc)
124
T(13, Ssc)
125
T(14, Ssc)
126
T(15, Ssc)
127
#ifndef SKIP_ZERO_ARRAY
128
T(0, Sis)
129
#endif
130
T(1, Sis)
131
T(2, Sis)
132
T(3, Sis)
133
T(4, Sis)
134
T(5, Sis)
135
T(6, Sis)
136
T(7, Sis)
137
T(8, Sis)
138
T(9, Sis)
139
T(10, Sis)
140
T(11, Sis)
141
T(12, Sis)
142
T(13, Sis)
143
T(14, Sis)
144
T(15, Sis)

powered by: WebSVN 2.1.0

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