Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jul 2001 21:13:17 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Dag-Erling Smorgrav <des@ofug.org>
Cc:        arch@FreeBSD.ORG
Subject:   Re: -fno-builtin
Message-ID:  <Pine.BSF.4.21.0107092057001.87275-100000@besplex.bde.org>
In-Reply-To: <xzpsng6v5cb.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On 9 Jul 2001, Dag-Erling Smorgrav wrote:

> arch@FreeBSD.ORG writes:
> > No.  We might as well as totally turn builtins off since the goal is to
> > have the whole tree under WARNS=2.  Since you want to change
> > functionality, the burdon is on you to convince us why you want to do this
> > -- which you have not.
> 
> The alternatives - just to get it to build - are to turn off -Wshadow,
> or rename every single local variable in the tree that shadows a
> builtin (and believe me, there are *tons* of these).
> 
> In addition, there's the issue of errors that -fno-builtin hides -
> many of those have been fixed already, but I don't know how many
> remain (or how many will be introduced in the future).

I think gcc gets this backwards.  I think it should warn about builtins
shadowing local variables only if the relevant header is included, and
it should warn about missing prototypes for builtins unless the relevarnt
is included.

Possible work-around: make -fno-builtin the default, and re-implement
all of the builtin functions that you want using macros or inline
functions.  E.g.:

---
#include <string.h>

static __inline size_t
strlen(const char *s)
{
	return (__builtin_strlen(s));
}
---

Unfortunately, the inline function version doesn't work right, at least
on i386's:  __builtin_strlen("foo") gives code that loads the constant
result 3, but the inline strlen("foo") gives code that scans the string.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0107092057001.87275-100000>