Re: [edk2-devel] [PATCH 1/1] ShellPkg/UefiShellAcpiViewCommandLib: Initialize local variables

2019-08-15 Thread Gao, Zhichao
Reviewed-by: Zhichao Gao 

Thanks,
Zhichao

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Zhang, Shenglei
> Sent: Thursday, August 15, 2019 1:42 PM
> To: devel@edk2.groups.io
> Cc: Carsey, Jaben ; Ni, Ray ;
> Gao, Zhichao 
> Subject: [edk2-devel] [PATCH 1/1] ShellPkg/UefiShellAcpiViewCommandLib:
> Initialize local variables
> 
> At latest edk2 version, there is build failure when building ShellPkg with
> VS2012x86, which results from uninitialized local variables.
> 
> Cc: Jaben Carsey 
> Cc: Ray Ni 
> Cc: Zhichao Gao 
> Signed-off-by: Shenglei Zhang 
> ---
>  .../Library/UefiShellAcpiViewCommandLib/AcpiParser.c   |  8 
>  .../Library/UefiShellAcpiViewCommandLib/AcpiView.c | 10 ++
>  2 files changed, 18 insertions(+)
> 
> diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
> index 2d6ff80e299e..94bafa22ef4c 100644
> --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
> +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
> @@ -121,6 +121,10 @@ VerifyChecksum (
>UINT8 Checksum;
>UINTN OriginalAttribute;
> 
> +  //
> +  // set local variables to suppress incorrect compiler/analyzer
> + warnings  //  OriginalAttribute = 0;
>ByteCount = 0;
>Checksum = 0;
> 
> @@ -472,6 +476,10 @@ ParseAcpi (
>BOOLEAN HighLight;
>UINTN   OriginalAttribute;
> 
> +  //
> +  // set local variables to suppress incorrect compiler/analyzer
> + warnings  //  OriginalAttribute = 0;
>Offset = 0;
> 
>// Increment the Indent
> diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
> index 9feb2df2078f..de0851dd5fba 100644
> --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
> +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
> @@ -211,6 +211,10 @@ ProcessTableReportOptions (
>BOOLEAN Log;
>BOOLEAN HighLight;
> 
> +  //
> +  // set local variables to suppress incorrect compiler/analyzer
> + warnings  //  OriginalAttribute = 0;
>SignaturePtr = (UINT8*)(UINTN)
>Log = FALSE;
>HighLight = GetColourHighlighting (); @@ -347,6 +351,12 @@ AcpiView (
>PARSE_ACPI_TABLE_PROCRsdpParserProc;
>BOOLEAN  Trace;
> 
> +  //
> +  // set local variables to suppress incorrect compiler/analyzer
> + warnings  //  EfiConfigurationTable = NULL;  OriginalAttribute = 0;
> +
>// Search the table for an entry that matches the ACPI Table Guid
>FoundAcpiTable = FALSE;
>for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) {
> --
> 2.18.0.windows.1
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#45785): https://edk2.groups.io/g/devel/message/45785
Mute This Topic: https://groups.io/mt/32883914/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 1/1] ShellPkg/UefiShellAcpiViewCommandLib: Initialize local variables

2019-08-14 Thread Zhang, Shenglei
At latest edk2 version, there is build failure when building ShellPkg
with VS2012x86, which results from uninitialized local variables.

Cc: Jaben Carsey 
Cc: Ray Ni 
Cc: Zhichao Gao 
Signed-off-by: Shenglei Zhang 
---
 .../Library/UefiShellAcpiViewCommandLib/AcpiParser.c   |  8 
 .../Library/UefiShellAcpiViewCommandLib/AcpiView.c | 10 ++
 2 files changed, 18 insertions(+)

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
index 2d6ff80e299e..94bafa22ef4c 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
@@ -121,6 +121,10 @@ VerifyChecksum (
   UINT8 Checksum;
   UINTN OriginalAttribute;
 
+  //
+  // set local variables to suppress incorrect compiler/analyzer warnings
+  //
+  OriginalAttribute = 0;
   ByteCount = 0;
   Checksum = 0;
 
@@ -472,6 +476,10 @@ ParseAcpi (
   BOOLEAN HighLight;
   UINTN   OriginalAttribute;
 
+  //
+  // set local variables to suppress incorrect compiler/analyzer warnings
+  //
+  OriginalAttribute = 0;
   Offset = 0;
 
   // Increment the Indent
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
index 9feb2df2078f..de0851dd5fba 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
@@ -211,6 +211,10 @@ ProcessTableReportOptions (
   BOOLEAN Log;
   BOOLEAN HighLight;
 
+  //
+  // set local variables to suppress incorrect compiler/analyzer warnings
+  //
+  OriginalAttribute = 0;
   SignaturePtr = (UINT8*)(UINTN)
   Log = FALSE;
   HighLight = GetColourHighlighting ();
@@ -347,6 +351,12 @@ AcpiView (
   PARSE_ACPI_TABLE_PROCRsdpParserProc;
   BOOLEAN  Trace;
 
+  //
+  // set local variables to suppress incorrect compiler/analyzer warnings
+  //
+  EfiConfigurationTable = NULL;
+  OriginalAttribute = 0;
+
   // Search the table for an entry that matches the ACPI Table Guid
   FoundAcpiTable = FALSE;
   for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) {
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#45686): https://edk2.groups.io/g/devel/message/45686
Mute This Topic: https://groups.io/mt/32883914/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-