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 where the 38,...



details:   https://anonhg.NetBSD.org/src/rev/a8b76728d9cc
branches:  trunk
changeset: 961080:a8b76728d9cc
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Apr 09 19:32:12 2021 +0000

description:
tests/lint: document where the 38,000 lint warnings come from

diffstat:

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

diffs (53 lines):

diff -r c1e47e25fb04 -r a8b76728d9cc tests/usr.bin/xlint/lint1/msg_247.c
--- a/tests/usr.bin/xlint/lint1/msg_247.c       Fri Apr 09 19:12:37 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_247.c       Fri Apr 09 19:32:12 2021 +0000
@@ -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 @@
        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
diff -r c1e47e25fb04 -r a8b76728d9cc tests/usr.bin/xlint/lint1/msg_247.exp
--- a/tests/usr.bin/xlint/lint1/msg_247.exp     Fri Apr 09 19:12:37 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_247.exp     Fri Apr 09 19:32:12 2021 +0000
@@ -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]



Home | Main Index | Thread Index | Old Index