[PATCH] include: sbi: Don't unconditionally define '__always_inline'

Samuel Holland samuel.holland at sifive.com
Sun Sep 15 14:15:29 PDT 2024


On 2024-09-15 11:04 AM, Anup Patel wrote:
> From: Elyes Haouas <ehaouas at noos.fr>
> 
> Update __always_inline macro define to fix opensbi upstream
> build for coreboot.
> Refer, https://qa.coreboot.org/job/coreboot-gerrit/257449/testReport/junit/(root)/clang/EMULATION_QEMU_RISCV_RV64_/
> 
> Closes: https://github.com/riscv-software-src/opensbi/issues/366
> Signed-off-by: Elyes Haouas <ehaouas at noos.fr>
> Signed-off-by: Anup Patel <apatel at ventanamicro.com>
> ---
>  include/sbi/sbi_types.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/include/sbi/sbi_types.h b/include/sbi/sbi_types.h
> index def88bba..a9943d29 100644
> --- a/include/sbi/sbi_types.h
> +++ b/include/sbi/sbi_types.h
> @@ -69,7 +69,10 @@ typedef uint64_t		be64_t;
>  #define __packed		__attribute__((packed))
>  #define __noreturn		__attribute__((noreturn))
>  #define __aligned(x)		__attribute__((aligned(x)))
> +
> +#ifndef __always_inline
>  #define __always_inline	inline __attribute__((always_inline))
> +#endif

If we're concerned about an existing definition behaving differently, we could
unconditionally #undef __always_inline instead. But I expect any existing
definition to be equivalent, so:

Reviewed-by: Samuel Holland <samuel.holland at sifive.com>

>  
>  #define likely(x) __builtin_expect((x), 1)
>  #define unlikely(x) __builtin_expect((x), 0)




More information about the opensbi mailing list