[build] remove unused values

Summary:
Ran the build with -w,-32 , delete code, repeat, until a fixpoint of no more warnings is reach.

Unfortunately we cannot fatal on w32 because ppx_compare can generate dead code (eg `compare_t` and only `compare` is used).

Reviewed By: mbouaziz

Differential Revision: D4945800

fbshipit-source-id: c95afb6
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 37896ff435
commit 29f7967f26

@ -19,8 +19,7 @@ module L = Logging;
type attr_kind =
| ProcDefined
| ProcObjCAccessor
| ProcUndefined
[@@deriving compare];
| ProcUndefined;
/** Module to manage the table of attributes. */

@ -129,11 +129,6 @@ let iter (f: iter_fun) (err_log: t) =
ErrDataSet.iter (fun err_data -> f err_key err_data) set)
err_log
let iter_filter (f: iter_fun) (err_log: t) =
ErrLogHash.iter (fun err_key set ->
ErrDataSet.iter (fun err_data -> f err_key err_data) set)
err_log
(** Return the number of elements in the error log which satisfy [filter] *)
let size filter (err_log: t) =
let count = ref 0 in

@ -37,7 +37,6 @@ module Name = {
| Footprint => footprint
| Spec => spec
| FromString s => s;
let equal = [%compare.equal : t];
};
type name = Name.t [@@deriving compare];

@ -45,13 +45,6 @@ type mem_kind =
| Mobjc /** memory allocated with objective-c alloc */
[@@deriving compare];
let mem_kind_to_num =
fun
| Mmalloc => 0
| Mnew => 1
| Mnew_array => 2
| Mobjc => 3;
/** resource that can be allocated */
type resource =

@ -79,19 +79,6 @@ type fkind =
| FLongDouble /** [long double] */
[@@deriving compare];
/** comparison for fkind */
let fkind_compare k1 k2 =>
switch (k1, k2) {
| (FFloat, FFloat) => 0
| (FFloat, _) => (-1)
| (_, FFloat) => 1
| (FDouble, FDouble) => 0
| (FDouble, _) => (-1)
| (_, FDouble) => 1
| (FLongDouble, FLongDouble) => 0
};
let fkind_to_string =
fun
| FFloat => "float"
@ -456,7 +443,7 @@ let rec java_from_string: string => t =
}
| typ_str => mk (Tstruct (Name.Java.from_string typ_str));
type typ = t [@@deriving compare];
type typ = t;
module Procname = {
/* e.g. ("", "int") for primitive types or ("java.io", "PrintWriter") for objects */

@ -170,26 +170,6 @@ module NullifyAnalysis =
(Scheduler.ReversePostorder (ProcCfg.Exceptional))
(NullifyTransferFunctions)
(** remove dead stores whose lhs is a frontend-created temporary variable. these dead stores are
created by copy-propagation *)
let remove_dead_frontend_stores pdesc liveness_inv_map =
let is_live var instr_id liveness_inv_map =
match LivenessAnalysis.extract_pre instr_id liveness_inv_map with
| Some pre -> VarDomain.mem var pre
| None -> true in
let is_used_store (instr, instr_id_opt) =
match instr, instr_id_opt with
| Sil.Load (id, _, _, _), Some instr_id when not (Ident.is_none id) ->
is_live (Var.of_id id) instr_id liveness_inv_map
| _ -> true in
let node_remove_dead_stores node =
let instr_nodes = BackwardCfg.instr_ids node in
let instr_nodes' = IList.filter_changed is_used_store instr_nodes in
if not (phys_equal instr_nodes' instr_nodes)
then
Procdesc.Node.replace_instrs node (List.rev_map ~f:fst instr_nodes') in
Procdesc.iter_nodes node_remove_dead_stores pdesc
let add_nullify_instrs pdesc tenv liveness_inv_map =
let address_taken_vars =
if Typ.Procname.is_java (Procdesc.get_proc_name pdesc)

@ -350,11 +350,6 @@ let spec_tbl: spec_tbl = Typ.Procname.Hash.create 128
let clear_spec_tbl () = Typ.Procname.Hash.clear spec_tbl
(** pretty print analysis time; if [whole_seconds] is true, only print time in seconds *)
let pp_time whole_seconds fmt t =
if whole_seconds then F.fprintf fmt "%3.0f s" t
else F.fprintf fmt "%f s" t
let pp_failure_kind_opt fmt failure_kind_opt = match failure_kind_opt with
| Some failure_kind -> SymOp.pp_failure_kind fmt failure_kind
| None -> F.fprintf fmt "NONE"

@ -33,8 +33,6 @@ let exe_name =
let exe_to_name = List.map ~f:(fun (n,a) -> (a,n)) exes in
fun exe -> List.Assoc.find_exn ~equal:equal_exe exe_to_name exe
let frontend_parse_modes = CLOpt.(Infer [Clang])
type analyzer =
| Capture | Compile | Infer | Eradicate | Checkers | Tracing | Crashcontext | Linters | Quandary
[@@deriving compare]
@ -1446,7 +1444,7 @@ let javac_classes_out =
classes_out)
""
and java_classpath =
and _ =
CLOpt.mk_string_opt ~parse_mode:CLOpt.Javac
~deprecated:["classpath";"cp"] ~long:""
~f:(fun classpath ->
@ -1571,7 +1569,7 @@ let inferconfig_path () =
let is_root = String.equal dir parent in
if is_root then None
else find parent in
match Sys.getenv "INFERCONFIG" with
match Sys.getenv inferconfig_env_var with
| Some env_path ->
(* make sure the path makes sense in children infer processes *)
Some (

@ -239,10 +239,6 @@ let shell_escape_command cmd =
|> Printf.sprintf "'%s'" in
List.map ~f:escape cmd |> String.concat ~sep:" "
let run_command_and_get_output cmd =
let shell_escaped_cmd = shell_escape_command cmd in
with_process_in (Printf.sprintf "%s 2>&1" shell_escaped_cmd) In_channel.input_lines
(** Create a directory if it does not exist already. *)
let create_dir dir =
try

@ -118,10 +118,7 @@ end
module PPMap =
struct
include PrettyPrintable.MakePPMap (struct
include Allocsite
let pp_key f k = pp f k
end)
include PrettyPrintable.MakePPMap (Allocsite)
let pp ~pp_value fmt m =
let pp_item fmt (k, v) = F.fprintf fmt "(%a, %a)" pp_key k pp_value v in

@ -57,8 +57,6 @@ module Make (Kind : Kind) = struct
if false, report only if the value passed to the sink is itself a source *)
}
let equal = [%compare.equal : t]
let kind t =
t.kind

@ -865,12 +865,6 @@ let filter_by_access access_filter trace =
PathDomain.Sinks.filter access_filter (PathDomain.sinks trace)
|> PathDomain.update_sinks trace
(* keep only the accesses of the given kind *)
let filter_by_kind access_kind trace =
filter_by_access
(fun sink -> phys_equal access_kind (snd (ThreadSafetyDomain.TraceElem.kind sink)))
trace
let get_all_accesses_with_pre pre_filter access_filter accesses =
let open ThreadSafetyDomain in
AccessDomain.fold

@ -14,7 +14,6 @@ type keyword =
| Suggestion
| Severity
| Mode
[@@deriving compare]
type formula_id = Formula_id of string[@@deriving compare]

@ -160,61 +160,6 @@ let create_parsed_linters linters_def_file checkers : linter list =
{condition; issue_desc; def_file = Some linters_def_file} in
List.map ~f:do_one_checker checkers
let check_def_well_expanded vars expanded_formula =
let open CTL in
let check_const c =
match c with
| ALVar.Regexp c
| ALVar.Const c when List.mem vars (ALVar.Var c) ->
failwith ("[ERROR]: Const/Regexp '" ^ c ^
"' is used as formal parameter of some LET definition.")
| ALVar.Const _
| ALVar.Regexp _ -> ()
| ALVar.Var v
| ALVar.FId (Formula_id v) ->
failwith ("[ERROR]: Variable '" ^ v ^
"' could not be substituted and cannot be evaluated") in
let rec check_expansion exp_f =
match exp_f with
| True
| False -> ()
| Atomic (_, ps) -> List.iter ~f: check_const ps
| Not f1 -> check_expansion f1
| And (f1, f2) ->
check_expansion f1;
check_expansion f2
| Or (f1, f2) ->
check_expansion f1;
check_expansion f2
| Implies (f1, f2) ->
check_expansion f1;
check_expansion f2
| InNode (node_type_list, f1) ->
List.iter ~f:check_const node_type_list;
check_expansion f1
| AU (f1, f2) ->
check_expansion f1;
check_expansion f2
| EU (_, f1, f2) ->
check_expansion f1;
check_expansion f2
| EF (_, f1) -> check_expansion f1
| AF f1 -> check_expansion f1
| AG f1 -> check_expansion f1
| EX (_, f1) -> check_expansion f1
| AX f1 -> check_expansion f1
| EH (cl, f1) ->
List.iter ~f:check_const cl;
check_expansion f1
| EG (_, f1) -> check_expansion f1
| ET (ntl, _, f1) ->
List.iter ~f: check_const ntl;
check_expansion f1
| ETX (ntl, _, f1) ->
List.iter ~f: check_const ntl;
check_expansion f1 in
check_expansion expanded_formula
let rec apply_substitution f sub =
let sub_param p = try
snd (List.find_exn sub ~f:(fun (a,_) -> ALVar.equal p a))

@ -84,9 +84,6 @@ let pp_predicate fmt (_name, _arglist) =
let arglist = List.map ~f:ALVar.alexp_to_string _arglist in
Format.fprintf fmt "%s(%a)" name (Pp.comma_seq Format.pp_print_string) arglist
let is_declaration_kind decl s =
String.equal (Clang_ast_proj.get_decl_kind_string decl) s
(* is an objc interface with name expected_name *)
let is_objc_interface_named an expected_name =
match an with

@ -105,12 +105,6 @@ let mk_ia ann ia =
let mark_ia ann ia x =
if x then mk_ia ann ia else ia
let mk_ia_strict ia =
if Annotations.ia_get_strict ia <> None then ia
else (mk_ann_str Annotations.strict, true) :: ia
let mark_ia_strict ia x =
if x then mk_ia_strict ia else ia
let method_annotation_mark_return ann method_annotation =
let ia_ret, params = method_annotation in
let ia_ret' = mark_ia ann ia_ret true in

@ -13,11 +13,7 @@ module F = Format
(* string set domain we use to ensure we're getting the expected traces *)
module MockTraceDomain = struct
include AbstractDomain.FiniteSet
(PrettyPrintable.MakePPSet(struct
include String
let pp_element fmt s = Format.fprintf fmt "%s" s
end))
include AbstractDomain.FiniteSet (PrettyPrintable.MakePPSet (String))
let top_str = "T"

Loading…
Cancel
Save