generator: Make the 'this file is generated' warning clearer.

Also rename the ~extra_inputs parameter as plain ~inputs.  We will use
~inputs more widely in following commit.
This commit is contained in:
Richard W.M. Jones
2016-02-22 21:53:43 +00:00
parent 9eb26a1748
commit 52b5ddf23e
4 changed files with 14 additions and 9 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -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.

View File

@@ -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.