aboutsummaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
Diffstat (limited to 'library')
-rw-r--r--library/goptions.ml12
-rw-r--r--library/goptions.mli12
-rw-r--r--library/library.ml3
3 files changed, 17 insertions, 10 deletions
diff --git a/library/goptions.ml b/library/goptions.ml
index 1b907fd966..b9c1802a72 100644
--- a/library/goptions.ml
+++ b/library/goptions.ml
@@ -57,7 +57,7 @@ module MakeTable =
type key
val compare : t -> t -> int
val table : (string * key table_of_A) list ref
- val encode : key -> t
+ val encode : Environ.env -> key -> t
val subst : substitution -> t -> t
val printer : t -> Pp.t
val key : option_name
@@ -111,10 +111,10 @@ module MakeTable =
class table_of_A () =
object
- method add x = add_option (A.encode x)
- method remove x = remove_option (A.encode x)
+ method add x = add_option (A.encode (Global.env()) x)
+ method remove x = remove_option (A.encode (Global.env()) x)
method mem x =
- let y = A.encode x in
+ let y = A.encode (Global.env()) x in
let answer = MySet.mem y !t in
Feedback.msg_info (A.member_message y answer)
method print = print_table A.title A.printer !t
@@ -142,7 +142,7 @@ struct
type key = string
let compare = String.compare
let table = string_table
- let encode x = x
+ let encode _env x = x
let subst _ x = x
let printer = str
let key = A.key
@@ -161,7 +161,7 @@ module type RefConvertArg =
sig
type t
val compare : t -> t -> int
- val encode : qualid -> t
+ val encode : Environ.env -> qualid -> t
val subst : substitution -> t -> t
val printer : t -> Pp.t
val key : option_name
diff --git a/library/goptions.mli b/library/goptions.mli
index b91553bf3c..2e593e9d9e 100644
--- a/library/goptions.mli
+++ b/library/goptions.mli
@@ -89,8 +89,8 @@ module MakeRefTable :
(A : sig
type t
val compare : t -> t -> int
- val encode : qualid -> t
- val subst : substitution -> t -> t
+ val encode : Environ.env -> qualid -> t
+ val subst : substitution -> t -> t
val printer : t -> Pp.t
val key : option_name
val title : string
@@ -172,6 +172,14 @@ type option_value =
| StringValue of string
| StringOptValue of string option
+val set_option_value : ?locality:option_locality ->
+ ('a -> option_value -> option_value) -> option_name -> 'a -> unit
+(** [set_option_value ?locality f name v] sets [name] to the result of
+ applying [f] to [v] and [name]'s current value. Use for behaviour
+ depending on the type of the option, eg erroring when ['a] doesn't
+ match it. Changing the type will result in errors later so don't do
+ that. *)
+
(** Summary of an option status *)
type option_state = {
opt_depr : bool;
diff --git a/library/library.ml b/library/library.ml
index 37dadadb76..04e38296d9 100644
--- a/library/library.ml
+++ b/library/library.ml
@@ -718,8 +718,7 @@ let save_library_to ?todo ~output_native_objects dir f otab =
(* Writing native code files *)
if output_native_objects then
let fn = Filename.dirname f'^"/"^Nativecode.mod_uid_of_dirpath dir in
- if not (Nativelib.compile_library dir ast fn) then
- user_err Pp.(str "Could not compile the library to native code.")
+ Nativelib.compile_library dir ast fn
with reraise ->
let reraise = CErrors.push reraise in
let () = Feedback.msg_warning (str "Removed file " ++ str f') in