From owner-freebsd-current Sun Oct 20 6:54:13 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 4976F37B401 for ; Sun, 20 Oct 2002 06:54:10 -0700 (PDT) Received: from espresso.q9media.com (espresso.q9media.com [65.39.129.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id AD66743E91 for ; Sun, 20 Oct 2002 06:54:09 -0700 (PDT) (envelope-from mike@espresso.q9media.com) Received: by espresso.q9media.com (Postfix, from userid 1002) id E19649BC3; Sun, 20 Oct 2002 09:46:08 -0400 (EDT) Date: Sun, 20 Oct 2002 09:46:08 -0400 From: Mike Barcroft To: Kris Kennaway Cc: current@FreeBSD.org Subject: Re: Conflicting declarations for ffs() Message-ID: <20021020094608.F81582@espresso.q9media.com> References: <20021020100158.GA18938@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="tKW2IUtsqtDRztdT" Content-Disposition: inline In-Reply-To: <20021020100158.GA18938@xor.obsecurity.org>; from kris@obsecurity.org on Sun, Oct 20, 2002 at 03:01:58AM -0700 Organization: The FreeBSD Project 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 --tKW2IUtsqtDRztdT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. Attached is an untested patch which should fix the problem. Best regards, Mike Barcroft --tKW2IUtsqtDRztdT Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ffs.diff" Index: include/strings.h =================================================================== RCS file: /work/repo/src/include/strings.h,v retrieving revision 1.3 diff -u -r1.3 strings.h --- include/strings.h 21 Aug 2002 16:19:55 -0000 1.3 +++ include/strings.h 20 Oct 2002 13:45:21 -0000 @@ -41,7 +41,10 @@ int bcmp(const void *, const void *, size_t); /* LEGACY */ void bcopy(const void *, void *, size_t); /* LEGACY */ void bzero(void *, size_t); /* LEGACY */ +#ifndef _FFS_DECLARED +#define _FFS_DECLARED int ffs(int); +#endif char *index(const char *, int); /* LEGACY */ char *rindex(const char *, int); /* LEGACY */ int strcasecmp(const char *, const char *); Index: sys/i386/include/cpufunc.h =================================================================== RCS file: /work/repo/src/sys/i386/include/cpufunc.h,v retrieving revision 1.130 diff -u -r1.130 cpufunc.h --- sys/i386/include/cpufunc.h 22 Sep 2002 04:45:21 -0000 1.130 +++ sys/i386/include/cpufunc.h 20 Oct 2002 13:48:04 -0000 @@ -103,8 +103,9 @@ __asm __volatile("sti"); } +#ifndef _FFS_DECLARED +#define _FFS_DECLARED #define HAVE_INLINE_FFS - static __inline int ffs(int mask) { @@ -116,6 +117,7 @@ */ return (mask == 0 ? mask : (int)bsfl((u_int)mask) + 1); } +#endif #define HAVE_INLINE_FLS Index: sys/sparc64/include/cpufunc.h =================================================================== RCS file: /work/repo/src/sys/sparc64/include/cpufunc.h,v retrieving revision 1.14 diff -u -r1.14 cpufunc.h --- sys/sparc64/include/cpufunc.h 1 Apr 2002 23:51:23 -0000 1.14 +++ sys/sparc64/include/cpufunc.h 20 Oct 2002 13:46:45 -0000 @@ -200,6 +200,8 @@ * Ultrasparc II doesn't implement popc in hardware. Suck. */ #if 0 +#ifndef _FFS_DECLARED +#define _FFS_DECLARED #define HAVE_INLINE_FFS /* * See page 202 of the SPARC v9 Architecture Manual. @@ -219,6 +221,7 @@ : "=r" (result), "=r" (neg), "=r" (tmp) : "r" (mask)); return (result); } +#endif #endif #undef LDNC_GEN --tKW2IUtsqtDRztdT-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message