1 // This tests sparse "-vcompound" output.
2 #define NULL ((void*)0)
3 typedef unsigned int uint32_t;
4 typedef unsigned long long uint64_t;
6 // Do not list functions.
7 static int do_nothing(void)
11 static inline int zero(void)
18 unsigned char description
[64];
19 unsigned char department
[64];
22 uint64_t stock_number
;
23 uint32_t tally
[12]; // per month
27 static struct inventory
*get_inv(uint64_t stocknum
)
35 unsigned char bytes
[0];
42 static struct inventory inven
[100];
45 typedef struct inventory inventory_t
;
48 static struct inventory
*invptr
;
51 static inventory_t invent
[10];
55 static double double_float
;
58 static float floats
[42];
59 static double doubles
[84];
64 // no, these are not global.
65 struct inventory inv
[10];
67 // what about statics?
68 static struct inventory invtop
;
69 static inventory_t inv_top
;
70 static uint64_t stocknums
[100];
72 invptr
= get_inv(42000);
77 * check-name: compound-sizes
78 * check-command: sparse -vcompound $file
79 * check-assert: _Alignof(long long) == 8
82 compound-sizes.c:39:17: union un static [toplevel] un: compound size 192, alignment 8
83 compound-sizes.c:42:25: struct inventory static [toplevel] inven[100]: compound size 19200, alignment 8
84 compound-sizes.c:51:33: struct inventory static [toplevel] [usertype] invent[10]: compound size 1920, alignment 8
85 compound-sizes.c:58:25: float static [toplevel] floats[42]: compound size 168, alignment 4
86 compound-sizes.c:59:25: double static [toplevel] doubles[84]: compound size 672, alignment 8