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: correct interpretation...
details: https://anonhg.NetBSD.org/src/rev/91e243cf418f
branches: trunk
changeset: 1022956:91e243cf418f
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Aug 15 21:51:56 2021 +0000
description:
tests/lint: correct interpretation of NOTREACHED
The branch is unconditionally taken, therefore any later code is
unreachable as well.
diffstat:
tests/usr.bin/xlint/lint1/msg_193.c | 9 +++++++--
tests/usr.bin/xlint/lint1/msg_193.exp | 2 +-
2 files changed, 8 insertions(+), 3 deletions(-)
diffs (32 lines):
diff -r eeab390eec1a -r 91e243cf418f tests/usr.bin/xlint/lint1/msg_193.c
--- a/tests/usr.bin/xlint/lint1/msg_193.c Sun Aug 15 21:21:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_193.c Sun Aug 15 21:51:56 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_193.c,v 1.13 2021/08/15 21:21:13 rillig Exp $ */
+/* $NetBSD: msg_193.c,v 1.14 2021/08/15 21:51:56 rillig Exp $ */
# 3 "msg_193.c"
// Test for message: statement not reached [193]
@@ -645,7 +645,12 @@
suppressed();
}
- /* FIXME: The 'if' statement _is_ reached. */
+ /*
+ * Since the condition in the 'if' statement is constant, lint knows
+ * that the branch is unconditionally taken. The annotation comment
+ * marks that branch as not reached, which means that any following
+ * statement cannot be reached as well.
+ */
/* expect+1: warning: statement not reached [193] */
if (1)
/* NOTREACHED */
diff -r eeab390eec1a -r 91e243cf418f tests/usr.bin/xlint/lint1/msg_193.exp
--- a/tests/usr.bin/xlint/lint1/msg_193.exp Sun Aug 15 21:21:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_193.exp Sun Aug 15 21:51:56 2021 +0000
@@ -86,4 +86,4 @@
msg_193.c(597): warning: statement not reached [193]
msg_193.c(606): warning: statement not reached [193]
msg_193.c(627): warning: statement not reached [193]
-msg_193.c(650): warning: statement not reached [193]
+msg_193.c(655): warning: statement not reached [193]
Home |
Main Index |
Thread Index |
Old Index