msg_243.c revision 1.3
1/* $NetBSD: msg_243.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ 2# 3 "msg_243.c" 3 4// Test for message: dubious comparison of enums, op %s [243] 5 6/* lint1-extra-flags: -eP */ 7 8enum color { 9 RED, GREEN, BLUE 10}; 11 12void eval(_Bool); 13 14/* TODO: There should be a way to declare an enum type as "ordered ok". */ 15 16void 17example(enum color a, enum color b) 18{ 19 /* expect+1: warning: dubious comparison of enums, op < [243] */ 20 eval(a < b); 21 /* expect+1: warning: dubious comparison of enums, op <= [243] */ 22 eval(a <= b); 23 /* expect+1: warning: dubious comparison of enums, op > [243] */ 24 eval(a > b); 25 /* expect+1: warning: dubious comparison of enums, op >= [243] */ 26 eval(a >= b); 27 eval(a == b); 28 eval(a != b); 29} 30