let is_annot_for_config config edges_before s_annot bhv_name_list =
Wp_parameters.debug ~level:3 "[is_annot_for_config] at sid:%d for %a ? @."
s_annot.sid (Wp_error.pp_string_list ~sep:" " ~empty:"<default>")
bhv_name_list;
let hyp_but_not_at_post n =
let s_post =
try
let next = Cil2cfg.node_after config.cfg n in
match Cil2cfg.pred_e config.cfg next with
| e::_ -> Cil2cfg.get_edge_next_stmt config.cfg e
| _ -> None
with Not_found -> None
in match s_post with
| Some s_post when s_post.sid = s_annot.sid -> TBRno
| _ -> TBRhyp
in
let res = match bhv_name_list with
| [] ->
begin
let e = match edges_before with
| e::_ -> e
| _ -> Wp_parameters.fatal "annot with no edge ?"
in
match config.cur_bhv with
| FunBhv b when b = Cil.default_behavior_name ->
begin
try
let _ = HdefAnnotBhv.find config.def_annots_info e in
TBRhyp
with Not_found -> TBRok
end
| StmtBhv (n, sb, bname) when bname = Cil.default_behavior_name ->
begin
try
let s,_ = HdefAnnotBhv.find config.def_annots_info e in
if s.sid = sb.sid then TBRok
else raise Not_found
with Not_found -> hyp_but_not_at_post n
end
| FunBhv _ -> TBRhyp
| StmtBhv (n,_,_) -> hyp_but_not_at_post n
end
| bhvs ->
let asked_bhv = match config.cur_bhv with
| FunBhv bhv -> bhv
| StmtBhv (_, _, bhv) -> bhv
in
let goal = List.exists (fun bl -> bl = asked_bhv) bhvs in
if goal then
let full = true
in (if full then TBRok else TBRpart)
else TBRno
in let s_res = match res with
| TBRok -> "ok"
| TBRhyp -> "hyp"
| TBRno -> "no"
| TBRpart -> "part"
in Wp_parameters.debug ~level:3 "[is_annot_for_config] -> %s@." s_res;
res