[Edk2 Dev] Some GCC issues with MdeModulePkg

Subject: [Edk2 Dev] Some GCC issues with MdeModulePkg

From: Andrew Fish <afish@apple.com>

To: dev@edk2.tianocore.org

Date: 2008-03-10 01:40:57

More observations trying to use the Leopard version of GCC on the MdeModulePkg

edk2/MdeModulePkg/Library/GenricBdsLib/BdsConnect.c:368 warning: comparison is always true due to limited range of data type

  if (HostControllerPI != 0xFF &&
      HostControllerPI != 0x00 &&
      HostControllerPI != 0x20) {
    return EFI_INVALID_PARAMETER;
  }

edk2/MdeModulePkg/Library/GenricBdsLib/BdsConnect.c:400 warning: comparison is always true due to limited range of data type
            if (HostControllerPI == Class[0] || HostControllerPI == 0xFF) {

Looks like HostControllerPI is of type CHAR8 and the compiler does not think 0xFF is a valid comparison. Change to UINT8 fixes.


edk2/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c:553: cast from pointer to integer of different size
                (EFI_PHYSICAL_ADDRESS)(VOID*)((UINTN) NewHandOffTable->EfiEndOfHobList + Offset);
Removing (VOID*) fixes. I'm not sure if this may introduce a sign extension issue?


edk2/MdeModulePkg/Core/Pei/Memory/MemoryServices.c:24: warning: mMemoryDiscoveredPpi defined but not used
  Looks like two static copies of mMemoryDiscoveredPpi exist in the PEI Core. Remove the extra copy in this file.

edk2/MdeModulePkg/Core/Pei/FwVol/FwVol.c:771: warning: VolumeHandle may be used uninitialized in this function
  VolumeHandle is a retured argument. So just initializing it prior call fixes the issue

edk2/MdePkg/Include/IndustryStandard/Tpm12.h:29: warning: malformed '#pragma pack(push[, id], <n>)' - ignored
  #pragma pack (push)
  #pragma pack (1)

  looks like #pragma pack(push, 1) fixes warning. It seems this form is the more common one. Maybe we should require this form.


I'm still having some issues figuring out linker flags that work.

Andrew Fish
Work iPhone: 360-259-7562