* [PATCH 1/2] tools: sepdebugcrcfix: fix build with c23
@ 2024-08-30 23:42 Sam James
2024-08-30 23:42 ` [PATCH 2/2] tools: sepdebugcrcfix: sort includes Sam James
0 siblings, 1 reply; 2+ messages in thread
From: Sam James @ 2024-08-30 23:42 UTC (permalink / raw)
To: debugedit; +Cc: Sam James
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/2] tools: sepdebugcrcfix: sort includes
2024-08-30 23:42 [PATCH 1/2] tools: sepdebugcrcfix: fix build with c23 Sam James
@ 2024-08-30 23:42 ` Sam James
0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2024-08-30 23:42 UTC (permalink / raw)
To: debugedit; +Cc: Sam James
---
tools/sepdebugcrcfix.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/tools/sepdebugcrcfix.c b/tools/sepdebugcrcfix.c
index b505019..4516267 100644
--- a/tools/sepdebugcrcfix.c
+++ b/tools/sepdebugcrcfix.c
@@ -19,20 +19,20 @@
#include "config.h"
#endif
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/mman.h>
#include <endian.h>
+#include <errno.h>
+#include <error.h>
+#include <fcntl.h>
+#include <gelf.h>
+#include <libelf.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
-#include <error.h>
-#include <libelf.h>
-#include <gelf.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
#ifndef _
#define _(x) x
--
2.46.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-30 23:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-30 23:42 [PATCH 1/2] tools: sepdebugcrcfix: fix build with c23 Sam James
2024-08-30 23:42 ` [PATCH 2/2] tools: sepdebugcrcfix: sort includes Sam James
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).