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 <pkre...@redhat.com>
> ---
>  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

Reply via email to