Re: [PATCH] virhostcpu: Fix build with clang and newest kernel headers

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

 



On 8/23/22 16:15, Peter Krempa wrote:
> The most recent environment e.g. present in our Fedora Rawhide builds
> fail to build the tree with clang with the following error:
> 
> ../src/util/virhostcpu.c:1291:25: error: field 'header' with variable sized type 'struct kvm_msrs' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
>         struct kvm_msrs header;
>                         ^
> 
> The problem seems to be that clang doesn't like the new way the
> 'entries' field in struct kvm_msrs is declared.
> 
> To work around the issue we can simply allocate the variable dynamically
> and use the 'entries' member as it was intended to to access the
> members.
> 
> Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
> ---
>  src/util/virhostcpu.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)

Yeah, since this code is heavily inspired by QEMU I wanted to wait a bit
to see how QEMU deals with this because allocating those few bytes
looked needless to me. But I guess there's no better solution. Anyway,
I've raised this issue with QEMU here:

https://lists.gnu.org/archive/html/qemu-devel/2022-08/msg03128.html

Michal




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux