Commit b3000fc2 authored by MARCHE Claude's avatar MARCHE Claude

fix issue #32: re-enabled display of warnings in IDE

parent 8fa6fd92
......@@ -428,10 +428,12 @@ let debug_ignore_unused_var = Debug.register_info_flag "ignore_unused_vars"
~desc:"Suppress@ warnings@ on@ unused@ variables"
let check_used_var t vs =
if not (Debug.test_flag debug_ignore_unused_var) then
let s = vs.vs_name.id_string in
if (s = "" || s.[0] <> '_') && t_v_occurs vs t = 0 then
Warning.emit ?loc:vs.vs_name.id_loc "unused variable %s" s
if Debug.test_noflag debug_ignore_unused_var then
begin
let s = vs.vs_name.id_string in
if (s = "" || s.[0] <> '_') && t_v_occurs vs t = 0 then
Warning.emit ?loc:vs.vs_name.id_loc "unused variable %s" s
end
let check_exists_implies f = match f.t_node with
| Tbinop (Timplies,{ t_node = Tbinop (Tor,f,{ t_node = Ttrue }) },_)
......
......@@ -1042,9 +1042,11 @@ let display_warnings () =
print_message ~kind:1 ~notif_kind:"warning" "%s" msg
end
let print_message ~kind ~notif_kind fmt =
display_warnings (); print_message ~kind ~notif_kind fmt
let () =
Warning.set_hook (fun ?loc s -> record_warning ?loc s; display_warnings ())
(**** Monitor *****)
......@@ -1420,10 +1422,10 @@ let interp_ide cmd =
let s = List.fold_left (fun acc x -> (fst x) ^ ": " ^
(snd x) ^ "\n" ^ acc) "" ide_command_list in
clear_command_entry ();
message_zone#buffer#set_text s
print_message ~kind:1 ~notif_kind:"Info" "%s" s
| _ ->
clear_command_entry ();
message_zone#buffer#set_text ("Error: " ^ cmd ^ "\nPlease report.")
print_message ~kind:1 ~notif_kind:"error" "Error: %s\nPlease report." cmd
let interp cmd =
(* TODO: do some preprocessing for queries, or leave everything to server ? *)
......@@ -2321,5 +2323,5 @@ let () =
(fun () -> List.iter treat_notification (get_notified ()); true);
main_window#add_accel_group accel_group;
main_window#set_icon (Some !Gconfig.why_icon);
message_zone#buffer#set_text "Welcome to Why3 IDE\ntype 'help' for help";
print_message ~kind:1 ~notif_kind:"Info" "Welcome to Why3 IDE\ntype 'help' for help\n";
GMain.main ()
......@@ -7,6 +7,20 @@ module M
end
module TestWarnings
use import int.Int
function f (x y : int) :int = x
axiom a : forall x:int. x*x >= 0
goal g1: forall z:int. 42 > 0
goal g2: let z=1 in 42 > 0
end
module TestTaskPrinting
use import int.Int
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment