[libvirt] [PATCH 0/3] Couple of build fixes after latest cpu changes

Michal Privoznik mprivozn at redhat.com
Mon Apr 15 07:04:34 UTC 2019


On 4/15/19 8:12 AM, Bjoern Walk wrote:
> Michal Privoznik <mprivozn at redhat.com> [2019-04-15, 06:50AM +0200]:
>> I've successfully tested these on mingw, arm and x86_64.
> 
> Fixes S390 as well, thanks.
> 
>> Almost trivial, but not pushed yet. I'll wait for review.
> 
> I got another incidential build error that doesn't seem related though:

Yep, it's unrelated.

> 
> 	../../examples/domtop/domtop.c: In function 'print_cpu_usage':
> 	../../examples/domtop/domtop.c:242:28: error: 'pos' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 			 usage = (now_params[pos].value.ul - then_params[pos].value.ul) /
> 								^
> 	cc1: all warnings being treated as errors
> 
> GCC is 8.2.1. Here's a patch:
> 
> 	diff --git a/examples/domtop/domtop.c b/examples/domtop/domtop.c
> 	index c9b51aed..e463e287 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 */
> 

This is a false positive. Either the control cannot get to line 242 or 
if it will then @pos was set. But if this patch helps you to compile 
cleanly then I'm up for taking it. Mind sending it as a proper patch?

Thanks,
Michal




More information about the libvir-list mailing list