[PATCH 1/2] tools: sepdebugcrcfix: fix build with c23
Sam James
sam@gentoo.org
Fri Aug 30 23:42:42 GMT 2024
Avoid redefining bool:
```
CC tools/sepdebugcrcfix-sepdebugcrcfix.o
tools/sepdebugcrcfix.c:47:13: error: two or more data types in declaration specifiers
47 | typedef int bool;
| ^~~~
tools/sepdebugcrcfix.c:47:1: warning: useless type name in empty declaration
47 | typedef int bool;
| ^~~~~~~
tools/sepdebugcrcfix.c:48:19: error: expected identifier or ‘(’ before ‘false’
48 | static const bool false = 0, true = 1;
| ^~~~~
```
While here, include `<stdbool.h>` for older C standards than C23.
---
tools/sepdebugcrcfix.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tools/sepdebugcrcfix.c b/tools/sepdebugcrcfix.c
index 7464f6a..b505019 100644
--- a/tools/sepdebugcrcfix.c
+++ b/tools/sepdebugcrcfix.c
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <sys/mman.h>
#include <endian.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <error.h>
@@ -44,9 +45,6 @@
static_assert (sizeof (unsigned long) >= sizeof (uint32_t));
-typedef int bool;
-static const bool false = 0, true = 1;
-
/* This is bfd_calc_gnu_debuglink_crc32 from bfd/opncls.c. */
static unsigned long
calc_gnu_debuglink_crc32 (unsigned long crc,
--
2.46.0
More information about the Debugedit
mailing list