Module Name: src Committed By: rillig Date: Fri Apr 9 19:32:12 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: msg_247.c msg_247.exp Log Message: tests/lint: document where the 38,000 lint warnings come from To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/msg_247.c cvs rdiff -u -r1.7 -r1.8 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.11 src/tests/usr.bin/xlint/lint1/msg_247.c:1.12 --- src/tests/usr.bin/xlint/lint1/msg_247.c:1.11 Thu Apr 8 19:31:51 2021 +++ src/tests/usr.bin/xlint/lint1/msg_247.c Fri Apr 9 19:32:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_247.c,v 1.11 2021/04/08 19:31:51 rillig Exp $ */ +/* $NetBSD: msg_247.c,v 1.12 2021/04/09 19:32:12 rillig Exp $ */ # 3 "msg_247.c" // Test for message: pointer cast from '%s' to '%s' may be troublesome [247] @@ -120,3 +120,34 @@ counter_increment(struct counter *counte impl->saved_count = impl->public_part.count; impl->public_part.count++; } + + +/* + * In OpenSSL, the hashing API uses the incomplete 'struct lhash_st' for their + * type-generic hashing API while defining a separate struct for each type to + * be hashed. + * + * As of 2021-04-09, in a typical NetBSD build this leads to about 38,000 lint + * warnings about possibly troublesome pointer casts. + */ + +struct lhash_st; /* expect: struct lhash_st never defined */ + +struct lhash_st *OPENSSL_LH_new(void); + +struct lhash_st_OPENSSL_STRING { + union lh_OPENSSL_STRING_dummy { + void *d1; + unsigned long d2; + int d3; + } dummy; +}; + +# 196 "lhash.h" 1 3 4 +struct lhash_st_OPENSSL_STRING * +lh_OPENSSL_STRING_new(void) +{ + /* expect+1: 247 */ + return (struct lhash_st_OPENSSL_STRING *)OPENSSL_LH_new(); +} +# 154 "msg_247.c" 2 Index: src/tests/usr.bin/xlint/lint1/msg_247.exp diff -u src/tests/usr.bin/xlint/lint1/msg_247.exp:1.7 src/tests/usr.bin/xlint/lint1/msg_247.exp:1.8 --- src/tests/usr.bin/xlint/lint1/msg_247.exp:1.7 Thu Apr 8 19:20:54 2021 +++ src/tests/usr.bin/xlint/lint1/msg_247.exp Fri Apr 9 19:32:12 2021 @@ -1,2 +1,5 @@ msg_247.c(31): warning: pointer cast from 'pointer to struct Other' to 'pointer to struct <unnamed>' may be troublesome [247] msg_247.c(70): warning: pointer cast from 'pointer to struct Other' to 'pointer to signed char' may be troublesome [247] +lhash.h(200): warning: pointer cast from 'pointer to struct lhash_st' to 'pointer to struct lhash_st_OPENSSL_STRING' may be troublesome [247] + included from msg_247.c(146) +msg_247.c(134): warning: struct lhash_st never defined [233]