Commit 9ef53724 authored by Michel Dänzer's avatar Michel Dänzer Committed by Marge Bot
Browse files

Guard FALLTHROUGH annotations after assert()



clang warns if it can determine that the assert() never returns and
there's a fall-through annotation below.
Acked-by: Emma Anholt's avatarEric Anholt <eric@anholt.net>
Part-of: <mesa/mesa!10220>
parent 2928c21e
......@@ -2208,8 +2208,10 @@ lp_build_sample_common(struct lp_build_sample_context *bld,
*/
switch (mip_filter) {
default:
assert(0 && "bad mip_filter value in lp_build_sample_soa()");
debug_assert(0 && "bad mip_filter value in lp_build_sample_soa()");
#if defined(NDEBUG) || defined(DEBUG)
FALLTHROUGH;
#endif
case PIPE_TEX_MIPFILTER_NONE:
/* always use mip level 0 */
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
......
......@@ -408,7 +408,9 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
switch (swizzles[i]) {
default:
assert(0);
#if defined(NDEBUG) || defined(DEBUG)
FALLTHROUGH;
#endif
case PIPE_SWIZZLE_X:
case PIPE_SWIZZLE_Y:
case PIPE_SWIZZLE_Z:
......
......@@ -426,7 +426,9 @@ fd_msaa_samples(unsigned samples)
switch (samples) {
default:
debug_assert(0);
#if defined(NDEBUG) || defined(DEBUG)
FALLTHROUGH;
#endif
case 0:
case 1:
return MSAA_ONE;
......
......@@ -144,8 +144,10 @@ FormatYCBCRToPipe(VdpYCbCrFormat vdpau_format)
#endif
default:
/* NOTE: Can't be "unreachable", as it's quite reachable. */
assert(!"unexpected VdpYCbCrFormat");
debug_assert(!"unexpected VdpYCbCrFormat");
#if defined(NDEBUG) || defined(DEBUG)
FALLTHROUGH;
#endif
#ifdef VDP_YCBCR_FORMAT_Y_UV_444
case VDP_YCBCR_FORMAT_Y_UV_444:
#endif
......
......@@ -184,7 +184,9 @@ st_gl_texture_dims_to_pipe_dims(GLenum texture,
break;
default:
assert(0 && "Unexpected texture in st_gl_texture_dims_to_pipe_dims()");
#if defined(NDEBUG) || defined(DEBUG)
FALLTHROUGH;
#endif
case GL_TEXTURE_3D:
case GL_PROXY_TEXTURE_3D:
*widthOut = widthIn;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment