summaryrefslogtreecommitdiff
path: root/src/sail.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/sail.ml')
-rw-r--r--src/sail.ml14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/sail.ml b/src/sail.ml
index ddea4a41..516b3726 100644
--- a/src/sail.ml
+++ b/src/sail.ml
@@ -70,6 +70,7 @@ let opt_file_arguments = ref ([]:string list)
let opt_process_elf : string option ref = ref None
let opt_ocaml_generators = ref ([]:string list)
let opt_splice = ref ([]:string list)
+let opt_have_feature = ref None
let set_target name = Arg.Unit (fun _ -> opt_target := Some name)
@@ -276,6 +277,9 @@ let options = Arg.align ([
( "-memo",
Arg.Tuple [Arg.Set opt_memo_z3; Arg.Set C_backend.opt_memo_cache],
" memoize calls to z3, and intermediate compilation results");
+ ( "-have_feature",
+ Arg.String (fun symbol -> opt_have_feature := Some symbol),
+ " check if a feature symbol is set by default");
( "-splice",
Arg.String (fun s -> opt_splice := s :: !opt_splice),
"<filename> add functions from file, replacing existing definitions where necessary");
@@ -548,7 +552,17 @@ let target name out_name ast type_envs =
| Some t ->
raise (Reporting.err_unreachable Parse_ast.Unknown __POS__ ("Undefined target: " ^ t))
+let feature_check () =
+ match !opt_have_feature with
+ | None -> ()
+ | Some symbol ->
+ if Process_file.have_symbol symbol then
+ exit 0
+ else
+ exit 2
+
let main () =
+ feature_check ();
if !opt_print_version then
print_endline version
else