xref: /netbsd-src/tests/usr.bin/xlint/lint1/d_packed_structs.c (revision 82d56013d7b633d116a93943de88e08335357a7c)
1 /*	$NetBSD: d_packed_structs.c,v 1.3 2021/01/31 14:57:28 rillig Exp $	*/
2 # 3 "d_packed_structs.c"
3 
4 /* packed tests */
5 
6 struct in_addr {
7 	int x;
8 };
9 struct ip_timestamp {
10 	char ipt_code;
11 	char ipt_len;
12 	char ipt_ptr;
13 	unsigned int
14 	    ipt_flg: 4,
15 	    ipt_oflw: 4;
16 	union ipt_timestamp {
17 		int ipt_time[1];
18 		struct ipt_ta {
19 			struct in_addr ipt_addr;
20 			int ipt_time;
21 		} ipt_ta[1]__packed;
22 	} ipt_timestamp__packed;
23 } __packed;
24 
25 typedef struct __packed {
26 	int x;
27 } t;
28 
29 struct x {
30 	char c;
31 	long l;
32 } __packed;
33 
34 struct y {
35 	char c;
36 	long l;
37 };
38 
39 int a[sizeof(struct y) - sizeof(struct x) - 1];
40