1 /* $NetBSD: gcc_attribute_enum.c,v 1.4 2021/07/25 18:48:47 rillig Exp $ */ 2 # 3 "gcc_attribute_enum.c" 3 4 /* 5 * Tests for the GCC __attribute__ for enumerators. 6 * 7 * https://gcc.gnu.org/onlinedocs/gcc/Enumerator-Attributes.html 8 */ 9 10 /* 11 * Attributes in enum-specifier. 12 * 13 * See GCC, c-parser.c, function c_parser_enum_specifier. 14 */ 15 16 enum __attribute__(()) tag; 17 18 enum __attribute__(()) tag_with_declaration { 19 TAG_WITH_DECL 20 } __attribute__(()); 21 22 enum __attribute__(()) { 23 ONLY_DECL 24 } __attribute__(()); 25 26 /* 27 * Attributes in enumerator. 28 * 29 * See GCC, c-parser.c, function c_parser_enum_specifier. 30 */ 31 32 enum without_initializer { 33 NO_INIT_FIRST __attribute__(()), 34 NO_INIT_LAST __attribute__(()) 35 }; 36 37 enum with_initializer { 38 INIT_FIRST __attribute__(()) = 1, 39 INIT_LAST __attribute__(()) = 2, 40 /* expect+1: syntax error '__attribute__' [249] */ 41 INIT_WRONG = 3 __attribute__(()), 42 }; 43 44 enum tag { 45 TAG 46 }; 47