aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/util/macros.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-11-29 12:44:10 +0100
committermarha <marha@users.sourceforge.net>2014-11-29 12:44:10 +0100
commit0dbe845b2f4ba08924d6fcb9634d09dc3dde13d6 (patch)
tree4fc0c706447f18bc522bb503273ec9e10f6c2ba5 /mesalib/src/util/macros.h
parentd17578910169acabae7e67a3da8f26b5ed608ce6 (diff)
parentd6d5581d5fba846c8476ad4d593da662306765d7 (diff)
downloadvcxsrv-0dbe845b2f4ba08924d6fcb9634d09dc3dde13d6.tar.gz
vcxsrv-0dbe845b2f4ba08924d6fcb9634d09dc3dde13d6.tar.bz2
vcxsrv-0dbe845b2f4ba08924d6fcb9634d09dc3dde13d6.zip
Merge remote-tracking branch 'origin/released'
Conflicts: xorg-server/hw/xwin/winclip.c xorg-server/hw/xwin/winengine.c xorg-server/hw/xwin/winfont.c xorg-server/hw/xwin/wingc.c xorg-server/hw/xwin/wingetsp.c xorg-server/hw/xwin/winmisc.c xorg-server/hw/xwin/winnativegdi.c xorg-server/hw/xwin/winpfbdd.c xorg-server/hw/xwin/winpixmap.c xorg-server/hw/xwin/winpolyline.c xorg-server/hw/xwin/winscrinit.c xorg-server/hw/xwin/winsetsp.c xorg-server/hw/xwin/winwindow.c
Diffstat (limited to 'mesalib/src/util/macros.h')
-rw-r--r--mesalib/src/util/macros.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/mesalib/src/util/macros.h b/mesalib/src/util/macros.h
index 40ebf02da..ff37a7d63 100644
--- a/mesalib/src/util/macros.h
+++ b/mesalib/src/util/macros.h
@@ -75,6 +75,20 @@ do { \
#define unreachable(str)
#endif
+/**
+ * Assume macro. Useful for expressing our assumptions to the compiler,
+ * typically for purposes of silencing warnings.
+ */
+#ifdef HAVE___BUILTIN_UNREACHABLE
+#define assume(expr) ((expr) ? ((void) 0) \
+ : (assert(!"assumption failed"), \
+ __builtin_unreachable()))
+#elif _MSC_VER >= 1200
+#define assume(expr) __assume(expr)
+#else
+#define assume(expr) assert(expr)
+#endif
+
#ifdef HAVE_FUNC_ATTRIBUTE_FLATTEN
#define FLATTEN __attribute__((__flatten__))
#else