Add a new error kind Advice

Reviewed By: jberdine

Differential Revision: D3549522

fbshipit-source-id: 38e07d0
master
Dulma Churchill 9 years ago committed by Facebook Github Bot 5
parent 7b58c71475
commit 5566ca1fd9

@ -208,7 +208,7 @@ let log_issue _ekind err_log loc node_id_key session ltr pre_opt exn =
let d = match ekind with let d = match ekind with
| Exceptions.Kerror -> L.d_error | Exceptions.Kerror -> L.d_error
| Exceptions.Kwarning -> L.d_warning | Exceptions.Kwarning -> L.d_warning
| Exceptions.Kinfo -> L.d_info in | Exceptions.Kinfo | Exceptions.Kadvice -> L.d_info in
d warn_str; L.d_ln(); d warn_str; L.d_ln();
end in end in
if should_print_now then print_now () if should_print_now then print_now ()
@ -251,13 +251,15 @@ module Err_table = struct
let map_warn_fp = ref LocMap.empty in let map_warn_fp = ref LocMap.empty in
let map_warn_re = ref LocMap.empty in let map_warn_re = ref LocMap.empty in
let map_info = ref LocMap.empty in let map_info = ref LocMap.empty in
let map_advice = ref LocMap.empty in
let add_err nslm (ekind , in_fp, err_name, desc, _) = let add_err nslm (ekind , in_fp, err_name, desc, _) =
let map = match in_fp, ekind with let map = match in_fp, ekind with
| true, Exceptions.Kerror -> map_err_fp | true, Exceptions.Kerror -> map_err_fp
| false, Exceptions.Kerror -> map_err_re | false, Exceptions.Kerror -> map_err_re
| true, Exceptions.Kwarning -> map_warn_fp | true, Exceptions.Kwarning -> map_warn_fp
| false, Exceptions.Kwarning -> map_warn_re | false, Exceptions.Kwarning -> map_warn_re
| _, Exceptions.Kinfo -> map_info in | _, Exceptions.Kinfo -> map_info
| _, Exceptions.Kadvice -> map_advice in
try try
let err_list = LocMap.find nslm !map in let err_list = LocMap.find nslm !map in
map := LocMap.add nslm ((err_name, desc) :: err_list) !map map := LocMap.add nslm ((err_name, desc) :: err_list) !map

@ -28,7 +28,7 @@ type err_class = Checker | Prover | Nocat
(** kind of error/warning *) (** kind of error/warning *)
type err_kind = type err_kind =
Kwarning | Kerror | Kinfo Kwarning | Kerror | Kinfo | Kadvice
exception Abduction_case_not_implemented of L.ml_loc exception Abduction_case_not_implemented of L.ml_loc
exception Analysis_stops of Localise.error_desc * L.ml_loc option exception Analysis_stops of Localise.error_desc * L.ml_loc option
@ -323,6 +323,7 @@ let err_kind_string = function
| Kwarning -> "WARNING" | Kwarning -> "WARNING"
| Kerror -> "ERROR" | Kerror -> "ERROR"
| Kinfo -> "INFO" | Kinfo -> "INFO"
| Kadvice -> "ADVICE"
(** string describing an error class *) (** string describing an error class *)
let err_class_string = function let err_class_string = function

@ -24,7 +24,7 @@ type exception_severity = (** severity of bugs *)
(** kind of error/warning *) (** kind of error/warning *)
type err_kind = type err_kind =
Kwarning | Kerror | Kinfo Kwarning | Kerror | Kinfo | Kadvice
(** class of error *) (** class of error *)
type err_class = Checker | Prover | Nocat type err_class = Checker | Prover | Nocat

@ -603,6 +603,7 @@ module Stats = struct
mutable ndefective : int; mutable ndefective : int;
mutable nerrors : int; mutable nerrors : int;
mutable ninfos : int; mutable ninfos : int;
mutable nadvice : int;
mutable nLOC : int; mutable nLOC : int;
mutable nprocs : int; mutable nprocs : int;
mutable nspecs : int; mutable nspecs : int;
@ -618,6 +619,7 @@ module Stats = struct
ndefective = 0; ndefective = 0;
nerrors = 0; nerrors = 0;
ninfos = 0; ninfos = 0;
nadvice = 0;
nLOC = 0; nLOC = 0;
nprocs = 0; nprocs = 0;
nspecs = 0; nspecs = 0;
@ -676,7 +678,8 @@ module Stats = struct
let trace = loc_trace_to_string_list linereader 1 ltr in let trace = loc_trace_to_string_list linereader 1 ltr in
stats.saved_errors <- IList.rev_append (error_strs @ trace @ [""]) stats.saved_errors stats.saved_errors <- IList.rev_append (error_strs @ trace @ [""]) stats.saved_errors
| Exceptions.Kwarning -> stats.nwarnings <- stats.nwarnings + 1 | Exceptions.Kwarning -> stats.nwarnings <- stats.nwarnings + 1
| Exceptions.Kinfo -> stats.ninfos <- stats.ninfos + 1 in | Exceptions.Kinfo -> stats.ninfos <- stats.ninfos + 1
| Exceptions.Kadvice -> stats.nadvice <- stats.nadvice + 1 in
Errlog.iter process_row err_log; Errlog.iter process_row err_log;
!found_errors !found_errors

Loading…
Cancel
Save