This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: glibc 2.1.1pre2 breaks libstdc++-v3 build
- To: jsm28 at cam dot ac dot uk
- Subject: Re: glibc 2.1.1pre2 breaks libstdc++-v3 build
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Thu, 11 Jan 2001 13:18:28 -0500 (EST)
- Cc: gcc-bugs at gcc dot gnu dot org, libc-alpha at sources dot redhat dot com, libstdc++ at gcc dot gnu dot org
> From: "Joseph S. Myers" <jsm28@cam.ac.uk>
>
> glibc 2.1.1pre2 breaks building libstdc++-v3. <bits/stdio.h> includes a
> macro printf, ostensibly for optimization.
>
> (a) Is this really a good idea, or should such changes printf -> fprintf
> not rather be achieved by extracting "stdout" somehow (as discussed on the
> gcc lists from time to time) in GCC?
Something like this is on my todo list. We had previously decided the
best way would be to add some code to stdio.h via fixincl which does
this to portably capture the definition of stdout:
> extern __inline__ FILE *__builtin_stdout(void) { return stdout; }
Then the substitution inside expand_builtin_printf is pretty easy.
The only quirk I have to figure out is how to expand inlines using the
tree based stuff in C++. Of course builtins are broken in C++ right
now, so its moot for the moment. :-)
I did a quick measurement of printf vs fprintf and the latter is about
6-7% faster on sparc-solaris2.7 for printing ("%s", "hello world\n")
so it actually might be worth it. Plus converting to fprintf allows
further reductions to fputs and then into fputc or fwrite if such
transformation are determined to be valid.
However we should be careful about a blanket opt like this because it
increases code size by a measureable amount. E.g. gcc has over 1000
calls to printf, and depending on how many instructions/bytes it takes
to pass stdout, you might increase the resulting code size by 5-10K.
(That's just a guess, I haven't measured it yet.)
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions