[Mesa-dev] [PATCH] mesa: Define helper function to get the number of texture layers.
Paul Berry
stereotype441 at gmail.com
Tue Dec 10 09:38:01 PST 2013
On 10 December 2013 08:42, Francisco Jerez <currojerez at riseup.net> wrote:
> Brian Paul <brianp at vmware.com> writes:
>
> > On 12/07/2013 06:17 PM, Francisco Jerez wrote:
> >>[...]
> >> + default:
> >> + unreachable();
> >
> > I think I'd like to see an assertion or _mesa_problem() call to catch
> > unhandled cases if new texture targets are added in the future.
> >
> >
> How about having the unreachable() macro print out an error and abort if
> it's ever reached? See the attached patch.
>
I would prefer for us to simply do this:
assert(!"Unexpected texture target");
unreachable();
That would have the exact same semantics as your proposed patch (assert in
debug builds, allow compiler optimizations in release builds), and it would
have the added advantage that it's obvious what's going on to someone
reading the code. With your proposed patch it's not obvious--the reader
has to be aware that Mesa has a non-standard meaning for unreachable().
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131210/68791eb6/attachment.html>
More information about the mesa-dev
mailing list