On 15/07/15 17:00, Matt Turner wrote: > Otherwise Coverity thinks we'll divide by zero. > --- > src/mesa/drivers/dri/i965/brw_reg.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_reg.h > b/src/mesa/drivers/dri/i965/brw_reg.h > index c8b1341..f96b28d 100644 > --- a/src/mesa/drivers/dri/i965/brw_reg.h > +++ b/src/mesa/drivers/dri/i965/brw_reg.h > @@ -283,7 +283,7 @@ type_sz(unsigned type) > case BRW_REGISTER_TYPE_B: > return 1; > default: > - return 0; > + unreachable("not reached"); I've seen a case in nir, where a default statement + unreachable was added, despite that every value of the enum explicitly being handled.
While I'm not sure if that's the case here, wouldn't it be better to omit the default statement in such cases and let the compiler warn us as new values get added ? -Emil _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev