Module Name: src
Committed By: rillig
Date: Sun Jan 17 16:16:10 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_163.c msg_163.exp
Log Message:
lint: add test for rvalue ++ after cast
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_163.c \
src/tests/usr.bin/xlint/lint1/msg_163.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_163.c
diff -u src/tests/usr.bin/xlint/lint1/msg_163.c:1.1 src/tests/usr.bin/xlint/lint1/msg_163.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_163.c:1.1 Sat Jan 2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_163.c Sun Jan 17 16:16:09 2021
@@ -1,7 +1,13 @@
-/* $NetBSD: msg_163.c,v 1.1 2021/01/02 10:22:43 rillig Exp $ */
+/* $NetBSD: msg_163.c,v 1.2 2021/01/17 16:16:09 rillig Exp $ */
# 3 "msg_163.c"
// Test for message: a cast does not yield an lvalue [163]
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+void
+example(char *p, int i)
+{
+ p++;
+ ((char *)p)++; /* XXX: why is this ok? */
+ i++;
+ ((int)i)++; /* expect: 163, 114 */
+}
Index: src/tests/usr.bin/xlint/lint1/msg_163.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_163.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_163.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_163.exp:1.1 Sat Jan 2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_163.exp Sun Jan 17 16:16:09 2021
@@ -1 +1,2 @@
-msg_163.c(6): syntax error ':' [249]
+msg_163.c(12): a cast does not yield an lvalue [163]
+msg_163.c(12): operand of 'x++' must be lvalue [114]