Debian Codegraph @

gcc/testsuite/gcc.target/i386/iamcu/test_empty_structs_and_unions.c

raw
1 /* This tests passing and returning of empty structures and unions. */
2
3 #include "defines.h"
4 #include "args.h"
5
6 struct IntegerRegisters iregbits = { ~0, ~0, ~0, ~0, ~0, ~0 };
7 struct IntegerRegisters iregs;
8 unsigned int num_iregs;
9
10 struct empty_struct
11 {
12 };
13
14 struct empty_struct
15 check_struct_passing(struct empty_struct s0 ATTRIBUTE_UNUSED,
16 struct empty_struct s1 ATTRIBUTE_UNUSED,
17 int i0 ATTRIBUTE_UNUSED)
18 {
19 struct empty_struct s;
20 check_int_arguments;
21 return s;
22 }
23
24 #define check_struct_passing WRAP_CALL(check_struct_passing)
25
26 union empty_union
27 {
28 };
29
30 union empty_union
31 check_union_passing(union empty_union u0 ATTRIBUTE_UNUSED,
32 union empty_union u1 ATTRIBUTE_UNUSED,
33 int i0 ATTRIBUTE_UNUSED)
34 {
35 union empty_union u;
36 check_int_arguments;
37 return u;
38 }
39
40 #define check_union_passing WRAP_CALL(check_union_passing)
41
42 int
43 main (void)
44 {
45 struct empty_struct s;
46 union empty_union u;
47
48 clear_struct_registers;
49 iregs.I0 = 32;
50 num_iregs = 1;
51 clear_int_hardware_registers;
52 check_union_passing(u,u,32);
53
54 clear_struct_registers;
55 iregs.I0 = 33;
56 num_iregs = 1;
57 clear_int_hardware_registers;
58 check_struct_passing(s,s,33);
59
60 return 0;
61 }