From: "Kuo, Ted" <ted.kuo@intel.com>
To: devel@edk2.groups.io
Cc: Liming Gao <gaoliming@byosoft.com.cn>,
Bob Feng <bob.c.feng@intel.com>,
Yuwei Chen <yuwei.chen@intel.com>
Subject: [edk2-devel][PATCH][edk2-staging] BaseTools: Fix BaseTools compilation issues
Date: Fri, 5 Jul 2024 17:31:31 +0800 [thread overview]
Message-ID: <1287dcdf308fe882db0ed2d229f8ea28434b3707.1720171761.git.ted.kuo@intel.com> (raw)
https://bugzilla.tianocore.org/show_bug.cgi?id=4798
This patch removes unused variables that were causing compilation
errors when building EDK2/BaseTools with GCC with the compiler flag
Wunused-but-set-variable set.
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
---
BaseTools/Source/C/BfmLib/BfmLib.c | 26 --------------------------
BaseTools/Source/C/FMMT/FmmtLib.c | 26 --------------------------
2 files changed, 52 deletions(-)
diff --git a/BaseTools/Source/C/BfmLib/BfmLib.c b/BaseTools/Source/C/BfmLib/BfmLib.c
index c247cc8e1d..0893356b08 100644
--- a/BaseTools/Source/C/BfmLib/BfmLib.c
+++ b/BaseTools/Source/C/BfmLib/BfmLib.c
@@ -363,11 +363,9 @@ LibGetFvSize (
)
{
- UINTN BytesRead;
UINT32 Size;
EFI_FV_BLOCK_MAP_ENTRY BlockMap;
- BytesRead = 0;
Size = 0;
if (InputFile == NULL || FvSize == NULL) {
@@ -377,7 +375,6 @@ LibGetFvSize (
fseek (InputFile, sizeof (EFI_FIRMWARE_VOLUME_HEADER) - sizeof (EFI_FV_BLOCK_MAP_ENTRY), SEEK_CUR);
do {
fread (&BlockMap, sizeof (EFI_FV_BLOCK_MAP_ENTRY), 1, InputFile);
- BytesRead += sizeof (EFI_FV_BLOCK_MAP_ENTRY);
if (BlockMap.NumBlocks != 0) {
Size += BlockMap.NumBlocks * BlockMap.Length;
@@ -1032,7 +1029,6 @@ LibParseSection (
CHAR16 *UIName;
UINT32 UINameSize;
BOOLEAN HasDepexSection;
- UINT32 NumberOfSections;
BOOLEAN IsFfsGenerated;
ENCAP_INFO_DATA *LocalEncapData;
CHAR8 *BlankChar;
@@ -1058,7 +1054,6 @@ LibParseSection (
ParsedLength = 0;
ToolOutputLength = 0;
UINameSize = 0;
- NumberOfSections = 0;
UncompressedLength = 0;
CompressedLength = 0;
CompressionType = 0;
@@ -1116,7 +1111,6 @@ LibParseSection (
EncapDataNeedUpdata = TRUE;
Level ++;
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].IsLeaf = FALSE;
@@ -1171,7 +1165,6 @@ LibParseSection (
case EFI_SECTION_COMPRESSION:
Level ++;
- NumberOfSections ++;
EncapDataNeedUpdata = TRUE;
//
@@ -1317,7 +1310,6 @@ LibParseSection (
// a GUID defined FV section.
//
Level ++;
- NumberOfSections++;
EncapDataNeedUpdata = TRUE;
//
@@ -1583,7 +1575,6 @@ LibParseSection (
//Leaf sections
//
case EFI_SECTION_RAW:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
if (!ViewFlag) {
if (!IsFfsGenerated) {
@@ -1594,7 +1585,6 @@ LibParseSection (
break;
case EFI_SECTION_PE32:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
if (!ViewFlag) {
if (!IsFfsGenerated) {
@@ -1605,7 +1595,6 @@ LibParseSection (
break;
case EFI_SECTION_PIC:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
if (!ViewFlag) {
if (!IsFfsGenerated) {
@@ -1616,7 +1605,6 @@ LibParseSection (
break;
case EFI_SECTION_TE:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
if (!ViewFlag) {
if (!IsFfsGenerated) {
@@ -1627,7 +1615,6 @@ LibParseSection (
break;
case EFI_SECTION_COMPATIBILITY16:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
if (!ViewFlag) {
@@ -1639,7 +1626,6 @@ LibParseSection (
break;
case EFI_SECTION_FREEFORM_SUBTYPE_GUID:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
if (!ViewFlag) {
if (!IsFfsGenerated) {
@@ -1650,27 +1636,22 @@ LibParseSection (
break;
case EFI_SECTION_VERSION:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
break;
case EFI_SECTION_PEI_DEPEX:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
HasDepexSection = TRUE;
break;
case EFI_SECTION_DXE_DEPEX:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
HasDepexSection = TRUE;
break;
case EFI_SECTION_SMM_DEPEX:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
HasDepexSection = TRUE;
break;
case EFI_SECTION_USER_INTERFACE:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
UiSectionLength = FvBufExpand3ByteSize (((EFI_USER_INTERFACE_SECTION *) Ptr)->CommonHeader.Size);
@@ -1975,7 +1956,6 @@ LibGetFvInfo (
)
{
EFI_STATUS Status;
- UINTN NumberOfFiles;
BOOLEAN ErasePolarity;
UINTN FvSize;
EFI_FFS_FILE_HEADER2 *CurrentFile;
@@ -1983,7 +1963,6 @@ LibGetFvInfo (
ENCAP_INFO_DATA *LocalEncapData;
EFI_FIRMWARE_VOLUME_EXT_HEADER *ExtHdrPtr;
- NumberOfFiles = 0;
Key = 0;
LocalEncapData = NULL;
CurrentFile = NULL;
@@ -2147,11 +2126,6 @@ LibGetFvInfo (
while (CurrentFile != NULL) {
- //
- // Increment the number of files counter
- //
- NumberOfFiles++;
-
//
// Store FFS file Header information
//
diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c
index e1436112ca..20e3e1acfc 100644
--- a/BaseTools/Source/C/FMMT/FmmtLib.c
+++ b/BaseTools/Source/C/FMMT/FmmtLib.c
@@ -552,11 +552,9 @@ LibGetFvSize (
)
{
- UINTN BytesRead;
UINT32 Size;
EFI_FV_BLOCK_MAP_ENTRY BlockMap;
- BytesRead = 0;
Size = 0;
if (InputFile == NULL || FvSize == NULL) {
@@ -567,7 +565,6 @@ LibGetFvSize (
fseek (InputFile, sizeof (EFI_FIRMWARE_VOLUME_HEADER) - sizeof (EFI_FV_BLOCK_MAP_ENTRY), SEEK_CUR);
do {
fread (&BlockMap, sizeof (EFI_FV_BLOCK_MAP_ENTRY), 1, InputFile);
- BytesRead += sizeof (EFI_FV_BLOCK_MAP_ENTRY);
if (BlockMap.NumBlocks != 0) {
Size += BlockMap.NumBlocks * BlockMap.Length;
@@ -813,7 +810,6 @@ LibParseSection (
CHAR16 *UIName;
UINT32 UINameSize;
BOOLEAN HasDepexSection;
- UINT32 NumberOfSections;
ENCAP_INFO_DATA *LocalEncapData;
ENCAP_INFO_DATA *LocalEncapDataTemp;
CHAR8 *BlankChar;
@@ -846,7 +842,6 @@ LibParseSection (
ParsedLength = 0;
ToolOutputLength = 0;
UINameSize = 0;
- NumberOfSections = 0;
UncompressedLength = 0;
CompressedLength = 0;
CompressionType = 0;
@@ -910,7 +905,6 @@ LibParseSection (
HasUiSection = TRUE;
Level ++;
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].IsLeaf = FALSE;
CurrentFv->FfsAttuibutes[*FfsCount].IsFvStart = TRUE;
@@ -1021,7 +1015,6 @@ LibParseSection (
Level ++;
}
}
- NumberOfSections ++;
EncapDataNeedUpdata = TRUE;
HasUiSection = TRUE;
@@ -1211,7 +1204,6 @@ LibParseSection (
Level ++;
}
}
- NumberOfSections++;
EncapDataNeedUpdata = TRUE;
HasUiSection = TRUE;
//
@@ -1559,7 +1551,6 @@ LibParseSection (
//Leaf sections
//
case EFI_SECTION_RAW:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
if (!ViewFlag) {
if (!*IsFfsGenerated) {
@@ -1570,7 +1561,6 @@ LibParseSection (
break;
case EFI_SECTION_PE32:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
if (!ViewFlag) {
if (!*IsFfsGenerated) {
@@ -1581,7 +1571,6 @@ LibParseSection (
break;
case EFI_SECTION_PIC:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
if (!ViewFlag) {
if (!*IsFfsGenerated) {
@@ -1592,7 +1581,6 @@ LibParseSection (
break;
case EFI_SECTION_TE:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
if (!ViewFlag) {
if (!*IsFfsGenerated) {
@@ -1603,7 +1591,6 @@ LibParseSection (
break;
case EFI_SECTION_COMPATIBILITY16:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
if (!ViewFlag) {
if (!*IsFfsGenerated) {
@@ -1614,7 +1601,6 @@ LibParseSection (
break;
case EFI_SECTION_FREEFORM_SUBTYPE_GUID:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
if (!ViewFlag) {
if (!*IsFfsGenerated) {
@@ -1625,11 +1611,9 @@ LibParseSection (
break;
case EFI_SECTION_VERSION:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
break;
case EFI_SECTION_PEI_DEPEX:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
HasDepexSection = TRUE;
CurrentFv->FfsAttuibutes[*FfsCount].PeiDepex = malloc (SectionLength);
@@ -1637,7 +1621,6 @@ LibParseSection (
CurrentFv->FfsAttuibutes[*FfsCount].PeiDepexLen = SectionLength;
break;
case EFI_SECTION_DXE_DEPEX:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
HasDepexSection = TRUE;
CurrentFv->FfsAttuibutes[*FfsCount].DxeDepex = malloc (SectionLength);
@@ -1645,7 +1628,6 @@ LibParseSection (
CurrentFv->FfsAttuibutes[*FfsCount].DxeDepexLen = SectionLength;
break;
case EFI_SECTION_SMM_DEPEX:
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
HasDepexSection = TRUE;
CurrentFv->FfsAttuibutes[*FfsCount].SmmDepex = malloc (SectionLength);
@@ -1655,7 +1637,6 @@ LibParseSection (
case EFI_SECTION_USER_INTERFACE:
HasUiSection = TRUE;
- NumberOfSections ++;
CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
UiSectionLength = GetLength (((EFI_USER_INTERFACE_SECTION *) Ptr)->CommonHeader.Size);
@@ -2186,7 +2167,6 @@ LibGetFvInfo (
)
{
EFI_STATUS Status;
- UINTN NumberOfFiles;
BOOLEAN ErasePolarity;
UINTN FvSize;
EFI_FFS_FILE_HEADER2 *CurrentFile;
@@ -2196,7 +2176,6 @@ LibGetFvInfo (
EFI_FIRMWARE_VOLUME_HEADER *FvHdr;
UINT8 PreFvId;
- NumberOfFiles = 0;
Key = 0;
LocalEncapData = NULL;
CurrentFile = NULL;
@@ -2382,11 +2361,6 @@ LibGetFvInfo (
while (CurrentFile != NULL) {
- //
- // Increment the number of files counter
- //
- NumberOfFiles++;
-
//
// Store FFS file Header information
//
--
2.40.1.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#119802): https://edk2.groups.io/g/devel/message/119802
Mute This Topic: https://groups.io/mt/107051142/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next reply other threads:[~2024-07-05 9:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-05 9:31 Kuo, Ted [this message]
2024-07-12 5:14 ` [edk2-devel][PATCH][edk2-staging] BaseTools: Fix BaseTools compilation issues Yuwei Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1287dcdf308fe882db0ed2d229f8ea28434b3707.1720171761.git.ted.kuo@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox