From 8c28d0630576de35e739edebc2abe127d18de22a Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 9 May 2016 07:38:06 +0200 Subject: Added version string to Clightgen. Clightgen now also prints a version string. Also the CompCert version string is now similar in both modes. Bug 18768. --- exportclight/Clightgen.ml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'exportclight') diff --git a/exportclight/Clightgen.ml b/exportclight/Clightgen.ml index c6ba9649..0a586acd 100644 --- a/exportclight/Clightgen.ml +++ b/exportclight/Clightgen.ml @@ -67,9 +67,15 @@ let process_c_file sourcename = compile_c_file sourcename preproname (prefixname ^ ".v") end +let version_string = + if Version.buildnr <> "" && Version.tag <> "" then + sprintf "The CompCert Clight generator, %s, Build: %s, Tag: %s\n" Version.version Version.buildnr Version.tag + else + "The CompCert Clight generator, version "^ Version.version ^ "\n" + let usage_string = -"The CompCert Clight generator\n\ -Usage: clightgen [options] \n\ + version_string ^ +"Usage: clightgen [options] \n\ Recognized source files:\n\ \ .c C source file\n\ Processing options:\n\ @@ -95,6 +101,9 @@ General options:\n\ let print_usage_and_exit _ = printf "%s" usage_string; exit 0 +let print_version_and_exit _ = + printf "%s" version_string; exit 0 + let language_support_options = [ option_fbitfields; option_flongdouble; option_fstruct_passing; option_fvararg_calls; option_funprototyped; @@ -111,6 +120,9 @@ let cmdline_actions = (* Getting help *) Exact "-help", Self print_usage_and_exit; Exact "--help", Self print_usage_and_exit; +(* Getting version info *) + Exact "-version", Self print_version_and_exit; + Exact "--version", Self print_version_and_exit; (* Processing options *) Exact "-E", Set option_E;] (* Preprocessing options *) -- cgit