This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Gcc 3.0, printf() and exim-3.30
- To: "Russ Allbery" <rra at stanford dot edu>,"Nix" <nix at esperi dot demon dot co dot uk>
- Subject: RE: Gcc 3.0, printf() and exim-3.30
- From: "bmj2001" <bmj2001 at bellsouth dot net>
- Date: Thu, 21 Jun 2001 06:52:52 -0500
- Cc: "Vadim Vygonets" <vadik at vygo dot net>,<gcc at gcc dot gnu dot org>
Changes. The standards committee had its reasons.
-----Original Message-----
From: gcc-owner@gcc.gnu.org [mailto:gcc-owner@gcc.gnu.org]On Behalf Of
Russ Allbery
Sent: Thursday, June 21, 2001 3:42 AM
To: Nix
Cc: Vadim Vygonets; gcc@gcc.gnu.org
Subject: Re: Gcc 3.0, printf() and exim-3.30
Nix <nix@esperi.demon.co.uk> writes:
> Nope; printf is not a macro, and GCC does not define printf :)
You're correct that GCC does not define printf, of course, but in recent
versions of glibc, printf is indeed a macro.
/usr/include/stdio.h:
/* If we are compiling with optimizing read this file. It contains
several optimizing inline functions and macros. */
#ifdef __USE_EXTERN_INLINES
# include <bits/stdio.h>
#endif
/usr/include/bits/stdio.h:
#ifdef __USE_EXTERN_INLINES
/* Since version 2.97 GCC knows about `fprintf' and can optimize certain
cases. Help gcc to optimize more code by mapping `printf' to the known
`fprintf' function. Unfortunately we have to use a macro. */
# if __GNUC_PREREQ (2,97)
# define printf(fmt, args...) fprintf (stdout, fmt, ##args)
# endif
You didn't see this before because glibc doesn't enable this optimization
unless the version of gcc is greater than 2.96.
firebird1:/root# rpm -q glibc
glibc-2.2-12
(Out of curiosity, is that little aid to GCC as braindead as it looks?
I'd think that if GCC optimized fprintf, it would pick up printf too....)
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>