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: add test for message 1...



details:   https://anonhg.NetBSD.org/src/rev/385e1ebe778f
branches:  trunk
changeset: 1019631:385e1ebe778f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Mar 16 23:12:30 2021 +0000

description:
tests/lint: add test for message 128 about incompatible pointers

diffstat:

 tests/usr.bin/xlint/lint1/msg_128.c   |  10 +++++++---
 tests/usr.bin/xlint/lint1/msg_128.exp |   2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diffs (24 lines):

diff -r 8c089ffa35b0 -r 385e1ebe778f tests/usr.bin/xlint/lint1/msg_128.c
--- a/tests/usr.bin/xlint/lint1/msg_128.c       Tue Mar 16 20:11:30 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_128.c       Tue Mar 16 23:12:30 2021 +0000
@@ -1,7 +1,11 @@
-/*     $NetBSD: msg_128.c,v 1.2 2021/02/21 09:07:58 rillig Exp $       */
+/*     $NetBSD: msg_128.c,v 1.3 2021/03/16 23:12:30 rillig Exp $       */
 # 3 "msg_128.c"
 
 // Test for message: operands have incompatible pointer types, op %s (%s != %s) [128]
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+void
+conversion_to_unconst(const char *cstr)
+{
+       char *str;
+       str = cstr;             /* expect: 128 */
+}
diff -r 8c089ffa35b0 -r 385e1ebe778f tests/usr.bin/xlint/lint1/msg_128.exp
--- a/tests/usr.bin/xlint/lint1/msg_128.exp     Tue Mar 16 20:11:30 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_128.exp     Tue Mar 16 23:12:30 2021 +0000
@@ -1,1 +1,1 @@
-msg_128.c(6): syntax error ':' [249]
+msg_128.c(10): warning: operands have incompatible pointer types, op = (char != const char) [128]



Home | Main Index | Thread Index | Old Index