Skip to content
Snippets Groups Projects
Commit 7cf1420c authored by Basile Desloges's avatar Basile Desloges
Browse files

[eacsl] Remove `reverse` parameter of `mk_runtime_check`

parent 57a28d88
No related branches found
No related tags found
No related merge requests found
...@@ -158,14 +158,9 @@ let mk_mark_readonly vi = ...@@ -158,14 +158,9 @@ let mk_mark_readonly vi =
let loc = vi.vdecl in let loc = vi.vdecl in
mk_rtl_call ~loc "mark_readonly" [ Cil.evar ~loc vi ] mk_rtl_call ~loc "mark_readonly" [ Cil.evar ~loc vi ]
let mk_runtime_check_with_msg ?(reverse=false) ~loc msg kind kf e = let mk_runtime_check_with_msg ~loc msg kind kf e =
let file = (fst loc).Filepath.pos_path in let file = (fst loc).Filepath.pos_path in
let line = (fst loc).Filepath.pos_lnum in let line = (fst loc).Filepath.pos_lnum in
let e =
if reverse
then Cil.new_exp ~loc:e.eloc (UnOp(LNot, e, Cil.intType))
else e
in
mk_rtl_call ~loc mk_rtl_call ~loc
"assert" "assert"
[ e; [ e;
...@@ -175,18 +170,13 @@ let mk_runtime_check_with_msg ?(reverse=false) ~loc msg kind kf e = ...@@ -175,18 +170,13 @@ let mk_runtime_check_with_msg ?(reverse=false) ~loc msg kind kf e =
Cil.mkString ~loc (Filepath.Normalized.to_pretty_string file); Cil.mkString ~loc (Filepath.Normalized.to_pretty_string file);
Cil.integer loc line ] Cil.integer loc line ]
let mk_runtime_check ?(reverse=false) kind kf e p = let mk_runtime_check kind kf e p =
let loc = p.pred_loc in let loc = p.pred_loc in
let p =
if reverse
then Logic_const.pnot ~loc p
else p
in
let msg = let msg =
Kernel.Unicode.without_unicode Kernel.Unicode.without_unicode
(Format.asprintf "%a@?" Printer.pp_predicate) p (Format.asprintf "%a@?" Printer.pp_predicate) p
in in
mk_runtime_check_with_msg ~reverse ~loc msg kind kf e mk_runtime_check_with_msg ~loc msg kind kf e
(* (*
Local Variables: Local Variables:
......
...@@ -80,16 +80,14 @@ type annotation_kind = ...@@ -80,16 +80,14 @@ type annotation_kind =
| RTE | RTE
val mk_runtime_check: val mk_runtime_check:
?reverse:bool -> annotation_kind -> kernel_function -> exp -> predicate -> annotation_kind -> kernel_function -> exp -> predicate -> stmt
stmt
(** [mk_runtime_check kind kf e p] generates a runtime check for predicate [p] (** [mk_runtime_check kind kf e p] generates a runtime check for predicate [p]
by building a call to [__e_acsl_assert]. [e] (or [!e] if [reverse] is set to by building a call to [__e_acsl_assert]. [e] (or [!e] if [reverse] is set to
[true]) is the C translation of [p], [kf] is the current kernel_function and [true]) is the C translation of [p], [kf] is the current kernel_function and
[kind] is the annotation kind of [p]. *) [kind] is the annotation kind of [p]. *)
val mk_runtime_check_with_msg: val mk_runtime_check_with_msg:
?reverse:bool -> loc:location -> string -> annotation_kind -> loc:location -> string -> annotation_kind -> kernel_function -> exp -> stmt
kernel_function -> exp -> stmt
(** [mk_runtime_check_with_msg kind kf e msg] generates a runtime check for [e] (** [mk_runtime_check_with_msg kind kf e msg] generates a runtime check for [e]
(or [!e] if [reverse] is [true]) by building a call to [__e_acsl_assert]. (or [!e] if [reverse] is [true]) by building a call to [__e_acsl_assert].
[msg] is the message printed if the runtime check fails. [loc] is the [msg] is the message printed if the runtime check fails. [loc] is the
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment