Skip to content
Snippets Groups Projects
Commit d87c0496 authored by Julien Signoles's avatar Julien Signoles
Browse files

[E-ACSL] compatibility with warning 7

parent 043929c1
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,7 @@ let init_mpz () = ...@@ -27,7 +27,7 @@ let init_mpz () =
Options.feedback ~level:2 "initializing GMP type."; Options.feedback ~level:2 "initializing GMP type.";
let set_mpzt = object let set_mpzt = object
inherit Cil.nopCilVisitor inherit Cil.nopCilVisitor
method vglob = function method !vglob = function
| GType({ torig_name = s } as info, _) when s = "mpz_t" -> | GType({ torig_name = s } as info, _) when s = "mpz_t" ->
Mpz.set_t info; Mpz.set_t info;
Cil.SkipChildren Cil.SkipChildren
...@@ -313,7 +313,7 @@ module rec Transfer ...@@ -313,7 +313,7 @@ module rec Transfer
let register_object kf state_ref = object let register_object kf state_ref = object
inherit Visitor.frama_c_inplace inherit Visitor.frama_c_inplace
method vpredicate = function method !vpredicate = function
| Pvalid(_, t) | Pvalid_read(_, t) | Pinitialized(_, t) -> | Pvalid(_, t) | Pvalid_read(_, t) | Pinitialized(_, t) ->
(* Options.feedback "REGISTER %a" Cil.d_term t;*) (* Options.feedback "REGISTER %a" Cil.d_term t;*)
state_ref := register_term kf !state_ref t; state_ref := register_term kf !state_ref t;
...@@ -326,7 +326,7 @@ module rec Transfer ...@@ -326,7 +326,7 @@ module rec Transfer
| Pand _ | Por _ | Pxor _ | Pimplies _ | Piff _ | Pnot _ | Pif _ | Pand _ | Por _ | Pxor _ | Pimplies _ | Piff _ | Pnot _ | Pif _
| Plet _ | Pforall _ | Pexists _ | Pat _ | Psubtype _ -> | Plet _ | Pforall _ | Pexists _ | Pat _ | Psubtype _ ->
Cil.DoChildren Cil.DoChildren
method vterm term = match term.term_node with method !vterm term = match term.term_node with
| Tbase_addr(_, t) | Toffset(_, t) | Tblock_length(_, t) -> | Tbase_addr(_, t) | Toffset(_, t) | Tblock_length(_, t) ->
state_ref := register_term kf !state_ref t; state_ref := register_term kf !state_ref t;
Cil.DoChildren Cil.DoChildren
...@@ -341,8 +341,8 @@ module rec Transfer ...@@ -341,8 +341,8 @@ module rec Transfer
| Tcomprehension _ | Trange _ | Tlet _ | TLogic_coerce _ -> | Tcomprehension _ | Trange _ | Tlet _ | TLogic_coerce _ ->
(* potential sub-term inside *) (* potential sub-term inside *)
Cil.DoChildren Cil.DoChildren
method vlogic_label _ = Cil.SkipChildren method !vlogic_label _ = Cil.SkipChildren
method vterm_lhost = function method !vterm_lhost = function
| TMem t -> | TMem t ->
(* potential RTE *) (* potential RTE *)
state_ref := register_term kf !state_ref t; state_ref := register_term kf !state_ref t;
......
...@@ -103,7 +103,7 @@ let dup_funspec tbl bhv spec = ...@@ -103,7 +103,7 @@ let dup_funspec tbl bhv spec =
val already_visited = Cil_datatype.Logic_var.Hashtbl.create 7 val already_visited = Cil_datatype.Logic_var.Hashtbl.create 7
method vlogic_info_use li = method !vlogic_info_use li =
if Global.mem_logic_info li then if Global.mem_logic_info li then
Cil.ChangeDoChildrenPost Cil.ChangeDoChildrenPost
({ li with l_var_info = li.l_var_info } (* force a copy *), ({ li with l_var_info = li.l_var_info } (* force a copy *),
...@@ -111,7 +111,7 @@ let dup_funspec tbl bhv spec = ...@@ -111,7 +111,7 @@ let dup_funspec tbl bhv spec =
else else
Cil.JustCopy Cil.JustCopy
method vterm_offset _ = method !vterm_offset _ =
Cil.DoChildrenPost Cil.DoChildrenPost
(function (function
(* no way to directly visit fieldinfo and model_info uses *) (* no way to directly visit fieldinfo and model_info uses *)
...@@ -119,7 +119,7 @@ let dup_funspec tbl bhv spec = ...@@ -119,7 +119,7 @@ let dup_funspec tbl bhv spec =
| TModel(mi, off) -> TModel(Cil.get_model_info bhv mi, off) | TModel(mi, off) -> TModel(Cil.get_model_info bhv mi, off)
| off -> off) | off -> off)
method vlogic_var_use orig_lvi = method !vlogic_var_use orig_lvi =
match orig_lvi.lv_origin with match orig_lvi.lv_origin with
| None -> | None ->
Cil.JustCopy Cil.JustCopy
...@@ -149,10 +149,10 @@ let dup_funspec tbl bhv spec = ...@@ -149,10 +149,10 @@ let dup_funspec tbl bhv spec =
assert vi.vglob; assert vi.vglob;
Cil.get_logic_var bhv lvi) Cil.get_logic_var bhv lvi)
method videntified_term _ = method !videntified_term _ =
Cil.DoChildrenPost Logic_const.refresh_identified_term Cil.DoChildrenPost Logic_const.refresh_identified_term
method videntified_predicate _ = method !videntified_predicate _ =
Cil.DoChildrenPost Logic_const.refresh_predicate Cil.DoChildrenPost Logic_const.refresh_predicate
end in end in
Cil.visitCilFunspec o spec Cil.visitCilFunspec o spec
...@@ -249,7 +249,7 @@ class dup_functions_visitor prj = object (self) ...@@ -249,7 +249,7 @@ class dup_functions_visitor prj = object (self)
| Memory_model -> before_memory_model <- Code | Memory_model -> before_memory_model <- Code
| Code -> () | Code -> ()
method vcode_annot a = method !vcode_annot a =
Cil.JustCopyPost Cil.JustCopyPost
(fun a' -> (fun a' ->
let get_ppt kf stmt a = Property.ip_of_code_annot kf stmt a in let get_ppt kf stmt a = Property.ip_of_code_annot kf stmt a in
...@@ -264,11 +264,11 @@ class dup_functions_visitor prj = object (self) ...@@ -264,11 +264,11 @@ class dup_functions_visitor prj = object (self)
a'); a');
a') a')
method vlogic_info_decl li = method !vlogic_info_decl li =
Global.add_logic_info li; Global.add_logic_info li;
Cil.JustCopy Cil.JustCopy
method vvrbl vi = method !vvrbl vi =
try try
let new_vi = Cil_datatype.Varinfo.Hashtbl.find fct_tbl vi in let new_vi = Cil_datatype.Varinfo.Hashtbl.find fct_tbl vi in
Cil.ChangeTo new_vi Cil.ChangeTo new_vi
...@@ -280,7 +280,7 @@ class dup_functions_visitor prj = object (self) ...@@ -280,7 +280,7 @@ class dup_functions_visitor prj = object (self)
| TFun(_, _, variadic, _) -> not variadic | TFun(_, _, variadic, _) -> not variadic
| _ -> false | _ -> false
method vglob_aux = function method !vglob_aux = function
| GVarDecl(_, vi, loc) | GFun({ svar = vi }, loc) | GVarDecl(_, vi, loc) | GFun({ svar = vi }, loc)
when self#is_unvariadic_function vi when self#is_unvariadic_function vi
&& not (Misc.is_library_loc loc) && not (Misc.is_library_loc loc)
...@@ -346,7 +346,7 @@ if there are memory-related annotations.@]" ...@@ -346,7 +346,7 @@ if there are memory-related annotations.@]"
self#next (); self#next ();
Cil.DoChildrenPost self#insert_libc Cil.DoChildrenPost self#insert_libc
method vfile _ = method !vfile _ =
Cil.DoChildrenPost Cil.DoChildrenPost
(fun f -> (fun f ->
match libc_decls with match libc_decls with
......
...@@ -466,7 +466,7 @@ and at_to_exp env t_opt label e = ...@@ -466,7 +466,7 @@ and at_to_exp env t_opt label e =
let res = ref false in let res = ref false in
let o = object let o = object
inherit Cil.nopCilVisitor inherit Cil.nopCilVisitor
method vlval (host, _) = match host with method !vlval (host, _) = match host with
| Var v -> | Var v ->
if Pre_analysis.old_must_model_vi (Env.get_behavior env) v then if Pre_analysis.old_must_model_vi (Env.get_behavior env) v then
res := true; res := true;
...@@ -495,7 +495,7 @@ and at_to_exp env t_opt label e = ...@@ -495,7 +495,7 @@ and at_to_exp env t_opt label e =
one). *) one). *)
let o = object let o = object
inherit Visitor.frama_c_inplace inherit Visitor.frama_c_inplace
method vstmt_aux stmt = method !vstmt_aux stmt =
(* either a standard C affectation or an mpz one according to type of (* either a standard C affectation or an mpz one according to type of
[e] *) [e] *)
let new_stmt = Mpz.init_set ~loc (Cil.var res_v) res e in let new_stmt = Mpz.init_set ~loc (Cil.var res_v) res e in
......
...@@ -36,7 +36,7 @@ let move_labels env stmt new_stmt = ...@@ -36,7 +36,7 @@ let move_labels env stmt new_stmt =
(* update the gotos of the function jumping to one of the labels *) (* update the gotos of the function jumping to one of the labels *)
let o = object let o = object
inherit Visitor.frama_c_inplace inherit Visitor.frama_c_inplace
method vstmt_aux s = match s.skind with method !vstmt_aux s = match s.skind with
| Goto(s_ref, _) -> | Goto(s_ref, _) ->
(* [!s_ref] and [stmt] are not part of the same project, thus it (* [!s_ref] and [stmt] are not part of the same project, thus it
is safer to compare the ids than to use Stmt.equal *) is safer to compare the ids than to use Stmt.equal *)
...@@ -45,10 +45,10 @@ let move_labels env stmt new_stmt = ...@@ -45,10 +45,10 @@ let move_labels env stmt new_stmt =
| _ -> Cil.DoChildren | _ -> Cil.DoChildren
(* improve efficiency: skip childrens of vstmt which cannot (* improve efficiency: skip childrens of vstmt which cannot
contain any stmt *) contain any stmt *)
method vinst _ = Cil.SkipChildren method !vinst _ = Cil.SkipChildren
method vexpr _ = Cil.SkipChildren method !vexpr _ = Cil.SkipChildren
method vcode_annot _ = Cil.SkipChildren method !vcode_annot _ = Cil.SkipChildren
method vlval _ = Cil.SkipChildren method !vlval _ = Cil.SkipChildren
end in end in
let vis = Env.get_visitor env in let vis = Env.get_visitor env in
let f = Extlib.the vis#current_func in let f = Extlib.the vis#current_func in
...@@ -114,7 +114,7 @@ class e_acsl_visitor prj generate = object (self) ...@@ -114,7 +114,7 @@ class e_acsl_visitor prj generate = object (self)
method private reset_env () = method private reset_env () =
function_env := Env.empty (self :> Visitor.frama_c_visitor) function_env := Env.empty (self :> Visitor.frama_c_visitor)
method vfile _f = method !vfile _f =
(* copy the options used during the visit in the new project: it is the (* copy the options used during the visit in the new project: it is the
right place to do this: it is still before visiting, but after right place to do this: it is still before visiting, but after
that the visitor internals reset all of them :-(. *) that the visitor internals reset all of them :-(. *)
...@@ -240,7 +240,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]" ...@@ -240,7 +240,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]"
if generate then Project.clear ~selection ~project:prj (); if generate then Project.clear ~selection ~project:prj ();
f) f)
method vglob_aux = function method !vglob_aux = function
| GVarDecl(_, vi, _) | GVar(vi, _, _) | GFun({ svar = vi }, _) | GVarDecl(_, vi, _) | GVar(vi, _, _) | GFun({ svar = vi }, _)
when Misc.is_library_loc vi.vdecl -> when Misc.is_library_loc vi.vdecl ->
if generate then if generate then
...@@ -292,7 +292,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]" ...@@ -292,7 +292,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]"
if generate then Cil.DoChildrenPost(fun g -> List.iter do_it g; g) if generate then Cil.DoChildrenPost(fun g -> List.iter do_it g; g)
else Cil.DoChildren else Cil.DoChildren
method vinit vi _off _i = method !vinit vi _off _i =
if generate then if generate then
if Pre_analysis.must_model_vi vi then begin if Pre_analysis.must_model_vi vi then begin
keep_initializer <- Some true; keep_initializer <- Some true;
...@@ -308,7 +308,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]" ...@@ -308,7 +308,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]"
else else
Cil.SkipChildren Cil.SkipChildren
method vvdec vi = method !vvdec vi =
try try
let old_vi = Cil.get_original_varinfo self#behavior vi in let old_vi = Cil.get_original_varinfo self#behavior vi in
let old_kf = Globals.Functions.get old_vi in let old_kf = Globals.Functions.get old_vi in
...@@ -332,7 +332,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]" ...@@ -332,7 +332,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]"
body.blocals body.blocals
vars vars
method vfunc f = method !vfunc f =
if generate then if generate then
let kf = Extlib.the self#current_kf in let kf = Extlib.the self#current_kf in
Options.feedback ~dkey ~level:2 "entering in function %a." Options.feedback ~dkey ~level:2 "entering in function %a."
...@@ -378,7 +378,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]" ...@@ -378,7 +378,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]"
let env_ref = ref env in let env_ref = ref env in
let o = object let o = object
inherit Cil.genericCilVisitor (Cil.copy_visit (Project.current ())) inherit Cil.genericCilVisitor (Cil.copy_visit (Project.current ()))
method vexpr e = match e.enode with method !vexpr e = match e.enode with
| Const(CStr s) -> | Const(CStr s) ->
let loc = e.eloc in let loc = e.eloc in
let _, exp, env = let _, exp, env =
...@@ -405,7 +405,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]" ...@@ -405,7 +405,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]"
let e = Cil.visitCilExpr o e in let e = Cil.visitCilExpr o e in
e, !env_ref e, !env_ref
method vstmt_aux stmt = method !vstmt_aux stmt =
Options.debug ~level:4 "proceeding stmt (sid %d) %a@." Options.debug ~level:4 "proceeding stmt (sid %d) %a@."
stmt.sid Stmt.pretty stmt; stmt.sid Stmt.pretty stmt;
let kf = Extlib.the self#current_kf in let kf = Extlib.the self#current_kf in
...@@ -572,7 +572,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]" ...@@ -572,7 +572,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]"
function_env := Env.add_stmt !function_env stmt function_env := Env.add_stmt !function_env stmt
end end
method vinst = function method !vinst = function
| Set(old_lv, _, _) -> | Set(old_lv, _, _) ->
if generate then if generate then
Cil.DoChildrenPost Cil.DoChildrenPost
...@@ -596,7 +596,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]" ...@@ -596,7 +596,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]"
| _ -> | _ ->
Cil.DoChildren Cil.DoChildren
method vblock blk = method !vblock blk =
let handle_memory new_blk = let handle_memory new_blk =
match new_blk.blocals with match new_blk.blocals with
| [] -> new_blk | [] -> new_blk
...@@ -644,7 +644,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]" ...@@ -644,7 +644,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]"
in in
if generate then Cil.DoChildrenPost handle_memory else Cil.DoChildren if generate then Cil.DoChildrenPost handle_memory else Cil.DoChildren
method vexpr exp = method !vexpr exp =
if generate then if generate then
match keep_initializer with match keep_initializer with
| Some false -> Cil.JustCopy | Some false -> Cil.JustCopy
......
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