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: document how lint disc...



details:   https://anonhg.NetBSD.org/src/rev/03f0d77b9c71
branches:  trunk
changeset: 960338:03f0d77b9c71
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 14 22:24:24 2021 +0000

description:
tests/lint: document how lint discards the typedef name in 247

diffstat:

 tests/usr.bin/xlint/lint1/msg_247.c   |  15 +++++++++++++--
 tests/usr.bin/xlint/lint1/msg_247.exp |   2 +-
 2 files changed, 14 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 125ad45c3043 -r 03f0d77b9c71 tests/usr.bin/xlint/lint1/msg_247.c
--- a/tests/usr.bin/xlint/lint1/msg_247.c       Sun Mar 14 21:44:35 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_247.c       Sun Mar 14 22:24:24 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_247.c,v 1.4 2021/03/14 21:44:35 rillig Exp $       */
+/*     $NetBSD: msg_247.c,v 1.5 2021/03/14 22:24:24 rillig Exp $       */
 # 3 "msg_247.c"
 
 // Test for message: pointer cast from '%s' to '%s' may be troublesome [247]
@@ -17,5 +17,16 @@
 void
 example(struct Other *arg)
 {
-       PDisplay display = (PDisplay)arg;       /* expect: 247 */
+       PDisplay display;
+
+       /*
+        * XXX: The target type is reported as 'struct <unnamed>'.  In cases
+        *  like these, it would be helpful to print at least the type name
+        *  of the pointer.  This type name though is discarded immediately
+        *  when the parser reduces 'T_TYPENAME clrtyp' to 'clrtyp_typespec'.
+        *  After that, the target type of the cast is just an unnamed struct,
+        *  with no hint at all that there is a typedef for a pointer to the
+        *  struct.
+        */
+       display = (PDisplay)arg;        /* expect: 247 */
 }
diff -r 125ad45c3043 -r 03f0d77b9c71 tests/usr.bin/xlint/lint1/msg_247.exp
--- a/tests/usr.bin/xlint/lint1/msg_247.exp     Sun Mar 14 21:44:35 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_247.exp     Sun Mar 14 22:24:24 2021 +0000
@@ -1,1 +1,1 @@
-msg_247.c(20): warning: pointer cast from 'pointer to struct Other' to 'pointer to struct <unnamed>' may be troublesome [247]
+msg_247.c(31): warning: pointer cast from 'pointer to struct Other' to 'pointer to struct <unnamed>' may be troublesome [247]



Home | Main Index | Thread Index | Old Index