ShellPkg: don't call functions with side effects in ASSERT_EFI_ERROR()

When ASSERT_EFI_ERROR() is compiled out, dependent on build flags, only
the status checking should be removed; the function calls should stay.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Shumin Qiu <shumin.qiu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
This commit is contained in:
Laszlo Ersek 2016-06-28 13:52:11 +02:00
parent 74e00be5c0
commit 4a7518d31a
2 changed files with 12 additions and 3 deletions

View File

@ -991,8 +991,11 @@ ShellCommandRunElse (
IN EFI_SYSTEM_TABLE *SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status;
SCRIPT_FILE *CurrentScriptFile; SCRIPT_FILE *CurrentScriptFile;
ASSERT_EFI_ERROR(CommandInit());
Status = CommandInit ();
ASSERT_EFI_ERROR (Status);
if (gEfiShellParametersProtocol->Argc > 1) { if (gEfiShellParametersProtocol->Argc > 1) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"if"); ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"if");
@ -1066,8 +1069,11 @@ ShellCommandRunEndIf (
IN EFI_SYSTEM_TABLE *SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status;
SCRIPT_FILE *CurrentScriptFile; SCRIPT_FILE *CurrentScriptFile;
ASSERT_EFI_ERROR(CommandInit());
Status = CommandInit ();
ASSERT_EFI_ERROR (Status);
if (gEfiShellParametersProtocol->Argc > 1) { if (gEfiShellParametersProtocol->Argc > 1) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"if"); ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"if");

View File

@ -373,6 +373,8 @@ EFIAPI
ShellInitialize ( ShellInitialize (
) )
{ {
EFI_STATUS Status;
// //
// if auto initialize is not false then skip // if auto initialize is not false then skip
// //
@ -383,7 +385,8 @@ ShellInitialize (
// //
// deinit the current stuff // deinit the current stuff
// //
ASSERT_EFI_ERROR(ShellLibDestructor(gImageHandle, gST)); Status = ShellLibDestructor (gImageHandle, gST);
ASSERT_EFI_ERROR (Status);
// //
// init the new stuff // init the new stuff