From f8cfbc1bc22c06835e9ea7b0cab41a8f25b523ba Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 2 Jul 2020 14:52:34 +0200 Subject: Introduce additional "branch" build information. --- Makefile | 5 ++++- VERSION | 1 + backend/PrintAsmaux.ml | 4 ++-- cparser/Diagnostics.ml | 10 +++++----- debug/Dwarfgen.ml | 4 ++-- driver/CommonOptions.ml | 8 +++++--- exportclight/ExportClight.ml | 1 + 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index d91c5f37..5e97ebbf 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ include VERSION BUILDVERSION ?= $(version) BUILDNR ?= $(buildnr) TAG ?= $(tag) +BRANCH ?= $(branch) ifeq ($(wildcard $(ARCH)_$(BITSIZE)),) ARCHDIRS=$(ARCH) @@ -238,12 +239,14 @@ compcert.config: Makefile.config echo "COMPCERT_VERSION=$(BUILDVERSION)"; \ echo "COMPCERT_BUILDNR=$(BUILDNR)"; \ echo "COMPCERT_TAG=$(TAG)" \ + echo "COMPCERT_BRANCH=$(BRANCH)" \ ) > compcert.config driver/Version.ml: VERSION (echo 'let version = "$(BUILDVERSION)"'; \ echo 'let buildnr = "$(BUILDNR)"'; \ - echo 'let tag = "$(TAG)"';) > driver/Version.ml + echo 'let tag = "$(TAG)"'; \ + echo 'let branch = "$(BRANCH)"') > driver/Version.ml cparser/Parser.v: cparser/Parser.vy @rm -f $@ diff --git a/VERSION b/VERSION index b60e8d9b..f544e624 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,4 @@ version=3.7 buildnr= tag= +branch= diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml index d82e6f84..d31507ff 100644 --- a/backend/PrintAsmaux.ml +++ b/backend/PrintAsmaux.ml @@ -293,8 +293,8 @@ let print_inline_asm print_preg oc txt sg args res = let print_version_and_options oc comment = let version_string = - if Version.buildnr <> "" && Version.tag <> "" then - sprintf "Release: %s, Build: %s, Tag: %s" Version.version Version.buildnr Version.tag + if Version.buildnr <> "" && Version.tag <> "" && Version.branch <> "" then + sprintf "Release: %s, Build: %s, Tag: %s, Branch: %s" Version.version Version.buildnr Version.tag Version.branch else Version.version in fprintf oc "%s File generated by CompCert %s\n" comment version_string; diff --git a/cparser/Diagnostics.ml b/cparser/Diagnostics.ml index 7957375c..86a5e522 100644 --- a/cparser/Diagnostics.ml +++ b/cparser/Diagnostics.ml @@ -400,16 +400,16 @@ let raise_on_errors () = raise Abort let crash exn = - if Version.buildnr <> "" && Version.tag <> "" then begin + if Version.buildnr <> "" && Version.tag <> "" && Version.branch <> "" then begin let backtrace = Printexc.get_backtrace () in - eprintf "%tThis is CompCert, Release %s, Build:%s, Tag:%s%t\n" - bc Version.version Version.buildnr Version.tag rsc; + eprintf "%tThis is CompCert, Release %s, Build:%s, Tag:%s, Branch:%s%t\n" + bc Version.version Version.buildnr Version.tag Version.branch rsc; eprintf "Backtrace (please include this in your support request):\n%s" backtrace; eprintf "%tUncaught exception: %s.\n\ \ Please report this problem to our support.\n\ -\ Error occurred in Build: %s, Tag: %s.\n%t" - rc (Printexc.to_string exn) Version.buildnr Version.tag rsc; +\ Error occurred in Build: %s, Tag: %s, Branch %s.\n%t" + rc (Printexc.to_string exn) Version.buildnr Version.tag Version.branch rsc; exit 2 end else begin let backtrace = Printexc.get_backtrace () diff --git a/debug/Dwarfgen.ml b/debug/Dwarfgen.ml index 6c1d0846..020ac60e 100644 --- a/debug/Dwarfgen.ml +++ b/debug/Dwarfgen.ml @@ -543,8 +543,8 @@ let diab_file_loc sec (f,l) = let prod_name = let version_string = - if Version.buildnr <> "" && Version.tag <> "" then - Printf.sprintf "Release: %s, Build: %s, Tag: %s" Version.version Version.buildnr Version.tag + if Version.buildnr <> "" && Version.tag <> "" && Version.branch <> "" then + Printf.sprintf "Release: %s, Build: %s, Tag: %s, Branch:%s" Version.version Version.buildnr Version.tag Version.branch else Version.version in Printf.sprintf "AbsInt Angewandte Informatik GmbH:CompCert Version %s:(%s,%s,%s,%s)" diff --git a/driver/CommonOptions.ml b/driver/CommonOptions.ml index fc7bbb77..a2f249c1 100644 --- a/driver/CommonOptions.ml +++ b/driver/CommonOptions.ml @@ -15,8 +15,9 @@ open Commandline (* The version string for [tool_name] *) let version_string tool_name = - if Version.buildnr <> "" && Version.tag <> "" then - Printf.sprintf "The CompCert %s, Release: %s, Build: %s, Tag: %s\n" tool_name Version.version Version.buildnr Version.tag + if Version.buildnr <> "" && Version.tag <> "" && Version.branch <> "" then + Printf.sprintf "The CompCert %s, Release: %s, Build: %s, Tag: %s, Branch %s\n" + tool_name Version.version Version.buildnr Version.tag Version.branch else Printf.sprintf "The CompCert %s, version %s\n" tool_name Version.version @@ -26,7 +27,8 @@ let print_version_and_exit tool_name () = let version_file_string tool_name = if Version.buildnr <> "" && Version.tag <> "" then - Printf.sprintf "This is CompCert %s,\nVersion: %s,\nBuild: %s,\nTag: %s\n" tool_name Version.version Version.buildnr Version.tag + Printf.sprintf "This is CompCert %s,\nVersion: %s,\nBuild: %s,\nTag: %s,\nBranch: %s\n" + tool_name Version.version Version.buildnr Version.tag Version.branch else Printf.sprintf "The CompCert %s,\nversion %s\n" tool_name Version.version diff --git a/exportclight/ExportClight.ml b/exportclight/ExportClight.ml index 321ed8c9..4a85b591 100644 --- a/exportclight/ExportClight.ml +++ b/exportclight/ExportClight.ml @@ -514,6 +514,7 @@ let print_clightgen_info p sourcefile normalized = fprintf p "@ Definition version := %S." Version.version; fprintf p "@ Definition build_number := %S." Version.buildnr; fprintf p "@ Definition build_tag := %S." Version.tag; + fprintf p "@ Definition build_branch := %S." Version.branch; fprintf p "@ Definition arch := %S." Configuration.arch; fprintf p "@ Definition model := %S." Configuration.model; fprintf p "@ Definition abi := %S." Configuration.abi; -- cgit