i965: Silence warning.
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user