cvs commit: src/usr.bin/chat Makefile

Bruce Evans bde at zeta.org.au
Tue Oct 28 03:28:34 PST 2003


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

> Bruce Evans <bde at 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 at besplex:/tmp> cat z.c
int
main(void)
{
=09return (strlen("123"));
}
ttyp0:bde at besplex:/tmp> cc -O -S -Wimplicit z.c
z.c: In function `main':
z.c:4: warning: implicit declaration of function `strlen'
ttyp0:bde at 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 at 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


More information about the cvs-src mailing list