This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Removing code dupe in libc (Was: A final solution...)


On Sat, 13 Feb 1999 00:01:28 -0500, Paul Derbyshire wrote:
>At 09:02 PM 2/12/99 -0500, you wrote:
>>Or you can isolate the inline functions in their own header file, and
>>have a separate C file that just does
>>
>>#define inline /* nothing */
>>#include <linux/inlinefuns.h>
>>
>>No code duplication, and if all the inlines went through, the linker
>>will throw away the unnecessary object module.
>
>That same technique might be usable to remove the code duplication wart
>with libc. The object module generated goes in libc.a; the linker will
>ignore it if all the functions used inlined.
>For dynamic linked implementations, the object module goes in libc.so and
>the dynamic linker will ignore it.

Actually, there isn't code duplication in libc.  The inline functions
in the headers are limited in what they'll do themselves, they fall
back to out-of-line calls for the general case.  This is done with an
ungodly mess of macros, special-case-only functions, and compiler
extensions.  We rely on cse to crush out the mess.

I do wish there was a cleaner way to do it.  Replacing cpp with M4
wouldn't be a bad start...

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]