Lazlo, No apology necessary. I thought about that, but to my knowledge there is no new blocks added inside any of the existing core EDK functions and I will have to check whether this violates the coding style.
-Jaben -----Original Message----- From: Laszlo Ersek [mailto:[email protected]] Sent: Monday, July 29, 2013 11:49 AM To: [email protected] Cc: Carsey, Jaben Subject: Re: [edk2] InternalShellProtocolDebugPrintMessage() returns un-initialised Status On 07/29/13 19:22, Carsey, Jaben wrote: > The macro/function cannot go in the middle of the variable > declarations. What do you think of this? Sorry for butting in. DEBUG_CODE_BEGIN() opens a new block scope, at the top of which declarations are allowed even in C89. "MdePkg/Include/Library/DebugLib.h": /** Macro that marks the beginning of debug source code. If the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set, then this macro marks the beginning of source code that is included in a module. Otherwise, the source lines between DEBUG_CODE_BEGIN() and DEBUG_CODE_END() are not included in a module. **/ #define DEBUG_CODE_BEGIN() do { if (DebugCodeEnabled ()) { UINT8 __DebugCodeLocal /** The macro that marks the end of debug source code. If the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set, then this macro marks the end of source code that is included in a module. Otherwise, the source lines between DEBUG_CODE_BEGIN() and DEBUG_CODE_END() are not included in a module. **/ #define DEBUG_CODE_END() __DebugCodeLocal = 0; __DebugCodeLocal++; } } while (FALSE) Now, the edk2 coding style may still forbid this. In that case I propose an extra block scope. Valid C89 even after the removal of the macros, and visually obvious. DEBUG_CODE_BEGIN(); { CHAR16 *Temp; if (Mapping != NULL) { DEBUG((EFI_D_INFO, "Added new map item:\"%S\"\r\n", Mapping)); } Temp = ConvertDevicePathToText(DevicePath, TRUE, TRUE); DEBUG((EFI_D_INFO, "DevicePath: %S\r\n", Temp)); FreePool(Temp); } DEBUG_CODE_END(); Thanks Laszlo > -----Original Message----- > From: Alexei Fedorov [mailto:[email protected]] > Sent: Monday, July 29, 2013 5:57 AM > To: [email protected] > Subject: [edk2] InternalShellProtocolDebugPrintMessage() returns > un-initialised Status > > 1. InternalShellProtocolDebugPrintMessage() function in > \edk2\ShellPkg\Application\Shell\ShellProtocol.c returns > un-initialised Status variable: > > EFI_STATUS > EFIAPI > InternalShellProtocolDebugPrintMessage ( > IN CONST CHAR16 *Mapping, > IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath > ) > { > EFI_STATUS Status; > CHAR16 *Temp; > DEBUG_CODE_BEGIN(); > if (Mapping != NULL) { > DEBUG((EFI_D_INFO, "Added new map item:\"%S\"\r\n", Mapping)); > } > Temp = ConvertDevicePathToText(DevicePath, TRUE, TRUE); > DEBUG((EFI_D_INFO, "DevicePath: %S\r\n", Temp)); > FreePool(Temp); > DEBUG_CODE_END(); > return (Status); > } > > 2. DEBUG_CODE_BEGIN() macro should be placed before *Temp declaration > to suppress warning regarding unused variable for RELEASE build. ------------------------------------------------------------------------------ Get your SQL database under version control now! Version control is standard for application code, but databases havent caught up. So what steps can you take to put your SQL databases under version control? Why should you start doing it? Read more to find out. http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
