summaryrefslogtreecommitdiff
path: root/Xfuncproto.h.in
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-04-19 14:45:28 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-05-09 18:17:39 -0700
commit043ed78ce03febd113615f5920bc9dffaf7f0b16 (patch)
treef9496d000a4eeb5b71d7fad43d674b11beffcf41 /Xfuncproto.h.in
parentd103af8068fb90494cbd6e1ff950850369bbf95f (diff)
Add _X_COLD attribute for branch prediction hints
Unfortunately the Solaris Studio equivalent is a pragma taking the function names as arguments, so doesn't translate cleanly into a common macro form. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xfuncproto.h.in')
-rw-r--r--Xfuncproto.h.in9
1 files changed, 9 insertions, 0 deletions
diff --git a/Xfuncproto.h.in b/Xfuncproto.h.in
index 8256fec..dac9229 100644
--- a/Xfuncproto.h.in
+++ b/Xfuncproto.h.in
@@ -97,6 +97,7 @@ in this Software without prior written authorization from The Open Group.
# define _X_INTERNAL
#endif /* GNUC >= 4 */
+/* Branch prediction hints for individual conditionals */
/* requires xproto >= 7.0.9 */
#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
# define _X_LIKELY(x) __builtin_expect(!!(x), 1)
@@ -106,6 +107,14 @@ in this Software without prior written authorization from The Open Group.
# define _X_UNLIKELY(x) (x)
#endif
+/* Bulk branch prediction hints via marking error path functions as "cold" */
+/* requires xproto >= 7.0.25 */
+#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403) /* 4.3+ */
+# define _X_COLD __attribute__((__cold__))
+#else
+# define _X_COLD /* nothing */
+#endif
+
/* Added in X11R6.9, so available in any version of modular xproto */
#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 301)
# define _X_DEPRECATED __attribute__((deprecated))