From 689bddabd9bbcd27a83bb11fdc232d0db8193466 Mon Sep 17 00:00:00 2001 From: Mark Shinwell Date: Thu, 13 Oct 2022 14:54:37 +0100 Subject: [PATCH] flambda-backend: Add strict mode for ocamldep (#892) --- driver/makedepend.ml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/driver/makedepend.ml b/driver/makedepend.ml index 481b6507cc1..1d1f1dedd0d 100644 --- a/driver/makedepend.ml +++ b/driver/makedepend.ml @@ -38,6 +38,7 @@ let allow_approximation = ref false let map_files = ref [] let module_map = ref String.Map.empty let debug = ref false +let strict = ref false module Error_occurred : sig val set : unit -> unit @@ -327,7 +328,7 @@ let read_parse_and_extract parse_function extract_function def ast_kind end with x -> begin print_exception x; - if not !allow_approximation then begin + if !strict || not !allow_approximation then begin Error_occurred.set (); (String.Set.empty, def) end else @@ -415,7 +416,9 @@ let process_file_as process_fun def source_file = )); Location.input_name := source_file; try - if Sys.file_exists source_file then process_fun source_file else def + if !strict || Sys.file_exists source_file + then process_fun source_file + else def with x -> report_err x; def let process_file source_file ~ml_file ~mli_file ~def = @@ -642,6 +645,8 @@ let run_main argv = " (Windows) Use forward slash / instead of backslash \\ in file paths"; "-sort", Arg.Set sort_files, " Sort files according to their dependencies"; + "-strict", Arg.Set strict, + " Fail if an input file does not exist"; "-version", Arg.Unit print_version, " Print version and exit"; "-vnum", Arg.Unit print_version_num,