Skip to content
Snippets Groups Projects
Commit 96cddc05 authored by Michele Alberti's avatar Michele Alberti
Browse files

[oneret] More explanations of the problem we try to solve.

parent 4b424be4
No related branches found
No related tags found
No related merge requests found
...@@ -120,12 +120,22 @@ let collect_returns (ca : Cil_types.code_annotation) = ...@@ -120,12 +120,22 @@ let collect_returns (ca : Cil_types.code_annotation) =
| _ -> [] | _ -> []
let encapsulate_local_vars f = let encapsulate_local_vars f =
(* we must ensure that our gotos to the end of the function do not (* We must ensure that our gotos to the end of the function do not bypass
bypass declaration of objects with destructors, or there will be declarations of objects with destructors, or we may miss to insert the
issues when inserting the destructor calls. If needed, enclose corresponding destructor calls. Here is an example, with T a class:
the main body (except return and the declaration of the retvar)
inside its own block. extern void Ctor(T* x);
*)
int f(void) {
goto L;
T __attribute__((__fc_destructor)) x;
Ctor(&x);
L: return 42;
}
Treating such a special case may be hard and not sufficient. Then, although
coarse, our general solution is to enclose the function body (except the
return statement and the declaration of the retvar) inside a block. *)
if if
List.exists List.exists
(fun v -> Cil.hasAttribute Cabs2cil.frama_c_destructor v.vattr) (fun v -> Cil.hasAttribute Cabs2cil.frama_c_destructor v.vattr)
......
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