Module Name:    src
Committed By:   rillig
Date:           Sun Aug 15 21:51:56 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint1: msg_193.c msg_193.exp

Log Message:
tests/lint: correct interpretation of NOTREACHED

The branch is unconditionally taken, therefore any later code is
unreachable as well.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/xlint/lint1/msg_193.c \
    src/tests/usr.bin/xlint/lint1/msg_193.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_193.c
diff -u src/tests/usr.bin/xlint/lint1/msg_193.c:1.13 src/tests/usr.bin/xlint/lint1/msg_193.c:1.14
--- src/tests/usr.bin/xlint/lint1/msg_193.c:1.13	Sun Aug 15 21:21:13 2021
+++ src/tests/usr.bin/xlint/lint1/msg_193.c	Sun Aug 15 21:51:56 2021
@@ -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 @@ lint_annotation_NOTREACHED(void)
 		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 */
Index: src/tests/usr.bin/xlint/lint1/msg_193.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_193.exp:1.13 src/tests/usr.bin/xlint/lint1/msg_193.exp:1.14
--- src/tests/usr.bin/xlint/lint1/msg_193.exp:1.13	Sun Aug 15 21:21:13 2021
+++ src/tests/usr.bin/xlint/lint1/msg_193.exp	Sun Aug 15 21:51:56 2021
@@ -86,4 +86,4 @@ msg_193.c(580): warning: label 'six' unu
 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]

Reply via email to