Module Name: src Committed By: rillig Date: Sun Mar 14 21:44:35 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: msg_247.c msg_247.exp Log Message: tests/lint: add test for message 247 for pointer to unnamed struct To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_247.c cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_247.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_247.c diff -u src/tests/usr.bin/xlint/lint1/msg_247.c:1.3 src/tests/usr.bin/xlint/lint1/msg_247.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_247.c:1.3 Sun Feb 28 12:40:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_247.c Sun Mar 14 21:44:35 2021 @@ -1,7 +1,21 @@ -/* $NetBSD: msg_247.c,v 1.3 2021/02/28 12:40:00 rillig Exp $ */ +/* $NetBSD: msg_247.c,v 1.4 2021/03/14 21:44:35 rillig Exp $ */ # 3 "msg_247.c" // Test for message: pointer cast from '%s' to '%s' may be troublesome [247] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* lint1-extra-flags: -c */ + +/* example taken from Xlib.h */ +typedef struct { + int id; +} *PDisplay; + +struct Other { + int id; +}; + +void +example(struct Other *arg) +{ + PDisplay display = (PDisplay)arg; /* expect: 247 */ +} Index: src/tests/usr.bin/xlint/lint1/msg_247.exp diff -u src/tests/usr.bin/xlint/lint1/msg_247.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_247.exp:1.2 --- src/tests/usr.bin/xlint/lint1/msg_247.exp:1.1 Sat Jan 2 10:22:44 2021 +++ src/tests/usr.bin/xlint/lint1/msg_247.exp Sun Mar 14 21:44:35 2021 @@ -1 +1 @@ -msg_247.c(6): syntax error ':' [249] +msg_247.c(20): warning: pointer cast from 'pointer to struct Other' to 'pointer to struct <unnamed>' may be troublesome [247]