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: demonstrate undetected...
details: https://anonhg.NetBSD.org/src/rev/c8aa34d2bd06
branches: trunk
changeset: 359665:c8aa34d2bd06
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Jan 15 22:12:35 2022 +0000
description:
tests/lint: demonstrate undetected double semicolon
In a statement-list like 'return 0;;', the second semicolon is a
separate, unreachable statement.
diffstat:
tests/usr.bin/xlint/lint1/msg_193.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diffs (24 lines):
diff -r 06e4ac8418f2 -r c8aa34d2bd06 tests/usr.bin/xlint/lint1/msg_193.c
--- a/tests/usr.bin/xlint/lint1/msg_193.c Sat Jan 15 20:16:55 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_193.c Sat Jan 15 22:12:35 2022 +0000
@@ -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 @@
/* 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;;
+}
Home |
Main Index |
Thread Index |
Old Index