Re: [PATCH v2 1/1] x86/cpu: Mark flag_is_changeable_p() with __maybe_unused

From: Dave Hansen
Date: Mon Sep 09 2024 - 11:36:16 EST


On 9/5/24 10:02, Andy Shevchenko wrote:
> When flag_is_changeable_p() is unused, it prevents kernel builds
> with clang, `make W=1` and CONFIG_WERROR=y:
>
> arch/x86/kernel/cpu/common.c:351:19: error: unused function 'flag_is_changeable_p' [-Werror,-Wunused-function]
> 351 | static inline int flag_is_changeable_p(u32 flag)
> | ^~~~~~~~~~~~~~~~~~~~
>
> Fix this by marking it with __maybe_unused (both cases for the sake of
> symmetry).
>
> See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
> inline functions for W=1 build").

Maybe something like this:

http://hansen.beer/~dave/intel/onelessifdef.patch

I assume the inlines were there to suppress the "unused" warnings in the
first place. So, let's just 'use' them unconditionally and leave it up
to the compiler to figure it out.