diff options
| author | rillig <rillig@NetBSD.org> | 2023-06-24 17:50:31 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2023-06-24 17:50:31 +0000 |
| commit | cc6a62c5d6ab38c5481fd895c23ef9aa55542c24 (patch) | |
| tree | 3ea338b19ff98383df3b2c93f29af79f1dd42a3c /tests/usr.bin | |
| parent | ed1ea27f95d04ad338a74593086cecd68fbea545 (diff) | |
lint: don't warn about comparison between char and character constant
Diffstat (limited to 'tests/usr.bin')
| -rw-r--r-- | tests/usr.bin/xlint/lint1/msg_230.c | 10 | ||||
| -rw-r--r-- | tests/usr.bin/xlint/lint1/msg_230_uchar.c | 10 |
2 files changed, 4 insertions, 16 deletions
diff --git a/tests/usr.bin/xlint/lint1/msg_230.c b/tests/usr.bin/xlint/lint1/msg_230.c index 01f401048c6..24586a49aa0 100644 --- a/tests/usr.bin/xlint/lint1/msg_230.c +++ b/tests/usr.bin/xlint/lint1/msg_230.c @@ -1,4 +1,4 @@ -/* $NetBSD: msg_230.c,v 1.12 2023/02/22 22:30:40 rillig Exp $ */ +/* $NetBSD: msg_230.c,v 1.13 2023/06/24 17:50:31 rillig Exp $ */ # 3 "msg_230.c" // Test for message: nonportable character comparison '%s' [230] @@ -113,18 +113,12 @@ compare_greater(char c) return; } +/* Comparing a char expression with a character constant is always valid. */ void compare_with_character_literal(char ch) { - /* - * FIXME: These comparisons are portable since the character constant - * is interpreted using the type 'char' on the exact same platform - * as where the comparison takes place. - */ - /* expect+1: warning: nonportable character comparison '== -128' [230] */ if (ch == '\200') return; - /* expect+1: warning: nonportable character comparison '== -1' [230] */ if (ch == '\377') return; if (ch == '\000') diff --git a/tests/usr.bin/xlint/lint1/msg_230_uchar.c b/tests/usr.bin/xlint/lint1/msg_230_uchar.c index e74a29faf52..238e503d8b1 100644 --- a/tests/usr.bin/xlint/lint1/msg_230_uchar.c +++ b/tests/usr.bin/xlint/lint1/msg_230_uchar.c @@ -1,4 +1,4 @@ -/* $NetBSD: msg_230_uchar.c,v 1.11 2023/02/27 21:59:14 rillig Exp $ */ +/* $NetBSD: msg_230_uchar.c,v 1.12 2023/06/24 17:50:31 rillig Exp $ */ # 3 "msg_230_uchar.c" // Test for message: nonportable character comparison '%s' [230] @@ -117,18 +117,12 @@ compare_greater(char c) return; } +/* Comparing a char expression with a character constant is always valid. */ void compare_with_character_literal(char ch) { - /* - * FIXME: These comparisons are portable since the character constant - * is interpreted using the type 'char' on the exact same platform - * as where the comparison takes place. - */ - /* expect+1: warning: nonportable character comparison '== 128' [230] */ if (ch == '\200') return; - /* expect+1: warning: nonportable character comparison '== 255' [230] */ if (ch == '\377') return; if (ch == '\000') |
