From owner-svn-src-head@freebsd.org Fri Aug 10 00:26:00 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 3C6F81052718; Fri, 10 Aug 2018 00:26:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id A7FD18F56A; Fri, 10 Aug 2018 00:25:59 +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 mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 2DD3F4348F4; Fri, 10 Aug 2018 10:25:50 +1000 (AEST) Date: Fri, 10 Aug 2018 10:25:50 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Mark Johnston cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r337426 - head/sbin/ifconfig In-Reply-To: <201808071725.w77HPciT051597@repo.freebsd.org> Message-ID: <20180810092251.K1276@besplex.bde.org> References: <201808071725.w77HPciT051597@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=I9sVfJog c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=x7bEGLp0ZPQA:10 a=5lkVNKLIfOsGeeQGpCIA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 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: Fri, 10 Aug 2018 00:26:00 -0000 On Tue, 7 Aug 2018, Mark Johnston wrote: > Log: > ifconfig: Fix use of _Noreturn. > > The _Noreturn is a function-specifier (like inline) which must preceed > the declarator. > > Submitted by: Sebastian Huber > MFC after: 1 week _Noreturn is even more broken than I knew. It should never be used. Here its use is wronger than usual. > Modified: head/sbin/ifconfig/ifconfig.c > ============================================================================== > --- head/sbin/ifconfig/ifconfig.c Tue Aug 7 17:13:42 2018 (r337425) > +++ head/sbin/ifconfig/ifconfig.c Tue Aug 7 17:25:38 2018 (r337426) > @@ -109,7 +109,7 @@ static int ifconfig(int argc, char *const *argv, int i > static void status(const struct afswtch *afp, const struct sockaddr_dl *sdl, > struct ifaddrs *ifa); > static void tunnel_status(int s); > -static void usage(void) _Noreturn; > +static _Noreturn void usage(void); > > static struct afswtch *af_getbyname(const char *name); > static struct afswtch *af_getbyfamily(int af); FreeBSD code should use __dead2 since it is more portable (within FreeBSD) and doesn't have so mean syntactical restrictions. However, it only exists at all since it had similar syntactial restrictions when it was new (FreeBSD-1 used __dead, which must be placed like _Noreturn, but __dead2 uses __attribute__(()) which couldn't be placed there when it was new), and the macro that hides the details was renamed to inhibit misuse. Changing __dead2 to _Noreturn and moving it to satisfy the restricted syntax of the latter mainly broke support for old compilers where __dead2 cannot be placed there. However, all declarations of static usage() as non-returning are bogus, and this one is more bogus than most since another style bug is to unsort usage() to before where it is used, so even 1-pass compilers can see that it doesn't return before generating code that uses it. Unsorting of inline functions is sometimes needed so that 1-pass compilers can optimize them, but optimizing usage() is especially not needed. Bruce