Skip to content

Commit

Permalink
Add empty action function to Target
Browse files Browse the repository at this point in the history
  • Loading branch information
Alasdair committed Nov 28, 2023
1 parent de3d7db commit bb1d6be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bin/sail.ml
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ let rec options =
("--help", Arg.Unit (fun () -> help !options), " display this list of options");
]

let register_default_target () = Target.register ~name:"default" (fun _ _ _ _ _ _ -> ())
let register_default_target () = Target.register ~name:"default" Target.empty_action

let run_sail (config : Yojson.Basic.t option) tgt =
Target.run_pre_parse_hook tgt ();
Expand Down
2 changes: 2 additions & 0 deletions src/lib/target.ml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ let register ~name ?flag ?description:desc ?(options = []) ?(pre_parse_hook = fu
targets := StringMap.add name tgt !targets;
tgt

let empty_action _ _ _ _ _ _ = ()

let get_the_target () = match !the_target with Some name -> StringMap.find_opt name !targets | None -> None

let get ~name = StringMap.find_opt name !targets
Expand Down
4 changes: 4 additions & 0 deletions src/lib/target.mli
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ val register :
(Yojson.Basic.t option -> string -> string option -> tannot ast -> Effects.side_effect_info -> Env.t -> unit) ->
target

(** Use if you want to register a target that does nothing *)
val empty_action :
Yojson.Basic.t option -> string -> string option -> tannot ast -> Effects.side_effect_info -> Env.t -> unit

(** Return the current target. For example, if we register a 'coq'
target, and Sail is invoked with `sail -coq`, then this function
will return the coq target. *)
Expand Down

0 comments on commit bb1d6be

Please sign in to comment.