diff mbox series

[for-4.13,5/6] xen/arm: mm: Mark check_memory_layout_alignment_constraints as unused

Message ID 20191002180047.17144-6-julien.grall@arm.com (mailing list archive)
State New, archived
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/mm.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>

I'd like something like "Note that the function is now marked as __init"
to the commit message, but in any case:

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/mm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
> index 9e0fdc39f9..be23acfe26 100644
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -190,7 +190,8 @@ unsigned long total_pages;
>  extern char __init_begin[], __init_end[];
>  
>  /* Checking VA memory layout alignment. */
> -static inline void check_memory_layout_alignment_constraints(void) {
> +static void __init __maybe_unused build_assertions(void)
> +{
>      /* 2MB aligned regions */
>      BUILD_BUG_ON(XEN_VIRT_START & ~SECOND_MASK);
>      BUILD_BUG_ON(FIXMAP_ADDR(0) & ~SECOND_MASK);
> -- 
> 2.11.0
>
Julien Grall Oct. 3, 2019, 10:41 a.m. UTC | #2
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>
> 
> I'd like something like "Note that the function is now marked as __init"
> to the commit message, but in any case:

This is already implied with "update it to match prototype of similar functions".

42sh> grep "build_assertions"

> 
> 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/mm.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
>> index 9e0fdc39f9..be23acfe26 100644
>> --- a/xen/arch/arm/mm.c
>> +++ b/xen/arch/arm/mm.c
>> @@ -190,7 +190,8 @@ unsigned long total_pages;
>>   extern char __init_begin[], __init_end[];
>>   
>>   /* Checking VA memory layout alignment. */
>> -static inline void check_memory_layout_alignment_constraints(void) {
>> +static void __init __maybe_unused build_assertions(void)
>> +{
>>       /* 2MB aligned regions */
>>       BUILD_BUG_ON(XEN_VIRT_START & ~SECOND_MASK);
>>       BUILD_BUG_ON(FIXMAP_ADDR(0) & ~SECOND_MASK);
>> -- 
>> 2.11.0
>>
diff mbox series

Patch

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 9e0fdc39f9..be23acfe26 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -190,7 +190,8 @@  unsigned long total_pages;
 extern char __init_begin[], __init_end[];
 
 /* Checking VA memory layout alignment. */
-static inline void check_memory_layout_alignment_constraints(void) {
+static void __init __maybe_unused build_assertions(void)
+{
     /* 2MB aligned regions */
     BUILD_BUG_ON(XEN_VIRT_START & ~SECOND_MASK);
     BUILD_BUG_ON(FIXMAP_ADDR(0) & ~SECOND_MASK);