[Libosinfo] [PATCH] tools: Fix compilation with Clang 6

Andrea Bolognani abologna at redhat.com
Fri May 11 15:01:53 UTC 2018


Clang 6 doesn't like the way the last item in a GOptionEntry
array is initialized:

  ../../tools/osinfo-install-script.c:87:12: error: missing field
  'short_name' initializer [-Werror,-Wmissing-field-initializers]
      { NULL }
             ^
  1 error generated.
  gmake[2]: *** [Makefile:540: osinfo-install-script.o] Error 1
  gmake[2]: *** Waiting for unfinished jobs....
  ../../tools/osinfo-detect.c:104:12: error: missing field
  'short_name' initializer [-Werror,-Wmissing-field-initializers]
      { NULL }
             ^
  1 error generated.
  gmake[2]: *** [Makefile:540: osinfo-detect.o] Error 1

Fix the issue by initializing all fields explicitly.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 tools/osinfo-detect.c         | 2 +-
 tools/osinfo-install-script.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/osinfo-detect.c b/tools/osinfo-detect.c
index 2e5af97..460c6e1 100644
--- a/tools/osinfo-detect.c
+++ b/tools/osinfo-detect.c
@@ -101,7 +101,7 @@ static GOptionEntry entries[] =
       G_OPTION_ARG_CALLBACK, parse_type_str,
       N_("URL type. Default: media"),
       N_("media|tree.") },
-    { NULL }
+    { NULL, 0, 0, 0, NULL, NULL, NULL }
 };
 
 static void print_bootable(gboolean bootable)
diff --git a/tools/osinfo-install-script.c b/tools/osinfo-install-script.c
index 75bfda1..1230806 100644
--- a/tools/osinfo-install-script.c
+++ b/tools/osinfo-install-script.c
@@ -84,7 +84,7 @@ static GOptionEntry entries[] =
       (void*)&list_inj_method, N_("List supported injection methods"), NULL },
     { "quiet", 'q', 0, G_OPTION_ARG_NONE, (void*)&quiet,
       N_("Do not display output filenames"), NULL },
-    { NULL }
+    { NULL, 0, 0, 0, NULL, NULL, NULL }
 };
 
 
-- 
2.17.0




More information about the Libosinfo mailing list