[PATCH] virhostcpu: Fix build with clang and newest kernel headers
Jiri Denemark
jdenemar at redhat.com
Tue Aug 23 14:21:05 UTC 2022
On Tue, Aug 23, 2022 at 16:15:54 +0200, 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 at redhat.com>
> ---
> src/util/virhostcpu.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
Reviewed-by: Jiri Denemark <jdenemar at redhat.com>
More information about the libvir-list
mailing list