Date: Thu, 17 Jan 2013 10:35:14 -0500 From: John Baldwin <jhb@freebsd.org> To: Eitan Adler <eadler@freebsd.org> Cc: "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, Xin LI <delphij@gmail.com>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, d@delphij.net Subject: Re: svn commit: r245494 - head/bin/pwait Message-ID: <201301171035.14799.jhb@freebsd.org> In-Reply-To: <CAF6rxgn0sxXbRko0R5nKG%2BySQXqWxxurCGPhzr5t6mpGXHAT2A@mail.gmail.com> References: <201301160503.r0G53qie087155@svn.freebsd.org> <50F6ED68.50602@delphij.net> <CAF6rxgn0sxXbRko0R5nKG%2BySQXqWxxurCGPhzr5t6mpGXHAT2A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, January 16, 2013 2:15:00 pm Eitan Adler wrote: > On 16 January 2013 13:11, Xin Li <delphij@delphij.net> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301171035.14799.jhb>