> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:uclibc-cvs- > [EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] > Sent: den 18 november 2008 14:04 > To: [EMAIL PROTECTED] > Subject: svn commit: trunk/uClibc: include libc/sysdeps/linux/common > > Author: aldot > Date: 2008-11-18 05:03:34 -0800 (Tue, 18 Nov 2008) > New Revision: 24092 > > Log: > - add __hot and __cold annotations > Will spare us quite some likely()/unlikely() occurances. > See http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html for details > > > Modified: > trunk/uClibc/include/libc-symbols.h > trunk/uClibc/libc/sysdeps/linux/common/ssp.c > > > Changeset: > Modified: trunk/uClibc/include/libc-symbols.h > =================================================================== > --- trunk/uClibc/include/libc-symbols.h 2008-11-18 12:56:05 UTC (rev > 24091) > +++ trunk/uClibc/include/libc-symbols.h 2008-11-18 13:03:34 UTC (rev > 24092) > @@ -63,6 +63,14 @@ > #ifndef unlikely > # define unlikely(x) __builtin_expect((!!(x)),0) > #endif > +#if defined __GNUC__ && !(__GNUC__ == 4 && __GNUC_MINOR__ < 3) > +# ifndef __cold > +# define __cold __attribute__ ((__cold__)) > +# endif > +# ifndef __hot > +# define __hot __attribute__ ((__hot__)) > +# endif > +#endif > #ifndef __LINUX_COMPILER_H > # define __LINUX_COMPILER_H > #endif
The above will not work for any compiler older than 4.3. For compilers with version 4.0 and 4.1 it will not work because __cold and __hot are never defined, and for compilers older than 4.0 (yes, some of us are limited to use such old compilers) it will not work because __cold and __hot _are_ defined (but the attributes do not exist). Please consider using the following code instead: #if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) # ifndef __cold # define __cold __attribute__ ((__cold__)) # endif # ifndef __hot # define __hot __attribute__ ((__hot__)) # endif #else # ifndef __cold # define __cold # endif # ifndef __hot # define __hot # endif #endif //Peter _______________________________________________ uClibc mailing list uClibc@uclibc.org http://busybox.net/cgi-bin/mailman/listinfo/uclibc