On 2014-11-21 15:53:35, Matt Turner wrote: > On Fri, Nov 21, 2014 at 3:47 PM, Jordan Justen > <jordan.l.jus...@intel.com> wrote: > > On 2014-11-21 15:17:00, Matt Turner wrote: > >> --- > >> src/util/macros.h | 12 +++++++++++- > >> 1 file changed, 11 insertions(+), 1 deletion(-) > >> > >> diff --git a/src/util/macros.h b/src/util/macros.h > >> index da5daff..b67596d 100644 > >> --- a/src/util/macros.h > >> +++ b/src/util/macros.h > >> @@ -29,6 +29,10 @@ > >> # define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) > >> #endif > >> > >> +/* For compatibility with Clang's __has_builtin() */ > >> +#ifndef __has_builtin > >> +# define __has_builtin(x) 0 > >> +#endif > >> > >> /** > >> * __builtin_expect macros > >> @@ -85,7 +89,13 @@ do { \ > >> * Assume macro. Useful for expressing our assumptions to the compiler, > >> * typically for purposes of silencing warnings. > >> */ > >> -#ifdef HAVE___BUILTIN_UNREACHABLE > >> +#if __has_builtin(__builtin_assume) > >> +#define assume(expr) \ > >> +do { \ > >> + assert(!"assumption failed"); \ > > > > Did you mean to remove this assert? > > > > With that removed > > Reviewed-by: Jordan Justen <jordan.l.jus...@intel.com> > > No. Clang's documentation says that if the expression you're assuming > is false, behavior is undefined.
Worth noting in the commit message or a comment? > The assertion is to help us catch > cases where that happens. So ... assert(expr) instead? -Jordan _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev