From b49feed2f88c0a6ae9cc2ca4b2982096f18a2112 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 6 May 2019 17:07:24 +0200 Subject: Expand the responsefiles earlier * Move the expansion of response files to module Commandline, during the initialization of `Commandline.argv`. This way we're sure it's done exactly once. * Make `Commandline.argv` a `string array` instead of a `string array ref`. We no longer need to update it after initialization! * Improve reporting of errors during expansion of response files. --- backend/JsonAST.ml | 4 ++-- backend/PrintAsmaux.ml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'backend') diff --git a/backend/JsonAST.ml b/backend/JsonAST.ml index 3469bdc6..599c6ecb 100644 --- a/backend/JsonAST.ml +++ b/backend/JsonAST.ml @@ -129,9 +129,9 @@ let pp_ast pp pp_inst ast sourcename = let get_args () = let buf = Buffer.create 100 in Buffer.add_string buf Sys.executable_name; - for i = 1 to (Array.length !Commandline.argv - 1) do + for i = 1 to (Array.length Commandline.argv - 1) do Buffer.add_string buf " "; - Buffer.add_string buf (Responsefile.gnu_quote !Commandline.argv.(i)); + Buffer.add_string buf (Responsefile.gnu_quote Commandline.argv.(i)); done; Buffer.contents buf in let dump_compile_info pp () = diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml index f9ed569f..6f293bf4 100644 --- a/backend/PrintAsmaux.ml +++ b/backend/PrintAsmaux.ml @@ -294,7 +294,7 @@ let print_version_and_options oc comment = Version.version in fprintf oc "%s File generated by CompCert %s\n" comment version_string; fprintf oc "%s Command line:" comment; - for i = 1 to Array.length Sys.argv - 1 do - fprintf oc " %s" Sys.argv.(i) + for i = 1 to Array.length Commandline.argv - 1 do + fprintf oc " %s" Commandline.argv.(i) done; fprintf oc "\n" -- cgit