From 8219490aae44fa79932d913cc69941d6b22a70a3 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 4 Jan 2018 18:35:40 +0100 Subject: Handle dcompcertc and dparsedc like all dump opts. This time with the correct place for setting the destination files. Bug 20521 --- cparser/Cprint.ml | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cparser/Cprint.ml') diff --git a/cparser/Cprint.ml b/cparser/Cprint.ml index 0a927873..d623ab96 100644 --- a/cparser/Cprint.ml +++ b/cparser/Cprint.ml @@ -555,3 +555,13 @@ let program pp prog = fprintf pp "@["; List.iter (globdecl pp) prog; fprintf pp "@]@." + +let destination : string option ref = ref None + +let print_if prog = + match !destination with + | None -> () + | Some f -> + let oc = open_out f in + program (formatter_of_out_channel oc) prog; + close_out oc -- cgit