Re: [edk2] [PATCH] ShellPkg: Fix GCC 4.4 build issues

Subject: Re: [edk2] [PATCH] ShellPkg: Fix GCC 4.4 build issues

From: Andrew Fish <afish@apple.com>

To: edk2-devel@lists.sourceforge.net

Date: 2011-04-11 18:22:51

Jordan,

looks good to me. I had the same ULL fixes in my patch.

Andrew Fish





On Apr 11, 2011, at 8:54 AM, Jordan Justen wrote:

> Jaben and edk2 community,
> 
> Please review this patch to fix build issues for Linux
> and GCC 4.4 within the ShellPkg.
> 
> -Jordan
> 
> ===
> 
> This change fixes various GCC 4.4 build issues
> * EFIAPI usage inconsistencies
> * multi-character literal warning ('eell')
> * Filename case inconsistencies
> * Use 'ULL' suffix for integers > 4GB
> ---
> .../Edit/MainTextEditor.c                          |   18 ------------------
> .../Edit/TextEditorTypes.h                         |    2 +-
> .../UefiShellDebug1CommandsLib/EditMenuBar.h       |    2 +-
> .../HexEdit/HexEditorTypes.h                       |    2 +-
> .../UefiShellDebug1CommandsLib/HexEdit/MemImage.c  |    2 ++
> ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c  |   14 +++++++-------
> .../SmbiosView/LibSmbiosView.c                     |    4 ++--
> .../UefiShellDebug1CommandsLib/SmbiosView/Smbios.c |    2 +-
> .../UefiShellDebug1CommandsLib.c                   |    1 -
> 9 files changed, 15 insertions(+), 32 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
> index 713332e..1a8f39a 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
> @@ -24,7 +24,6 @@
>   @retval EFI_OUT_OF_RESOURCES    A memory allocation failed.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandOpenFile (
>   VOID
>   );
> @@ -35,7 +34,6 @@ MainCommandOpenFile (
>   @retval EFI_SUCCESS           The switch was ok or a warning was presented.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandSwitchFileType (
>   VOID
>   );
> @@ -46,7 +44,6 @@ MainCommandSwitchFileType (
>   @retval EFI_SUCCESS             The operation was successful.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandGotoLine (
>   VOID
>   );
> @@ -60,7 +57,6 @@ MainCommandGotoLine (
>   @retval EFI_LOAD_ERROR          A file access error occured.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandSaveFile (
>   VOID
>   );
> @@ -73,7 +69,6 @@ MainCommandSaveFile (
>   @retval EFI_LOAD_ERROR          A load error occured.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandExit (
>   VOID
>   );
> @@ -86,7 +81,6 @@ MainCommandExit (
>   @retval EFI_LOAD_ERROR          A load error occured.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandSearch (
>   VOID
>   );
> @@ -99,7 +93,6 @@ MainCommandSearch (
>   @retval EFI_LOAD_ERROR          A load error occured.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandSearchReplace (
>   VOID
>   );
> @@ -112,7 +105,6 @@ MainCommandSearchReplace (
>   @retval EFI_LOAD_ERROR          A load error occured.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandCutLine (
>   VOID
>   );
> @@ -125,7 +117,6 @@ MainCommandCutLine (
>   @retval EFI_LOAD_ERROR          A load error occured.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandPasteLine (
>   VOID
>   );
> @@ -195,7 +186,6 @@ EDITOR_MENU_ITEM  MainMenuItems[] = {
>   @retval EFI_OUT_OF_RESOURCES    A memory allocation failed.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandOpenFile (
>   VOID
>   )
> @@ -350,7 +340,6 @@ MainCommandOpenFile (
>   @retval EFI_SUCCESS           The switch was ok or a warning was presented.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandSwitchFileType (
>   VOID
>   )
> @@ -384,7 +373,6 @@ MainCommandSwitchFileType (
>   @retval EFI_LOAD_ERROR          A load error occured.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandCutLine (
>   VOID
>   )
> @@ -422,7 +410,6 @@ MainCommandCutLine (
>   @retval EFI_LOAD_ERROR          A load error occured.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandPasteLine (
>   VOID
>   )
> @@ -455,7 +442,6 @@ MainCommandPasteLine (
>   @retval EFI_LOAD_ERROR          A load error occured.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandSearch (
>   VOID
>   )
> @@ -597,7 +583,6 @@ MainCommandSearch (
>   @retval EFI_LOAD_ERROR          A load error occured.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandSearchReplace (
>   VOID
>   )
> @@ -901,7 +886,6 @@ MainCommandSearchReplace (
>   @retval EFI_LOAD_ERROR          A load error occured.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandExit (
>   VOID
>   )
> @@ -983,7 +967,6 @@ MainCommandExit (
>   @retval EFI_SUCCESS             The operation was successful.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandGotoLine (
>   VOID
>   )
> @@ -1057,7 +1040,6 @@ MainCommandGotoLine (
>   @retval EFI_LOAD_ERROR          A file access error occured.
> **/
> EFI_STATUS
> -EFIAPI
> MainCommandSaveFile (
>   VOID
>   )
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditorTypes.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditorTypes.h
> index 9bcf39e..dfd56dd 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditorTypes.h
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditorTypes.h
> @@ -42,7 +42,7 @@ typedef enum {
>   NewLineTypeUnknown
> } EE_NEWLINE_TYPE;
> 
> -#define LINE_LIST_SIGNATURE  'eell'
> +#define LINE_LIST_SIGNATURE  SIGNATURE_32 ('e', 'e', 'l', 'l')
> typedef struct _EFI_EDITOR_LINE {
>   UINTN           Signature;
>   CHAR16          *Buffer;
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.h
> index 407f259..41dccf6 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.h
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.h
> @@ -17,7 +17,7 @@
> 
> typedef
> EFI_STATUS
> -(EFIAPI *MENU_ITEM_FUNCTION) (
> +(*MENU_ITEM_FUNCTION) (
>   VOID
>   );
> 
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h
> index 2849f2b..22f5c05 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h
> @@ -18,7 +18,7 @@
> #include "UefiShellDebug1CommandsLib.h"
> #include "EditTitleBar.h"
> 
> -#define EFI_EDITOR_LINE_LIST  'eell'
> +#define EFI_EDITOR_LINE_LIST  SIGNATURE_32 ('e', 'e', 'l', 'l')
> 
> #define ASCII_POSITION        ((0x10 * 3) + 12)
> 
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c
> index a593d0a..f327c5a 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c
> @@ -50,6 +50,7 @@ HEFI_EDITOR_MEM_IMAGE             HMemImageConst = {
>   @retval EFI_UNSUPPORTED.
> **/
> EFI_STATUS
> +EFIAPI
> DummyMemRead (
>   IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL              * This,
>   IN     EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH    Width,
> @@ -73,6 +74,7 @@ DummyMemRead (
>   @retval EFI_UNSUPPORTED.
> **/
> EFI_STATUS
> +EFIAPI
> DummyMemWrite (
>   IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL              * This,
>   IN     EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH    Width,
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
> index 65effc7..3f4147f 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
> @@ -3199,8 +3199,8 @@ PciExplainBar (
>     } else if ((*Bar & PCI_BIT_1) == 0 && (*Bar & PCI_BIT_2) != 0) {
>       Bar64 = 0x0;
>       CopyMem (&Bar64, Bar, sizeof (UINT64));
> -      ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_2), gShellDebug1HiiHandle, RShiftU64 ((Bar64 & 0xfffffffffffffff0), 32));
> -      ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_3), gShellDebug1HiiHandle, (UINT32) (Bar64 & 0xfffffffffffffff0));
> +      ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_2), gShellDebug1HiiHandle, RShiftU64 ((Bar64 & 0xfffffffffffffff0ULL), 32));
> +      ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_3), gShellDebug1HiiHandle, (UINT32) (Bar64 & 0xfffffffffffffff0ULL));
>       ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEM), gShellDebug1HiiHandle);
>       ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_64_BITS), gShellDebug1HiiHandle);
>       IsBar32 = FALSE;
> @@ -3271,18 +3271,18 @@ PciExplainBar (
> 
>     OldBar64 = 0x0;
>     CopyMem (&OldBar64, Bar, sizeof (UINT64));
> -    NewBar64 = 0xffffffffffffffff;
> +    NewBar64 = 0xffffffffffffffffULL;
> 
>     IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 2, &NewBar64);
>     IoDev->Pci.Read (IoDev, EfiPciWidthUint32, RegAddress, 2, &NewBar64);
>     IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 2, &OldBar64);
> 
>     if (IsMem) {
> -      NewBar64  = NewBar64 & 0xfffffffffffffff0;
> +      NewBar64  = NewBar64 & 0xfffffffffffffff0ULL;
>       NewBar64  = (~NewBar64) + 1;
> 
>     } else {
> -      NewBar64  = NewBar64 & 0xfffffffffffffffc;
> +      NewBar64  = NewBar64 & 0xfffffffffffffffcULL;
>       NewBar64  = (~NewBar64) + 1;
>       NewBar64  = NewBar64 & 0x000000000000ffff;
>     }
> @@ -3305,9 +3305,9 @@ PciExplainBar (
>       ShellPrintHiiEx(-1, -1, NULL,
>         STRING_TOKEN (STR_PCI2_RSHIFT),
>         gShellDebug1HiiHandle,
> -        RShiftU64 ((NewBar64 + (Bar64 & 0xfffffffffffffff0) - 1), 32)
> +        RShiftU64 ((NewBar64 + (Bar64 & 0xfffffffffffffff0ULL) - 1), 32)
>        );
> -      ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32) (NewBar64 + (Bar64 & 0xfffffffffffffff0) - 1));
> +      ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32) (NewBar64 + (Bar64 & 0xfffffffffffffff0ULL) - 1));
> 
>     }
>   } else {
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c
> index 409f684..9e99568 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c
> @@ -14,8 +14,8 @@
> 
> 
> #include "../UefiShellDebug1CommandsLib.h"
> -#include 
> -#include "LIbSmbios.h"
> +#include 
> +#include "LibSmbios.h"
> #include "LibSmbiosView.h"
> #include "SmbiosView.h"
> 
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/Smbios.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/Smbios.c
> index 8df7c81..7e627b9 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/Smbios.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/Smbios.c
> @@ -13,7 +13,7 @@
> **/
> 
> #include "../UefiShellDebug1CommandsLib.h"
> -#include 
> +#include 
> #include "LibSmbios.h"
> 
> /**
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c
> index cccec12..66345b4 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c
> @@ -150,7 +150,6 @@ STATIC CONST CHAR8 Hex[] = {
>   @param[in] UserData   The data to print out.
> **/
> VOID
> -EFIAPI
> DumpHex (
>   IN UINTN        Indent,
>   IN UINTN        Offset,
> -- 
> 1.7.1
> 
> 
> ------------------------------------------------------------------------------
> Xperia(TM) PLAY
> It's a major breakthrough. An authentic gaming
> smartphone on the nation's most reliable network.
> And it wants your games.
> http://p.sf.net/sfu/verizon-sfdev
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel