Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/usr.bin/xlint/lint1 tests/lint: sync tests for platfor...
details: https://anonhg.NetBSD.org/src/rev/37e98c23a0c8
branches: trunk
changeset: 362025:37e98c23a0c8
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Feb 26 11:13:01 2022 +0000
description:
tests/lint: sync tests for platform-dependent character comparisons
diffstat:
tests/usr.bin/xlint/lint1/msg_230.c | 4 +-
tests/usr.bin/xlint/lint1/msg_230_uchar.c | 32 +++++++++++++++++++++++-------
2 files changed, 26 insertions(+), 10 deletions(-)
diffs (87 lines):
diff -r 915fff45b19b -r 37e98c23a0c8 tests/usr.bin/xlint/lint1/msg_230.c
--- a/tests/usr.bin/xlint/lint1/msg_230.c Sat Feb 26 10:16:35 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_230.c Sat Feb 26 11:13:01 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_230.c,v 1.10 2021/10/09 22:03:38 rillig Exp $ */
+/* $NetBSD: msg_230.c,v 1.11 2022/02/26 11:13:01 rillig Exp $ */
# 3 "msg_230.c"
// Test for message: nonportable character comparison '%s %d' [230]
@@ -71,7 +71,7 @@
}
void
-compare_lt(char c)
+compare_greater(char c)
{
/* expect+1: warning: nonportable character comparison '> -2' [230] */
diff -r 915fff45b19b -r 37e98c23a0c8 tests/usr.bin/xlint/lint1/msg_230_uchar.c
--- a/tests/usr.bin/xlint/lint1/msg_230_uchar.c Sat Feb 26 10:16:35 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_230_uchar.c Sat Feb 26 11:13:01 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_230_uchar.c,v 1.6 2021/12/16 21:14:59 rillig Exp $ */
+/* $NetBSD: msg_230_uchar.c,v 1.7 2022/02/26 11:13:01 rillig Exp $ */
# 3 "msg_230_uchar.c"
// Test for message: nonportable character comparison '%s %d' [230]
@@ -46,32 +46,32 @@
void
compare_plain_char_yoda(char c)
{
- /* expect+1: warning: nonportable character comparison '== -129' */
+ /* expect+1: warning: nonportable character comparison '== -129' [230] */
if (-129 == c)
return;
- /* expect+1: warning: nonportable character comparison '== -128' */
+ /* expect+1: warning: nonportable character comparison '== -128' [230] */
if (-128 == c)
return;
- /* expect+1: warning: nonportable character comparison '== -1' */
+ /* expect+1: warning: nonportable character comparison '== -1' [230] */
if (-1 == c)
return;
if (0 == c)
return;
if (127 == c)
return;
- /* expect+1: warning: nonportable character comparison '== 128' */
+ /* expect+1: warning: nonportable character comparison '== 128' [230] */
if (128 == c)
return;
- /* expect+1: warning: nonportable character comparison '== 255' */
+ /* expect+1: warning: nonportable character comparison '== 255' [230] */
if (255 == c)
return;
- /* expect+1: warning: nonportable character comparison '== 256' */
+ /* expect+1: warning: nonportable character comparison '== 256' [230] */
if (256 == c)
return;
}
void
-compare_lt(char c)
+compare_greater(char c)
{
/* expect+1: warning: nonportable character comparison '> -2' [230] */
@@ -116,3 +116,19 @@
if (c >= 129)
return;
}
+
+void
+compare_with_character_literal(char ch)
+{
+ /*
+ * 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.
+ */
+ if (ch == '\200')
+ return;
+ if (ch == '\377')
+ return;
+ if (ch == '\000')
+ return;
+}
Home |
Main Index |
Thread Index |
Old Index