From ce6c3c56f0788d2caf44b7e6935002c32c01aedc Mon Sep 17 00:00:00 2001 From: Stefan Jumarea Date: Mon, 23 Sep 2024 15:14:27 +0300 Subject: [PATCH] include/uk/arch: Define bool types for C++ compilers If compiling using a C++ compiler, `_Bool` is undefined, as it is a C built-in type and C++ compilers do not recognize it. Define `__bool`, `__true` and `__false` for C++ compiler as `bool`, `true` and `false`. Checkpatch-Ignore: REPEATED_WORD Github-Fixes: #1513 Signed-off-by: Stefan Jumarea Reviewed-by: Razvan Deaconescu Reviewed-by: Maria Pana Reviewed-by: Michalis Pappas Approved-by: Simon Kuenzer GitHub-Closes: #1500 --- include/uk/arch/types.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/uk/arch/types.h b/include/uk/arch/types.h index b43dffabb..e0bd80c6c 100644 --- a/include/uk/arch/types.h +++ b/include/uk/arch/types.h @@ -257,9 +257,15 @@ typedef struct { __u32 counter; } __atomic; +#ifdef __cplusplus +typedef bool __bool; +#define __true (true) +#define __false (false) +#else typedef _Bool __bool; #define __true (1) #define __false (0) +#endif /* __cplusplus */ #else /* __ASSEMBLY__ */ -- 2.39.5