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