From bb84fa146f2252f22999205a2904d8a948bffd3b Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Sat, 20 Oct 2018 18:00:08 +0100 Subject: [PATCH] util: use C99 declaration in the for-loop hash_table_foreach() macro Signed-off-by: Eric Engestrom Reviewed-by: Timothy Arceri --- src/amd/common/ac_nir_to_llvm.c | 1 - src/broadcom/compiler/vir_live_variables.c | 2 -- src/broadcom/compiler/vir_lower_uniforms.c | 1 - src/compiler/glsl/ast_to_hir.cpp | 1 - src/compiler/glsl/link_uniform_blocks.cpp | 2 -- src/compiler/glsl/opt_constant_propagation.cpp | 2 -- src/compiler/glsl/opt_constant_variable.cpp | 1 - src/compiler/glsl/opt_dead_code.cpp | 1 - src/compiler/glsl/tests/array_refcount_test.cpp | 1 - src/compiler/nir/nir_lower_global_vars_to_local.c | 1 - src/compiler/nir/nir_lower_io_arrays_to_elements.c | 3 --- src/compiler/nir/nir_lower_io_to_scalar.c | 1 - src/compiler/nir/nir_opt_copy_prop_vars.c | 2 -- src/compiler/nir/nir_validate.c | 7 ------- src/gallium/drivers/freedreno/a6xx/fd6_texture.c | 3 --- src/gallium/drivers/freedreno/ir3/ir3_cache.c | 2 -- src/gallium/drivers/v3d/v3d_context.c | 1 - src/gallium/drivers/v3d/v3d_job.c | 6 ------ src/gallium/drivers/v3d/v3d_program.c | 2 -- src/gallium/drivers/vc4/vc4_context.c | 1 - src/gallium/drivers/vc4/vc4_job.c | 1 - src/gallium/drivers/vc4/vc4_program.c | 1 - src/gallium/drivers/vc4/vc4_qir_live_variables.c | 2 -- src/gallium/drivers/vc4/vc4_qir_lower_uniforms.c | 1 - src/intel/common/gen_decoder.c | 2 -- src/intel/compiler/brw_nir_analyze_ubo_ranges.c | 1 - src/intel/tools/aubinator_viewer.cpp | 2 -- src/intel/vulkan/anv_pipeline_cache.c | 3 --- src/mesa/drivers/dri/i965/brw_performance_query.c | 2 -- src/mesa/drivers/dri/i965/intel_fbo.c | 2 -- src/mesa/main/hash.c | 3 --- src/util/hash_table.c | 4 +--- src/util/hash_table.h | 8 +++----- src/util/tests/hash_table/clear.c | 1 - src/util/tests/hash_table/collision.c | 2 +- src/vulkan/wsi/wsi_common_x11.c | 1 - 36 files changed, 5 insertions(+), 72 deletions(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index ee75e2890dd..5ab81987d08 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -3635,7 +3635,6 @@ static void visit_post_phi(struct ac_nir_context *ctx, static void phi_post_pass(struct ac_nir_context *ctx) { - struct hash_entry *entry; hash_table_foreach(ctx->phis, entry) { visit_post_phi(ctx, (nir_phi_instr*)entry->key, (LLVMValueRef)entry->data); diff --git a/src/broadcom/compiler/vir_live_variables.c b/src/broadcom/compiler/vir_live_variables.c index 019cde14567..2879e23b43c 100644 --- a/src/broadcom/compiler/vir_live_variables.c +++ b/src/broadcom/compiler/vir_live_variables.c @@ -180,8 +180,6 @@ vir_setup_def(struct v3d_compile *c, struct qblock *block, int ip, static void sf_state_clear(struct hash_table *partial_update_ht) { - struct hash_entry *entry; - hash_table_foreach(partial_update_ht, entry) { struct partial_update_state *state = entry->data; diff --git a/src/broadcom/compiler/vir_lower_uniforms.c b/src/broadcom/compiler/vir_lower_uniforms.c index 1e900404c9c..570e601a66c 100644 --- a/src/broadcom/compiler/vir_lower_uniforms.c +++ b/src/broadcom/compiler/vir_lower_uniforms.c @@ -134,7 +134,6 @@ vir_lower_uniforms(struct v3d_compile *c) */ uint32_t max_count = 0; uint32_t max_index = 0; - struct hash_entry *entry; hash_table_foreach(ht, entry) { uint32_t count = (uintptr_t)entry->data; uint32_t index = (uintptr_t)entry->key - 1; diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index 97329e5be24..084b7021a9f 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -6645,7 +6645,6 @@ ast_case_statement_list::hir(exec_list *instructions, * if default should be chosen or not. */ if (!default_case.is_empty()) { - struct hash_entry *entry; ir_factory body(instructions, state); ir_expression *cmp = NULL; diff --git a/src/compiler/glsl/link_uniform_blocks.cpp b/src/compiler/glsl/link_uniform_blocks.cpp index 0ab9687b7fb..0b890586298 100644 --- a/src/compiler/glsl/link_uniform_blocks.cpp +++ b/src/compiler/glsl/link_uniform_blocks.cpp @@ -362,7 +362,6 @@ create_buffer_blocks(void *mem_ctx, struct gl_context *ctx, ctx->Const.UseSTD430AsDefaultPacking); unsigned i = 0; - struct hash_entry *entry; hash_table_foreach (block_hash, entry) { const struct link_uniform_block_active *const b = (const struct link_uniform_block_active *) entry->data; @@ -429,7 +428,6 @@ link_uniform_blocks(void *mem_ctx, unsigned num_ubo_variables = 0; unsigned num_ssbo_variables = 0; count_block_size block_size; - struct hash_entry *entry; hash_table_foreach (block_hash, entry) { struct link_uniform_block_active *const b = diff --git a/src/compiler/glsl/opt_constant_propagation.cpp b/src/compiler/glsl/opt_constant_propagation.cpp index a603c9fbbf9..642bd641ed6 100644 --- a/src/compiler/glsl/opt_constant_propagation.cpp +++ b/src/compiler/glsl/opt_constant_propagation.cpp @@ -380,7 +380,6 @@ ir_constant_propagation_visitor::visit_enter(ir_if *ir) acp->make_empty(); killed_all = true; } else { - hash_entry *htk; hash_table_foreach(new_kills, htk) kill((ir_variable *) htk->key, (uintptr_t) htk->data); } @@ -420,7 +419,6 @@ ir_constant_propagation_visitor::handle_loop(ir_loop *ir, bool keep_acp) this->acp = orig_acp; this->killed_all = this->killed_all || orig_killed_all; - hash_entry *htk; hash_table_foreach(new_kills, htk) { kill((ir_variable *) htk->key, (uintptr_t) htk->data); } diff --git a/src/compiler/glsl/opt_constant_variable.cpp b/src/compiler/glsl/opt_constant_variable.cpp index 914b46004c1..15d8cf7cdfd 100644 --- a/src/compiler/glsl/opt_constant_variable.cpp +++ b/src/compiler/glsl/opt_constant_variable.cpp @@ -190,7 +190,6 @@ do_constant_variable(exec_list *instructions) _mesa_key_pointer_equal); v.run(instructions); - struct hash_entry *hte; hash_table_foreach(v.ht, hte) { struct assignment_entry *entry = (struct assignment_entry *) hte->data; diff --git a/src/compiler/glsl/opt_dead_code.cpp b/src/compiler/glsl/opt_dead_code.cpp index 75e668ae46d..1eff3f2fd14 100644 --- a/src/compiler/glsl/opt_dead_code.cpp +++ b/src/compiler/glsl/opt_dead_code.cpp @@ -50,7 +50,6 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned) v.run(instructions); - struct hash_entry *e; hash_table_foreach(v.ht, e) { ir_variable_refcount_entry *entry = (ir_variable_refcount_entry *)e->data; diff --git a/src/compiler/glsl/tests/array_refcount_test.cpp b/src/compiler/glsl/tests/array_refcount_test.cpp index 0d8f4521cae..45c204dc2f8 100644 --- a/src/compiler/glsl/tests/array_refcount_test.cpp +++ b/src/compiler/glsl/tests/array_refcount_test.cpp @@ -160,7 +160,6 @@ validate_variables_in_hash_table(struct hash_table *ht, va_end(args); - struct hash_entry *entry; hash_table_foreach(ht, entry) { const ir_instruction *const ir = (ir_instruction *) entry->key; const ir_variable *const v = ir->as_variable(); diff --git a/src/compiler/nir/nir_lower_global_vars_to_local.c b/src/compiler/nir/nir_lower_global_vars_to_local.c index d441215a44d..be99cf9ad02 100644 --- a/src/compiler/nir/nir_lower_global_vars_to_local.c +++ b/src/compiler/nir/nir_lower_global_vars_to_local.c @@ -85,7 +85,6 @@ nir_lower_global_vars_to_local(nir_shader *shader) } } - struct hash_entry *entry; hash_table_foreach(var_func_table, entry) { nir_variable *var = (void *)entry->key; nir_function_impl *impl = entry->data; diff --git a/src/compiler/nir/nir_lower_io_arrays_to_elements.c b/src/compiler/nir/nir_lower_io_arrays_to_elements.c index 432524c2feb..f0bc487d6be 100644 --- a/src/compiler/nir/nir_lower_io_arrays_to_elements.c +++ b/src/compiler/nir/nir_lower_io_arrays_to_elements.c @@ -359,7 +359,6 @@ nir_lower_io_arrays_to_elements_no_indirects(nir_shader *shader, patch_indirects, split_inputs, true); /* Remove old input from the shaders inputs list */ - struct hash_entry *entry; hash_table_foreach(split_inputs, entry) { nir_variable *var = (nir_variable *) entry->key; exec_node_remove(&var->node); @@ -369,7 +368,6 @@ nir_lower_io_arrays_to_elements_no_indirects(nir_shader *shader, } /* Remove old output from the shaders outputs list */ - struct hash_entry *entry; hash_table_foreach(split_outputs, entry) { nir_variable *var = (nir_variable *) entry->key; exec_node_remove(&var->node); @@ -406,7 +404,6 @@ nir_lower_io_arrays_to_elements(nir_shader *producer, nir_shader *consumer) patch_indirects, split_inputs, false); /* Remove old input from the shaders inputs list */ - struct hash_entry *entry; hash_table_foreach(split_inputs, entry) { nir_variable *var = (nir_variable *) entry->key; exec_node_remove(&var->node); diff --git a/src/compiler/nir/nir_lower_io_to_scalar.c b/src/compiler/nir/nir_lower_io_to_scalar.c index f0c2a6a95d6..2b98e298cce 100644 --- a/src/compiler/nir/nir_lower_io_to_scalar.c +++ b/src/compiler/nir/nir_lower_io_to_scalar.c @@ -360,7 +360,6 @@ nir_lower_io_to_scalar_early(nir_shader *shader, nir_variable_mode mask) } /* Remove old input from the shaders inputs list */ - struct hash_entry *entry; hash_table_foreach(split_inputs, entry) { nir_variable *var = (nir_variable *) entry->key; exec_node_remove(&var->node); diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c index b664ef27d35..7a21ad56c79 100644 --- a/src/compiler/nir/nir_opt_copy_prop_vars.c +++ b/src/compiler/nir/nir_opt_copy_prop_vars.c @@ -201,7 +201,6 @@ gather_vars_written(struct copy_prop_var_state *state, /* Merge new information to the parent control flow node. */ if (written) { written->modes |= new_written->modes; - struct hash_entry *new_entry; hash_table_foreach(new_written->derefs, new_entry) { struct hash_entry *old_entry = _mesa_hash_table_search_pre_hashed(written->derefs, new_entry->hash, @@ -575,7 +574,6 @@ invalidate_copies_for_cf_node(struct copy_prop_var_state *state, } } - struct hash_entry *entry; hash_table_foreach (written->derefs, entry) { nir_deref_instr *deref_written = (nir_deref_instr *)entry->key; kill_aliases(copies, deref_written, (uintptr_t)entry->data); diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index 1852224b520..cf7ef91f08c 100644 --- a/src/compiler/nir/nir_validate.c +++ b/src/compiler/nir/nir_validate.c @@ -727,7 +727,6 @@ validate_block(nir_block *block, validate_state *state) } } - struct set_entry *entry; set_foreach(block->predecessors, entry) { const nir_block *pred = entry->key; validate_assert(state, pred->successors[0] == block || @@ -936,7 +935,6 @@ postvalidate_reg_decl(nir_register *reg, validate_state *state) if (reg_state->uses->entries != 0) { printf("extra entries in register uses:\n"); - struct set_entry *entry; set_foreach(reg_state->uses, entry) printf("%p\n", entry->key); @@ -951,7 +949,6 @@ postvalidate_reg_decl(nir_register *reg, validate_state *state) if (reg_state->if_uses->entries != 0) { printf("extra entries in register if_uses:\n"); - struct set_entry *entry; set_foreach(reg_state->if_uses, entry) printf("%p\n", entry->key); @@ -966,7 +963,6 @@ postvalidate_reg_decl(nir_register *reg, validate_state *state) if (reg_state->defs->entries != 0) { printf("extra entries in register defs:\n"); - struct set_entry *entry; set_foreach(reg_state->defs, entry) printf("%p\n", entry->key); @@ -1033,7 +1029,6 @@ postvalidate_ssa_def(nir_ssa_def *def, void *void_state) if (def_state->uses->entries != 0) { printf("extra entries in SSA def uses:\n"); - struct set_entry *entry; set_foreach(def_state->uses, entry) printf("%p\n", entry->key); @@ -1048,7 +1043,6 @@ postvalidate_ssa_def(nir_ssa_def *def, void *void_state) if (def_state->if_uses->entries != 0) { printf("extra entries in SSA def uses:\n"); - struct set_entry *entry; set_foreach(def_state->if_uses, entry) printf("%p\n", entry->key); @@ -1157,7 +1151,6 @@ dump_errors(validate_state *state) if (_mesa_hash_table_num_entries(errors) > 0) { fprintf(stderr, "%d additional errors:\n", _mesa_hash_table_num_entries(errors)); - struct hash_entry *entry; hash_table_foreach(errors, entry) { fprintf(stderr, "%s\n", (char *)entry->data); } diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_texture.c b/src/gallium/drivers/freedreno/a6xx/fd6_texture.c index a48c4ee1ad0..0fa20e01e67 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_texture.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_texture.c @@ -151,7 +151,6 @@ fd6_sampler_state_delete(struct pipe_context *pctx, void *hwcso) struct fd6_context *fd6_ctx = fd6_context(fd_context(pctx)); struct fd6_sampler_stateobj *samp = hwcso; - struct hash_entry *entry; hash_table_foreach(fd6_ctx->tex_cache, entry) { struct fd6_texture_state *state = entry->data; @@ -344,7 +343,6 @@ fd6_sampler_view_destroy(struct pipe_context *pctx, struct fd6_context *fd6_ctx = fd6_context(fd_context(pctx)); struct fd6_pipe_sampler_view *view = fd6_pipe_sampler_view(_view); - struct hash_entry *entry; hash_table_foreach(fd6_ctx->tex_cache, entry) { struct fd6_texture_state *state = entry->data; @@ -508,7 +506,6 @@ fd6_texture_fini(struct pipe_context *pctx) { struct fd6_context *fd6_ctx = fd6_context(fd_context(pctx)); - struct hash_entry *entry; hash_table_foreach(fd6_ctx->tex_cache, entry) { fd6_texture_state_destroy(entry->data); } diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cache.c b/src/gallium/drivers/freedreno/ir3/ir3_cache.c index 05edeed4681..a198ef4c769 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_cache.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_cache.c @@ -76,7 +76,6 @@ struct ir3_cache * ir3_cache_create(const struct ir3_cache_funcs *funcs, void *d void ir3_cache_destroy(struct ir3_cache *cache) { /* _mesa_hash_table_destroy is so *almost* useful.. */ - struct hash_entry *entry; hash_table_foreach(cache->ht, entry) { cache->funcs->destroy_state(cache->data, entry->data); } @@ -117,7 +116,6 @@ ir3_cache_lookup(struct ir3_cache *cache, const struct ir3_cache_key *key, */ void ir3_cache_invalidate(struct ir3_cache *cache, void *stobj) { - struct hash_entry *entry; hash_table_foreach(cache->ht, entry) { const struct ir3_cache_key *key = entry->key; if ((key->fs == stobj) || (key->vs == stobj)) { diff --git a/src/gallium/drivers/v3d/v3d_context.c b/src/gallium/drivers/v3d/v3d_context.c index 2fd2fa0bbf3..12741b578e3 100644 --- a/src/gallium/drivers/v3d/v3d_context.c +++ b/src/gallium/drivers/v3d/v3d_context.c @@ -43,7 +43,6 @@ v3d_flush(struct pipe_context *pctx) { struct v3d_context *v3d = v3d_context(pctx); - struct hash_entry *entry; hash_table_foreach(v3d->jobs, entry) { struct v3d_job *job = entry->data; v3d_job_submit(v3d, job); diff --git a/src/gallium/drivers/v3d/v3d_job.c b/src/gallium/drivers/v3d/v3d_job.c index 3645305f4f0..8ba5c8996dc 100644 --- a/src/gallium/drivers/v3d/v3d_job.c +++ b/src/gallium/drivers/v3d/v3d_job.c @@ -47,8 +47,6 @@ remove_from_ht(struct hash_table *ht, void *key) static void v3d_job_free(struct v3d_context *v3d, struct v3d_job *job) { - struct set_entry *entry; - set_foreach(job->bos, entry) { struct v3d_bo *bo = (struct v3d_bo *)entry->key; v3d_bo_unreference(&bo); @@ -57,8 +55,6 @@ v3d_job_free(struct v3d_context *v3d, struct v3d_job *job) remove_from_ht(v3d->jobs, &job->key); if (job->write_prscs) { - struct set_entry *entry; - set_foreach(job->write_prscs, entry) { const struct pipe_resource *prsc = entry->key; @@ -175,7 +171,6 @@ v3d_flush_jobs_reading_resource(struct v3d_context *v3d, v3d_flush_jobs_writing_resource(v3d, prsc); - struct hash_entry *entry; hash_table_foreach(v3d->jobs, entry) { struct v3d_job *job = entry->data; @@ -351,7 +346,6 @@ v3d_clif_dump(struct v3d_context *v3d, struct v3d_job *job) stderr, V3D_DEBUG & V3D_DEBUG_CL); - struct set_entry *entry; set_foreach(job->bos, entry) { struct v3d_bo *bo = (void *)entry->key; char *name = ralloc_asprintf(NULL, "%s_0x%x", diff --git a/src/gallium/drivers/v3d/v3d_program.c b/src/gallium/drivers/v3d/v3d_program.c index e9fae77d5c0..1d4b0bb2080 100644 --- a/src/gallium/drivers/v3d/v3d_program.c +++ b/src/gallium/drivers/v3d/v3d_program.c @@ -618,7 +618,6 @@ v3d_shader_state_delete(struct pipe_context *pctx, void *hwcso) struct v3d_context *v3d = v3d_context(pctx); struct v3d_uncompiled_shader *so = hwcso; - struct hash_entry *entry; hash_table_foreach(v3d->fs_cache, entry) { delete_from_cache_if_matches(v3d->fs_cache, &v3d->prog.fs, entry, so); @@ -673,7 +672,6 @@ v3d_program_fini(struct pipe_context *pctx) { struct v3d_context *v3d = v3d_context(pctx); - struct hash_entry *entry; hash_table_foreach(v3d->fs_cache, entry) { struct v3d_compiled_shader *shader = entry->data; v3d_bo_unreference(&shader->bo); diff --git a/src/gallium/drivers/vc4/vc4_context.c b/src/gallium/drivers/vc4/vc4_context.c index 9ff39c2655f..ffd7d4c8555 100644 --- a/src/gallium/drivers/vc4/vc4_context.c +++ b/src/gallium/drivers/vc4/vc4_context.c @@ -42,7 +42,6 @@ vc4_flush(struct pipe_context *pctx) { struct vc4_context *vc4 = vc4_context(pctx); - struct hash_entry *entry; hash_table_foreach(vc4->jobs, entry) { struct vc4_job *job = entry->data; vc4_job_submit(vc4, job); diff --git a/src/gallium/drivers/vc4/vc4_job.c b/src/gallium/drivers/vc4/vc4_job.c index 72569765847..f38c4647541 100644 --- a/src/gallium/drivers/vc4/vc4_job.c +++ b/src/gallium/drivers/vc4/vc4_job.c @@ -118,7 +118,6 @@ vc4_flush_jobs_reading_resource(struct vc4_context *vc4, vc4_flush_jobs_writing_resource(vc4, prsc); - struct hash_entry *entry; hash_table_foreach(vc4->jobs, entry) { struct vc4_job *job = entry->data; diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index f734d121052..4896833177a 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -2975,7 +2975,6 @@ vc4_shader_state_delete(struct pipe_context *pctx, void *hwcso) struct vc4_context *vc4 = vc4_context(pctx); struct vc4_uncompiled_shader *so = hwcso; - struct hash_entry *entry; hash_table_foreach(vc4->fs_cache, entry) { delete_from_cache_if_matches(vc4->fs_cache, &vc4->prog.fs, entry, so); diff --git a/src/gallium/drivers/vc4/vc4_qir_live_variables.c b/src/gallium/drivers/vc4/vc4_qir_live_variables.c index 7108b3ee9b6..5629ce044d9 100644 --- a/src/gallium/drivers/vc4/vc4_qir_live_variables.c +++ b/src/gallium/drivers/vc4/vc4_qir_live_variables.c @@ -173,8 +173,6 @@ qir_setup_def(struct vc4_compile *c, struct qblock *block, int ip, static void sf_state_clear(struct hash_table *partial_update_ht) { - struct hash_entry *entry; - hash_table_foreach(partial_update_ht, entry) { struct partial_update_state *state = entry->data; diff --git a/src/gallium/drivers/vc4/vc4_qir_lower_uniforms.c b/src/gallium/drivers/vc4/vc4_qir_lower_uniforms.c index ad19f06d31b..d7c22e75c29 100644 --- a/src/gallium/drivers/vc4/vc4_qir_lower_uniforms.c +++ b/src/gallium/drivers/vc4/vc4_qir_lower_uniforms.c @@ -136,7 +136,6 @@ qir_lower_uniforms(struct vc4_compile *c) */ uint32_t max_count = 0; uint32_t max_index = 0; - struct hash_entry *entry; hash_table_foreach(ht, entry) { uint32_t count = (uintptr_t)entry->data; uint32_t index = (uintptr_t)entry->key - 1; diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c index 5f6e7a0b808..f24d3ccf15d 100644 --- a/src/intel/common/gen_decoder.c +++ b/src/intel/common/gen_decoder.c @@ -702,8 +702,6 @@ void gen_spec_destroy(struct gen_spec *spec) struct gen_group * gen_spec_find_instruction(struct gen_spec *spec, const uint32_t *p) { - struct hash_entry *entry; - hash_table_foreach(spec->commands, entry) { struct gen_group *command = entry->data; uint32_t opcode = *p & command->opcode_mask; diff --git a/src/intel/compiler/brw_nir_analyze_ubo_ranges.c b/src/intel/compiler/brw_nir_analyze_ubo_ranges.c index cfa531675fc..2dfc7b8ddd6 100644 --- a/src/intel/compiler/brw_nir_analyze_ubo_ranges.c +++ b/src/intel/compiler/brw_nir_analyze_ubo_ranges.c @@ -245,7 +245,6 @@ brw_nir_analyze_ubo_ranges(const struct brw_compiler *compiler, struct util_dynarray ranges; util_dynarray_init(&ranges, mem_ctx); - struct hash_entry *entry; hash_table_foreach(state.blocks, entry) { const int b = entry->hash - 1; const struct ubo_block_info *info = entry->data; diff --git a/src/intel/tools/aubinator_viewer.cpp b/src/intel/tools/aubinator_viewer.cpp index d5d289032e8..27ef4f7e99b 100644 --- a/src/intel/tools/aubinator_viewer.cpp +++ b/src/intel/tools/aubinator_viewer.cpp @@ -839,7 +839,6 @@ display_registers_window(struct window *win) filter.Draw(); ImGui::BeginChild(ImGui::GetID("##block")); - struct hash_entry *entry; hash_table_foreach(context.file->spec->registers_by_name, entry) { struct gen_group *reg = (struct gen_group *) entry->data; if (filter.PassFilter(reg->name) && @@ -895,7 +894,6 @@ display_commands_window(struct window *win) if (ImGui::Button("Dwords")) show_dwords ^= 1; ImGui::BeginChild(ImGui::GetID("##block")); - struct hash_entry *entry; hash_table_foreach(context.file->spec->commands, entry) { struct gen_group *cmd = (struct gen_group *) entry->data; if ((cmd_filter.PassFilter(cmd->name) && diff --git a/src/intel/vulkan/anv_pipeline_cache.c b/src/intel/vulkan/anv_pipeline_cache.c index 3efa427279d..eac058fb47f 100644 --- a/src/intel/vulkan/anv_pipeline_cache.c +++ b/src/intel/vulkan/anv_pipeline_cache.c @@ -237,7 +237,6 @@ anv_pipeline_cache_finish(struct anv_pipeline_cache *cache) * going away, the shader cache has to hold a reference to all shader * binaries it contains. We unref them when we destroy the cache. */ - struct hash_entry *entry; hash_table_foreach(cache->cache, entry) anv_shader_bin_unref(cache->device, entry->data); @@ -499,7 +498,6 @@ VkResult anv_GetPipelineCacheData( VkResult result = VK_SUCCESS; if (cache->cache) { - struct hash_entry *entry; hash_table_foreach(cache->cache, entry) { struct anv_shader_bin *shader = entry->data; @@ -540,7 +538,6 @@ VkResult anv_MergePipelineCaches( if (!src->cache) continue; - struct hash_entry *entry; hash_table_foreach(src->cache, entry) { struct anv_shader_bin *bin = entry->data; assert(bin); diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c b/src/mesa/drivers/dri/i965/brw_performance_query.c index ff9272999d1..10e3d024f17 100644 --- a/src/mesa/drivers/dri/i965/brw_performance_query.c +++ b/src/mesa/drivers/dri/i965/brw_performance_query.c @@ -1848,7 +1848,6 @@ static bool kernel_has_dynamic_config_support(struct brw_context *brw) { __DRIscreen *screen = brw->screen->driScrnPriv; - struct hash_entry *entry; hash_table_foreach(brw->perfquery.oa_metrics_table, entry) { struct brw_perf_query_info *query = entry->data; @@ -1872,7 +1871,6 @@ static void init_oa_configs(struct brw_context *brw) { __DRIscreen *screen = brw->screen->driScrnPriv; - struct hash_entry *entry; hash_table_foreach(brw->perfquery.oa_metrics_table, entry) { const struct brw_perf_query_info *query = entry->data; diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c index 968d61014e5..2bbbc34114c 100644 --- a/src/mesa/drivers/dri/i965/intel_fbo.c +++ b/src/mesa/drivers/dri/i965/intel_fbo.c @@ -979,11 +979,9 @@ intel_renderbuffer_move_to_temp(struct brw_context *brw, void brw_cache_sets_clear(struct brw_context *brw) { - struct hash_entry *render_entry; hash_table_foreach(brw->render_cache, render_entry) _mesa_hash_table_remove(brw->render_cache, render_entry); - struct set_entry *depth_entry; set_foreach(brw->depth_cache, depth_entry) _mesa_set_remove(brw->depth_cache, depth_entry); } diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index 9a6d5ed5edb..902c5efc65a 100644 --- a/src/mesa/main/hash.c +++ b/src/mesa/main/hash.c @@ -283,8 +283,6 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table, void (*callback)(GLuint key, void *data, void *userData), void *userData) { - struct hash_entry *entry; - assert(callback); _mesa_HashLockMutex(table); table->InDeleteAll = GL_TRUE; @@ -316,7 +314,6 @@ hash_walk_unlocked(const struct _mesa_HashTable *table, assert(table); assert(callback); - struct hash_entry *entry; hash_table_foreach(table->ht, entry) { callback((uintptr_t)entry->key, entry->data, userData); } diff --git a/src/util/hash_table.c b/src/util/hash_table.c index 7ee9e18a1fc..fc152f84a4d 100644 --- a/src/util/hash_table.c +++ b/src/util/hash_table.c @@ -177,8 +177,6 @@ _mesa_hash_table_destroy(struct hash_table *ht, return; if (delete_function) { - struct hash_entry *entry; - hash_table_foreach(ht, entry) { delete_function(entry); } @@ -284,7 +282,7 @@ static void _mesa_hash_table_rehash(struct hash_table *ht, unsigned new_size_index) { struct hash_table old_ht; - struct hash_entry *table, *entry; + struct hash_entry *table; if (new_size_index >= ARRAY_SIZE(hash_sizes)) return; diff --git a/src/util/hash_table.h b/src/util/hash_table.h index 40ff041e94b..d89fc1dc1c8 100644 --- a/src/util/hash_table.h +++ b/src/util/hash_table.h @@ -139,9 +139,9 @@ _mesa_fnv32_1a_accumulate_block(uint32_t hash, const void *data, size_t size) * an entry's data with the deleted marker), but not against insertion * (which may rehash the table, making entry a dangling pointer). */ -#define hash_table_foreach(ht, entry) \ - for (entry = _mesa_hash_table_next_entry(ht, NULL); \ - entry != NULL; \ +#define hash_table_foreach(ht, entry) \ + for (struct hash_entry *entry = _mesa_hash_table_next_entry(ht, NULL); \ + entry != NULL; \ entry = _mesa_hash_table_next_entry(ht, entry)) static inline void @@ -151,8 +151,6 @@ hash_table_call_foreach(struct hash_table *ht, void *closure), void *closure) { - struct hash_entry *entry; - hash_table_foreach(ht, entry) callback(entry->key, entry->data, closure); } diff --git a/src/util/tests/hash_table/clear.c b/src/util/tests/hash_table/clear.c index 526700bfb0f..3d6bf80c0cf 100644 --- a/src/util/tests/hash_table/clear.c +++ b/src/util/tests/hash_table/clear.c @@ -53,7 +53,6 @@ static void delete_function(struct hash_entry *entry) int main() { struct hash_table *ht; - struct hash_entry *entry; const uint32_t size = 1000; bool flags[size]; uint32_t i; diff --git a/src/util/tests/hash_table/collision.c b/src/util/tests/hash_table/collision.c index 69a4c29eca7..ba8913281fb 100644 --- a/src/util/tests/hash_table/collision.c +++ b/src/util/tests/hash_table/collision.c @@ -37,7 +37,7 @@ main(int argc, char **argv) const char *str1 = "test1"; const char *str2 = "test2"; const char *str3 = "test3"; - struct hash_entry *entry1, *entry2, *search_entry; + struct hash_entry *entry1, *entry2; uint32_t bad_hash = 5; int i; diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index 16a544ec775..6eb72827eda 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -1545,7 +1545,6 @@ wsi_x11_finish_wsi(struct wsi_device *wsi_device, (struct wsi_x11 *)wsi_device->wsi[VK_ICD_WSI_PLATFORM_XCB]; if (wsi) { - struct hash_entry *entry; hash_table_foreach(wsi->connections, entry) wsi_x11_connection_destroy(wsi_device, entry->data); -- 2.30.2