From b888e33e1f7febfdab132601ede1ad15fd337a56 Mon Sep 17 00:00:00 2001 From: Dulma Churchill Date: Tue, 23 Jun 2020 06:12:16 -0700 Subject: [PATCH] [biabduction] Delete UNARY_MINUS_APPLIED_TO_UNSIGNED_EXPRESSION Summary: This is unused so we can delete it. Reviewed By: ezgicicek Differential Revision: D22184609 fbshipit-source-id: 42dfaffc3 --- infer/man/man1/infer-full.txt | 2 -- infer/man/man1/infer-report.txt | 2 -- infer/man/man1/infer.txt | 2 -- infer/src/absint/Localise.ml | 17 ----------------- infer/src/absint/Localise.mli | 3 --- infer/src/base/IssueType.ml | 4 ---- infer/src/base/IssueType.mli | 2 -- infer/src/biabduction/Exceptions.ml | 6 ------ infer/src/biabduction/Exceptions.mli | 2 -- infer/src/biabduction/SymExec.ml | 10 +--------- infer/src/biabduction/errdesc.ml | 12 ------------ infer/src/biabduction/errdesc.mli | 4 ---- 12 files changed, 1 insertion(+), 65 deletions(-) diff --git a/infer/man/man1/infer-full.txt b/infer/man/man1/infer-full.txt index eb3cef24c..d130225ba 100644 --- a/infer/man/man1/infer-full.txt +++ b/infer/man/man1/infer-full.txt @@ -495,8 +495,6 @@ OPTIONS Symexec_memory_error (enabled by default), THREAD_SAFETY_VIOLATION (enabled by default), TOPL_ERROR (enabled by default), - UNARY_MINUS_APPLIED_TO_UNSIGNED_EXPRESSION (disabled by - default), UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK (enabled by default), UNINITIALIZED_VALUE (enabled by default), UNREACHABLE_CODE (enabled by default), diff --git a/infer/man/man1/infer-report.txt b/infer/man/man1/infer-report.txt index 060fecf5b..b8f8a51ab 100644 --- a/infer/man/man1/infer-report.txt +++ b/infer/man/man1/infer-report.txt @@ -220,8 +220,6 @@ OPTIONS Symexec_memory_error (enabled by default), THREAD_SAFETY_VIOLATION (enabled by default), TOPL_ERROR (enabled by default), - UNARY_MINUS_APPLIED_TO_UNSIGNED_EXPRESSION (disabled by - default), UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK (enabled by default), UNINITIALIZED_VALUE (enabled by default), UNREACHABLE_CODE (enabled by default), diff --git a/infer/man/man1/infer.txt b/infer/man/man1/infer.txt index 9e134fc58..352b8fb62 100644 --- a/infer/man/man1/infer.txt +++ b/infer/man/man1/infer.txt @@ -495,8 +495,6 @@ OPTIONS Symexec_memory_error (enabled by default), THREAD_SAFETY_VIOLATION (enabled by default), TOPL_ERROR (enabled by default), - UNARY_MINUS_APPLIED_TO_UNSIGNED_EXPRESSION (disabled by - default), UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK (enabled by default), UNINITIALIZED_VALUE (enabled by default), UNREACHABLE_CODE (enabled by default), diff --git a/infer/src/absint/Localise.ml b/infer/src/absint/Localise.ml index c9aac89aa..f7e547ca0 100644 --- a/infer/src/absint/Localise.ml +++ b/infer/src/absint/Localise.ml @@ -564,23 +564,6 @@ let desc_registered_observer_being_deallocated pvar loc = ; tags= !tags } -let desc_unary_minus_applied_to_unsigned_expression expr_str_opt typ_str loc = - let tags = Tags.create () in - let expression = - match expr_str_opt with - | Some s -> - Tags.update tags Tags.value s ; - "expression " ^ s - | None -> - "an expression" - in - let description = - Format.asprintf "A unary minus is applied to %a of type %s %s" MF.pp_monospaced expression - typ_str (at_line tags loc) - in - {no_desc with descriptions= [description]; tags= !tags} - - let desc_skip_function proc_name = let tags = Tags.create () in let proc_name_str = Procname.to_string proc_name in diff --git a/infer/src/absint/Localise.mli b/infer/src/absint/Localise.mli index 7828813f1..30d807552 100644 --- a/infer/src/absint/Localise.mli +++ b/infer/src/absint/Localise.mli @@ -135,9 +135,6 @@ val desc_skip_function : Procname.t -> error_desc val desc_inherently_dangerous_function : Procname.t -> error_desc -val desc_unary_minus_applied_to_unsigned_expression : - string option -> string -> Location.t -> error_desc - val desc_uninitialized_dangling_pointer_deref : deref_str -> string -> Location.t -> error_desc val access_desc : access option -> string list diff --git a/infer/src/base/IssueType.ml b/infer/src/base/IssueType.ml index 6b22c8d81..0407b4e27 100644 --- a/infer/src/base/IssueType.ml +++ b/infer/src/base/IssueType.ml @@ -889,10 +889,6 @@ let complexity_increase ~kind ~is_on_ui_thread = let topl_error = register ~id:"TOPL_ERROR" Error TOPL ~user_documentation:"Experimental." -let unary_minus_applied_to_unsigned_expression = - register ~enabled:false ~id:"UNARY_MINUS_APPLIED_TO_UNSIGNED_EXPRESSION" Warning - Biabduction (* TODO *) ~user_documentation:"" - let _unavailable_api_in_supported_ios_sdk = register ~id:"UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK" Warning Linters diff --git a/infer/src/base/IssueType.mli b/infer/src/base/IssueType.mli index 6cf049b67..4f52a24f2 100644 --- a/infer/src/base/IssueType.mli +++ b/infer/src/base/IssueType.mli @@ -318,8 +318,6 @@ val thread_safety_violation : t val topl_error : t -val unary_minus_applied_to_unsigned_expression : t - val uninitialized_value : t val unreachable_code_after : t diff --git a/infer/src/biabduction/Exceptions.ml b/infer/src/biabduction/Exceptions.ml index 758ec86e2..5470999d9 100644 --- a/infer/src/biabduction/Exceptions.ml +++ b/infer/src/biabduction/Exceptions.ml @@ -73,8 +73,6 @@ exception Skip_function of Localise.error_desc exception Symexec_memory_error of L.ocaml_pos -exception Unary_minus_applied_to_unsigned_expression of Localise.error_desc * L.ocaml_pos - exception Wrong_argument_number of L.ocaml_pos let recognize_exception exn : IssueToReport.t = @@ -169,10 +167,6 @@ let recognize_exception exn : IssueToReport.t = { issue_type= IssueType.symexec_memory_error ; description= Localise.no_desc ; ocaml_pos= Some ocaml_pos } - | Unary_minus_applied_to_unsigned_expression (desc, ocaml_pos) -> - { issue_type= IssueType.unary_minus_applied_to_unsigned_expression - ; description= desc - ; ocaml_pos= Some ocaml_pos } | Wrong_argument_number ocaml_pos -> { issue_type= IssueType.wrong_argument_number ; description= Localise.no_desc diff --git a/infer/src/biabduction/Exceptions.mli b/infer/src/biabduction/Exceptions.mli index 13aadae08..829315678 100644 --- a/infer/src/biabduction/Exceptions.mli +++ b/infer/src/biabduction/Exceptions.mli @@ -72,8 +72,6 @@ exception Skip_function of Localise.error_desc exception Symexec_memory_error of Logging.ocaml_pos -exception Unary_minus_applied_to_unsigned_expression of Localise.error_desc * Logging.ocaml_pos - exception Wrong_argument_number of Logging.ocaml_pos val handle_exception : exn -> bool diff --git a/infer/src/biabduction/SymExec.ml b/infer/src/biabduction/SymExec.ml index 4f1151633..280f1094c 100644 --- a/infer/src/biabduction/SymExec.ml +++ b/infer/src/biabduction/SymExec.ml @@ -412,15 +412,7 @@ let check_arith_norm_exp {InterproceduralAnalysis.proc_desc; err_log; tenv} exp let exn = Exceptions.Divide_by_zero (desc, __POS__) in BiabductionReporting.log_issue_deprecated_using_state proc_desc err_log exn ; (Prop.exp_normalize_prop tenv prop exp, prop') - | Some (Attribute.UminusUnsigned (e, typ)), prop' -> - let desc = - Errdesc.explain_unary_minus_applied_to_unsigned_expression tenv e typ - (AnalysisState.get_node_exn ()) (AnalysisState.get_loc_exn ()) - in - let exn = Exceptions.Unary_minus_applied_to_unsigned_expression (desc, __POS__) in - BiabductionReporting.log_issue_deprecated_using_state proc_desc err_log exn ; - (Prop.exp_normalize_prop tenv prop exp, prop') - | None, prop' -> + | Some (Attribute.UminusUnsigned _), prop' | None, prop' -> (Prop.exp_normalize_prop tenv prop exp, prop') diff --git a/infer/src/biabduction/errdesc.ml b/infer/src/biabduction/errdesc.ml index 511a05432..05bdc9987 100644 --- a/infer/src/biabduction/errdesc.ml +++ b/infer/src/biabduction/errdesc.ml @@ -1100,17 +1100,5 @@ let explain_condition_always_true_false tenv i cond node loc = Localise.desc_condition_always_true_false i cond_str_opt loc -(** explain unary minus applied to unsigned expression *) -let explain_unary_minus_applied_to_unsigned_expression tenv exp typ node loc = - let exp_str_opt = - match exp_rv_dexp tenv node exp with Some de -> Some (DExp.to_string de) | None -> None - in - let typ_str = - let pp fmt = Typ.pp_full Pp.text fmt typ in - F.asprintf "%t" pp - in - Localise.desc_unary_minus_applied_to_unsigned_expression exp_str_opt typ_str loc - - let warning_err loc fmt_string = L.(debug Analysis Medium) ("%a: Warning: " ^^ fmt_string) Location.pp loc diff --git a/infer/src/biabduction/errdesc.mli b/infer/src/biabduction/errdesc.mli index 7089cdaab..53e1d1eb2 100644 --- a/infer/src/biabduction/errdesc.mli +++ b/infer/src/biabduction/errdesc.mli @@ -72,10 +72,6 @@ val explain_condition_always_true_false : Tenv.t -> IntLit.t -> Exp.t -> Procdesc.Node.t -> Location.t -> Localise.error_desc (** explain a condition which is always true or false *) -val explain_unary_minus_applied_to_unsigned_expression : - Tenv.t -> Exp.t -> Typ.t -> Procdesc.Node.t -> Location.t -> Localise.error_desc -(** explain unary minus applied to unsigned expression *) - val explain_leak : Tenv.t -> Predicates.hpred