diff --git a/tests/usr.bin/xlint/lint1/msg_243.c b/tests/usr.bin/xlint/lint1/msg_243.c index 41a6e21d9670..4d048d6988c0 100644 --- a/tests/usr.bin/xlint/lint1/msg_243.c +++ b/tests/usr.bin/xlint/lint1/msg_243.c @@ -1,7 +1,7 @@ -/* $NetBSD: msg_243.c,v 1.5 2023/03/28 14:44:35 rillig Exp $ */ +/* $NetBSD: msg_243.c,v 1.6 2023/07/09 12:04:08 rillig Exp $ */ # 3 "msg_243.c" -// Test for message: dubious comparison of enums, op '%s' [243] +// Test for message: operator '%s' assumes that '%s' is ordered [243] /* lint1-extra-flags: -eP -X 351 */ @@ -16,13 +16,13 @@ void eval(_Bool); void example(enum color a, enum color b) { - /* expect+1: warning: dubious comparison of enums, op '<' [243] */ + /* expect+1: warning: operator '<' assumes that 'enum color' is ordered [243] */ eval(a < b); - /* expect+1: warning: dubious comparison of enums, op '<=' [243] */ + /* expect+1: warning: operator '<=' assumes that 'enum color' is ordered [243] */ eval(a <= b); - /* expect+1: warning: dubious comparison of enums, op '>' [243] */ + /* expect+1: warning: operator '>' assumes that 'enum color' is ordered [243] */ eval(a > b); - /* expect+1: warning: dubious comparison of enums, op '>=' [243] */ + /* expect+1: warning: operator '>=' assumes that 'enum color' is ordered [243] */ eval(a >= b); eval(a == b); eval(a != b); diff --git a/usr.bin/xlint/lint1/err.c b/usr.bin/xlint/lint1/err.c index c19f869403ab..b2a96f72ee5c 100644 --- a/usr.bin/xlint/lint1/err.c +++ b/usr.bin/xlint/lint1/err.c @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.208 2023/07/09 11:18:55 rillig Exp $ */ +/* $NetBSD: err.c,v 1.209 2023/07/09 12:04:08 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: err.c,v 1.208 2023/07/09 11:18:55 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.209 2023/07/09 12:04:08 rillig Exp $"); #endif #include @@ -298,7 +298,7 @@ static const char *const msgs[] = { "", /* unused */ /* 240 */ "dubious operation '%s' on enum", /* 241 */ "combination of '%s' and '%s', op '%s'", /* 242 */ - "dubious comparison of enums, op '%s'", /* 243 */ + "operator '%s' assumes that '%s' is ordered", /* 243 */ "illegal structure pointer combination", /* 244 */ "incompatible structure pointers: '%s' '%s' '%s'", /* 245 */ "dubious conversion of enum to '%s'", /* 246 */ diff --git a/usr.bin/xlint/lint1/tree.c b/usr.bin/xlint/lint1/tree.c index a24ce503a19d..161adf2bf8e9 100644 --- a/usr.bin/xlint/lint1/tree.c +++ b/usr.bin/xlint/lint1/tree.c @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.557 2023/07/09 11:18:55 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.558 2023/07/09 12:04:08 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.557 2023/07/09 11:18:55 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.558 2023/07/09 12:04:08 rillig Exp $"); #endif #include @@ -3132,11 +3132,9 @@ check_enum_type_mismatch(op_t op, int arg, const tnode_t *ln, const tnode_t *rn) type_name(rn->tn_type)); break; } - } else if (Pflag && mp->m_comparison && op != EQ && op != NE) { - if (eflag) - /* dubious comparison of enums, op '%s' */ - warning(243, mp->m_name); - } + } else if (Pflag && eflag && mp->m_comparison && op != EQ && op != NE) + /* operator '%s' assumes that '%s' is ordered */ + warning(243, mp->m_name, type_name(ln->tn_type)); } /* Prints a warning if the operands mix between enum and integer. */