summaryrefslogtreecommitdiff
path: root/OvmfPkg
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2020-03-25 10:07:43 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-03-26 08:09:53 +0000
commit92a1ac40809e0886ac5c53864993e268b515674c (patch)
treee8a17a7c1c0f975aa5d596aa612dbef96544ba51 /OvmfPkg
parente24529a5c324b07dd0e555206b35d1a56be834a6 (diff)
downloadedk2-92a1ac40809e0886ac5c53864993e268b515674c.zip
edk2-92a1ac40809e0886ac5c53864993e268b515674c.tar.gz
edk2-92a1ac40809e0886ac5c53864993e268b515674c.tar.bz2
OvmfPkg/X86QemuLoadImageLib: add dummy assignment to work around GCC
GCC 4.8 or 4.9 may throw the following error when building OVMF: Edk2/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c: In function ‘QemuLoadKernelImage’: Edk2/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c:416:30: error: ‘CommandLine’ may be used uninitialized in this function [-Werror=maybe-uninitialized] UnicodeSPrintAsciiFormat ( cc1: all warnings being treated as errors This is due to the fact that older GCCs fail to infer that CommandLine is never actually used unless it has been assigned. So add a redundant NULL assignment to help these older GCCs understand this. Link: https://bugzilla.tianocore.org/show_bug.cgi?id=2630 Fixes: 7c47d89003a6f ("OvmfPkg: implement QEMU loader library for X86 with ...") Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'OvmfPkg')
-rw-r--r--OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c b/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c
index e52ec66..ef753be 100644
--- a/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c
+++ b/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c
@@ -292,6 +292,11 @@ QemuLoadKernelImage (
UINTN InitrdSize;
//
+ // Redundant assignment to work around GCC48/GCC49 limitations.
+ //
+ CommandLine = NULL;
+
+ //
// Load the image. This should call back into the QEMU EFI loader file system.
//
Status = gBS->LoadImage (