1219820Sjeff/* $NetBSD: d_packed_structs.c,v 1.6 2023/08/05 10:00:59 rillig Exp $ */ 2219820Sjeff# 3 "d_packed_structs.c" 3219820Sjeff 4219820Sjeff/* packed tests */ 5219820Sjeff 6219820Sjeff/* lint1-extra-flags: -X 351 */ 7219820Sjeff 8219820Sjeffstruct in_addr { 9219820Sjeff int x; 10219820Sjeff}; 11219820Sjeffstruct ip_timestamp { 12219820Sjeff char ipt_code; 13219820Sjeff char ipt_len; 14219820Sjeff char ipt_ptr; 15219820Sjeff unsigned int 16219820Sjeff ipt_flg: 4, 17219820Sjeff ipt_oflw: 4; 18219820Sjeff union ipt_timestamp { 19219820Sjeff int ipt_time[1]; 20219820Sjeff struct ipt_ta { 21219820Sjeff struct in_addr ipt_addr; 22219820Sjeff int ipt_time; 23219820Sjeff } ipt_ta[1]__packed; 24219820Sjeff } ipt_timestamp__packed; 25219820Sjeff} __packed; 26219820Sjeff 27219820Sjefftypedef struct __packed { 28219820Sjeff int x; 29219820Sjeff} t; 30219820Sjeff 31219820Sjeffstruct x { 32219820Sjeff char c; 33219820Sjeff long long l; 34219820Sjeff} __packed; 35219820Sjeff 36219820Sjeffstruct y { 37219820Sjeff char c; 38219820Sjeff long long l; 39219820Sjeff}; 40219820Sjeff 41219820Sjeffint a[sizeof(struct y) - sizeof(struct x) - 1]; 42219820Sjeff 43219820Sjeff/* expect+1: error: negative array dimension (-9) [20] */ 44219820Sjefftypedef int sizeof_x[-(int)sizeof(struct x)]; 45219820Sjeff/* expect+1: error: negative array dimension (-16) [20] */ 46219820Sjefftypedef int sizeof_y[-(int)sizeof(struct y)]; 47219820Sjeff