From 386759b02dac1382072cecef4d6520a0770f995e Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Fri, 13 Nov 2015 12:13:14 -0800 Subject: [PATCH] i965: Silence warning. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit intel_asm_annotation.c: In function ‘annotation_insert_error’: intel_asm_annotation.c:214:18: warning: ‘ann’ may be used uninitialized in this function [-Wmaybe-uninitialized] ann->error = ralloc_strdup(annotation->mem_ctx, error); ^ I initially tried changing the type of ann_count to unsigned (is currently int), since that in addition to the check that it's non-zero at the beginning of the function seems sufficient to prove that it must be greater than zero. Unfortunately that wasn't sufficient. --- src/mesa/drivers/dri/i965/intel_asm_annotation.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/intel_asm_annotation.c b/src/mesa/drivers/dri/i965/intel_asm_annotation.c index 52878fde43e..bb7786ba748 100644 --- a/src/mesa/drivers/dri/i965/intel_asm_annotation.c +++ b/src/mesa/drivers/dri/i965/intel_asm_annotation.c @@ -185,6 +185,8 @@ annotation_insert_error(struct annotation_info *annotation, unsigned offset, if (!annotation_array_ensure_space(annotation)) return; + assume(annotation->ann_count > 0); + for (int i = 0; i < annotation->ann_count; i++) { struct annotation *cur = &annotation->ann[i]; struct annotation *next = &annotation->ann[i + 1]; @@ -206,8 +208,6 @@ annotation_insert_error(struct annotation_info *annotation, unsigned offset, break; } - assume(ann != NULL); - if (ann->error) ralloc_strcat(&ann->error, error); else -- 2.30.2