diff options
author | Michael D Kinney <michael.d.kinney@intel.com> | 2021-12-05 14:33:53 -0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-12-07 17:24:28 +0000 |
commit | db52c7f755885d2f42279ba0d967c5d646d017b1 (patch) | |
tree | 07e0902972606385aba6c20cf36829fdd76a23db | |
parent | 4a9d41166224346621981ce98add027d56901b53 (diff) | |
download | edk2-db52c7f755885d2f42279ba0d967c5d646d017b1.zip edk2-db52c7f755885d2f42279ba0d967c5d646d017b1.tar.gz edk2-db52c7f755885d2f42279ba0d967c5d646d017b1.tar.bz2 |
MdeModulePkg: Change complex DEBUG_CODE() to DEBUG_CODE_BEGIN/END()
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3767
Update use of DEBUG_CODE(Expression) if Expression is a complex code
block with if/while/for/case statements that use {}.
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
17 files changed, 48 insertions, 50 deletions
diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleOnDisk.c b/MdeModulePkg/Application/CapsuleApp/CapsuleOnDisk.c index 712cf2e..77f9a15 100644 --- a/MdeModulePkg/Application/CapsuleApp/CapsuleOnDisk.c +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleOnDisk.c @@ -336,7 +336,7 @@ GetEfiSysPartitionFromBootOptionFilePath ( break;
}
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
CHAR16 *DevicePathStr;
DevicePathStr = ConvertDevicePathToText (CurFullPath, TRUE, TRUE);
@@ -344,7 +344,7 @@ GetEfiSysPartitionFromBootOptionFilePath ( DEBUG ((DEBUG_INFO, "Full device path %s\n", DevicePathStr));
FreePool (DevicePathStr);
}
- );
+ DEBUG_CODE_END ();
Status = GetEfiSysPartitionFromDevPath (CurFullPath, &FsFullPath, Fs);
} while (EFI_ERROR (Status));
@@ -468,7 +468,7 @@ GetUpdateFileSystem ( continue;
}
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
CHAR16 *DevicePathStr;
DevicePathStr = ConvertDevicePathToText (DevicePath, TRUE, TRUE);
@@ -478,7 +478,7 @@ GetUpdateFileSystem ( } else {
DEBUG ((DEBUG_INFO, "DevicePathToStr failed\n"));
}
- );
+ DEBUG_CODE_END ();
Status = GetEfiSysPartitionFromBootOptionFilePath (DevicePath, &FullPath, Fs);
if (!EFI_ERROR (Status)) {
diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c index a715186..5c8f0f4 100644 --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c @@ -167,7 +167,7 @@ AddIoSpace ( }
}
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
//
// Make sure there are adjacent descriptors covering [Base, Base + Length).
// It is possible that they have not been merged; merging can be prevented
@@ -184,7 +184,7 @@ AddIoSpace ( ASSERT_EFI_ERROR (CheckStatus);
ASSERT (Descriptor.GcdIoType == EfiGcdIoTypeIo);
}
- );
+ DEBUG_CODE_END ();
FreeIoSpaceMap:
FreePool (IoSpaceMap);
@@ -315,7 +315,7 @@ AddMemoryMappedIoSpace ( }
}
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
//
// Make sure there are adjacent descriptors covering [Base, Base + Length).
// It is possible that they have not been merged; merging can be prevented
@@ -333,7 +333,7 @@ AddMemoryMappedIoSpace ( ASSERT (Descriptor.GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo);
ASSERT ((Descriptor.Capabilities & Capabilities) == Capabilities);
}
- );
+ DEBUG_CODE_END ();
FreeMemorySpaceMap:
FreePool (MemorySpaceMap);
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index 6518921..2224aae 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -141,7 +141,7 @@ CoreDumpGcdMemorySpaceMap ( BOOLEAN InitialMap
)
{
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
EFI_STATUS Status;
UINTN NumberOfDescriptors;
EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap;
@@ -167,7 +167,7 @@ CoreDumpGcdMemorySpaceMap ( }
DEBUG ((DEBUG_GCD, "\n"));
FreePool (MemorySpaceMap);
- );
+ DEBUG_CODE_END ();
}
/**
@@ -183,7 +183,7 @@ CoreDumpGcdIoSpaceMap ( BOOLEAN InitialMap
)
{
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
EFI_STATUS Status;
UINTN NumberOfDescriptors;
EFI_GCD_IO_SPACE_DESCRIPTOR *IoSpaceMap;
@@ -208,7 +208,7 @@ CoreDumpGcdIoSpaceMap ( }
DEBUG ((DEBUG_GCD, "\n"));
FreePool (IoSpaceMap);
- );
+ DEBUG_CODE_END ();
}
/**
diff --git a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c index 5b8ce55..002a8e4 100644 --- a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c +++ b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c @@ -2734,12 +2734,12 @@ DumpSmramInfo ( VOID
)
{
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
if (IS_SMRAM_PROFILE_ENABLED) {
DumpSmramProfile ();
DumpFreePagesList ();
DumpFreePoolList ();
DumpSmramRange ();
}
- );
+ DEBUG_CODE_END ();
}
diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c index 814c540..060abef 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c @@ -489,7 +489,7 @@ GetEfiSysPartitionFromActiveBootOption( continue;
}
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
CHAR16 *DevicePathStr;
DevicePathStr = ConvertDevicePathToText(DevicePath, TRUE, TRUE);
@@ -499,7 +499,7 @@ GetEfiSysPartitionFromActiveBootOption( } else {
DEBUG((DEBUG_INFO, "DevicePathToStr failed\n"));
}
- );
+ DEBUG_CODE_END ();
CurFullPath = NULL;
//
@@ -521,7 +521,7 @@ GetEfiSysPartitionFromActiveBootOption( break;
}
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
CHAR16 *DevicePathStr1;
DevicePathStr1 = ConvertDevicePathToText(CurFullPath, TRUE, TRUE);
@@ -529,7 +529,7 @@ GetEfiSysPartitionFromActiveBootOption( DEBUG((DEBUG_INFO, "Full device path %s\n", DevicePathStr1));
FreePool(DevicePathStr1);
}
- );
+ DEBUG_CODE_END ();
//
// Make sure the boot option device path connected.
@@ -587,7 +587,7 @@ GetEfiSysPartitionFromActiveBootOption( Status = EFI_NOT_FOUND;
}
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
CHAR16 *DevicePathStr2;
if (*FsHandle != NULL) {
DevicePathStr2 = ConvertDevicePathToText(CurFullPath, TRUE, TRUE);
@@ -598,7 +598,7 @@ GetEfiSysPartitionFromActiveBootOption( } else {
DEBUG((DEBUG_INFO, "Failed to found Active EFI System Partion\n"));
}
- );
+ DEBUG_CODE_END ();
if (CurFullPath != NULL) {
FreePool(CurFullPath);
@@ -990,13 +990,13 @@ GetFileImageInAlphabetFromDir( FileCount++;
}
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
for (Link = FileInfoList.ForwardLink; Link != &FileInfoList; Link = Link->ForwardLink) {
FileInfoEntry = CR (Link, FILE_INFO_ENTRY, Link, FILE_INFO_SIGNATURE);
FileInfo = FileInfoEntry->FileInfo;
DEBUG((DEBUG_INFO, "Successfully read capsule file %s from disk.\n", FileInfo->FileName));
}
- );
+ DEBUG_CODE_END ();
EXIT:
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c index a862e04..a7261d6 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -1387,7 +1387,7 @@ BmExpandLoadFile ( //
FileBuffer = AllocateReservedPages (EFI_SIZE_TO_PAGES (BufferSize));
if (FileBuffer == NULL) {
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
EFI_DEVICE_PATH *LoadFilePath;
CHAR16 *LoadFileText;
CHAR16 *FileText;
@@ -1417,7 +1417,7 @@ BmExpandLoadFile ( if (LoadFileText != NULL) {
FreePool (LoadFileText);
}
- );
+ DEBUG_CODE_END ();
return NULL;
}
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c b/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c index 2a850f2..eacd454 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c @@ -545,7 +545,7 @@ BmRepairAllControllers ( EfiBootManagerFreeDriverHealthInfo (DriverHealthInfo, Count);
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
CHAR16 *ControllerName;
DriverHealthInfo = EfiBootManagerGetDriverHealthInfo (&Count);
@@ -567,7 +567,7 @@ BmRepairAllControllers ( }
}
EfiBootManagerFreeDriverHealthInfo (DriverHealthInfo, Count);
- );
+ DEBUG_CODE_END ();
if (ReconnectRequired) {
if (ReconnectRepairCount < MAX_RECONNECT_REPAIR) {
diff --git a/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGenFromFv.c b/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGenFromFv.c index f32499e..6bac4bc 100644 --- a/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGenFromFv.c +++ b/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGenFromFv.c @@ -286,7 +286,7 @@ ParseFv ( );
ASSERT_EFI_ERROR (Status);
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *Fvb2;
EFI_PHYSICAL_ADDRESS FvAddress;
UINT64 FvSize;
@@ -303,7 +303,7 @@ ParseFv ( FvSize = ((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) FvAddress)->FvLength;
DEBUG ((DEBUG_INFO , "FvSize - 0x%08x\n", FvSize));
}
- );
+ DEBUG_CODE_END ();
if (ScanAll) {
//
diff --git a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/SetIdtEntry.c b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/SetIdtEntry.c index 1e3c5b8..45c9b66 100644 --- a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/SetIdtEntry.c +++ b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/SetIdtEntry.c @@ -38,7 +38,7 @@ SetIdtEntry ( Status = InitializeCpuExceptionHandlers (NULL);
ASSERT_EFI_ERROR (Status);
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
//
// Update IDT entry INT3 if the instruction is valid in it
//
@@ -51,6 +51,5 @@ SetIdtEntry ( IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
IdtEntry->Bits.OffsetHigh = (UINT16)(S3DebugBuffer >> 16);
}
- );
+ DEBUG_CODE_END ();
}
-
diff --git a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c index 0d448cc..afb2d5c 100644 --- a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c +++ b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c @@ -149,7 +149,7 @@ SetIdtEntry ( Status = InitializeCpuExceptionHandlers (NULL);
ASSERT_EFI_ERROR (Status);
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
//
// Update IDT entry INT3 if the instruction is valid in it
//
@@ -164,7 +164,7 @@ SetIdtEntry ( IdtEntry->Bits.OffsetUpper = (UINT32)(S3DebugBuffer >> 32);
IdtEntry->Bits.Reserved_1 = 0;
}
- );
+ DEBUG_CODE_END ();
//
// If both BIOS and OS wants long mode waking vector,
diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c index 4b10567..f705316 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c @@ -941,7 +941,7 @@ BdsEntry ( OsIndication = 0;
}
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType;
DEBUG ((DEBUG_INFO, "[Bds]OsIndication: %016x\n", OsIndication));
DEBUG ((DEBUG_INFO, "[Bds]=============Begin Load Options Dumping ...=============\n"));
@@ -963,7 +963,7 @@ BdsEntry ( EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount);
}
DEBUG ((DEBUG_INFO, "[Bds]=============End Load Options Dumping=============\n"));
- );
+ DEBUG_CODE_END ();
//
// BootManagerMenu doesn't contain the correct information when return status is EFI_NOT_FOUND.
diff --git a/MdeModulePkg/Universal/CapsuleOnDiskLoadPei/CapsuleOnDiskLoadPei.c b/MdeModulePkg/Universal/CapsuleOnDiskLoadPei/CapsuleOnDiskLoadPei.c index e9b1250..aedbc66 100644 --- a/MdeModulePkg/Universal/CapsuleOnDiskLoadPei/CapsuleOnDiskLoadPei.c +++ b/MdeModulePkg/Universal/CapsuleOnDiskLoadPei/CapsuleOnDiskLoadPei.c @@ -282,7 +282,7 @@ InitializeCapsuleOnDiskLoad ( return EFI_ABORTED;
}
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
VOID *CapsuleOnDiskModePpi;
if (!IsCapsuleOnDiskMode()){
@@ -302,7 +302,7 @@ InitializeCapsuleOnDiskLoad ( DEBUG((DEBUG_ERROR, "Locate CapsuleOnDiskModePpi error %x\n", Status));
return Status;
}
- );
+ DEBUG_CODE_END ();
Status = PeiServicesInstallPpi (&mCapsuleOnDiskPpiList);
ASSERT_EFI_ERROR (Status);
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c index 838c333..50c4d71 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c @@ -335,12 +335,12 @@ InitializeGraphicsConsoleTextMode ( }
}
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
for (Index = 0; Index < ValidCount; Index++) {
DEBUG ((DEBUG_INFO, "Graphics - Mode %d, Column = %d, Row = %d\n",
Index, NewModeBuffer[Index].Columns, NewModeBuffer[Index].Rows));
}
- );
+ DEBUG_CODE_END ();
//
// Return valid mode count and mode information buffer.
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c index a98b690..89d6e72 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c @@ -327,13 +327,13 @@ InitializeTerminalConsoleTextMode ( }
*TextModeCount = ARRAY_SIZE (mTerminalConsoleModeData);
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
INT32 Index;
for (Index = 0; Index < *TextModeCount; Index++) {
DEBUG ((DEBUG_INFO, "Terminal - Mode %d, Column = %d, Row = %d\n",
Index, TextModeData[Index].Columns, TextModeData[Index].Rows));
}
- );
+ DEBUG_CODE_END ();
return TextModeData;
}
@@ -1380,4 +1380,3 @@ IsHotPlugDevice ( return FALSE;
}
-
diff --git a/MdeModulePkg/Universal/SecurityStubDxe/Defer3rdPartyImageLoad.c b/MdeModulePkg/Universal/SecurityStubDxe/Defer3rdPartyImageLoad.c index 6a5f4a3..dfa680b 100644 --- a/MdeModulePkg/Universal/SecurityStubDxe/Defer3rdPartyImageLoad.c +++ b/MdeModulePkg/Universal/SecurityStubDxe/Defer3rdPartyImageLoad.c @@ -330,7 +330,7 @@ Defer3rdPartyImageLoad ( ImageInfo = LookupImage (File, BootPolicy);
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
CHAR16 *DevicePathStr;
DevicePathStr = ConvertDevicePathToText (File, FALSE, FALSE);
DEBUG ((
@@ -342,7 +342,7 @@ Defer3rdPartyImageLoad ( if (DevicePathStr != NULL) {
FreePool (DevicePathStr);
}
- );
+ DEBUG_CODE_END ();
if (mEndOfDxe) {
mImageLoadedAfterEndOfDxe = TRUE;
diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c b/MdeModulePkg/Universal/Variable/Pei/Variable.c index 468b732..7e4fa60 100644 --- a/MdeModulePkg/Universal/Variable/Pei/Variable.c +++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c @@ -512,7 +512,7 @@ GetHobVariableStore ( //
// Make sure there is no more than one Variable HOB.
//
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
GuidHob = GetFirstGuidHob (&gEfiAuthenticatedVariableGuid);
if (GuidHob != NULL) {
if ((GetNextGuidHob (&gEfiAuthenticatedVariableGuid, GET_NEXT_HOB (GuidHob)) != NULL)) {
@@ -531,7 +531,7 @@ GetHobVariableStore ( }
}
}
- );
+ DEBUG_CODE_END ();
GuidHob = GetFirstGuidHob (&gEfiAuthenticatedVariableGuid);
if (GuidHob != NULL) {
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c index 5115bcf..adb3e97 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -280,7 +280,7 @@ RecordVarErrorFlag ( VAR_ERROR_FLAG *VarErrFlag;
VAR_ERROR_FLAG TempFlag;
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
DEBUG ((DEBUG_ERROR, "RecordVarErrorFlag (0x%02x) %s:%g - 0x%08x - 0x%x\n", Flag, VariableName, VendorGuid, Attributes, VariableSize));
if (Flag == VAR_ERROR_FLAG_SYSTEM_ERROR) {
if (AtRuntime ()) {
@@ -291,7 +291,7 @@ RecordVarErrorFlag ( } else {
DEBUG ((DEBUG_ERROR, "CommonMaxUserVariableSpace = 0x%x - CommonUserVariableTotalSize = 0x%x\n", mVariableModuleGlobal->CommonMaxUserVariableSpace, mVariableModuleGlobal->CommonUserVariableTotalSize));
}
- );
+ DEBUG_CODE_END ();
if (!mEndOfDxe) {
//
@@ -3498,7 +3498,7 @@ GetHobVariableStore ( //
// Make sure there is no more than one Variable HOB.
//
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
GuidHob = GetFirstGuidHob (&gEfiAuthenticatedVariableGuid);
if (GuidHob != NULL) {
if ((GetNextGuidHob (&gEfiAuthenticatedVariableGuid, GET_NEXT_HOB (GuidHob)) != NULL)) {
@@ -3517,7 +3517,7 @@ GetHobVariableStore ( }
}
}
- );
+ DEBUG_CODE_END ();
//
// Combinations supported:
|