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

Make matchs more strict/accurate

parent 05205de0
No related branches found
No related tags found
No related merge requests found
...@@ -124,7 +124,7 @@ struct ...@@ -124,7 +124,7 @@ struct
else else
let completes_opt = G.completes spec.spec_complete_behaviors table in let completes_opt = G.completes spec.spec_complete_behaviors table in
match mode, completes_opt with match mode, completes_opt with
| _, Some completes_clauses -> | (Safe | Frama_C | Other _), Some completes_clauses ->
Generated (G.combine_default completes_clauses) Generated (G.combine_default completes_clauses)
| Safe, None -> | Safe, None ->
Generated(G.safe_default @@ Kernel_function.has_definition kf) Generated(G.safe_default @@ Kernel_function.has_definition kf)
...@@ -132,7 +132,7 @@ struct ...@@ -132,7 +132,7 @@ struct
Generated(G.frama_c_default kf) Generated(G.frama_c_default kf)
| Other mode, None -> | Other mode, None ->
Generated(G.custom_default mode kf spec) Generated(G.custom_default mode kf spec)
| _, None -> assert false | (Skip | ACSL), _ -> assert false
let emit = G.emit let emit = G.emit
...@@ -195,11 +195,12 @@ struct ...@@ -195,11 +195,12 @@ struct
List.iter (emit_status status) ppt_l List.iter (emit_status status) ppt_l
let emit mode kf bhv = function let emit mode kf bhv = function
| Kept -> () | Kept | Generated [] -> ()
| Generated _ when Kernel_function.has_definition kf -> () | Generated _ when Kernel_function.has_definition kf -> ()
| Generated exits -> | Generated exits ->
match mode with match mode with
| Skip | ACSL | Safe -> () | Skip | ACSL -> assert false
| Safe -> ()
| Frama_C -> emit_status kf bhv exits Property_status.Dont_know | Frama_C -> emit_status kf bhv exits Property_status.Dont_know
| Other mode -> | Other mode ->
let custom_mode = get_custom_mode mode in let custom_mode = get_custom_mode mode in
...@@ -288,7 +289,7 @@ struct ...@@ -288,7 +289,7 @@ struct
in in
Option.iter (emit_status status) ppt_opt; Option.iter (emit_status status) ppt_opt;
match assigns with match assigns with
| WritesAny -> () | WritesAny -> assert false
| Writes froms -> | Writes froms ->
let emit from = let emit from =
let ppt_opt = let ppt_opt =
...@@ -301,11 +302,12 @@ struct ...@@ -301,11 +302,12 @@ struct
List.iter emit froms List.iter emit froms
let emit mode kf bhv = function let emit mode kf bhv = function
| Kept -> () | Kept | Generated WritesAny -> ()
| Generated _ when Kernel_function.has_definition kf -> () | Generated _ when Kernel_function.has_definition kf -> ()
| Generated assigns -> | Generated assigns ->
match mode with match mode with
| ACSL | Safe | Skip -> () | Skip | ACSL -> assert false
| Safe -> ()
| Frama_C -> emit_status kf bhv assigns Property_status.Dont_know | Frama_C -> emit_status kf bhv assigns Property_status.Dont_know
| Other mode -> | Other mode ->
let custom_mode = get_custom_mode mode in let custom_mode = get_custom_mode mode in
...@@ -433,11 +435,12 @@ struct ...@@ -433,11 +435,12 @@ struct
Option.iter (emit_status status) ppt_opt Option.iter (emit_status status) ppt_opt
let emit mode kf bhv = function let emit mode kf bhv = function
| Kept -> () | Kept | Generated FreeAllocAny -> ()
| Generated _ when Kernel_function.has_definition kf -> () | Generated _ when Kernel_function.has_definition kf -> ()
| Generated allocates -> | Generated allocates ->
match mode with match mode with
| Skip | Safe -> () | Skip -> assert false
| Safe -> ()
| ACSL -> | ACSL ->
emit_status kf bhv allocates Property_status.True emit_status kf bhv allocates Property_status.True
| Frama_C -> | Frama_C ->
...@@ -459,8 +462,8 @@ struct ...@@ -459,8 +462,8 @@ struct
type clause = terminates type clause = terminates
type behaviors = bool type behaviors = bool
let has_behavior name behaviors = let has_behavior _ behaviors =
if name = default then behaviors else false behaviors
let collect_behaviors spec = let collect_behaviors spec =
None <> spec.spec_terminates None <> spec.spec_terminates
...@@ -493,17 +496,17 @@ struct ...@@ -493,17 +496,17 @@ struct
let emit_status kf _ terminates status = let emit_status kf _ terminates status =
match terminates with match terminates with
| None -> () | None -> assert false
| Some terminates -> | Some terminates ->
Property.ip_of_terminates kf Kglobal terminates Property.ip_of_terminates kf Kglobal terminates
|> emit_status status |> emit_status status
let emit mode kf bhv = function let emit mode kf bhv = function
| Kept -> () | Kept | Generated None -> ()
| Generated _ when Kernel_function.has_definition kf -> () | Generated _ when Kernel_function.has_definition kf -> ()
| Generated terminates -> | Generated terminates ->
match mode with match mode with
| Skip -> () | Skip -> assert false
| ACSL -> | ACSL ->
emit_status kf bhv terminates Property_status.True emit_status kf bhv terminates Property_status.True
| Safe | Frama_C -> | Safe | Frama_C ->
...@@ -588,6 +591,7 @@ let do_populate kf original_spec = ...@@ -588,6 +591,7 @@ let do_populate kf original_spec =
Annotations.add_spec emitter kf spec; Annotations.add_spec emitter kf spec;
Exits.emit config.exits kf bhv exits; Exits.emit config.exits kf bhv exits;
Assigns.emit config.assigns kf bhv assigns; Assigns.emit config.assigns kf bhv assigns;
Requires.emit config.assigns kf bhv requires;
Allocates.emit config.allocates kf bhv allocates; Allocates.emit config.allocates kf bhv allocates;
Terminates.emit config.terminates kf bhv terminates Terminates.emit config.terminates kf bhv terminates
......
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