From d8e34243ae6db2681467507bf9a55e3d2a76ade9 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 23 May 2022 14:36:52 +0200 Subject: [PATCH] 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 Part-of: --- 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];