public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/3] BaseTools/Source/C: Fix VS2010/2012 build failure
@ 2017-03-06  5:10 Hao Wu
  2017-03-06  5:10 ` [PATCH 1/3] BaseTools/GenFw: Fix VS2010/VS2012 " Hao Wu
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Hao Wu @ 2017-03-06  5:10 UTC (permalink / raw)
  To: edk2-devel; +Cc: Hao Wu, Yonghong Zhu, Liming Gao

https://bugzilla.tianocore.org/show_bug.cgi?id=417

The series resolves the build failure for the VS2010/2012 build failure
for BaseTools GenFw, GenVtf & VolInfo source codes.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>

Hao Wu (3):
  BaseTools/GenFw: Fix VS2010/VS2012 build failure
  BaseTools/GenVtf: Fix VS2010/VS2012 build failure
  BaseTools/VolInfo: Fix VS2010/VS2012 build failure

 BaseTools/Source/C/GenFw/Elf32Convert.c | 17 ++++++++++-------
 BaseTools/Source/C/GenFw/Elf64Convert.c | 17 ++++++++++-------
 BaseTools/Source/C/GenVtf/GenVtf.c      |  6 ++++--
 BaseTools/Source/C/VolInfo/VolInfo.c    |  4 +++-
 4 files changed, 27 insertions(+), 17 deletions(-)

-- 
2.12.0.windows.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] BaseTools/GenFw: Fix VS2010/VS2012 build failure
  2017-03-06  5:10 [PATCH 0/3] BaseTools/Source/C: Fix VS2010/2012 build failure Hao Wu
@ 2017-03-06  5:10 ` Hao Wu
  2017-03-06  5:10 ` [PATCH 2/3] BaseTools/GenVtf: " Hao Wu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Hao Wu @ 2017-03-06  5:10 UTC (permalink / raw)
  To: edk2-devel; +Cc: Hao Wu, Yonghong Zhu, Liming Gao

https://bugzilla.tianocore.org/show_bug.cgi?id=417

The commit makes the following refinements in GenFw source codes to
avoid VS2010/VS2012 build failure:

1. Replaces the uses of 'bool' with 'BOOLEAN' for accordance, and remove
the header file dependency for '<stdbool.h>'.

2. Refines coding style for function 'GetSymName' to declare local
variables at the beginning of the function block.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 BaseTools/Source/C/GenFw/Elf32Convert.c | 17 ++++++++++-------
 BaseTools/Source/C/GenFw/Elf64Convert.c | 17 ++++++++++-------
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c
index f420bc89da..f7b084dc9b 100644
--- a/BaseTools/Source/C/GenFw/Elf32Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -1,7 +1,7 @@
 /** @file
 Elf32 Convert solution
 
-Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
 Portions copyright (c) 2013, ARM Ltd. All rights reserved.<BR>
 
 This program and the accompanying materials are licensed and made available
@@ -21,7 +21,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <io.h>
 #endif
 #include <assert.h>
-#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -304,23 +303,27 @@ GetSymName (
   Elf_Sym *Sym
   )
 {
+  Elf_Shdr *StrtabShdr;
+  UINT8    *StrtabContents;
+  BOOLEAN  foundEnd;
+  UINT32   i;
+
   if (Sym->st_name == 0) {
     return NULL;
   }
 
-  Elf_Shdr *StrtabShdr = FindStrtabShdr();
+  StrtabShdr = FindStrtabShdr();
   if (StrtabShdr == NULL) {
     return NULL;
   }
 
   assert(Sym->st_name < StrtabShdr->sh_size);
 
-  UINT8* StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;
+  StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;
 
-  bool foundEnd = false;
-  UINT32 i;
+  foundEnd = FALSE;
   for (i = Sym->st_name; (i < StrtabShdr->sh_size) && !foundEnd; i++) {
-    foundEnd = StrtabContents[i] == 0;
+    foundEnd = (BOOLEAN)(StrtabContents[i] == 0);
   }
   assert(foundEnd);
 
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c
index acf021667e..7eed7b92d3 100644
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -1,7 +1,7 @@
 /** @file
 Elf64 convert solution
 
-Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
 Portions copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>
 
 This program and the accompanying materials are licensed and made available
@@ -21,7 +21,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <io.h>
 #endif
 #include <assert.h>
-#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -296,23 +295,27 @@ GetSymName (
   Elf_Sym *Sym
   )
 {
+  Elf_Shdr *StrtabShdr;
+  UINT8    *StrtabContents;
+  BOOLEAN  foundEnd;
+  UINT32   i;
+
   if (Sym->st_name == 0) {
     return NULL;
   }
 
-  Elf_Shdr *StrtabShdr = FindStrtabShdr();
+  StrtabShdr = FindStrtabShdr();
   if (StrtabShdr == NULL) {
     return NULL;
   }
 
   assert(Sym->st_name < StrtabShdr->sh_size);
 
-  UINT8* StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;
+  StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;
 
-  bool foundEnd = false;
-  UINT32 i;
+  foundEnd = FALSE;
   for (i= Sym->st_name; (i < StrtabShdr->sh_size) && !foundEnd; i++) {
-    foundEnd = StrtabContents[i] == 0;
+    foundEnd = (BOOLEAN)(StrtabContents[i] == 0);
   }
   assert(foundEnd);
 
-- 
2.12.0.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] BaseTools/GenVtf: Fix VS2010/VS2012 build failure
  2017-03-06  5:10 [PATCH 0/3] BaseTools/Source/C: Fix VS2010/2012 build failure Hao Wu
  2017-03-06  5:10 ` [PATCH 1/3] BaseTools/GenFw: Fix VS2010/VS2012 " Hao Wu
@ 2017-03-06  5:10 ` Hao Wu
  2017-03-06  5:10 ` [PATCH 3/3] BaseTools/VolInfo: " Hao Wu
  2017-03-06  5:18 ` [PATCH 0/3] BaseTools/Source/C: Fix VS2010/2012 " Zhu, Yonghong
  3 siblings, 0 replies; 5+ messages in thread
From: Hao Wu @ 2017-03-06  5:10 UTC (permalink / raw)
  To: edk2-devel; +Cc: Hao Wu, Yonghong Zhu, Liming Gao

https://bugzilla.tianocore.org/show_bug.cgi?id=417

The commit makes the following refinements in GenVtf source codes to
avoid VS2010/VS2012 build failure:

1. Refines coding style to declare local variables at the beginning of a
code block in function 'main'.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 BaseTools/Source/C/GenVtf/GenVtf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/GenVtf/GenVtf.c b/BaseTools/Source/C/GenVtf/GenVtf.c
index ff0e7cfb2c..2ae9a7be2c 100644
--- a/BaseTools/Source/C/GenVtf/GenVtf.c
+++ b/BaseTools/Source/C/GenVtf/GenVtf.c
@@ -2703,10 +2703,12 @@ Returns:
     }
     SymFileName = VTF_SYM_FILE;
   } else {
-    assert (OutFileName1);
-    INTN OutFileNameLen = strlen(OutFileName1);
+    INTN OutFileNameLen;
     INTN NewIndex;
 
+    assert (OutFileName1);
+    OutFileNameLen = strlen(OutFileName1);
+
     for (NewIndex = OutFileNameLen; NewIndex > 0; --NewIndex) {
       if (OutFileName1[NewIndex] == '/' || OutFileName1[NewIndex] == '\\') {
         break;
-- 
2.12.0.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] BaseTools/VolInfo: Fix VS2010/VS2012 build failure
  2017-03-06  5:10 [PATCH 0/3] BaseTools/Source/C: Fix VS2010/2012 build failure Hao Wu
  2017-03-06  5:10 ` [PATCH 1/3] BaseTools/GenFw: Fix VS2010/VS2012 " Hao Wu
  2017-03-06  5:10 ` [PATCH 2/3] BaseTools/GenVtf: " Hao Wu
@ 2017-03-06  5:10 ` Hao Wu
  2017-03-06  5:18 ` [PATCH 0/3] BaseTools/Source/C: Fix VS2010/2012 " Zhu, Yonghong
  3 siblings, 0 replies; 5+ messages in thread
From: Hao Wu @ 2017-03-06  5:10 UTC (permalink / raw)
  To: edk2-devel; +Cc: Hao Wu, Yonghong Zhu, Liming Gao

https://bugzilla.tianocore.org/show_bug.cgi?id=417

The commit makes the following refinements in VolInfo source codes to
avoid VS2010/VS2012 build failure:

1. Refines coding style for function 'CombinePath' to declare local
variables at the beginning of the function block.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 BaseTools/Source/C/VolInfo/VolInfo.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index 2647cbb73a..eff5f9ebfc 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -1590,9 +1590,11 @@ CombinePath (
 )
 {
   UINT32 DefaultPathLen;
+  UINT64 Index;
+
   DefaultPathLen = strlen(DefaultPath);
   strcpy(NewPath, DefaultPath);
-  UINT64 Index = 0;
+  Index = 0;
   for (; Index < DefaultPathLen; Index ++) {
     if (NewPath[Index] == '\\' || NewPath[Index] == '/') {
       if (NewPath[Index + 1] != '\0') {
-- 
2.12.0.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] BaseTools/Source/C: Fix VS2010/2012 build failure
  2017-03-06  5:10 [PATCH 0/3] BaseTools/Source/C: Fix VS2010/2012 build failure Hao Wu
                   ` (2 preceding siblings ...)
  2017-03-06  5:10 ` [PATCH 3/3] BaseTools/VolInfo: " Hao Wu
@ 2017-03-06  5:18 ` Zhu, Yonghong
  3 siblings, 0 replies; 5+ messages in thread
From: Zhu, Yonghong @ 2017-03-06  5:18 UTC (permalink / raw)
  To: Wu, Hao A, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong

Looks good.

Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> 

Best Regards,
Zhu Yonghong

-----Original Message-----
From: Wu, Hao A 
Sent: Monday, March 6, 2017 1:11 PM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A <hao.a.wu@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [PATCH 0/3] BaseTools/Source/C: Fix VS2010/2012 build failure

https://bugzilla.tianocore.org/show_bug.cgi?id=417

The series resolves the build failure for the VS2010/2012 build failure for BaseTools GenFw, GenVtf & VolInfo source codes.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>

Hao Wu (3):
  BaseTools/GenFw: Fix VS2010/VS2012 build failure
  BaseTools/GenVtf: Fix VS2010/VS2012 build failure
  BaseTools/VolInfo: Fix VS2010/VS2012 build failure

 BaseTools/Source/C/GenFw/Elf32Convert.c | 17 ++++++++++-------  BaseTools/Source/C/GenFw/Elf64Convert.c | 17 ++++++++++-------
 BaseTools/Source/C/GenVtf/GenVtf.c      |  6 ++++--
 BaseTools/Source/C/VolInfo/VolInfo.c    |  4 +++-
 4 files changed, 27 insertions(+), 17 deletions(-)

--
2.12.0.windows.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-03-06  5:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-06  5:10 [PATCH 0/3] BaseTools/Source/C: Fix VS2010/2012 build failure Hao Wu
2017-03-06  5:10 ` [PATCH 1/3] BaseTools/GenFw: Fix VS2010/VS2012 " Hao Wu
2017-03-06  5:10 ` [PATCH 2/3] BaseTools/GenVtf: " Hao Wu
2017-03-06  5:10 ` [PATCH 3/3] BaseTools/VolInfo: " Hao Wu
2017-03-06  5:18 ` [PATCH 0/3] BaseTools/Source/C: Fix VS2010/2012 " Zhu, Yonghong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox