From 46c3ab137fe6705293e8a44624e2a564cde1d55a Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Wed, 29 Nov 2017 14:37:37 +0100 Subject: Add a -Q option to coqchck. It has exactly the same effect as -R, because there is no such thing as implicit relativization for object files in coqchk, contrarily to what Require does in coqtop. --- checker/checker.ml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'checker') diff --git a/checker/checker.ml b/checker/checker.ml index b2433ee36..cc285d5e4 100644 --- a/checker/checker.ml +++ b/checker/checker.ml @@ -329,6 +329,9 @@ let parse_args argv = | ("-I"|"-include") :: d :: rem -> set_default_include d; parse rem | ("-I"|"-include") :: [] -> usage () + | "-Q" :: d :: p :: rem -> set_rec_include d p;parse rem + | "-Q" :: ([] | [_]) -> usage () + | "-R" :: d :: p :: rem -> set_rec_include d p;parse rem | "-R" :: ([] | [_]) -> usage () -- cgit v1.2.3 From 8ddc9cbd13ffc22a5895560102852506c9b1ece3 Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Wed, 29 Nov 2017 14:41:42 +0100 Subject: Mark the -I option in coqchk as deprecated and merge it with -Q. It is not doing the same thing as coqtop, and the corresponding coqtop semantics is irrelevant in the checker as the latter does not rely on ML code. --- checker/checker.ml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'checker') diff --git a/checker/checker.ml b/checker/checker.ml index cc285d5e4..596d42b66 100644 --- a/checker/checker.ml +++ b/checker/checker.ml @@ -96,17 +96,13 @@ let add_rec_path ~unix_path ~coq_root = (* By the option -include -I or -R of the command line *) let includes = ref [] -let push_include (s, alias) = includes := (s,alias,false) :: !includes -let push_rec_include (s, alias) = includes := (s,alias,true) :: !includes +let push_include (s, alias) = includes := (s,alias) :: !includes let set_default_include d = push_include (d, Check.default_root_prefix) let set_include d p = let p = dirpath_of_string p in push_include (d,p) -let set_rec_include d p = - let p = dirpath_of_string p in - push_rec_include(d,p) (* Initializes the LoadPath *) let init_load_path () = @@ -132,8 +128,7 @@ let init_load_path () = add_path ~unix_path:"." ~coq_root:Check.default_root_prefix; (* additional loadpath, given with -I -include -R options *) List.iter - (fun (unix_path, coq_root, reci) -> - if reci then add_rec_path ~unix_path ~coq_root else add_path ~unix_path ~coq_root) + (fun (unix_path, coq_root) -> add_rec_path ~unix_path ~coq_root) (List.rev !includes); includes := [] @@ -311,6 +306,9 @@ let explain_exn = function report ()) | e -> CErrors.print e (* for anomalies and other uncaught exceptions *) +let deprecated flag = + Feedback.msg_warning (str "Deprecated flag " ++ quote (str flag)) + let parse_args argv = let rec parse = function | [] -> () @@ -324,15 +322,15 @@ let parse_args argv = Flags.coqlib_spec := true; parse rem - | ("-I"|"-include") :: d :: "-as" :: p :: rem -> set_include d p; parse rem + | ("-I"|"-include") :: d :: "-as" :: p :: rem -> deprecated "-I"; set_include d p; parse rem | ("-I"|"-include") :: d :: "-as" :: [] -> usage () - | ("-I"|"-include") :: d :: rem -> set_default_include d; parse rem + | ("-I"|"-include") :: d :: rem -> deprecated "-I"; set_default_include d; parse rem | ("-I"|"-include") :: [] -> usage () - | "-Q" :: d :: p :: rem -> set_rec_include d p;parse rem + | "-Q" :: d :: p :: rem -> set_include d p;parse rem | "-Q" :: ([] | [_]) -> usage () - | "-R" :: d :: p :: rem -> set_rec_include d p;parse rem + | "-R" :: d :: p :: rem -> set_include d p;parse rem | "-R" :: ([] | [_]) -> usage () | "-debug" :: rem -> set_debug (); parse rem -- cgit v1.2.3 From a4dce1658f9a946cedb40ddcf0cdbc5391dd2005 Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Wed, 29 Nov 2017 14:49:14 +0100 Subject: Forbid implicitly relative names in the checker. Before this patch, passing a mere identifier (without dots) to the checker would make it consider it as implicitly referring to a relative name. For instance, if passed "foo", it would have looked for "Bar.foo.vo" and "Qux.foo.vo" if those files were in the loadpath. This was quite ad-hoc. We remove this "feature" and require the user to always give either a filename or a fully qualified logical name. --- checker/check.ml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'checker') diff --git a/checker/check.ml b/checker/check.ml index 21fdba1fa..a00ec3b0e 100644 --- a/checker/check.ml +++ b/checker/check.ml @@ -129,8 +129,6 @@ type logical_path = DirPath.t let load_paths = ref ([],[] : CUnix.physical_path list * logical_path list) -let get_load_paths () = fst !load_paths - (* Hints to partially detects if two paths refer to the same repertory *) let rec remove_path_dot p = let curdir = Filename.concat Filename.current_dir_name "" in (* Unix: "./" *) @@ -227,13 +225,8 @@ let locate_absolute_library dir = let locate_qualified_library qid = try - let loadpath = - (* Search library in loadpath *) - if qid.dirpath=[] then get_load_paths () - else - (* we assume qid is an absolute dirpath *) - load_paths_of_dir_path (dir_of_path qid) - in + (* we assume qid is an absolute dirpath *) + let loadpath = load_paths_of_dir_path (dir_of_path qid) in if loadpath = [] then raise LibUnmappedDir; let name = qid.basename^".vo" in let path, file = System.where_in_path loadpath name in -- cgit v1.2.3 From 9c0f36adac233efb1164ef88c86c78c7509d8b2c Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Wed, 29 Nov 2017 14:57:33 +0100 Subject: Documenting the -Q flag of coqchk. --- checker/checker.ml | 4 +++- doc/refman/RefMan-com.tex | 7 +++++-- man/coqchk.1 | 8 ++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) (limited to 'checker') diff --git a/checker/checker.ml b/checker/checker.ml index 596d42b66..fee31b667 100644 --- a/checker/checker.ml +++ b/checker/checker.ml @@ -174,7 +174,9 @@ let print_usage_channel co command = output_string co command; output_string co "coqchk options are:\n"; output_string co -" -R dir coqdir map physical dir to logical coqdir\ +" -Q dir coqdir map physical dir to logical coqdir\ +\n -R dir coqdir synonymous for -Q\ +\n\ \n\ \n -admit module load module and dependencies without checking\ \n -norec module check module but admit dependencies without checking\ diff --git a/doc/refman/RefMan-com.tex b/doc/refman/RefMan-com.tex index b4d9f60eb..04a8a25c1 100644 --- a/doc/refman/RefMan-com.tex +++ b/doc/refman/RefMan-com.tex @@ -331,9 +331,12 @@ code, it cannot be guaranteed that the produced compiled libraries are correct. {\tt coqchk} is a standalone verifier, and thus it cannot be tainted by such malicious code. -Command-line options {\tt -I}, {\tt -R}, {\tt -where} and +Command-line options {\tt -Q}, {\tt -R}, {\tt -where} and {\tt -impredicative-set} are supported by {\tt coqchk} and have the -same meaning as for {\tt coqtop}. Extra options are: +same meaning as for {\tt coqtop}. As there is no notion of relative paths in +object files {\tt -Q} and {\tt -R} have exactly the same meaning. + +Extra options are: \begin{description} \item[{\tt -norec} {\em module}]\ % diff --git a/man/coqchk.1 b/man/coqchk.1 index a00914eab..f9241c0d4 100644 --- a/man/coqchk.1 +++ b/man/coqchk.1 @@ -34,12 +34,16 @@ add directory in the include path .TP -.BI \-R \ dir\ coqdir -recursively map physical +.BI \-Q \ dir\ coqdir +map physical .I dir to logical .I coqdir +.TP +.BI \-R \ dir\ coqdir +synonymous for -Q + .TP .BI \-silent makes coqchk less verbose. -- cgit v1.2.3