[Libguestfs] [p2v PATCH 1/7] "shutdown_actions": suppress "missing initializer" warnings/errors

Laszlo Ersek
2022-09-26T08:18:06Z

gcc reports:

> gui.c:1795:3: error: missing initializer for field ?padding? of
> ?GActionEntry? {aka ?const struct _GActionEntry?}
> [-Werror=missing-field-initializers]
>  1795 |   { "shutdown", activate_action, NULL, NULL, NULL },
>
> gui.c:1796:3: error: missing initializer for field ?padding? of
> ?GActionEntry? {aka ?const struct _GActionEntry?}
> [-Werror=missing-field-initializers]
>  1796 |   { "reboot", activate_action, NULL, NULL, NULL },

I've found this only now because:

- this is the first time I'm building virt-p2v with GTK3,

- the "shutdown_actions" array depends on USE_POPOVERS which depends
on
  GTK3 being selected,

- the "missing-field-initializers" warning (treated as an error) has
  recently been enabled via "-Wextra" in commit 391f9833d398
("p2v-c.m4:
  elicit a stricter set of warnings from gcc", 2022-09-23).

The C-language documentation for GActionEntry is silent on the
"padding"
array:

  https://docs.gtk.org/gio/struct.ActionEntry.html

However, the D-language docs expose it:

  https://api.gtkd.org/gio.c.types.GActionEntry.html

Provide the missing field initializer.

Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---
 gui.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gui.c b/gui.c
index 49301d9a985b..4faaa710ed90 100644
--- a/gui.c
+++ b/gui.c
@@ -1792,8 +1792,8 @@ static gboolean close_running_dialog (GtkWidget *w,
GdkEvent *event, gpointer da

 #ifdef USE_POPOVERS
 static const GActionEntry shutdown_actions[] = {
-  { "shutdown", activate_action, NULL, NULL, NULL },
-  { "reboot", activate_action, NULL, NULL, NULL },
+  { "shutdown", activate_action, NULL, NULL, NULL, { 0 } },
+  { "reboot", activate_action, NULL, NULL, NULL, { 0 } },
 };
 #endif