From owner-svn-src-head@freebsd.org Sun Jun 17 06:54:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E960101104D; Sun, 17 Jun 2018 06:54:55 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 8EB5B828CA; Sun, 17 Jun 2018 06:54:54 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 5576B1A19CF; Sun, 17 Jun 2018 16:54:46 +1000 (AEST) Date: Sun, 17 Jun 2018 16:54:43 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Eitan Adler cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r335278 - head/bin/pwd In-Reply-To: <201806170514.w5H5Epts050842@repo.freebsd.org> Message-ID: <20180617161907.Y1464@besplex.bde.org> References: <201806170514.w5H5Epts050842@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=ANYk93-bGHjE3TR_3hgA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2018 06:54:55 -0000 On Sun, 17 Jun 2018, Eitan Adler wrote: > Log: > pwd: mark usage as dead > > Modified: > head/bin/pwd/pwd.c > > Modified: head/bin/pwd/pwd.c > ============================================================================== > --- head/bin/pwd/pwd.c Sun Jun 17 03:33:29 2018 (r335277) > +++ head/bin/pwd/pwd.c Sun Jun 17 05:14:50 2018 (r335278) > @@ -95,7 +95,7 @@ main(int argc, char *argv[]) > exit(0); > } > > -void > +void __dead2 > usage(void) > { I asked you to back out a previous addition of __dead2 about 20 additions of it ago. __dead2 here has no effect. The compiler can see that usage() doesn't return if it understands __dead2 at all, since usage() ends with exit() which is declared as __dead2. If __dead2 were added in a place where the addition is not complete nonsense, that is in the forward declaration of the function, then it would have an effect in compilers that don't implement -funit-at-a-time. Then since usage() is called before it is defined, compilers that don't parse the whole file before generating any code would have to consider the function as possibly returning for some of the calls to it unless the forward declaration tells them otherwise. However, -funit-at-a-time can't even be turned off for clang. -funit-at-time is merely the default for gcc starting with -O2, and can be turned off. Detecting functions that don't return is a trivial part of inlining. See my old mail about this for more details. Bruce