From owner-svn-src-all@FreeBSD.ORG Thu Jan 17 18:40:50 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 36FD13CE; Thu, 17 Jan 2013 18:40:50 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 0DF16942; Thu, 17 Jan 2013 18:40:50 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 20A12B924; Thu, 17 Jan 2013 13:40:49 -0500 (EST) From: John Baldwin To: Eitan Adler Subject: Re: svn commit: r245494 - head/bin/pwait Date: Thu, 17 Jan 2013 10:35:14 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201301160503.r0G53qie087155@svn.freebsd.org> <50F6ED68.50602@delphij.net> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201301171035.14799.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 17 Jan 2013 13:40:49 -0500 (EST) Cc: "svn-src-head@freebsd.org" , Xin LI , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , d@delphij.net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jan 2013 18:40:50 -0000 On Wednesday, January 16, 2013 2:15:00 pm Eitan Adler wrote: > On 16 January 2013 13:11, Xin Li wrote: > > > Yes I did. Using exit(3) tells clang that this is the final exit and > > thus eliminates the warning. > > > > It sounds like a bug (or arguably a feature) that clang does not > > recognize return in main()s... > > It is not a bug: see > http://clang-developers.42468.n3.nabble.com/Static-analyzer-possible-memory- leak-false-positive-td4026706.html No, it is clearly a bug. It is a waste of time and adds obfuscation (and runtime overhead) to go free a bunch of stuff just before a return() from main(). The vast, vast majority of time main() is used as main(), so it should clearly by the default behavior to treat a return() from main() the same as exit() and possibly have an option to toggle that setting. As to the last post in that thread, the same problem exists if you malloc something early in main() and later call exit(), so that has no bearing on whether or not a return() from main() should be treated as an exit(). -- John Baldwin