summary refs log tree commit diff
path: root/misc/sys
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-16 21:29:11 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-16 21:29:11 -0400
commitaa78043a4aafe5db1a1a76d544a833b63b4c5f5c (patch)
tree6fca4ccd13ce51fafa16beac415df02122e13b33 /misc/sys
parentad0f5cad15f1c76faf3843b3e189dead2c05cfcc (diff)
downloadglibc-aa78043a4aafe5db1a1a76d544a833b63b4c5f5c.tar.gz
glibc-aa78043a4aafe5db1a1a76d544a833b63b4c5f5c.tar.xz
glibc-aa78043a4aafe5db1a1a76d544a833b63b4c5f5c.zip
Use leaf function attribute in __THROW
Diffstat (limited to 'misc/sys')
-rw-r--r--misc/sys/cdefs.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 165a94a64b..bef8be7f4a 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -38,18 +38,27 @@
 
 #ifdef __GNUC__
 
+/* All functions, except those with callbacks, are leaf functions.  */
+# if __GNUC_PREREQ (4, 6) && !defined _LIBC
+#  define __LEAF , __leaf__
+#  define __LEAF_ATTR __attribute__ ((__leaf__))
+# else
+#  define __LEAF
+#  define __LEAF_ATTR
+# endif
+
 /* GCC can always grok prototypes.  For C++ programs we add throw()
    to help it optimize the function calls.  But this works only with
    gcc 2.8.x and egcs.  For gcc 3.2 and up we even mark C functions
    as non-throwing using a function attribute since programs can use
    the -fexceptions options for C code as well.  */
 # if !defined __cplusplus && __GNUC_PREREQ (3, 3)
-#  define __THROW	__attribute__ ((__nothrow__))
-#  define __NTH(fct)	__attribute__ ((__nothrow__)) fct
+#  define __THROW	__attribute__ ((__nothrow__ __LEAF_ATTR))
+#  define __NTH(fct)	__attribute__ ((__nothrow__ __LEAF_ATTR)) fct
 # else
 #  if defined __cplusplus && __GNUC_PREREQ (2,8)
 #   define __THROW	throw ()
-#   define __NTH(fct)	fct throw ()
+#   define __NTH(fct)	__LEAF_ATTR fct throw ()
 #  else
 #   define __THROW
 #   define __NTH(fct)	fct