svn commit: r245494 - head/bin/pwait
John Baldwin
jhb at freebsd.org
Thu Jan 17 18:40:50 UTC 2013
On Wednesday, January 16, 2013 2:15:00 pm Eitan Adler wrote:
> On 16 January 2013 13:11, Xin Li <delphij at 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
More information about the svn-src-head
mailing list