From owner-svn-src-head@freebsd.org Tue Dec 12 02:39:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E8BEE87F3A; Tue, 12 Dec 2017 02:39:45 +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 60DAB6604F; Tue, 12 Dec 2017 02:39:45 +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 68DBA42AAAB; Tue, 12 Dec 2017 13:21:53 +1100 (AEDT) Date: Tue, 12 Dec 2017 13:21:52 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r326771 - head/usr.sbin/efibootmgr In-Reply-To: <201712111617.vBBGHrCZ027885@repo.freebsd.org> Message-ID: <20171212130425.H1415@besplex.bde.org> References: <201712111617.vBBGHrCZ027885@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=KeqiiUQD c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=n5yUbEFbmlxqnXSyspkA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 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: Tue, 12 Dec 2017 02:39:45 -0000 On Mon, 11 Dec 2017, Warner Losh wrote: > Log: > Unbreak gcc build by using (void) for functions that take no args. You mean "Fix a bug (K&R function definition without even a C99 prototype) that is detected by compilers like gcc with non-broken support for the -W flag that we used to detect such bugs. The bug is only a style bug in this case." > Modified: head/usr.sbin/efibootmgr/efibootmgr.c > ============================================================================== > --- head/usr.sbin/efibootmgr/efibootmgr.c Mon Dec 11 15:33:24 2017 (r326770) > +++ head/usr.sbin/efibootmgr/efibootmgr.c Mon Dec 11 16:17:53 2017 (r326771) > @@ -275,7 +275,7 @@ parse_args(int argc, char *argv[]) > > > static void > -print_order() > +print_order(void) > { > uint32_t attrs; > uint8_t *data; This is a K&R function definition. Since the function is also unprototyped, it has K&R semantics. Since it is defined before it is used, the compiler can see what it does even without -funit-at-a-time. It still has K&R semantics. However, since it is static the compiler can use a non-K&R compatible ABI to call or inline it anyway. Apparently broken compilers use this to suppress the warning, leaving only a style bug. This is a feature if the user didn't explicitly ask for warnings, otherwise a bug. Similarly for the other functions. KNF requires prototypes even for static functions, but this rule is often not followed. It allows the functions to be defined after they are used, in some sort of stable order. With -funit-at-a-time, this doesn't prevent inlining and other optimizations that you ask for (or even inlining that you don't ask for and don't want). Bruce