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>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 28 Oct 2003, Dag-Erling [iso-8859-1] Sm=F8rgrav wrote:

> Bruce Evans <bde@zeta.org.au> writes:
> > On Sun, 26 Oct 2003, Dag-Erling [iso-8859-1] Sm=F8rgrav 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 optimi=
zed
> > 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)
{
=09return (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
=09.file=09"z.c"
=09.text
=09.p2align 2,,3
=2Eglobl main
=09.type=09main, @function
main:
=09pushl=09%ebp
=09movl=09%esp, %ebp
=09subl=09$8, %esp
=09andl=09$-16, %esp
=09movl=09$3, %eax
=09leave
=09ret
=09.size=09main, .-main
=09.ident=09"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



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