[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 1/6] x86/cpu-policy: Drop build time cross-checks of featureset sizes
On 04.05.2023 21:39, Andrew Cooper wrote: > These BUILD_BUG_ON()s exist to cover the curious absence of a diagnostic for > code which looks like: > > uint32_t foo[1] = { 1, 2, 3 }; > > However, GCC 12 at least does now warn for this: > > foo.c:1:24: error: excess elements in array initializer [-Werror] > 884 | uint32_t foo[1] = { 1, 2, 3 }; > | ^ > foo.c:1:24: note: (near initialization for 'foo') I'm pretty sure all gcc versions we support diagnose such cases. In turn the arrays in question don't have explicit dimensions at their definition sites, and hence they derive their dimensions from their initializers. So the build-time-checks are about the arrays in fact obtaining the right dimensions, i.e. the initializers being suitable. With the core part of the reasoning not being applicable, I'm afraid I can't even say "okay with an adjusted description". Jan > and has found other array length issues which we want to fix. Drop the cross > check now tools can spot the problem case directly. > > Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> > --- > CC: Jan Beulich <JBeulich@xxxxxxxx> > CC: Roger Pau Monné <roger.pau@xxxxxxxxxx> > CC: Wei Liu <wl@xxxxxxx> > --- > xen/arch/x86/cpu-policy.c | 6 ------ > 1 file changed, 6 deletions(-) > > diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c > index ef6a2d0d180a..44c88debf958 100644 > --- a/xen/arch/x86/cpu-policy.c > +++ b/xen/arch/x86/cpu-policy.c > @@ -883,12 +883,6 @@ void __init init_dom0_cpuid_policy(struct domain *d) > > static void __init __maybe_unused build_assertions(void) > { > - BUILD_BUG_ON(ARRAY_SIZE(known_features) != FSCAPINTS); > - BUILD_BUG_ON(ARRAY_SIZE(pv_max_featuremask) != FSCAPINTS); > - BUILD_BUG_ON(ARRAY_SIZE(hvm_shadow_max_featuremask) != FSCAPINTS); > - BUILD_BUG_ON(ARRAY_SIZE(hvm_hap_max_featuremask) != FSCAPINTS); > - BUILD_BUG_ON(ARRAY_SIZE(deep_features) != FSCAPINTS); > - > /* Find some more clever allocation scheme if this trips. */ > BUILD_BUG_ON(sizeof(struct cpu_policy) > PAGE_SIZE); >
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |