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