grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Hamilton <adhamilt@gmail.com>
To: grub-devel@gnu.org
Cc: daniel.kiper@oracle.com, Andrew Hamilton <adhamilt@gmail.com>
Subject: [PATCH 4/4] loader/efi/linux: Fix Compile Error With Clang
Date: Sat, 25 Oct 2025 10:53:40 -0500	[thread overview]
Message-ID: <20251025155340.578883-5-adhamilt@gmail.com> (raw)
In-Reply-To: <20251025155340.578883-1-adhamilt@gmail.com>

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 <adhamilt@gmail.com>
---
 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
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

  parent reply	other threads:[~2025-10-25 15:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-25 15:53 [PATCH 0/4] Dist Archive and Clang Build Fixes Andrew Hamilton
2025-10-25 15:53 ` [PATCH 1/4] build: Include MAINTAINERS and SECURITY files in dist archive Andrew Hamilton
2025-10-25 15:53 ` [PATCH 2/4] build: Include new zstd test support " Andrew Hamilton
2025-10-25 15:53 ` [PATCH 3/4] build: Add tpm2asn file for reference to " Andrew Hamilton
2025-10-25 15:53 ` Andrew Hamilton [this message]
2025-10-27 17:16 ` [PATCH 0/4] Dist Archive and Clang Build Fixes Daniel Kiper via Grub-devel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251025155340.578883-5-adhamilt@gmail.com \
    --to=adhamilt@gmail.com \
    --cc=daniel.kiper@oracle.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).