File ovmf-ignore-spurious-GCC-12-warning.patch of Package tdvf

From 492f92f0675ead707b91f5b8a58c4dc4aa6c2fc0 Mon Sep 17 00:00:00 2001
From: Richard Lyu <richard.lyu@suse.com>
Date: Tue, 14 Jan 2025 14:56:35 +0800
Subject: [PATCH 2/2] ovmf ignore spurious GCC 12 warning

---
 BaseTools/Source/C/DevicePath/DevicePathUtilities.c | 4 ++++
 BaseTools/Source/C/GenFfs/GenFfs.c                  | 4 ++++
 BaseTools/Source/C/GenSec/GenSec.c                  | 4 ++++
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c     | 4 ++++
 4 files changed, 16 insertions(+)

diff --git a/BaseTools/Source/C/DevicePath/DevicePathUtilities.c b/BaseTools/Source/C/DevicePath/DevicePathUtilities.c
index 49078aac8c..f5f14541ed 100644
--- a/BaseTools/Source/C/DevicePath/DevicePathUtilities.c
+++ b/BaseTools/Source/C/DevicePath/DevicePathUtilities.c
@@ -16,6 +16,10 @@
 #include "UefiDevicePathLib.h"
 #include <Protocol/DevicePathUtilities.h>
 
+#if __GNUC__ >= 12
+#  pragma GCC diagnostic ignored "-Wstringop-overflow"
+#endif
+
 //
 // Template for an end-of-device path node.
 //
diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c
index 4c2e93e6f4..eb12a8cb8b 100644
--- a/BaseTools/Source/C/GenFfs/GenFfs.c
+++ b/BaseTools/Source/C/GenFfs/GenFfs.c
@@ -38,6 +38,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #define UTILITY_MAJOR_VERSION   0
 #define UTILITY_MINOR_VERSION   1
 
+#if __GNUC__ >= 12
+#  pragma GCC diagnostic ignored "-Wuse-after-free"
+#endif
+
 STATIC CHAR8 *mFfsFileType[] = {
   NULL,                                   // 0x00
   "EFI_FV_FILETYPE_RAW",                  // 0x01
diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c
index d9d2efeca7..09d05f1828 100644
--- a/BaseTools/Source/C/GenSec/GenSec.c
+++ b/BaseTools/Source/C/GenSec/GenSec.c
@@ -39,6 +39,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #define UTILITY_MAJOR_VERSION   0
 #define UTILITY_MINOR_VERSION   1
 
+#if __GNUC__ >= 12
+#  pragma GCC diagnostic ignored "-Wuse-after-free"
+#endif
+
 STATIC CHAR8      *mSectionTypeName[] = {
   NULL,                                 // 0x00 - reserved
   "EFI_SECTION_COMPRESSION",            // 0x01
diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
index 4b9f5fa692..0ffe42580f 100644
--- a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
+++ b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
@@ -40,6 +40,10 @@ static unsigned g_STAT_OFFSET = 0;
 
 #define REP_LEN_COUNT 64
 
+#if __GNUC__ >= 12
+#  pragma GCC diagnostic ignored "-Wdangling-pointer"
+#endif
+
 void LzmaEncProps_Init(CLzmaEncProps *p)
 {
   p->level = 5;
-- 
2.43.0

openSUSE Build Service is sponsored by