Home | History | Annotate | Line # | Download | only in lint1
      1 /*	$NetBSD: gcc_attribute_enum.c,v 1.6 2025/05/16 16:49:43 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__(()) __attribute__((__deprecated__)) tag;
     17 
     18 enum __attribute__(()) __attribute__((__deprecated__)) tag_with_declaration {
     19 	TAG_WITH_DECL
     20 } __attribute__(()) __attribute__((__deprecated__));
     21 
     22 enum __attribute__(()) __attribute__((__deprecated__)) {
     23 	ONLY_DECL
     24 } __attribute__(()) __attribute__((__deprecated__));
     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__(()) __attribute__((__deprecated__)),
     34 	NO_INIT_LAST __attribute__(()) __attribute__((__deprecated__))
     35 };
     36 
     37 enum with_initializer {
     38 	INIT_FIRST __attribute__(()) __attribute__((__deprecated__)) = 1,
     39 	INIT_LAST __attribute__(()) __attribute__((__deprecated__)) = 2,
     40 	/* expect+1: error: syntax error '__attribute__' [249] */
     41 	INIT_WRONG = 3 __attribute__(()) __attribute__((__deprecated__)),
     42 };
     43 
     44 enum tag {
     45 	TAG
     46 };
     47