From 506f47f9fa18224a0e6a642aff712d2547d61139 Mon Sep 17 00:00:00 2001 From: Chao Wei Date: Wed, 30 Jul 2025 10:12:31 +0800 Subject: [PATCH] fixbug, syntax error on gcc15 Signed-off-by: Chao Wei --- include/sbi/sbi_types.h | 7 ++++--- include/sbi_utils/serial/semihosting.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/sbi/sbi_types.h b/include/sbi/sbi_types.h index def88bba..cba787b2 100644 --- a/include/sbi/sbi_types.h +++ b/include/sbi/sbi_types.h @@ -44,7 +44,11 @@ typedef unsigned long long uint64_t; #error "Unexpected __riscv_xlen" #endif +#if __STDC_VERSION__ < 202000L typedef int bool; +#define true 1 +#define false 0 +#endif typedef unsigned long ulong; typedef unsigned long uintptr_t; typedef unsigned long size_t; @@ -61,9 +65,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/include/sbi_utils/serial/semihosting.h b/include/sbi_utils/serial/semihosting.h index 8cc4a86c..5297cb07 100644 --- a/include/sbi_utils/serial/semihosting.h +++ b/include/sbi_utils/serial/semihosting.h @@ -38,7 +38,7 @@ enum semihosting_open_mode { #ifdef CONFIG_SERIAL_SEMIHOSTING int semihosting_init(void); -int semihosting_enabled(void); +bool semihosting_enabled(void); #else static inline int semihosting_init(void) { return SBI_ENODEV; } static inline int semihosting_enabled(void) { return 0; }