I see the following warnings:
cmds.c:934:13: warning: 'print_int_bool_list' defined but not used
cmds.c:1093:13: warning: 'print_stat_list' defined but not used
cmds.c:1124:13: warning: 'print_statvfs_list' defined but not used
cmds.c:1171:13: warning: 'print_version_list' defined but not used
This patch makes it so we don't emit the unused definitions:
From ff307d5e14b33fbbf97c411a97905127021b09fc Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 17 Aug 2009 20:28:34 +0200
Subject: [PATCH libguestfs] generator.ml: do not emit unused print_*_list functions
* src/generator.ml (emit_print_list_function): New function.
Emit a function definition only if it will be used.
---
src/generator.ml | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/src/generator.ml b/src/generator.ml
index ac01a98..03dc52b 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -6063,6 +6063,21 @@ and generate_fish_cmds () =
pr "}\n";
pr "\n";
+ let emit_print_list_function typ =
+ pr "static void print_%s_list (struct guestfs_%s_list *%ss)\n"
+ typ typ typ;
+ pr "{\n";
+ pr " int i;\n";
+ pr "\n";
+ pr " for (i = 0; i < %ss->len; ++i) {\n" typ;
+ pr " printf (\"[%%d] = {\\n\", i);\n";
+ pr " print_%s_indent (&%ss->val[i], \" \");\n" typ
typ;
+ pr " printf (\"}\\n\");\n";
+ pr " }\n";
+ pr "}\n";
+ pr "\n";
+ in
+
(* print_* functions *)
List.iter (
fun (typ, cols) ->
@@ -6119,20 +6134,17 @@ and generate_fish_cmds () =
pr " print_%s_indent (%s, \"\");\n" typ typ;
pr "}\n";
pr "\n";
- pr "static void print_%s_list (struct guestfs_%s_list *%ss)\n"
- typ typ typ;
- pr "{\n";
- pr " int i;\n";
- pr "\n";
- pr " for (i = 0; i < %ss->len; ++i) {\n" typ;
- pr " printf (\"[%%d] = {\\n\", i);\n";
- pr " print_%s_indent (&%ss->val[i], \" \");\n" typ
typ;
- pr " printf (\"}\\n\");\n";
- pr " }\n";
- pr "}\n";
- pr "\n";
) structs;
+ (* Emit a put_TYPE_list function definition only if that function is used. *)
+ List.iter (
+ function
+ | typ, (RStructListOnly | RStructAndList) ->
+ (* generate the function for typ *)
+ emit_print_list_function typ
+ | typ, _ -> () (* empty *)
+ ) rstructs_used;
+
(* run_<action> actions *)
List.iter (
fun (name, style, _, flags, _, _, _) ->
--
1.6.4.378.g88f2f