From owner-freebsd-current Sun Oct 20 16:29:16 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BEABF37B401; Sun, 20 Oct 2002 16:29:14 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5D89543E88; Sun, 20 Oct 2002 16:29:13 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id JAA25178; Mon, 21 Oct 2002 09:28:48 +1000 Date: Mon, 21 Oct 2002 09:39:40 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Peter Wemm Cc: Mike Barcroft , Kris Kennaway , Subject: Re: Conflicting declarations for ffs() In-Reply-To: <20021020195557.972FD2A88D@canning.wemm.org> Message-ID: <20021021093120.I8562-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, 20 Oct 2002, Peter Wemm wrote: > Mike Barcroft wrote: > > > Kris Kennaway writes: > > > Take a look at: > > > > > > http://bento.freebsd.org/errorlogs/5-full/cqcam-0.91_1.log > > > > > > This port includes headers that declare the ffs() function twice: once > > > with an inline version and once with a prototype. > > > > > > Is the bug in the application, or the headers? > > > > It looks like a bug in our headers. I don't see why this is a new bug > > though. It looks like (which used to include) > > and i386's have been defining conflicting ffs() > > prototypes since at least 1999. > > machine/cpufunc.h is really meant to be a kernel header and isn't really > meant for consumption by userland. However, it is sortof useful. Right, it is a bug in the application. > In this particular case, gcc provides a respectable builtin for ffs(). We > probably shouldn't be overriding it for userland with our own inline for > userland. The gcc inline may now be OK in the kernel too. However, we use -fno-inline in the kernel, so we don't even get inlining for memcpy(). > Maybe it would just be better to stick a #ifdef _KERNEL around the inline > version? That should leave gcc to use the builtin and fall back to the > libc version if -fno-builtin is used [or if non-gcc is used]. I prefer: #ifndef _KERNEL #error "no user-serviceable parts inside" #endif near the beginning of cpufunc.h. I have added this to several other kernel-only headers. BSD/OS arranges kernel-only MD headers better by not putting them in . This also inhibits them being abused in MI code. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message