Re: [kvm-unit-tests PATCH] s390x/intercept: Fix problem with bad compiler warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27.06.2017 06:18, Thomas Huth wrote:
> The intercept test currently can not be compiled with GCC 4.8 anymore.
> It generates the following warning (which is fatal due to -Werror):
> 
> s390x/intercept.c: In function ‘test_stidp’:
> s390x/intercept.c:111:9: error: missing initializer for field ‘version’ of ‘struct cpuid’ [-Werror=missing-field-initializers]
>   struct cpuid id = {};
>          ^
> Fix it by using a "0" as intializer here.
> 
> Signed-off-by: Thomas Huth <thuth@xxxxxxxxxx>
> ---
>  NB: We could also remove the -Wextra from the CFLAGS instead. IMHO
>  using -Wextra together with -Werror is just like playing Russian roulette.
>  Since -Wextra is some kind of "compiler warning playground" for the GCC
>  folks, you never know which compiler version will trigger an unexpected
>  (and often also unfounded) warning here, so using this together with -Werror
>  is just a nuisance.

I agree, this is really not deterministic.

> 
>  s390x/intercept.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/s390x/intercept.c b/s390x/intercept.c
> index 9766289..9fe86cf 100644
> --- a/s390x/intercept.c
> +++ b/s390x/intercept.c
> @@ -108,7 +108,7 @@ static void test_stap(void)
>  /* Test the STORE CPU ID instruction */
>  static void test_stidp(void)
>  {
> -	struct cpuid id = {};
> +	struct cpuid id = { 0 };
>  
>  	asm volatile ("stidp %0\n" : "+Q"(id));
>  	report("type set", id.type);
> 

arm and powerpc also use -Wextra, maybe we should remove this then for all.

Whatever you prefer.

Reviewed-by: David Hildenbrand <david@xxxxxxxxxx>

-- 

Thanks,

David



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux