[edk2] [PATCH] BaseTools: Fix GCC build PcdValueCommon.c bug

Feng, YunhuaX posted 1 patch 6 years, 9 months ago
Failed in applying to current master (apply log)
BaseTools/Source/C/Common/PcdValueCommon.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[edk2] [PATCH] BaseTools: Fix GCC build PcdValueCommon.c bug
Posted by Feng, YunhuaX 6 years, 9 months ago
error message:
PcdValueCommon.c: In function '__PcdGetPtr':
PcdValueCommon.c:315:11: error: variable 'Byte' 
set but not used [-Werror=unused-but-set-variable]
   UINT8   Byte;
           ^
cc1: all warnings being treated as errors

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1

Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
 BaseTools/Source/C/Common/PcdValueCommon.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/Common/PcdValueCommon.c b/BaseTools/Source/C/Common/PcdValueCommon.c
index 210f87b8b5..fa12869eda 100644
--- a/BaseTools/Source/C/Common/PcdValueCommon.c
+++ b/BaseTools/Source/C/Common/PcdValueCommon.c
@@ -310,11 +310,10 @@ Returns:
 {
   int    Index;
   CHAR8   *Value;
   UINT8   *Buffer;
   CHAR8   *End;
-  UINT8   Byte;
 
   Index = LookupPcdIndex (SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
   if (Index < 0) {
     fprintf (stderr, "PCD %s.%s.%s.%s is not in database\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
     exit (EXIT_FAILURE);
@@ -328,11 +327,11 @@ Returns:
     fprintf (stderr, "PCD %s.%s.%s.%s is a value.  Use PcdGet()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
     exit (EXIT_FAILURE);
     break;
   case PcdDataTypePointer:
     Value = &PcdList[Index].Value[1];
-    for (*Size = 0, Byte = (UINT8) strtoul(Value, &End, 16); Value != End; Byte = (UINT8) strtoul(Value, &End, 16), *Size = *Size + 1) {
+    for (*Size = 0, strtoul(Value, &End, 16); Value != End; strtoul(Value, &End, 16), *Size = *Size + 1) {
       Value = End + 1;
     }
     Buffer = malloc(*Size + 1);
     if (Buffer == NULL) {
       *Size = 0;
-- 
2.12.2.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] BaseTools: Fix GCC build PcdValueCommon.c bug
Posted by Zhu, Yonghong 6 years, 9 months ago
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> 

Best Regards,
Zhu Yonghong

-----Original Message-----
From: Feng, YunhuaX 
Sent: Friday, February 02, 2018 10:34 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [PATCH] BaseTools: Fix GCC build PcdValueCommon.c bug

error message:
PcdValueCommon.c: In function '__PcdGetPtr':
PcdValueCommon.c:315:11: error: variable 'Byte' 
set but not used [-Werror=unused-but-set-variable]
   UINT8   Byte;
           ^
cc1: all warnings being treated as errors

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1

Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
 BaseTools/Source/C/Common/PcdValueCommon.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/Common/PcdValueCommon.c b/BaseTools/Source/C/Common/PcdValueCommon.c
index 210f87b8b5..fa12869eda 100644
--- a/BaseTools/Source/C/Common/PcdValueCommon.c
+++ b/BaseTools/Source/C/Common/PcdValueCommon.c
@@ -310,11 +310,10 @@ Returns:
 {
   int    Index;
   CHAR8   *Value;
   UINT8   *Buffer;
   CHAR8   *End;
-  UINT8   Byte;
 
   Index = LookupPcdIndex (SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
   if (Index < 0) {
     fprintf (stderr, "PCD %s.%s.%s.%s is not in database\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
     exit (EXIT_FAILURE);
@@ -328,11 +327,11 @@ Returns:
     fprintf (stderr, "PCD %s.%s.%s.%s is a value.  Use PcdGet()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
     exit (EXIT_FAILURE);
     break;
   case PcdDataTypePointer:
     Value = &PcdList[Index].Value[1];
-    for (*Size = 0, Byte = (UINT8) strtoul(Value, &End, 16); Value != End; Byte = (UINT8) strtoul(Value, &End, 16), *Size = *Size + 1) {
+    for (*Size = 0, strtoul(Value, &End, 16); Value != End; strtoul(Value, &End, 16), *Size = *Size + 1) {
       Value = End + 1;
     }
     Buffer = malloc(*Size + 1);
     if (Buffer == NULL) {
       *Size = 0;
-- 
2.12.2.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel