Having this check in library code guarantees that the tool stack use(s) will also be covered.
Signed-off-by: Jan Beulich <[email protected]> --- Dropping the check from arch/x86/cpu-policy.c:build_assertions() in exchange may be an option. While there checking is against FSCAPINTS, the difference is only on the surface: That's a #define resolving to FEATURESET_NR_ENTRIES. Really the duplication of deep_features[] itself is also somewhat odd. While not quite as big as deep_deps[], both Xen and libxg could certainly get away with just a single instance each. --- a/xen/lib/x86/cpuid.c +++ b/xen/lib/x86/cpuid.c @@ -298,6 +298,7 @@ const uint32_t *x86_cpu_policy_lookup_de } deep_deps[] = INIT_DEEP_DEPS; unsigned int start = 0, end = ARRAY_SIZE(deep_deps); + BUILD_BUG_ON(ARRAY_SIZE(deep_features) != FEATURESET_NR_ENTRIES); BUILD_BUG_ON(ARRAY_SIZE(deep_deps) != NR_DEEP_DEPS); /* Fast early exit. */
