Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/lib/csu/i386_elf




On May 17, 2006, at 2:39 PM, David Laight wrote:

On Wed, May 17, 2006 at 02:14:38PM -0700, Jason Thorpe wrote:

Way too much weak function grief.

How about:
#if __GNUC_PREREQ__(4, 0)
#define __weak_reference(sym)      __attribute__((__weakref__))
#else
#define __weak_reference(sym) ; __asm(".weak " _C_LABEL_STRING (#sym))
#endif

So you do:

int weak_fn(void) __weak_reference(weak_fn);

Slightly ugly because we duplicate the name twice.... but I guess it's OK.

I just dislike #if's in code so much :-)

        David

--
David Laight: david%l8s.co.uk@localhost

-- thorpej




Home | Main Index | Thread Index | Old Index