[Libguestfs] [PATCH 3/4] generator: Make the 'this file is generated' warning clearer.

Richard W.M. Jones rjones at redhat.com
Tue Feb 23 08:19:25 UTC 2016


Also rename the ~extra_inputs parameter as plain ~inputs.  We will use
~inputs more widely in following commits.
---
 generator/docstrings.ml  | 13 +++++++++----
 generator/docstrings.mli |  2 +-
 gobject/Makefile.inc     |  4 ++--
 java/Makefile.inc        |  4 ++--
 4 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/generator/docstrings.ml b/generator/docstrings.ml
index 488526f..9d3fd0b 100644
--- a/generator/docstrings.ml
+++ b/generator/docstrings.ml
@@ -67,8 +67,7 @@ type comment_style =
   | ErlangStyle | LuaStyle | PODStyle
 type license = GPLv2plus | LGPLv2plus
 
-let generate_header ?(extra_inputs = []) ?emacs_mode comment license =
-  let inputs = "generator/ *.ml" :: extra_inputs in
+let generate_header ?(inputs = []) ?emacs_mode comment license =
   let c = match comment with
     | CStyle ->         pr "/* "; " *"
     | CPlusPlusStyle -> pr "// "; "//"
@@ -84,8 +83,14 @@ let generate_header ?(extra_inputs = []) ?emacs_mode comment license =
   | Some mode -> pr " -*- %s -*-" mode
   );
   pr "\n";
-  pr "%s WARNING: THIS FILE IS GENERATED FROM:\n" c;
-  List.iter (pr "%s   %s\n" c) inputs;
+  if inputs <> [] then (
+    pr "%s WARNING: THIS FILE IS GENERATED FROM THE FOLLOWING FILES:\n" c;
+    List.iter (pr "%s          %s\n" c) inputs;
+    pr "%s          and from the code in the generator/ subdirectory.\n" c
+  ) else (
+    pr "%s WARNING: THIS FILE IS GENERATED\n" c;
+    pr "%s          from the code in the generator/ subdirectory.\n" c
+  );
   pr "%s ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.\n" c;
   pr "%s\n" c;
   pr "%s Copyright (C) %s Red Hat Inc.\n" c copyright_years;
diff --git a/generator/docstrings.mli b/generator/docstrings.mli
index 22cadeb..204b38d 100644
--- a/generator/docstrings.mli
+++ b/generator/docstrings.mli
@@ -31,4 +31,4 @@ val version_added : Types.action -> string option
 
 val copyright_years : string
 
-val generate_header : ?extra_inputs:string list -> ?emacs_mode:string -> comment_style -> license -> unit
+val generate_header : ?inputs:string list -> ?emacs_mode:string -> comment_style -> license -> unit
diff --git a/gobject/Makefile.inc b/gobject/Makefile.inc
index 5ba0fc9..866e1be 100644
--- a/gobject/Makefile.inc
+++ b/gobject/Makefile.inc
@@ -1,6 +1,6 @@
 # libguestfs generated file
-# WARNING: THIS FILE IS GENERATED FROM:
-#   generator/ *.ml
+# WARNING: THIS FILE IS GENERATED
+#          from the code in the generator/ subdirectory.
 # ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
 #
 # Copyright (C) 2009-2016 Red Hat Inc.
diff --git a/java/Makefile.inc b/java/Makefile.inc
index 8c17443..86da36a 100644
--- a/java/Makefile.inc
+++ b/java/Makefile.inc
@@ -1,6 +1,6 @@
 # libguestfs generated file
-# WARNING: THIS FILE IS GENERATED FROM:
-#   generator/ *.ml
+# WARNING: THIS FILE IS GENERATED
+#          from the code in the generator/ subdirectory.
 # ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
 #
 # Copyright (C) 2009-2016 Red Hat Inc.
-- 
2.5.0




More information about the Libguestfs mailing list