Mesa (main): freedreno: degrade STATIC_ASSERT to assert

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 3 07:49:47 UTC 2022


Module: Mesa
Branch: main
Commit: d8e34243ae6db2681467507bf9a55e3d2a76ade9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d8e34243ae6db2681467507bf9a55e3d2a76ade9

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Mon May 23 14:36:52 2022 +0200

freedreno: degrade STATIC_ASSERT to assert

dirty is a variable, and C standard doesn't guarantee that the compiler
can see that it's always passed a constant. So this isn't appropriate to
use for static_assert, which we're about to convert STATIC_ASSERT to
expand to.

If we really want to do this compile-time, we need to make
fd_context_dirty a macro instead. But it seems reaonable to just use a
run-time assert instead here.

Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16670>

---

 src/gallium/drivers/freedreno/freedreno_context.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h
index e9c25fde9bd..56b0b0c8c37 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.h
+++ b/src/gallium/drivers/freedreno/freedreno_context.h
@@ -608,7 +608,7 @@ static inline void
 fd_context_dirty(struct fd_context *ctx, enum fd_dirty_3d_state dirty) assert_dt
 {
    assert(util_is_power_of_two_nonzero(dirty));
-   STATIC_ASSERT(ffs(dirty) <= ARRAY_SIZE(ctx->gen_dirty_map));
+   assert(ffs(dirty) <= ARRAY_SIZE(ctx->gen_dirty_map));
 
    ctx->gen_dirty |= ctx->gen_dirty_map[ffs(dirty) - 1];
 



More information about the mesa-commit mailing list