From owner-cvs-src@FreeBSD.ORG Mon Apr 2 12:30:51 2007 Return-Path: X-Original-To: cvs-src@freebsd.org Delivered-To: cvs-src@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DFF0016A404; Mon, 2 Apr 2007 12:30:51 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.freebsd.org (Postfix) with ESMTP id 7191F13C465; Mon, 2 Apr 2007 12:30:51 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.8/8.13.8) with ESMTP id l32CUm1i085172; Mon, 2 Apr 2007 08:30:49 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Alexander Leidinger Date: Mon, 2 Apr 2007 08:21:12 -0400 User-Agent: KMail/1.9.6 References: <200703282125.l2SLPuR9058727@repoman.freebsd.org> <20070402042600.GB19923@wantadilla.lemis.com> <20070402093238.dmw2rypu40sksc0o@webmail.leidinger.net> In-Reply-To: <20070402093238.dmw2rypu40sksc0o@webmail.leidinger.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200704020821.15298.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 02 Apr 2007 08:30:49 -0400 (EDT) X-Virus-Scanned: ClamAV 0.88.3/2997/Mon Apr 2 06:19:52 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.3 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Greg 'groggy' Lehey , cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: Giving in to Coverity (was: cvs commit: src/sys/netgraph/bluetooth/l2cap ng_l2cap_cmds.c) X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2007 12:30:52 -0000 On Monday 02 April 2007 03:32:38 am Alexander Leidinger wrote: > Quoting Greg 'groggy' Lehey (from Mon, 2 Apr 2007 > 13:56:00 +0930): > > > On Thursday, 29 March 2007 at 13:36:31 +0200, Alexander Leidinger wrote: > >> Quoting Andrew Thompson (from Thu, 29 Mar 2007 > >> 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 cast does not obfuscate the code, doesn't make it harder to read ... > > > > I've dropped the rest of your argumentation, because I don't disagree > > with it, but I do think that unnecessary casts cause (minor) > > obfuscation and make it (fractionally) more difficult to read. > > > > My concern is that we shouldn't compromise our style because of bugs > > in program checkers. I understand that there are alternatives, like > > flagging it for Coverity as "OK", and I'd expect that to be the > > preferable solution. But I'm not the guardian of style, so I'll let > > others decide on this if they care. > > There are several cases where Coverity gets something wrong (e.g. the > use of TAILQ). I did mark those as invalid in Coverity (until either > we get a new version of Coverity which understands this, or someone > writes a model of the TAILQ stuff for Coverity, or until someone tells > me to mark them as false positives). I did this because I don't know > how to fix this in our code _and_ I see no benefit in fixing this in > our code just to make Coverity not moan. For the void cast we are > talking about I see a benefit. Coverity can count this as "the return > value of this function is checked". As such a report is only generated > if a specific percentage of the use of a function is handled this way, > it is important if we want to get reports for this. And we want to get > reports for functions where the return value typically has to be > checked. There is previous history of casting a function's return value to (void) to please lint(1). Just look for '(void)printf' :) Coverity at least is smarter than lint as it doesn't warn about printf not being checked. -- John Baldwin