Module Name:    src
Committed By:   rillig
Date:           Sat Jan 15 22:12:35 UTC 2022

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

Log Message:
tests/lint: demonstrate undetected double semicolon

In a statement-list like 'return 0;;', the second semicolon is a
separate, unreachable statement.


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

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.14 src/tests/usr.bin/xlint/lint1/msg_193.c:1.15
--- src/tests/usr.bin/xlint/lint1/msg_193.c:1.14	Sun Aug 15 21:51:56 2021
+++ src/tests/usr.bin/xlint/lint1/msg_193.c	Sat Jan 15 22:12:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_193.c,v 1.14 2021/08/15 21:51:56 rillig Exp $	*/
+/*	$NetBSD: msg_193.c,v 1.15 2022/01/15 22:12:35 rillig Exp $	*/
 # 3 "msg_193.c"
 
 // Test for message: statement not reached [193]
@@ -656,3 +656,14 @@ lint_annotation_NOTREACHED(void)
 		/* NOTREACHED */
 		suppressed();
 }
+
+/*
+ * Since at least 2002, lint does not detect a double semicolon.  See
+ * cgram.y, expression_statement, T_SEMI.
+ */
+int
+test_empty_statement(int x)
+{
+	/* TODO: expect+1: warning: statement not reachable [193] */
+	return x > 0 ? x : -x;;
+}

Reply via email to