[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] linux: Fix building with C23
From: |
Sergey Bugaev |
Subject: |
[PATCH 2/3] linux: Fix building with C23 |
Date: |
Tue, 10 Dec 2024 14:57:04 +0300 |
'true' and 'false' are keywords in C23. This will equally be an issue on
older standards if something pulls in stdbool.h, which make these into
macros. In either of these two cases, just typedef 'boolean' from
'bool' (avoiding the enum), and rely on 'true' and 'false' being valid
values of the type.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
---
Only compile-tested.
linux/src/drivers/scsi/BusLogic.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/linux/src/drivers/scsi/BusLogic.h
b/linux/src/drivers/scsi/BusLogic.h
index f60ee071..7b2644a6 100644
--- a/linux/src/drivers/scsi/BusLogic.h
+++ b/linux/src/drivers/scsi/BusLogic.h
@@ -311,8 +311,11 @@ BusLogic_BIOS_DiskGeometryTranslation_T;
/*
Define a Boolean data type.
*/
-
+#if defined(__bool_true_false_are_defined) || __STDC_VERSION__ > 201710L
+typedef bool boolean;
+#else
typedef enum { false, true } __attribute__ ((packed)) boolean;
+#endif
/*
--
2.47.1