[Mesa-dev] [PATCH] mesa: Define helper function to get the number of texture layers.
Daniel Vetter
daniel at ffwll.ch
Wed Dec 11 07:45:30 PST 2013
On Tue, Dec 10, 2013 at 06:31:55PM -0800, Matt Turner wrote:
> On Tue, Dec 10, 2013 at 5:55 PM, Francisco Jerez <currojerez at riseup.net> wrote:
> > It just seems annoying and unnecessary to me to have to repeat the same
> > pattern before each use of unreachable(). If by definition the
> > unreachable macro wants to be accompanied with an assert, why don't we
> > save ourselves pain by having unreachable take care of both things you
> > mentioned?
> >
> >> I don't particularly like the idea of modifying unreachable to take a
> >> string to print.
> >
> > There's some precedent for this, see for example LLVM's unreachable
> > macro [1]. It turns out that it does roughly what my proposed patch
> > does: print an error message and abort on debug builds and call
> > __builtin_unreachable() on release builds.
> >
> > [1] http://llvm.org/svn/llvm-project/llvm/trunk/include/llvm/Support/ErrorHandling.h
>
> Yeah, okay. I just looked through the kernel and didn't find any uses
> of unreachable() combined with assert() or similar.
The kernel annotates fatal assert (i.e. BUG_ON and friends) already with
the relevant no_return/unreachable stuff. So it'd do exactly what
Fransisco suggested: You get the debug assert but also no false positive
compiler warnings, even in release builds.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
More information about the mesa-dev
mailing list