]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
ovmf: Don't define bool type if building in C23 mode
authorMingli Yu <mingli.yu@windriver.com>
Fri, 1 Aug 2025 10:29:12 +0000 (18:29 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 7 Aug 2025 09:43:42 +0000 (10:43 +0100)
Backport a patch [1] to fix the below build failure:
 /buildarea/tmp/work/corei7-64-wrs-linux/ovmf/edk2-stable202502/sources/ovmf-edk2-stable202502/SecurityPkg/DeviceSecurity/SpdmLib/Include/hal/LibspdmStdBoolAlt.h:13:17: error: two or more data types in declaration specifiers
 13 | typedef BOOLEAN bool;
 | ^~~~
  /buildarea/tmp/work/corei7-64-wrs-linux/ovmf/edk2-stable202502/sources/ovmf-edk2-stable202502/SecurityPkg/DeviceSecurity/SpdmLib/Include/hal/LibspdmStdBoolAlt.h:13:1: error: useless type name in empty declaration [-Werror]
  13 | typedef BOOLEAN bool;

[1] https://github.com/tianocore/edk2/commit/772fa11ac82579a8f6fa171e6b835f68af3f64be

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/ovmf/ovmf/0001-SecurityPkg-Don-t-define-bool-type-if-building-in-C2.patch [new file with mode: 0644]
meta/recipes-core/ovmf/ovmf_git.bb

diff --git a/meta/recipes-core/ovmf/ovmf/0001-SecurityPkg-Don-t-define-bool-type-if-building-in-C2.patch b/meta/recipes-core/ovmf/ovmf/0001-SecurityPkg-Don-t-define-bool-type-if-building-in-C2.patch
new file mode 100644 (file)
index 0000000..a555070
--- /dev/null
@@ -0,0 +1,35 @@
+From 772fa11ac82579a8f6fa171e6b835f68af3f64be Mon Sep 17 00:00:00 2001
+From: Rebecca Cran <rebecca@bsdio.com>
+Date: Mon, 26 May 2025 08:01:39 -0600
+Subject: [PATCH] SecurityPkg: Don't define bool type if building in C23 mode
+
+In C23 bool is a built-in type, so it's not necessary to typedef
+bool in LibspdmStdBoolAlt.h.
+
+Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
+
+Upstream-Status: Backport [https://github.com/tianocore/edk2/commit/772fa11ac82579a8f6fa171e6b835f68af3f64be]
+
+Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
+---
+ .../DeviceSecurity/SpdmLib/Include/hal/LibspdmStdBoolAlt.h     | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/SecurityPkg/DeviceSecurity/SpdmLib/Include/hal/LibspdmStdBoolAlt.h b/SecurityPkg/DeviceSecurity/SpdmLib/Include/hal/LibspdmStdBoolAlt.h
+index 08af7296d0..395ef22d43 100644
+--- a/SecurityPkg/DeviceSecurity/SpdmLib/Include/hal/LibspdmStdBoolAlt.h
++++ b/SecurityPkg/DeviceSecurity/SpdmLib/Include/hal/LibspdmStdBoolAlt.h
+@@ -10,7 +10,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
+ #ifndef LIBSPDM_STDBOOL_ALT_H\r
+ #define LIBSPDM_STDBOOL_ALT_H\r
\r
++// In C23, bool is a built-in type\r
++#if __STDC_VERSION__ < 202311L\r
+ typedef BOOLEAN bool;\r
++#endif\r
\r
+ #ifndef true\r
+ #define true  TRUE\r
+-- 
+2.34.1
+
index 08879966c34b6b11228783b4d3ed5927b3d7a1be..a8efcc2a4625d1be89a1c2e0cdfb8374a4fd0e86 100644 (file)
@@ -30,6 +30,7 @@ SRC_URI = "gitsm://github.com/tianocore/edk2.git;branch=master;protocol=https \
            file://CVE-2024-38797-2.patch \
            file://CVE-2024-38797-3.patch \
            file://CVE-2024-38797-4.patch \
+           file://0001-SecurityPkg-Don-t-define-bool-type-if-building-in-C2.patch \
            "
 
 PV = "edk2-stable202502"