Skip to content
Snippets Groups Projects
Commit b92bb659 authored by Basile Desloges's avatar Basile Desloges
Browse files

[Eva] Update missing assigns messages

The warning messages for missing assigns and missing from now have a
category that is set to `error` by default. Moreover, the message is
expanded to note that `assigns \nothing` and `assigns \from \nothing` is
assumed instead and that the analysis is probably incorrect.
parent b77a1c40
No related branches found
No related tags found
No related merge requests found
...@@ -59,12 +59,14 @@ let options_ok () = ...@@ -59,12 +59,14 @@ let options_ok () =
check Parameters.EqualityCallFunction.get; check Parameters.EqualityCallFunction.get;
let check_assigns kf = let check_assigns kf =
if need_assigns kf then if need_assigns kf then
Self.error "@[no assigns@ specified@ for function '%a',@ for \ Self.warning ~wkey:Self.wkey_missing_assigns
which@ a builtin@ or the specification@ will be used.@ \ "@[No assigns specified for function '%a', for which a builtin will be \
Potential unsoundness.@]" Kernel_function.pretty kf used. Potential unsoundness.@]"
Kernel_function.pretty kf
in in
Parameters.BuiltinsOverrides.iter (fun (kf, _) -> check_assigns kf); Parameters.BuiltinsOverrides.iter (fun (kf, _) -> check_assigns kf)
Parameters.UsePrototype.iter (fun kf -> check_assigns kf)
(* Parameters.UsePrototype.iter (fun kf -> check_assigns kf) *)
let plugins_ok () = let plugins_ok () =
if not (Plugin.is_present "inout") then if not (Plugin.is_present "inout") then
...@@ -77,8 +79,9 @@ let plugins_ok () = ...@@ -77,8 +79,9 @@ let plugins_ok () =
let generate_specs () = let generate_specs () =
let aux kf = let aux kf =
if need_assigns kf then begin if need_assigns kf then begin
Self.warning "Generating potentially incorrect assigns \ Self.warning ~wkey:Self.wkey_missing_assigns
for function '%a' for which option %s is set" "@[No assigns specified for function '%a' for which option %s is set. \
Generating potentially incorrect assigns.@]"
Kernel_function.pretty kf Parameters.UsePrototype.option_name; Kernel_function.pretty kf Parameters.UsePrototype.option_name;
Populate_spec.populate_funspec ~do_body:true kf [`Assigns]; Populate_spec.populate_funspec ~do_body:true kf [`Assigns];
end end
......
...@@ -48,11 +48,11 @@ let check_spec kinstr kf = ...@@ -48,11 +48,11 @@ let check_spec kinstr kf =
let funspec = Annotations.funspec kf in let funspec = Annotations.funspec kf in
if List.for_all (fun b -> b.b_assigns = WritesAny) funspec.spec_behavior if List.for_all (fun b -> b.b_assigns = WritesAny) funspec.spec_behavior
then then
Self.error ~current:true Self.warning ~current:true ~wkey:Self.wkey_missing_assigns
"@[Recursive call to %a@ without assigns clause.@ \ "@[Recursive call to %a without assigns clause.@ \
Generating probably incomplete assigns to interpret the call.@ \ Generating probably incomplete assigns to interpret the call.@ \
Try to increase@ the %s parameter@ \ Try to increase the %s parameter \
or write a correct specification@ for function %a.@\n%t@]" or write a correct specification for function %a.@\n%t@]"
(* note: the "\n" before the pretty print of the stack is required by: (* note: the "\n" before the pretty print of the stack is required by:
FRAMAC_LIB/analysis-scripts/make_wrapper.py FRAMAC_LIB/analysis-scripts/make_wrapper.py
*) *)
......
...@@ -40,9 +40,9 @@ let find_default_behavior spec = ...@@ -40,9 +40,9 @@ let find_default_behavior spec =
List.find (fun b' -> b'.b_name = Cil.default_behavior_name) spec.spec_behavior List.find (fun b' -> b'.b_name = Cil.default_behavior_name) spec.spec_behavior
let warn_empty_assigns () = let warn_empty_assigns () =
Self.warning ~current:true ~once:true Self.warning ~current:true ~once:true ~wkey:Self.wkey_missing_assigns
"Cannot handle empty assigns clause. Assuming assigns \\nothing: \ "Cannot handle empty assigns clause. Assuming assigns \\nothing so that \
be aware this is probably incorrect." the analysis can continue, but be aware this is probably incorrect."
(* Warn for assigns clauses without \from. *) (* Warn for assigns clauses without \from. *)
let warn_empty_from list = let warn_empty_from list =
...@@ -51,8 +51,9 @@ let warn_empty_from list = ...@@ -51,8 +51,9 @@ let warn_empty_from list =
| [] -> () | [] -> ()
| (out, _) :: _ -> | (out, _) :: _ ->
let source = fst out.it_content.term_loc in let source = fst out.it_content.term_loc in
Self.warning ~source ~once:true Self.warning ~source ~once:true ~wkey:Self.wkey_missing_assigns
"@[no \\from part@ for clause '%a'@]" "@[no \\from part for clause@ '%a'.@ Assuming \\from \\nothing so that \
the analysis can continue, but be aware this is probably incorrect.@]"
Printer.pp_assigns (Writes no_from) Printer.pp_assigns (Writes no_from)
let get_assigns = function let get_assigns = function
...@@ -124,8 +125,8 @@ let warn_on_missing_result_assigns kinstr kf spec = ...@@ -124,8 +125,8 @@ let warn_on_missing_result_assigns kinstr kf spec =
if return_used && not (List.for_all assigns_result spec.spec_behavior) if return_used && not (List.for_all assigns_result spec.spec_behavior)
then then
let source = fst (Kernel_function.get_location kf) in let source = fst (Kernel_function.get_location kf) in
Self.warning ~once:true ~source Self.warning ~wkey:Self.wkey_missing_assigns_result ~once:true ~source
"@[no 'assigns \\result@ \\from ...'@ clause@ specified for@ function %a@]" "@[no 'assigns \\result \\from ...' clause specified for function %a@]"
Kernel_function.pretty kf Kernel_function.pretty kf
let reduce_to_valid_location kind term loc = let reduce_to_valid_location kind term loc =
......
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