summaryrefslogtreecommitdiff
path: root/include/sys/cdefs.h
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-03-13 21:03:10 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-03-13 21:12:37 +0100
commit21cbb6fe887a30f0777521ec10f0d0d9c2a7da7e (patch)
tree73b95a94eae224cddb38c3f8d0b0ce5700ecf8c4 /include/sys/cdefs.h
parent8c66e0a6c7987cda9df8c88e84b3d50d573c1dbb (diff)
unistd.h: put getppid under XOPEN2K8
Add __LEAF to all __THROW, introduce non-leaf __THROWNL Adjust affected spots accordingly. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'include/sys/cdefs.h')
-rw-r--r--include/sys/cdefs.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index 6f81b6a7c..4da981f9a 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -37,20 +37,33 @@
#ifdef __GNUC__
+/* All functions, except those with callbacks or those that
+ synchronize memory, 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))
+# define __THROWNL __attribute__ ((__nothrow__))
+# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
# else
# if defined __cplusplus && __GNUC_PREREQ (2,8)
# define __THROW throw ()
-# define __NTH(fct) fct throw ()
+# define __THROWNL throw ()
+# define __NTH(fct) __LEAF_ATTR fct throw ()
# else
# define __THROW
+# define __THROWNL
# define __NTH(fct) fct
# endif
# endif
@@ -60,6 +73,7 @@
# define __inline /* No inline functions. */
# define __THROW
+# define __THROWNL
# define __NTH(fct) fct
#endif /* GCC. */
@@ -165,9 +179,13 @@
# ifdef __cplusplus
# define __REDIRECT_NTH(name, proto, alias) \
name proto __THROW __asm__ (__ASMNAME (#alias))
+# define __REDIRECT_NTHNL(name, proto, alias) \
+ name proto __THROWNL __asm__ (__ASMNAME (#alias))
# else
# define __REDIRECT_NTH(name, proto, alias) \
name proto __asm__ (__ASMNAME (#alias)) __THROW
+# define __REDIRECT_NTHNL(name, proto, alias) \
+ name proto __asm__ (__ASMNAME (#alias)) __THROWNL
# endif
# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
# define __ASMNAME2(prefix, cname) __STRING (prefix) cname