[Mesa-dev] [PATCH 1/2] util: Make unreachable at least be an assert

Ian Romanick idr at freedesktop.org
Fri Dec 5 13:25:32 PST 2014


On 12/05/2014 01:17 PM, Carl Worth wrote:
> Previously, if __builtin_unreachable() was unavailable, the
> unreachable macro was defined to do nothing. We do better here, by at
> least still making it an assert.
> ---
>  src/util/macros.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/util/macros.h b/src/util/macros.h
> index 5fc6729..eec8b93 100644
> --- a/src/util/macros.h
> +++ b/src/util/macros.h
> @@ -82,7 +82,7 @@ do {                        \
>  #endif
>  
>  #ifndef unreachable
> -#define unreachable(str)
> +#define unreachable(str) assert(!str)

I'd make this ASSERT.  In Mesa, ASSERT only exists if DEBUG is defined.
 It seems that many distros build without -DDEBUG and without -DNDEBUG.
 I'd rather have no code for these cases in all release builds.

With that changed, this patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

>  #endif
>  
>  /**
> 



More information about the mesa-dev mailing list