From d539d64a23bbd64ba324eed595449bcc9c7be0cb Mon Sep 17 00:00:00 2001 From: Michael Neuling Date: Sat, 21 Dec 2024 21:38:50 +0530 Subject: [PATCH] include: sbi: Fix compiling with C23 enabled compilers C23 pre-defines bool so we need to gate our defines. Signed-off-by: Michael Neuling Reviewed-by: Anup Patel --- include/sbi/sbi_types.h | 10 ++++++---- platform/generic/andes/andes_sbi.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/sbi/sbi_types.h b/include/sbi/sbi_types.h index a9943d29..90b0d458 100644 --- a/include/sbi/sbi_types.h +++ b/include/sbi/sbi_types.h @@ -44,7 +44,12 @@ typedef unsigned long long uint64_t; #error "Unexpected __riscv_xlen" #endif -typedef int bool; +#if __STDC_VERSION__ < 202000L +typedef _Bool bool; +#define true 1 +#define false 0 +#endif + typedef unsigned long ulong; typedef unsigned long uintptr_t; typedef unsigned long size_t; @@ -61,9 +66,6 @@ typedef uint32_t be32_t; typedef uint64_t le64_t; typedef uint64_t be64_t; -#define true 1 -#define false 0 - #define NULL ((void *)0) #define __packed __attribute__((packed)) diff --git a/platform/generic/andes/andes_sbi.c b/platform/generic/andes/andes_sbi.c index 01a3c1ac..c3ea7f87 100644 --- a/platform/generic/andes/andes_sbi.c +++ b/platform/generic/andes/andes_sbi.c @@ -33,7 +33,7 @@ static bool andes_iocp_disabled(void) static bool andes_apply_iocp_sw_workaround(void) { - return andes_cache_controllable() & andes_iocp_disabled(); + return andes_cache_controllable() && andes_iocp_disabled(); } int andes_sbi_vendor_ext_provider(long funcid,