[Mesa-dev] [PATCH] util: Implement unreachable for MSVC using __assume
Brian Paul
brianp at vmware.com
Tue Nov 4 06:53:28 PST 2014
On 11/03/2014 04:43 PM, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Based on the description of __assume at:
>
> http://msdn.microsoft.com/en-us/library/1b3fsfxw.aspx
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Cc: Brian Paul <brianp at vmware.com>
> ---
> src/util/macros.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/src/util/macros.h b/src/util/macros.h
> index ff37a7d..da5daff 100644
> --- a/src/util/macros.h
> +++ b/src/util/macros.h
> @@ -69,6 +69,12 @@ do { \
> assert(!str); \
> __builtin_unreachable(); \
> } while (0)
> +#elif _MSC_VER >= 1200
> +#define unreachable(str) \
> +do { \
> + assert(!str); \
> + __assume(0); \
> +} while (0)
> #endif
>
> #ifndef unreachable
>
Compiles here.
Reviewed-by: Brian Paul <brianp at vmware.com>
More information about the mesa-dev
mailing list