diff --git a/infer/src/backend/mergeCapture.ml b/infer/src/backend/mergeCapture.ml index 880b7935c..e00201b07 100644 --- a/infer/src/backend/mergeCapture.ml +++ b/infer/src/backend/mergeCapture.ml @@ -34,7 +34,7 @@ let empty_stats () = {files_linked= 0; targets_merged= 0} let link_exists s = try - let _ = Unix.lstat s in + ignore (Unix.lstat s) ; true with Unix.Unix_error _ -> false diff --git a/infer/src/biabduction/Prop.ml b/infer/src/biabduction/Prop.ml index 2c265f6dc..a2693240b 100644 --- a/infer/src/biabduction/Prop.ml +++ b/infer/src/biabduction/Prop.ml @@ -2568,7 +2568,7 @@ let prop_iter_gc_fields iter = prop_iter_map f iter -let prop_case_split tenv prop = +let prop_expand tenv prop = let pi_sigma_list = Sil.sigma_to_sigma_ne prop.sigma in let f props_acc (pi, sigma) = let sigma' = sigma_normalize_prop tenv prop sigma in @@ -2578,13 +2578,6 @@ let prop_case_split tenv prop = List.fold ~f ~init:[] pi_sigma_list -let prop_expand prop = - (* - let _ = check_prop_normalized prop in - *) - prop_case_split prop - - (*** START of module Metrics ***) module Metrics : sig val prop_size : 'a t -> int diff --git a/infer/src/biabduction/Prover.ml b/infer/src/biabduction/Prover.ml index 9bd4b24c3..ac5423e18 100644 --- a/infer/src/biabduction/Prover.ml +++ b/infer/src/biabduction/Prover.ml @@ -1932,16 +1932,14 @@ module Subtyping_check = struct end let cast_exception tenv texp1 texp2 e1 subs = - let _ = - match (texp1, texp2) with - | Exp.Sizeof {typ= t1}, Exp.Sizeof {typ= t2; subtype= st2} -> - if - Config.developer_mode - || (Subtype.is_cast st2 && not (Subtyping_check.check_subtype tenv t1 t2)) - then ProverState.checks := Class_cast_check (texp1, texp2, e1) :: !ProverState.checks - | _ -> - () - in + ( match (texp1, texp2) with + | Exp.Sizeof {typ= t1}, Exp.Sizeof {typ= t2; subtype= st2} -> + if + Config.developer_mode + || (Subtype.is_cast st2 && not (Subtyping_check.check_subtype tenv t1 t2)) + then ProverState.checks := Class_cast_check (texp1, texp2, e1) :: !ProverState.checks + | _ -> + () ) ; raise (IMPL_EXC ("class cast exception", subs, EXC_FALSE)) @@ -2073,17 +2071,15 @@ let rec hpred_imply tenv calc_index_frame calc_missing subs prop1 sigma2 hpred2 | Sil.Hpointsto (e2_, se2, texp2) -> ( let e2 = Sil.exp_sub (`Exp (snd subs)) e2_ in - let _ = - match e2 with - | Exp.Lvar _ -> - () - | Exp.Var v -> - if Ident.is_primed v then ( - d_impl_err ("rhs |-> not implemented", subs, EXC_FALSE_HPRED hpred2) ; - raise (Exceptions.Abduction_case_not_implemented __POS__) ) - | _ -> - () - in + ( match e2 with + | Exp.Lvar _ -> + () + | Exp.Var v -> + if Ident.is_primed v then ( + d_impl_err ("rhs |-> not implemented", subs, EXC_FALSE_HPRED hpred2) ; + raise (Exceptions.Abduction_case_not_implemented __POS__) ) + | _ -> + () ) ; match Prop.prop_iter_create prop1 with | None -> raise (IMPL_EXC ("lhs is empty", subs, EXC_FALSE)) @@ -2182,17 +2178,15 @@ let rec hpred_imply tenv calc_index_frame calc_missing subs prop1 sigma2 hpred2 -> ( (* for now ignore implications between PE and NE *) let e2, f2 = (Sil.exp_sub (`Exp (snd subs)) e2_, Sil.exp_sub (`Exp (snd subs)) f2_) in - let _ = - match e2 with - | Exp.Lvar _ -> - () - | Exp.Var v -> - if Ident.is_primed v then ( - d_impl_err ("rhs |-> not implemented", subs, EXC_FALSE_HPRED hpred2) ; - raise (Exceptions.Abduction_case_not_implemented __POS__) ) - | _ -> - () - in + ( match e2 with + | Exp.Lvar _ -> + () + | Exp.Var v -> + if Ident.is_primed v then ( + d_impl_err ("rhs |-> not implemented", subs, EXC_FALSE_HPRED hpred2) ; + raise (Exceptions.Abduction_case_not_implemented __POS__) ) + | _ -> + () ) ; if Exp.equal e2 f2 && Sil.equal_lseg_kind k Sil.Lseg_PE then (subs, prop1) else match Prop.prop_iter_create prop1 with @@ -2253,28 +2247,24 @@ let rec hpred_imply tenv calc_index_frame calc_missing subs prop1 sigma2 hpred2 (* for now ignore implications between PE and NE *) let iF2, oF2 = (Sil.exp_sub (`Exp (snd subs)) iF2, Sil.exp_sub (`Exp (snd subs)) oF2) in let iB2, oB2 = (Sil.exp_sub (`Exp (snd subs)) iB2, Sil.exp_sub (`Exp (snd subs)) oB2) in - let _ = - match oF2 with - | Exp.Lvar _ -> - () - | Exp.Var v -> - if Ident.is_primed v then ( - d_impl_err ("rhs dllseg not implemented", subs, EXC_FALSE_HPRED hpred2) ; - raise (Exceptions.Abduction_case_not_implemented __POS__) ) - | _ -> - () - in - let _ = - match oB2 with - | Exp.Lvar _ -> - () - | Exp.Var v -> - if Ident.is_primed v then ( - d_impl_err ("rhs dllseg not implemented", subs, EXC_FALSE_HPRED hpred2) ; - raise (Exceptions.Abduction_case_not_implemented __POS__) ) - | _ -> - () - in + ( match oF2 with + | Exp.Lvar _ -> + () + | Exp.Var v -> + if Ident.is_primed v then ( + d_impl_err ("rhs dllseg not implemented", subs, EXC_FALSE_HPRED hpred2) ; + raise (Exceptions.Abduction_case_not_implemented __POS__) ) + | _ -> + () ) ; + ( match oB2 with + | Exp.Lvar _ -> + () + | Exp.Var v -> + if Ident.is_primed v then ( + d_impl_err ("rhs dllseg not implemented", subs, EXC_FALSE_HPRED hpred2) ; + raise (Exceptions.Abduction_case_not_implemented __POS__) ) + | _ -> + () ) ; match Prop.prop_iter_create prop1 with | None -> raise (IMPL_EXC ("lhs is empty", subs, EXC_FALSE)) diff --git a/infer/src/checkers/printfArgs.ml b/infer/src/checkers/printfArgs.ml index a1f61478e..5d891cd21 100644 --- a/infer/src/checkers/printfArgs.ml +++ b/infer/src/checkers/printfArgs.ml @@ -95,7 +95,7 @@ let rec format_string_type_names (fmt_string: string) (start: int) : string list try let fmt_re = Str.regexp "%[0-9]*\\.?[0-9]*[A-mo-z]" in (* matches '%2.1d' etc. *) - let _ = Str.search_forward fmt_re fmt_string start in + ignore (Str.search_forward fmt_re fmt_string start) ; let fmt_match = Str.matched_string fmt_string in let fmt_type = String.sub fmt_match ~pos:(String.length fmt_match - 1) ~len:1 in fmt_type :: format_string_type_names fmt_string (Str.match_end ()) diff --git a/infer/src/clang/cFrontend_errors.ml b/infer/src/clang/cFrontend_errors.ml index 73356d4d9..aab3bff37 100644 --- a/infer/src/clang/cFrontend_errors.ml +++ b/infer/src/clang/cFrontend_errors.ml @@ -141,7 +141,7 @@ let rec expand_message_string context message an = (* reg exp should match alphanumeric id with possibly somee _ *) let re = Str.regexp "%[a-zA-Z0-9_]+%" in try - let _ = Str.search_forward re message 0 in + ignore (Str.search_forward re message 0) ; let ms = Str.matched_string message in let res = evaluate_place_holder context ms an in L.(debug Linters Medium) "@\nMatched string '%s'@\n" ms ; diff --git a/infer/src/clang/cTrans.ml b/infer/src/clang/cTrans.ml index 304b40a82..d1ea4a9b5 100644 --- a/infer/src/clang/cTrans.ml +++ b/infer/src/clang/cTrans.ml @@ -2079,7 +2079,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s } *) and objCForCollectionStmt_trans trans_state item items body stmt_info = - let _ = instruction trans_state item in + ignore (instruction trans_state item) ; (* Here we do ast transformation, so we don't need the value of the translation of the *) (* variable item but we still need to add the variable to the locals *) let assign_next_object, cond = Ast_expressions.make_next_object_exp stmt_info item items in diff --git a/infer/src/clang/objcCategory_decl.ml b/infer/src/clang/objcCategory_decl.ml index a30a468ea..fa491b27d 100644 --- a/infer/src/clang/objcCategory_decl.ml +++ b/infer/src/clang/objcCategory_decl.ml @@ -91,12 +91,12 @@ let category_decl qual_type_to_sil_type procname_from_decl tenv decl = let name = CAst_utils.get_qualified_name name_info in let class_name = get_classname_from_category_decl cdi in L.(debug Capture Verbose) "ADDING: ObjCCategoryDecl for '%a'@\n" QualifiedCppName.pp name ; - let _ = add_class_decl qual_type_to_sil_type tenv cdi in + add_class_decl qual_type_to_sil_type tenv cdi ; let typ = process_category qual_type_to_sil_type procname_from_decl tenv class_name decl_info decl_list in - let _ = add_category_implementation qual_type_to_sil_type tenv cdi in + add_category_implementation qual_type_to_sil_type tenv cdi ; typ | _ -> assert false @@ -109,7 +109,7 @@ let category_impl_decl qual_type_to_sil_type procname_from_decl tenv decl = let name = CAst_utils.get_qualified_name name_info in let class_name = get_classname_from_category_impl cii in L.(debug Capture Verbose) "ADDING: ObjCCategoryImplDecl for '%a'@\n" QualifiedCppName.pp name ; - let _ = add_category_decl qual_type_to_sil_type tenv cii in + add_category_decl qual_type_to_sil_type tenv cii ; let typ = process_category qual_type_to_sil_type procname_from_decl tenv class_name decl_info decl_list diff --git a/infer/src/clang/objcInterface_decl.ml b/infer/src/clang/objcInterface_decl.ml index 179d651c3..d37116740 100644 --- a/infer/src/clang/objcInterface_decl.ml +++ b/infer/src/clang/objcInterface_decl.ml @@ -133,11 +133,11 @@ let interface_declaration qual_type_to_sil_type procname_from_decl tenv decl = add_class_to_tenv qual_type_to_sil_type procname_from_decl tenv decl_info name_info decl_list ocidi in - let _ = add_class_implementation qual_type_to_sil_type tenv ocidi in - let _ = add_super_class_decl qual_type_to_sil_type tenv ocidi in - let _ = add_protocols_decl qual_type_to_sil_type tenv ocidi.Clang_ast_t.otdi_protocols in + add_class_implementation qual_type_to_sil_type tenv ocidi ; + add_super_class_decl qual_type_to_sil_type tenv ocidi ; + add_protocols_decl qual_type_to_sil_type tenv ocidi.Clang_ast_t.otdi_protocols ; let known_categories = ocidi.Clang_ast_t.otdi_known_categories in - let _ = add_categories_decl qual_type_to_sil_type tenv known_categories in + add_categories_decl qual_type_to_sil_type tenv known_categories ; typ | _ -> assert false @@ -151,7 +151,7 @@ let interface_impl_declaration qual_type_to_sil_type procname_from_decl tenv dec let class_name = CAst_utils.get_qualified_name name_info in L.(debug Capture Verbose) "ADDING: ObjCImplementationDecl for class '%a'@\n" QualifiedCppName.pp class_name ; - let _ = add_class_decl qual_type_to_sil_type tenv idi in + add_class_decl qual_type_to_sil_type tenv idi ; let class_tn_name = Typ.Name.Objc.from_qual_name class_name in let fields = CField_decl.get_fields qual_type_to_sil_type tenv class_tn_name decl_list in CField_decl.add_missing_fields tenv class_name fields ; diff --git a/infer/src/scripts/checkCopyright.ml b/infer/src/scripts/checkCopyright.ml index dfb19db61..79f22668f 100644 --- a/infer/src/scripts/checkCopyright.ml +++ b/infer/src/scripts/checkCopyright.ml @@ -170,7 +170,7 @@ let get_copyright_year cstart cend lines = let do_line line = try let fmt_re = Str.regexp "[0-9]+" in - let _ = Str.search_forward fmt_re line 0 in + ignore (Str.search_forward fmt_re line 0) ; let fmt_match = Str.matched_string line in if String.length fmt_match = 4 then try found := Some (int_of_string fmt_match) with _ -> () diff --git a/infer/tests/repl/infer_batch_script.mltop b/infer/tests/repl/infer_batch_script.mltop index 7dc258df0..f1f4dd712 100644 --- a/infer/tests/repl/infer_batch_script.mltop +++ b/infer/tests/repl/infer_batch_script.mltop @@ -5,16 +5,16 @@ * LICENSE file in the root directory of this source tree. *) -(* Example of ocaml script starting with infer code. To execute a scipt run: - ./scripts/infer_repl +(** Example of ocaml script starting with infer code. To execute a scipt run: + ./scripts/infer_repl It's used as a basic integration test *) (* "import" infer code *) #use "toplevel_init";; -let _ = Ident.create_fresh Ident.knormal in +ignore (Ident.create_fresh Ident.knormal) ; let ident = Ident.create_fresh Ident.knormal in let e = Exp.Var ident in -print_endline (Exp.to_string e); +print_endline (Exp.to_string e) ; (* pass --flavors flag to change the value *) print_endline (string_of_bool Config.flavors)