aboutsummaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
authorMaxime Dénès2018-03-08 10:11:49 +0100
committerMaxime Dénès2018-03-08 10:11:49 +0100
commitc31c6d92d2b2c314ea9c633f9e0f14500c2785b0 (patch)
tree7cd0f3c56b5b1e6dbf433e66e1d03fbb89d1f8a8 /library
parentc5cd6f93bc14c66a3e4d7e17f8d18dc9fb2308d7 (diff)
parent5cbb460234e32f5e325c60aaada91d3cea298b9f (diff)
Merge PR #6934: Warn when using “Require” in a section
Diffstat (limited to 'library')
-rw-r--r--library/summary.ml12
1 files changed, 11 insertions, 1 deletions
diff --git a/library/summary.ml b/library/summary.ml
index 6ca8715559..7ef19fbfb4 100644
--- a/library/summary.ml
+++ b/library/summary.ml
@@ -89,6 +89,16 @@ let unfreeze_single name state =
Pp.(seq [str "Error unfreezing summary "; str name; fnl (); CErrors.iprint e]);
iraise e
+let warn_summary_out_of_scope =
+ let name = "summary-out-of-scope" in
+ let category = "dev" in
+ let default = CWarnings.Disabled in
+ CWarnings.create ~name ~category ~default (fun name ->
+ Pp.str (Printf.sprintf
+ "A Coq plugin was loaded inside a local scope (such as a Section). It is recommended to load plugins at the start of the file. Summary entry: %s"
+ name)
+ )
+
let unfreeze_summaries ?(partial=false) { summaries; ml_module } =
(* The unfreezing of [ml_modules_summary] has to be anticipated since it
* may modify the content of [summaries] by loading new ML modules *)
@@ -101,7 +111,7 @@ let unfreeze_summaries ?(partial=false) { summaries; ml_module } =
try decl.unfreeze_function String.Map.(find name summaries)
with Not_found ->
if not partial then begin
- Feedback.msg_warning Pp.(str "Summary was captured out of module scope for entry " ++ str name);
+ warn_summary_out_of_scope name;
decl.init_function ()
end;
in