
On Tue, Aug 23, 2022 at 15:42:38 +0100, Daniel P. Berrangé wrote:
On Tue, Aug 23, 2022 at 04:15:54PM +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.
We explicitly only support GCC and CLang, and intentionally rely on many GNU extensions to C. CLang is trying to be helpful to people who need fully portable C code, but we don't care about that. So why not just turn off the warning by adding
-Wno-gnu-variable-sized-style-not-at-end
better than making our code less understandable IMHO
Well I guess mostly because the new code is actually easier to understand than the old one :-) Jirka