diff --git a/infer/src/IR/AttributesTable.re b/infer/src/IR/AttributesTable.re index 1ed375e8d..f6d14b6dc 100644 --- a/infer/src/IR/AttributesTable.re +++ b/infer/src/IR/AttributesTable.re @@ -19,8 +19,7 @@ module L = Logging; type attr_kind = | ProcDefined | ProcObjCAccessor - | ProcUndefined -[@@deriving compare]; + | ProcUndefined; /** Module to manage the table of attributes. */ diff --git a/infer/src/IR/Errlog.ml b/infer/src/IR/Errlog.ml index df78dc80a..ca5615740 100644 --- a/infer/src/IR/Errlog.ml +++ b/infer/src/IR/Errlog.ml @@ -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 diff --git a/infer/src/IR/Ident.re b/infer/src/IR/Ident.re index e0df49b5a..105711283 100644 --- a/infer/src/IR/Ident.re +++ b/infer/src/IR/Ident.re @@ -37,7 +37,6 @@ module Name = { | Footprint => footprint | Spec => spec | FromString s => s; - let equal = [%compare.equal : t]; }; type name = Name.t [@@deriving compare]; diff --git a/infer/src/IR/PredSymb.re b/infer/src/IR/PredSymb.re index 6bf426263..22dde8e6b 100644 --- a/infer/src/IR/PredSymb.re +++ b/infer/src/IR/PredSymb.re @@ -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 = diff --git a/infer/src/IR/Typ.re b/infer/src/IR/Typ.re index c1d5e77c5..442bfb72d 100644 --- a/infer/src/IR/Typ.re +++ b/infer/src/IR/Typ.re @@ -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 */ diff --git a/infer/src/backend/preanal.ml b/infer/src/backend/preanal.ml index 55df2de96..96c7c9a7c 100644 --- a/infer/src/backend/preanal.ml +++ b/infer/src/backend/preanal.ml @@ -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) diff --git a/infer/src/backend/specs.ml b/infer/src/backend/specs.ml index 07386a6e7..671f3c9fc 100644 --- a/infer/src/backend/specs.ml +++ b/infer/src/backend/specs.ml @@ -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" diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 461140ab1..e56771cfb 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -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 ( diff --git a/infer/src/base/Utils.ml b/infer/src/base/Utils.ml index 6592c8539..2f1bc984a 100644 --- a/infer/src/base/Utils.ml +++ b/infer/src/base/Utils.ml @@ -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 diff --git a/infer/src/bufferoverrun/arrayBlk.ml b/infer/src/bufferoverrun/arrayBlk.ml index aa6d4ea02..1dea1ca8e 100644 --- a/infer/src/bufferoverrun/arrayBlk.ml +++ b/infer/src/bufferoverrun/arrayBlk.ml @@ -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 diff --git a/infer/src/checkers/Sink.ml b/infer/src/checkers/Sink.ml index ce16d35f7..fa9c71040 100644 --- a/infer/src/checkers/Sink.ml +++ b/infer/src/checkers/Sink.ml @@ -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 diff --git a/infer/src/checkers/ThreadSafety.ml b/infer/src/checkers/ThreadSafety.ml index 8f10b2340..67c9d8f27 100644 --- a/infer/src/checkers/ThreadSafety.ml +++ b/infer/src/checkers/ThreadSafety.ml @@ -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 diff --git a/infer/src/clang/ALVar.ml b/infer/src/clang/ALVar.ml index 987bdb610..e9feff65c 100644 --- a/infer/src/clang/ALVar.ml +++ b/infer/src/clang/ALVar.ml @@ -14,7 +14,6 @@ type keyword = | Suggestion | Severity | Mode -[@@deriving compare] type formula_id = Formula_id of string[@@deriving compare] diff --git a/infer/src/clang/cFrontend_errors.ml b/infer/src/clang/cFrontend_errors.ml index 8fbac98ac..7da579f82 100644 --- a/infer/src/clang/cFrontend_errors.ml +++ b/infer/src/clang/cFrontend_errors.ml @@ -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)) diff --git a/infer/src/clang/cPredicates.ml b/infer/src/clang/cPredicates.ml index 22d736c25..8fba90657 100644 --- a/infer/src/clang/cPredicates.ml +++ b/infer/src/clang/cPredicates.ml @@ -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 diff --git a/infer/src/eradicate/AnnotatedSignature.ml b/infer/src/eradicate/AnnotatedSignature.ml index 2043c4cc8..a0c2928a5 100644 --- a/infer/src/eradicate/AnnotatedSignature.ml +++ b/infer/src/eradicate/AnnotatedSignature.ml @@ -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 diff --git a/infer/src/unit/accessTreeTests.ml b/infer/src/unit/accessTreeTests.ml index ceb11ce7d..2d3430e5c 100644 --- a/infer/src/unit/accessTreeTests.ml +++ b/infer/src/unit/accessTreeTests.ml @@ -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"