svn commit: trunk/uClibc: include libc/sysdeps/linux/common
aldot at uclibc.org
aldot at uclibc.org
Tue Nov 18 13:03:34 UTC 2008
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
Modified: trunk/uClibc/libc/sysdeps/linux/common/ssp.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/ssp.c 2008-11-18 12:56:05 UTC (rev 24091)
+++ trunk/uClibc/libc/sysdeps/linux/common/ssp.c 2008-11-18 13:03:34 UTC (rev 24092)
@@ -64,7 +64,7 @@
sigaction(SSP_SIGTYPE, &sa, NULL);
}
-static void ssp_write(int fd, const char *msg1, const char *msg2, const char *msg3)
+static void ssp_write(int fd, const char *msg1, const char *msg2, const char *msg3) __cold
{
write(fd, msg1, strlen(msg1));
write(fd, msg2, strlen(msg2));
@@ -83,7 +83,7 @@
_exit(127);
}
-void __stack_smash_handler(char func[], int damaged __attribute__ ((unused))) attribute_noreturn;
+void __stack_smash_handler(char func[], int damaged __attribute__ ((unused))) attribute_noreturn __cold;
void __stack_smash_handler(char func[], int damaged)
{
static const char message[] = ": stack smashing attack in function ";
@@ -97,7 +97,7 @@
terminate();
}
-void __stack_chk_fail(void) attribute_noreturn;
+void __stack_chk_fail(void) attribute_noreturn __cold;
void __stack_chk_fail(void)
{
static const char msg1[] = "stack smashing detected: ";
More information about the uClibc-cvs
mailing list