xref: /minix3/tests/usr.bin/xlint/lint1/d_packed_structs.c (revision 11be35a165022172ed3cea20f2b5df0307540b0e)
1*11be35a1SLionel Sambuc /* packed tests */
2*11be35a1SLionel Sambuc 
3*11be35a1SLionel Sambuc struct in_addr {
4*11be35a1SLionel Sambuc 	int x;
5*11be35a1SLionel Sambuc };
6*11be35a1SLionel Sambuc struct	ip_timestamp {
7*11be35a1SLionel Sambuc 	char ipt_code;
8*11be35a1SLionel Sambuc 	char ipt_len;
9*11be35a1SLionel Sambuc 	char ipt_ptr;
10*11be35a1SLionel Sambuc 	unsigned int ipt_flg:4,
11*11be35a1SLionel Sambuc 		     ipt_oflw:4;
12*11be35a1SLionel Sambuc 	union ipt_timestamp {
13*11be35a1SLionel Sambuc 		 int	ipt_time[1];
14*11be35a1SLionel Sambuc 		 struct	ipt_ta {
15*11be35a1SLionel Sambuc 			struct in_addr ipt_addr;
16*11be35a1SLionel Sambuc 			int ipt_time;
17*11be35a1SLionel Sambuc 		 } ipt_ta[1] __packed;
18*11be35a1SLionel Sambuc 	} ipt_timestamp __packed;
19*11be35a1SLionel Sambuc } __packed;
20*11be35a1SLionel Sambuc 
21*11be35a1SLionel Sambuc typedef struct __packed {
22*11be35a1SLionel Sambuc 	int x;
23*11be35a1SLionel Sambuc } t;
24*11be35a1SLionel Sambuc 
25*11be35a1SLionel Sambuc struct x {
26*11be35a1SLionel Sambuc 	char c;
27*11be35a1SLionel Sambuc 	long l;
28*11be35a1SLionel Sambuc } __packed;
29*11be35a1SLionel Sambuc 
30*11be35a1SLionel Sambuc struct y {
31*11be35a1SLionel Sambuc 	char c;
32*11be35a1SLionel Sambuc 	long l;
33*11be35a1SLionel Sambuc };
34*11be35a1SLionel Sambuc 
35*11be35a1SLionel Sambuc int a[sizeof(struct y) - sizeof(struct x) - 1];
36