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/702a84c21d0c
branches:  trunk
changeset: 960372:702a84c21d0c
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 d2f8f5248c75 -r 702a84c21d0c 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 d2f8f5248c75 -r 702a84c21d0c 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