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