[edk2-devel] [PATCH] OvmfPkg/QemuKernelLoaderFsDxe: drop tentative const object definition

Bob Feng bob.c.feng at intel.com
Sun Mar 8 01:22:41 UTC 2020


Hi Ard,

With this patch, Ovmf still build failed on windows with VS2017. The error message like below:

Building ... d:\edk2maintain\edk2\MdeModulePkg\Universal\Metronome\Metronome.inf [IA32]
d:\edk2maintain\edk2\OvmfPkg\LinuxInitrdDynamicShellCommand\LinuxInitrdDynamicShellCommand.c(199): error C2220: warning treated as error - no 'object' file generated
d:\edk2maintain\edk2\OvmfPkg\LinuxInitrdDynamicShellCommand\LinuxInitrdDynamicShellCommand.c(199): warning C4244: '=': conversion from 'UINT64' to 'UINTN', possible loss of data
        "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\cl.exe" /Fod:\edk2maintain\edk2\Build\OvmfIa32\DEBUG_VS2017\IA32\MdeModulePkg\Bus\Pci\UhciDxe\UhciDxe\OUTPUT\.\ /showIncludes /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Gw /D DISABLE_NEW_DEPRECATED_INTERFACES /Id:\edk2maintain\edk2\MdeModulePkg\Bus\Pci\UhciDxe  /Id:\edk2maintain\edk2\Build\OvmfIa32\DEBUG_VS2017\IA32\MdeModulePkg\Bus\Pci\UhciDxe\UhciDxe\DEBUG  /Id:\edk2maintain\edk2\MdePkg  /Id:\edk2maintain\edk2\MdePkg\Include  /Id:\edk2maintain\edk2\MdePkg\Include\Ia32  /Id:\edk2maintain\edk2\MdeModulePkg  /Id:\edk2maintain\edk2\MdeModulePkg\Include d:\edk2maintain\edk2\MdeModulePkg\Bus\Pci\UhciDxe\ComponentName.c d:\edk2maintain\edk2\Build\OvmfIa32\DEBUG_VS2017\IA32\MdeModulePkg\Bus\Pci\UhciDxe\UhciDxe\DEBUG\AutoGen.c d:\edk2maintain\edk2\MdeModulePkg\Bus\Pci\UhciDxe\UhciReg.c d:\edk2maintain\edk2\MdeModulePkg\Bus\Pci\UhciDxe\UhciQueue.c d:\edk2maintain\edk2\MdeModulePkg\Bus\Pci\UhciDxe\Uhci.c d:\edk2maintain\edk2\MdeModulePkg\Bus\Pci\UhciDxe\UhciDebug.c d:\edk2maintain\edk2\MdeModulePkg\Bus\Pci\UhciDxe\UsbHcMem.c d:\edk2maintain\edk2\MdeModulePkg\Bus\Pci\UhciDxe\UhciSched.c
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\cl.exe"' : return code '0x2'
Stop.


build.py...
 : error 7000: Failed to execute command
        C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\nmake.exe /nologo tbuild [d:\edk2maintain\edk2\Build\OvmfIa32\DEBUG_VS2017\IA32\OvmfPkg\LinuxInitrdDynamicShellCommand\LinuxInitrdDynamicShellCommand]


build.py...
 : error F002: Failed to build module
        d:\edk2maintain\edk2\OvmfPkg\LinuxInitrdDynamicShellCommand\LinuxInitrdDynamicShellCommand.inf [IA32, VS2017, DEBUG]

- Failed -



Thanks,
Bob

-----Original Message-----
From: devel at edk2.groups.io [mailto:devel at edk2.groups.io] On Behalf Of Ard Biesheuvel
Sent: Saturday, March 7, 2020 10:22 PM
To: edk2-devel-groups-io <devel at edk2.groups.io>; Laszlo Ersek <lersek at redhat.com>
Cc: Feng, Bob C <bob.c.feng at intel.com>
Subject: Re: [edk2-devel] [PATCH] OvmfPkg/QemuKernelLoaderFsDxe: drop tentative const object definition

On Fri, 6 Mar 2020 at 20:22, Laszlo Ersek <lersek at redhat.com> wrote:
>
> On 03/06/20 17:40, Ard Biesheuvel wrote:
> > On Fri, 6 Mar 2020 at 17:14, Laszlo Ersek <lersek at redhat.com> wrote:
> >>
> >> On 03/06/20 08:38, Ard Biesheuvel wrote:
> >>> Bob reports that VS2017 chokes on a tentative definition of the 
> >>> const object 'mEfiFileProtocolTemplate', with the following error:
> >>>
> >>>   OvmfPkg\QemuKernelLoaderFsDxe\QemuKernelLoaderFsDxe.c(130):
> >>>       error C2220: warning treated as error - no 'object' file generated
> >>>   OvmfPkg\QemuKernelLoaderFsDxe\QemuKernelLoaderFsDxe.c(130):
> >>>       warning C4132: 'mEfiFileProtocolTemplate': const object 
> >>> should be initialized
> >>>
> >>> Let's turn the only function that relies on this tentative 
> >>> definition into a forward declaration itself, and move its 
> >>> definition after the normal definition of the object. That allows 
> >>> us to drop the tentative
> >>
> >> (1) s/normal/external/
> >>
> >
> > Are you sure? The const object has static linkage.
>
> Yes, I'm sure.
>

:-)

I should have known better than to doubt you on a matter like this ...

Thanks for the explanation.




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#55657): https://edk2.groups.io/g/devel/message/55657
Mute This Topic: https://groups.io/mt/71768124/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list