Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Oct 2003 22:28:24 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?= <des@des.no>
Cc:        Peter Wemm <peter@FreeBSD.org>
Subject:   Re: cvs commit: src/usr.bin/chat Makefile
Message-ID:  <20031028222117.X4879@gamplex.bde.org>
In-Reply-To: <xzpbrs1afvz.fsf@dwp.des.no>
References:  <200310260449.h9Q4nwm9016893@repoman.freebsd.org> <20031026171515.P17272@gamplex.bde.org> <xzpu15w9rhk.fsf@dwp.des.no> <20031027152156.Y21211@gamplex.bde.org> <xzpbrs1afvz.fsf@dwp.des.no>

index | next in thread | previous in thread | raw e-mail

On Tue, 28 Oct 2003, Dag-Erling [iso-8859-1] Smørgrav wrote:

> Bruce Evans <bde@zeta.org.au> writes:
> > On Sun, 26 Oct 2003, Dag-Erling [iso-8859-1] Smørgrav wrote:
> > > In the meantime, now that we have a working fabsl(3), we can add
> > > -fno-builtin to CFLAGS in bsd.sys.mk.
> > That would just break the warning and pessimize anything that is optimized
> > by the builtins.
>
> The warnings are wrong more often than not...  particularly the *lack*
> of warning when you use a builtin function without including the
> header that declares it.

But that is fixed:

%%%
Script started on Tue Oct 28 22:20:44 2003
ttyp0:bde@besplex:/tmp> cat z.c
int
main(void)
{
	return (strlen("123"));
}
ttyp0:bde@besplex:/tmp> cc -O -S -Wimplicit z.c
z.c: In function `main':
z.c:4: warning: implicit declaration of function `strlen'
ttyp0:bde@besplex:/tmp> cat z.s
	.file	"z.c"
	.text
	.p2align 2,,3
.globl main
	.type	main, @function
main:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$8, %esp
	andl	$-16, %esp
	movl	$3, %eax
	leave
	ret
	.size	main, .-main
	.ident	"GCC: (GNU) 3.3.1 [FreeBSD]"
ttyp0:bde@besplex:/tmp> exit

Script done on Tue Oct 28 22:20:58 2003
%%%

Note that it uses the builtin to just return 3 after emitting the warning.

Similarly for `return (log(3));`.  gcc doesn't do the log() inline, at
least on i386's with no options, but it knows to pass 3.0 and convert
the return value to int.

Bruce


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031028222117.X4879>