Mesa (master): Guard FALLTHROUGH annotations after assert()
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 15 16:19:25 UTC 2021
Module: Mesa
Branch: master
Commit: 9ef53724412dc0e90bb0a207c7d86f88225da11f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9ef53724412dc0e90bb0a207c7d86f88225da11f
Author: Michel Dänzer <mdaenzer at redhat.com>
Date: Tue Apr 13 17:40:15 2021 +0200
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: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10220>
---
src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 4 +++-
src/gallium/auxiliary/gallivm/lp_bld_swizzle.c | 2 ++
src/gallium/drivers/freedreno/freedreno_util.h | 2 ++
src/gallium/frontends/vdpau/vdpau_private.h | 4 +++-
src/mesa/state_tracker/st_texture.c | 2 ++
5 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 6af22d0c378..9a18ef33ded 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -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,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
index 875271883e1..ea2ec780f16 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
@@ -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:
diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h
index dd7658bee18..064987265c2 100644
--- a/src/gallium/drivers/freedreno/freedreno_util.h
+++ b/src/gallium/drivers/freedreno/freedreno_util.h
@@ -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;
diff --git a/src/gallium/frontends/vdpau/vdpau_private.h b/src/gallium/frontends/vdpau/vdpau_private.h
index 68523e3214a..7e77aa354bc 100644
--- a/src/gallium/frontends/vdpau/vdpau_private.h
+++ b/src/gallium/frontends/vdpau/vdpau_private.h
@@ -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
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 1327fb56f90..d63628fcd87 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -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;
More information about the mesa-commit
mailing list