diff mbox series

[Xen-devel,for-4.13,6/6] xen/arm: traps: Mark check_stack_alignment_constraints as unused

Message ID 20191002180047.17144-7-julien.grall@arm.com
State New
Headers show
Series xen/arm: Add support to build with clang | expand

Commit Message

Julien Grall Oct. 2, 2019, 6 p.m. UTC
Clang will throw an error if a function is unused unless you tell
to ignore it. This can be done using __maybe_unused.

While modifying the declaration, update it to match prototype of similar
functions (see build_assertions). This helps to understand that the sole
purpose of the function is to hold BUILD_BUG_ON().

Signed-off-by: Julien Grall <julien.grall@arm.com>

---
    Changes in v2:
        - Update the prototype to match style of other functions holding
        on build assertions.
---
 xen/arch/arm/traps.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Stefano Stabellini Oct. 2, 2019, 10:26 p.m. UTC | #1
On Wed, 2 Oct 2019, Julien Grall wrote:
> Clang will throw an error if a function is unused unless you tell
> to ignore it. This can be done using __maybe_unused.
> 
> While modifying the declaration, update it to match prototype of similar
> functions (see build_assertions). This helps to understand that the sole
> purpose of the function is to hold BUILD_BUG_ON().
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Same small note about build_assertions becoming __init.

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>     Changes in v2:
>         - Update the prototype to match style of other functions holding
>         on build assertions.
> ---
>  xen/arch/arm/traps.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
> index a3b961bd06..a3deb59372 100644
> --- a/xen/arch/arm/traps.c
> +++ b/xen/arch/arm/traps.c
> @@ -54,7 +54,8 @@
>   * that both the kernel half of struct cpu_user_regs (which is pushed in
>   * entry.S) and struct cpu_info (which lives at the bottom of a Xen
>   * stack) must be doubleword-aligned in size.  */
> -static inline void check_stack_alignment_constraints(void) {
> +static void __init __maybe_unused build_assertions(void)
> +{
>  #ifdef CONFIG_ARM_64
>      BUILD_BUG_ON((sizeof (struct cpu_user_regs)) & 0xf);
>      BUILD_BUG_ON((offsetof(struct cpu_user_regs, spsr_el1)) & 0xf);
> -- 
> 2.11.0
>
Julien Grall Oct. 3, 2019, 10:44 a.m. UTC | #2
Hi Stefano,

On 02/10/2019 23:26, Stefano Stabellini wrote:
> On Wed, 2 Oct 2019, Julien Grall wrote:
>> Clang will throw an error if a function is unused unless you tell
>> to ignore it. This can be done using __maybe_unused.
>>
>> While modifying the declaration, update it to match prototype of similar
>> functions (see build_assertions). This helps to understand that the sole
>> purpose of the function is to hold BUILD_BUG_ON().
>>
>> Signed-off-by: Julien Grall <julien.grall@arm.com>
> 
> Same small note about build_assertions becoming __init.

Similar to the previous version this is already implied by "update it to match 
prototype of similar functions".

Cheers,
diff mbox series

Patch

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index a3b961bd06..a3deb59372 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -54,7 +54,8 @@ 
  * that both the kernel half of struct cpu_user_regs (which is pushed in
  * entry.S) and struct cpu_info (which lives at the bottom of a Xen
  * stack) must be doubleword-aligned in size.  */
-static inline void check_stack_alignment_constraints(void) {
+static void __init __maybe_unused build_assertions(void)
+{
 #ifdef CONFIG_ARM_64
     BUILD_BUG_ON((sizeof (struct cpu_user_regs)) & 0xf);
     BUILD_BUG_ON((offsetof(struct cpu_user_regs, spsr_el1)) & 0xf);