1 /* $NetBSD: msg_220.c,v 1.3 2021/04/12 15:54:55 christos Exp $ */ 2 # 3 "msg_220.c" 3 4 // Test for message: fallthrough on case statement [220] 5 6 /* lint1-extra-flags: -h */ 7 8 extern void 9 println(const char *); 10 11 void 12 example(int n) 13 { 14 switch (n) { 15 case 1: 16 case 3: 17 case 5: 18 println("odd"); 19 case 2: /* expect: 220 */ 20 case 7: 21 println("prime"); 22 default: /* expect: 284 */ 23 println("number"); 24 } 25 } 26 27 void 28 example1(int n) 29 { 30 switch (n) { 31 case 1: 32 case 3: 33 case 5: 34 println("odd"); 35 __attribute__((__fallthrough__)); 36 case 2: 37 case 7: 38 println("prime"); 39 __attribute__((__fallthrough__)); 40 default: 41 println("number"); 42 } 43 } 44