1 /* $NetBSD: gcc_attribute_stmt.c,v 1.4 2023/03/28 14:44:34 rillig Exp $ */ 2 # 3 "gcc_attribute_stmt.c" 3 4 /* 5 * Tests for the GCC __attribute__ for statements. 6 * 7 * https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html 8 */ 9 10 /* lint1-extra-flags: -X 351 */ 11 12 void println(const char *); 13 14 void attribute_fallthrough(int i)15attribute_fallthrough(int i) 16 { 17 switch (i) { 18 case 5: 19 /* 20 * The attribute 'fallthrough' is only valid after a 21 * preceding statement. This is already caught by GCC, so 22 * lint does not need to care. 23 */ 24 __attribute__((__fallthrough__)); 25 case 3: 26 println("odd"); 27 __attribute__((__fallthrough__)); 28 case 2: 29 /* 30 * Only the null statement can have the attribute 31 * 'fallthrough'. This is already caught by GCC, so 32 * lint does not need to care. 33 */ 34 /* expect+2: error: syntax error '__attribute__' [249] */ 35 println("prime") 36 __attribute__((__fallthrough__)); 37 } 38 } 39