d_packed_structs.c revision 1.2
11.2Srillig/* $NetBSD: d_packed_structs.c,v 1.2 2021/01/31 14:39:31 rillig Exp $ */ 21.2Srillig# 3 "d_packed_structs.c" 31.2Srillig 41.1Sjruoho/* packed tests */ 51.1Sjruoho 61.1Sjruohostruct in_addr { 71.1Sjruoho int x; 81.1Sjruoho}; 91.1Sjruohostruct ip_timestamp { 101.1Sjruoho char ipt_code; 111.1Sjruoho char ipt_len; 121.1Sjruoho char ipt_ptr; 131.1Sjruoho unsigned int ipt_flg:4, 141.1Sjruoho ipt_oflw:4; 151.1Sjruoho union ipt_timestamp { 161.1Sjruoho int ipt_time[1]; 171.1Sjruoho struct ipt_ta { 181.1Sjruoho struct in_addr ipt_addr; 191.1Sjruoho int ipt_time; 201.1Sjruoho } ipt_ta[1] __packed; 211.1Sjruoho } ipt_timestamp __packed; 221.1Sjruoho} __packed; 231.1Sjruoho 241.1Sjruohotypedef struct __packed { 251.1Sjruoho int x; 261.1Sjruoho} t; 271.1Sjruoho 281.1Sjruohostruct x { 291.1Sjruoho char c; 301.1Sjruoho long l; 311.1Sjruoho} __packed; 321.1Sjruoho 331.1Sjruohostruct y { 341.1Sjruoho char c; 351.1Sjruoho long l; 361.1Sjruoho}; 371.1Sjruoho 381.1Sjruohoint a[sizeof(struct y) - sizeof(struct x) - 1]; 39