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