diff --git a/tests/usr.bin/xlint/lint1/msg_135.c b/tests/usr.bin/xlint/lint1/msg_135.c index b1fb5c2c6651..dd589283701c 100644 --- a/tests/usr.bin/xlint/lint1/msg_135.c +++ b/tests/usr.bin/xlint/lint1/msg_135.c @@ -1,4 +1,4 @@ -/* $NetBSD: msg_135.c,v 1.6 2021/04/17 16:52:09 rillig Exp $ */ +/* $NetBSD: msg_135.c,v 1.7 2021/04/17 16:58:04 rillig Exp $ */ # 3 "msg_135.c" // Test for message: converting '%s' to '%s' may cause alignment problem [135] @@ -28,6 +28,10 @@ struct complete { * from the publicly visible, incomplete 'struct lhash_st' to a private * implementation type such as 'struct lhash_st_OPENSSL_STRING'. * + * Before tree.c 1.277 from 2021-04-17, lint warned about this, even though + * there was not enough evidence that there really was an alignment problem, + * resulting in many false positives. + * * See openssl/lhash.h. */ void @@ -35,6 +39,6 @@ pointer_to_structs(struct incomplete *incomplete) { struct complete *complete; - complete = (struct complete *)incomplete; /* expect: 135 */ + complete = (struct complete *)incomplete; sink(complete); } diff --git a/tests/usr.bin/xlint/lint1/msg_135.exp b/tests/usr.bin/xlint/lint1/msg_135.exp index 4098f99171fc..e369438d45e5 100644 --- a/tests/usr.bin/xlint/lint1/msg_135.exp +++ b/tests/usr.bin/xlint/lint1/msg_135.exp @@ -1,3 +1,2 @@ msg_135.c(15): warning: converting 'pointer to const unsigned char' to 'pointer to const unsigned int' may cause alignment problem [135] -msg_135.c(38): warning: converting 'pointer to incomplete struct incomplete' to 'pointer to struct complete' may cause alignment problem [135] msg_135.c(20): warning: struct incomplete never defined [233] diff --git a/usr.bin/xlint/lint1/tree.c b/usr.bin/xlint/lint1/tree.c index 7f60dfab9571..de2aa147b5b2 100644 --- a/usr.bin/xlint/lint1/tree.c +++ b/usr.bin/xlint/lint1/tree.c @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.276 2021/04/10 18:06:53 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.277 2021/04/17 16:58:04 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.276 2021/04/10 18:06:53 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.277 2021/04/17 16:58:04 rillig Exp $"); #endif #include @@ -2081,7 +2081,8 @@ check_pointer_conversion(tnode_t *tn, type_t *ntp) return; } - if (hflag && alignment_in_bits(nstp) > alignment_in_bits(ostp)) { + if (hflag && alignment_in_bits(nstp) > alignment_in_bits(ostp) && + !is_incomplete(ostp)) { /* converting '%s' to '%s' may cause alignment problem */ warning(135, type_name(otp), type_name(ntp)); }