Skip to content
Snippets Groups Projects
Commit 988432d3 authored by Thibault Martin's avatar Thibault Martin Committed by Allan Blanchard
Browse files

Generates assigns for prototypes in frama-c mode

parent 4852dc9c
No related branches found
No related tags found
No related merge requests found
...@@ -48,7 +48,7 @@ sig ...@@ -48,7 +48,7 @@ sig
val acsl_default : unit -> clause val acsl_default : unit -> clause
val safe_default : bool -> clause val safe_default : bool -> clause
val frama_c_default : unit -> clause val frama_c_default : kernel_function -> clause
val combine_default : clause list -> clause val combine_default : clause list -> clause
val custom_default : string -> kernel_function -> spec -> clause val custom_default : string -> kernel_function -> spec -> clause
...@@ -69,7 +69,7 @@ struct ...@@ -69,7 +69,7 @@ struct
| None when mode = Safe -> | None when mode = Safe ->
Generated(G.safe_default @@ Kernel_function.has_definition kf) Generated(G.safe_default @@ Kernel_function.has_definition kf)
| None when mode = Frama_C -> | None when mode = Frama_C ->
Generated(G.frama_c_default ()) Generated(G.frama_c_default kf)
| None -> | None ->
match mode with match mode with
| ACSL | Safe | Frama_C -> assert false | ACSL | Safe | Frama_C -> assert false
...@@ -111,7 +111,7 @@ struct ...@@ -111,7 +111,7 @@ struct
then [ Exits, Logic_const.(new_predicate pfalse) ] then [ Exits, Logic_const.(new_predicate pfalse) ]
else [] else []
let frama_c_default () = let frama_c_default _ =
[ Exits, Logic_const.(new_predicate pfalse) ] [ Exits, Logic_const.(new_predicate pfalse) ]
let combine_default (clauses : clause list) = let combine_default (clauses : clause list) =
...@@ -166,8 +166,10 @@ struct ...@@ -166,8 +166,10 @@ struct
then Writes [] then Writes []
else WritesAny else WritesAny
let frama_c_default () = let frama_c_default kf =
acsl_default () (* todo : port infer annotations *) if Kernel_function.has_definition kf then
acsl_default () (* TODO: use genassigns *)
else Writes (Infer_annotations.assigns_from_prototype kf)
let compare_deps d1 d2 = let compare_deps d1 d2 =
match d1, d2 with match d1, d2 with
...@@ -239,7 +241,7 @@ struct ...@@ -239,7 +241,7 @@ struct
then FreeAlloc([],[]) then FreeAlloc([],[])
else FreeAllocAny else FreeAllocAny
let frama_c_default () = let frama_c_default _ =
acsl_default () acsl_default ()
let combine_default clauses = let combine_default clauses =
...@@ -282,7 +284,7 @@ struct ...@@ -282,7 +284,7 @@ struct
then Some(Logic_const.(new_predicate ptrue)) then Some(Logic_const.(new_predicate ptrue))
else Some(Logic_const.(new_predicate pfalse)) else Some(Logic_const.(new_predicate pfalse))
let frama_c_default () = let frama_c_default _ =
acsl_default () acsl_default ()
let combine_default _ = let combine_default _ =
...@@ -305,8 +307,9 @@ let get_mode = function ...@@ -305,8 +307,9 @@ let get_mode = function
| "acsl" -> ACSL | "acsl" -> ACSL
| "safe" -> Safe | "safe" -> Safe
| s -> | s ->
Kernel.abort "\'%s\' is not a valid mode for spec generation, accepted values \ Kernel.abort
are 'frama-c', 'acsl' and 'safe'" s "\'%s\' is not a valid mode for spec generation, accepted values \
are 'frama-c', 'acsl' and 'safe'" s
let build_config mode = { let build_config mode = {
exits = mode; exits = mode;
...@@ -329,8 +332,9 @@ let get_config () = ...@@ -329,8 +332,9 @@ let get_config () =
| "allocates" -> {conf with allocates = mode} | "allocates" -> {conf with allocates = mode}
| "terminates" -> {conf with terminates = mode} | "terminates" -> {conf with terminates = mode}
| s -> | s ->
Kernel.abort "\'%s\' is not a valid clause for spec generation, accepted \ Kernel.abort
values are 'exits', 'assigns', 'allocates' and 'terminates'" s "\'%s\' is not a valid clause for spec generation, accepted \
values are 'exits', 'assigns', 'allocates' and 'terminates'" s
in in
Datatype.String.Map.fold apply_custom custom_map default Datatype.String.Map.fold apply_custom custom_map default
......
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