let is_annot_for_config config node s_annot bhv_name_list =
let edges_before = Cil2cfg.pred_e config.cfg node in
debug "[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 = match Cil2cfg.get_post_edges config.cfg n with
| [] -> None
| e::_ -> Cil2cfg.get_edge_next_stmt config.cfg e
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 _ when cur_fct_default_bhv config ->
begin
try
let _ = HdefAnnotBhv.find config.def_annots_info e in
TBRhyp
with Not_found -> TBRok
end
| StmtBhv (n, sb, b) when b.b_name = 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 = name_of_asked_bhv config.cur_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 debug "[is_annot_for_config] -> %s@."
(match res with TBRok -> "ok" | TBRhyp -> "hyp" | TBRno -> "no"
| TBRpart -> "part");
res