generator.ml: do not emit unused print_* functions
authorJim Meyering <meyering@redhat.com>
Mon, 17 Aug 2009 18:44:01 +0000 (20:44 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 18 Aug 2009 08:06:33 +0000 (10:06 +0200)
* src/generator.ml: Do not emit functions like print_xattr,
print_lvm_vg, print_inotify_event, that are not used.

src/generator.ml

index 4824438..08c28fc 100755 (executable)
@@ -6129,11 +6129,6 @@ and generate_fish_cmds () =
       ) cols;
       pr "}\n";
       pr "\n";
       ) cols;
       pr "}\n";
       pr "\n";
-      pr "static void print_%s (struct guestfs_%s *%s)\n" typ typ typ;
-      pr "{\n";
-      pr "  print_%s_indent (%s, \"\");\n" typ typ;
-      pr "}\n";
-      pr "\n";
   ) structs;
 
   (* Emit a print_TYPE_list function definition only if that function is used. *)
   ) structs;
 
   (* Emit a print_TYPE_list function definition only if that function is used. *)
@@ -6145,6 +6140,18 @@ and generate_fish_cmds () =
     | typ, _ -> () (* empty *)
   ) rstructs_used;
 
     | typ, _ -> () (* empty *)
   ) rstructs_used;
 
+  (* Emit a print_TYPE function definition only if that function is used. *)
+  List.iter (
+    function
+    | typ, RStructOnly ->
+        pr "static void print_%s (struct guestfs_%s *%s)\n" typ typ typ;
+        pr "{\n";
+        pr "  print_%s_indent (%s, \"\");\n" typ typ;
+        pr "}\n";
+        pr "\n";
+    | typ, _ -> () (* empty *)
+  ) rstructs_used;
+
   (* run_<action> actions *)
   List.iter (
     fun (name, style, _, flags, _, _, _) ->
   (* run_<action> actions *)
   List.iter (
     fun (name, style, _, flags, _, _, _) ->