msg_206.c revision 1.5
1/* $NetBSD: msg_206.c,v 1.5 2022/05/22 13:53:39 rillig Exp $ */ 2# 3 "msg_206.c" 3 4// Test for message: enumeration value(s) not handled in switch [206] 5 6/* lint1-extra-flags: -eh */ 7 8enum number { 9 ONE, TWO, THREE 10}; 11 12void 13test(enum number num) 14{ 15 switch (num) { 16 case ONE: 17 case TWO: 18 break; 19 } 20 /* expect-1: warning: enumeration value(s) not handled in switch [206] */ 21 22 switch (num) { 23 case ONE: 24 case TWO: 25 case THREE: 26 break; 27 } 28} 29 30int 31too_many(enum number num) 32{ 33 switch (num) { 34 case ONE: 35 return 1; 36 case TWO: 37 return 2; 38 case THREE: 39 return 3; 40 case 3: 41 return -1; 42 } 43 /* FIXME: There are _too many_ branches, not _too few_. */ 44 /* expect-2: warning: enumeration value(s) not handled in switch [206] */ 45 return 3; 46} 47