1 /* $NetBSD: gcc_attribute_type.c,v 1.4 2023/02/05 10:57:48 rillig Exp $ */ 2 # 3 "gcc_attribute_type.c" 3 4 /* 5 * Tests for the GCC __attribute__ for types. 6 * 7 * https://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html 8 */ 9 10 struct __attribute__((__packed__)) __attribute__(()) packed_record; 11 12 struct __attribute__((__packed__)) packed_record { 13 unsigned char len[2]; 14 unsigned long magic; 15 }; 16 17 struct record_packed { 18 unsigned char len[2]; 19 unsigned long magic; 20 } __attribute__((__packed__)); 21 22 /* TODO: do not allow __attribute__ before 'struct' */ 23 __attribute__((__packed__)) 24 struct attribute_before_keyword { 25 unsigned char len[2]; 26 unsigned long magic; 27 }; 28