From 4686a956212ac8e9b7be1b6a10672cb606095f8f Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Fri, 3 Jul 2020 12:06:09 +1000 Subject: r600/radeonsi: silence zero-length-bounds gcc warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Part-of: --- src/gallium/drivers/r600/r600_pipe_common.h | 4 ++-- src/gallium/drivers/radeonsi/si_pipe.h | 5 +++-- src/gallium/drivers/radeonsi/si_state.h | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/r600/r600_pipe_common.h b/src/gallium/drivers/r600/r600_pipe_common.h index 2ecd03845e6..8accf7eae98 100644 --- a/src/gallium/drivers/r600/r600_pipe_common.h +++ b/src/gallium/drivers/r600/r600_pipe_common.h @@ -289,7 +289,7 @@ struct r600_mmio_counter { }; union r600_mmio_counters { - struct { + struct r600_mmio_counters_named { /* For global GPU load including SDMA. */ struct r600_mmio_counter gpu; @@ -320,7 +320,7 @@ union r600_mmio_counters { struct r600_mmio_counter cp_dma; struct r600_mmio_counter scratch_ram; } named; - unsigned array[0]; + unsigned array[sizeof(struct r600_mmio_counters_named) / sizeof(unsigned)]; }; struct r600_memory_object { diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 467538c76cd..14b29db9b85 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -432,7 +432,7 @@ struct si_mmio_counter { }; union si_mmio_counters { - struct { + struct si_mmio_counters_named { /* For global GPU load including SDMA. */ struct si_mmio_counter gpu; @@ -463,7 +463,8 @@ union si_mmio_counters { struct si_mmio_counter cp_dma; struct si_mmio_counter scratch_ram; } named; - unsigned array[0]; + + unsigned array[sizeof(struct si_mmio_counters_named) / sizeof(unsigned)]; }; struct si_memory_object { diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index a45b18c827c..ab655498a1d 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -176,7 +176,7 @@ struct si_vertex_elements { }; union si_state { - struct { + struct si_state_named { struct si_state_blend *blend; struct si_state_rasterizer *rasterizer; struct si_state_dsa *dsa; @@ -189,7 +189,7 @@ union si_state { struct si_pm4_state *vs; struct si_pm4_state *ps; } named; - struct si_pm4_state *array[0]; + struct si_pm4_state *array[sizeof(struct si_state_named) / sizeof(struct si_pm4_state *)]; }; #define SI_STATE_IDX(name) (offsetof(union si_state, named.name) / sizeof(struct si_pm4_state *)) @@ -203,7 +203,7 @@ static inline unsigned si_states_that_always_roll_context(void) } union si_state_atoms { - struct { + struct si_atoms_s { /* The order matters. */ struct si_atom render_cond; struct si_atom streamout_begin; @@ -228,7 +228,7 @@ union si_state_atoms { struct si_atom window_rectangles; struct si_atom shader_query; } s; - struct si_atom array[0]; + struct si_atom array[sizeof(struct si_atoms_s) / sizeof(struct si_atom)]; }; #define SI_ATOM_BIT(name) (1 << (offsetof(union si_state_atoms, s.name) / sizeof(struct si_atom))) -- cgit v1.2.3