Date: Thu, 29 Mar 2007 13:36:31 +0200 From: Alexander Leidinger <Alexander@Leidinger.net> To: "Greg 'groggy' Lehey" <grog@FreeBSD.org> Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, Maksim Yevmenkin <emax@FreeBSD.org>, cvs-all@FreeBSD.org, Andrew Thompson <thompsa@FreeBSD.org> Subject: Re: Giving in to Coverity (was: cvs commit: src/sys/netgraph/bluetooth/l2cap ng_l2cap_cmds.c) Message-ID: <20070329133631.e0xqnpftccgc4cow@webmail.leidinger.net> In-Reply-To: <20070329015212.GA97061@heff.fud.org.nz> References: <200703282125.l2SLPuR9058727@repoman.freebsd.org> <20070329012834.GC79742@wantadilla.lemis.com> <20070329015212.GA97061@heff.fud.org.nz>
next in thread | previous in thread | raw e-mail | index | archive | help
Quoting Andrew Thompson <thompsa@freebsd.org> (from Thu, 29 Mar 2007 =20 13:52:12 +1200): > On Thu, Mar 29, 2007 at 10:58:34AM +0930, Greg 'groggy' Lehey wrote: >> On Wednesday, 28 March 2007 at 21:25:56 +0000, Maksim Yevmenkin wrote: >> > emax 2007-03-28 21:25:56 UTC >> > >> > FreeBSD src repository >> > >> > Modified files: >> > sys/netgraph/bluetooth/l2cap ng_l2cap_cmds.c >> > Log: >> > Try to silence Coverity by adding (void) in front of function call. >> > Also add a comment, explaining why return value is not being checked. >> >> I hope Coverity isn't going to force us to add unnecessary casts to >> function calls. > > Well no, you can always silence Coverity by just marking it as a false > bug. Maxim and me discussed this briefly before this commit. The return value of the function is checked most of the time (8 out of =20 9 times in this case). The cast tells that the return value of the =20 function is ignored by intend. It is not necessary for humans to =20 understand the code, but it allows humans to gain more insight than =20 without it. The comment tells even more, so a human would not need the =20 cast, but it should allow to give statistical checkers like Coverity =20 Prevent more hints. I don't know if this version of Coverity Prevent =20 understands this hint or not (and if it isn't, I will mark this CID up =20 as IGNORE). But in the light of such "useless" comments as "/* =20 FALLTHROUGH */" to "please lint" I don't think such a comment about =20 unnecessary casts is appropriate. I don't object to add hints for =20 lint, they provide some additional info to a human being too. The cast does not obfuscate the code, doesn't make it harder to read =20 or understand and doesn't cause deeper indenting or nesting or =20 whatever. It also allows statistical checkers to count this as a =20 checked return value, so next time the return value of the same =20 function at another place is not checked, it knows about it (at least =20 theoretically, I don't know if this is the case for the version of =20 Coverity Prevent we use). If you still think this cast is a bad idea, feel free to explain why =20 this is the case in your opinion. Bye, Alexander. --=20 Someone is speaking well of you. How unusual! http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID =3D B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID =3D 72077137
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070329133631.e0xqnpftccgc4cow>