[libvirt] [PATCH] examples: Initialize @pos in domtop.c

Martin Kletzander mkletzan at redhat.com
Mon Apr 15 09:43:04 UTC 2019


On Mon, Apr 15, 2019 at 10:33:10AM +0100, Daniel P. Berrangé wrote:
>On Mon, Apr 15, 2019 at 11:30:54AM +0200, Martin Kletzander wrote:
>> This is a zero-cost workaround for a bug in GCC 8.3.0 which causes the
>> compilation to fail, because the compiler thinks that the value might be used
>> uninitialized even though it clearly cannot be.
>>
>> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
>> ---
>> This is technically a fix for a build-breaker, but I'm sending it for review as
>> it is not that big of a deal it being in examples/
>
>This is due to me enabling all the compiler warnings in examples/ recently
>

I know, I just wanted someone to see this before pushing.

>>
>>  examples/domtop/domtop.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/examples/domtop/domtop.c b/examples/domtop/domtop.c
>> index c9b51aed510d..e463e2873f42 100644
>> --- a/examples/domtop/domtop.c
>> +++ b/examples/domtop/domtop.c
>> @@ -206,7 +206,7 @@ print_cpu_usage(size_t cpu,
>>      }
>>
>>      for (i = 0; i < ncpus; i++) {
>> -        size_t pos;
>> +        size_t pos = 0;
>>          double usage;
>>
>>          /* check if the vCPU is in the maps */
>
>Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>
>

Oh, I forgot to add this R-b to the commit message.  Sorry.

>
>Regards,
>Daniel
>-- 
>|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
>|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
>|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190415/ec3aa170/attachment-0001.sig>


More information about the libvir-list mailing list