[PATCH 4/4] loader/efi/linux: Fix Compile Error With Clang

Andrew Hamilton <[email protected]>
Newsgroups org.gnu.grub-devel
Message-ID <[email protected]>
Clang will produce a warning (which is treated as
an error) that "vendor_defined_data" is uninitialized.
This is a "zero length" array member of this struct.
Add conditional compile pragma to allow this to
compile with Clang.

Signed-off-by: Andrew Hamilton <[email protected]>
---
 grub-core/loader/efi/linux.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
index 4f5589862..ded507cd5 100644
--- a/grub-core/loader/efi/linux.c
+++ b/grub-core/loader/efi/linux.c
@@ -55,6 +55,14 @@ static bool initrd_use_loadfile2 = false;
 static grub_guid_t load_file2_guid = GRUB_EFI_LOAD_FILE2_PROTOCOL_GUID;
 static grub_guid_t device_path_guid = GRUB_EFI_DEVICE_PATH_GUID;
 
+/*
+ * Clang will produce a warning for missing initializer for the
+ * zero-length array "vendor_defined_data" inside this structure.
+ * Suppress this warning which is treated as an error.
+ */
+#ifdef __clang__
+#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+#endif
 static initrd_media_device_path_t initrd_lf2_device_path = {
   {
     {
-- 
2.43.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.