On 11.02.2015 16:50, Ilia Mirkin wrote:
It's already defined in src/util/macros.h which you can include via
#include "util/macros.h" -- I suspect some key gallium file should
include that...
Mh, i was under the expression these should be duped, as we already have
STATIC_ASSERT and likely/unlikely in p_compiler.h
We could clean these up there and include macros.h there...
On Wed, Feb 11, 2015 at 10:47 AM, Tobias Klausmann
<tobias.johannes.klausm...@mni.thm.de> wrote:
This is done the same way for glsl et al. already
Signed-off-by: Tobias Klausmann <tobias.johannes.klausm...@mni.thm.de>
---
src/gallium/include/pipe/p_compiler.h | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/gallium/include/pipe/p_compiler.h
b/src/gallium/include/pipe/p_compiler.h
index fb018bf..62ba9d3 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -249,6 +249,29 @@ void _ReadWriteBarrier(void);
/**
+ * Unreachable macro. Useful for suppressing "control reaches end of non-void
+ * function" warnings.
+ */
+#ifdef HAVE___BUILTIN_UNREACHABLE
+#define unreachable(str) \
+do { \
+ assert(!str); \
+ __builtin_unreachable(); \
+} while (0)
+#elif _MSC_VER >= 1200
+#define unreachable(str) \
+do { \
+ assert(!str); \
+ __assume(0); \
+} while (0)
+#endif
+
+#ifndef unreachable
+#define unreachable(str) assert(!str)
+#endif
+
+
+/**
* Static (compile-time) assertion.
* Basically, use COND to dimension an array. If COND is false/zero the
* array size will be -1 and we'll get a compilation error.
--
2.2.2
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev