mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-10 08:14:09 -09:00
boot/at91bootstrap3: fix build with host GCC 15
Building at91bootstrap3 with GCC 15 fails with:
include/types.h:23:23: error: ‘bool’ cannot be defined via ‘typedef’
23 | typedef unsigned char bool;
| ^~~~
include/types.h:23:23: note: ‘bool’ is a keyword with ‘-std=c23’ onwards
This is due to GCC 15 defaulting to the C23 language dialect.
Signed-off-by: Edgar Bonet <bonet@grenoble.cnrs.fr>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
(cherry picked from commit 500678593f)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
committed by
Thomas Perale
parent
869270f6ba
commit
9b2aa912c0
@@ -0,0 +1,47 @@
|
||||
From 908c65678867565a934ea5a967bfe7e204d1ccaf Mon Sep 17 00:00:00 2001
|
||||
From: Edgar Bonet <bonet@grenoble.cnrs.fr>
|
||||
Date: Wed, 25 Jun 2025 11:13:43 +0200
|
||||
Subject: [PATCH] include/types.h: conditionally define bool, false and true
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
include/types.h typedefs ‘bool’ and macro-defines ‘false’ and ‘true’.
|
||||
However, since C23, these are predefine keywords. As C23 is the default
|
||||
C dialect for GCC 15, building with this compiler fails with:
|
||||
|
||||
include/types.h:23:23: error: ‘bool’ cannot be defined via ‘typedef’
|
||||
23 | typedef unsigned char bool;
|
||||
| ^~~~
|
||||
include/types.h:23:23: note: ‘bool’ is a keyword with ‘-std=c23’ onwards
|
||||
|
||||
Fix this build failure by only defining ‘bool’, ‘false’ and ‘true’ on C
|
||||
dialects older than C23.
|
||||
|
||||
Upstream: https://github.com/linux4sam/at91bootstrap/pull/188
|
||||
[Edgar: backport to v3.10.3]
|
||||
|
||||
Signed-off-by: Edgar Bonet <bonet@grenoble.cnrs.fr>
|
||||
---
|
||||
include/types.h | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/include/types.h b/include/types.h
|
||||
index 1246a4df..2c1a41cf 100644
|
||||
--- a/include/types.h
|
||||
+++ b/include/types.h
|
||||
@@ -42,8 +42,11 @@ typedef signed long long s64;
|
||||
typedef unsigned long size_t;
|
||||
typedef signed long ssize_t;
|
||||
|
||||
+/* bool, false and true are predefined since C23. */
|
||||
+#if __STDC_VERSION__ < 202311L
|
||||
typedef unsigned char bool;
|
||||
#define false 0U
|
||||
#define true 1U
|
||||
+#endif
|
||||
|
||||
#endif /* TYPES_H_ */
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
From 4aab60e634d588dffbd3154fd0cfce78272b750a Mon Sep 17 00:00:00 2001
|
||||
From: Edgar Bonet <bonet@grenoble.cnrs.fr>
|
||||
Date: Wed, 25 Jun 2025 11:13:43 +0200
|
||||
Subject: [PATCH] include/types.h: conditionally define bool, false and true
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
include/types.h typedefs ‘bool’ and macro-defines ‘false’ and ‘true’.
|
||||
However, since C23, these are predefine keywords. As C23 is the default
|
||||
C dialect for GCC 15, building with this compiler fails with:
|
||||
|
||||
include/types.h:23:23: error: ‘bool’ cannot be defined via ‘typedef’
|
||||
23 | typedef unsigned char bool;
|
||||
| ^~~~
|
||||
include/types.h:23:23: note: ‘bool’ is a keyword with ‘-std=c23’ onwards
|
||||
|
||||
Fix this build failure by only defining ‘bool’, ‘false’ and ‘true’ on C
|
||||
dialects older than C23.
|
||||
|
||||
Upstream: https://github.com/linux4sam/at91bootstrap/pull/188
|
||||
|
||||
Signed-off-by: Edgar Bonet <bonet@grenoble.cnrs.fr>
|
||||
---
|
||||
include/types.h | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/include/types.h b/include/types.h
|
||||
index 950b1a46..0ad9ae61 100644
|
||||
--- a/include/types.h
|
||||
+++ b/include/types.h
|
||||
@@ -20,8 +20,11 @@ typedef signed long long s64;
|
||||
typedef unsigned long size_t;
|
||||
typedef signed long ssize_t;
|
||||
|
||||
+/* bool, false and true are predefined since C23. */
|
||||
+#if __STDC_VERSION__ < 202311L
|
||||
typedef unsigned char bool;
|
||||
#define false 0U
|
||||
#define true 1U
|
||||
+#endif
|
||||
|
||||
#endif /* TYPES_H_ */
|
||||
--
|
||||
2.43.0
|
||||
|
||||
Reference in New Issue
Block a user