current GCC build report error: 'for' loop initial declarations are only
allowed in C99 or C11 mode, the patch fix this failure.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong....@intel.com>
---
 BaseTools/Source/C/GenFw/Elf32Convert.c | 3 ++-
 BaseTools/Source/C/GenFw/Elf64Convert.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c 
b/BaseTools/Source/C/GenFw/Elf32Convert.c
index d115291..8fca7fb 100644
--- a/BaseTools/Source/C/GenFw/Elf32Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -312,11 +312,12 @@ GetSymName (
   assert(Sym->st_name < StrtabShdr->sh_size);
 
   UINT8* StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;
 
   bool foundEnd = false;
-  for (UINT32 i = Sym->st_name; (i < StrtabShdr->sh_size) && !foundEnd; i++) {
+  UINT32 i;
+  for (i = Sym->st_name; (i < StrtabShdr->sh_size) && !foundEnd; i++) {
     foundEnd = StrtabContents[i] == 0;
   }
   assert(foundEnd);
 
   return StrtabContents + Sym->st_name;
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c 
b/BaseTools/Source/C/GenFw/Elf64Convert.c
index 3b5f630..024a2a0 100644
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -304,11 +304,12 @@ GetSymName (
   assert(Sym->st_name < StrtabShdr->sh_size);
 
   UINT8* StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;
 
   bool foundEnd = false;
-  for (UINT32 i = Sym->st_name; (i < StrtabShdr->sh_size) && !foundEnd; i++) {
+  UINT32 i;
+  for (i= Sym->st_name; (i < StrtabShdr->sh_size) && !foundEnd; i++) {
     foundEnd = StrtabContents[i] == 0;
   }
   assert(foundEnd);
 
   return StrtabContents + Sym->st_name;
-- 
2.6.1.windows.1

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

Reply via email to