From 090ce4edb96bb1ae99949c21b342958360279797 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Tue, 19 May 2020 03:56:36 -0700 Subject: [PATCH] [IR] delete unused Issue types Summary: `ocamlc` didn't tell us but there are a bunch of dead exceptions in `Exceptions.ml` that translate into dead issue types. Found with: ``` for ex in $(grep -o -e '^exception [^ ]*' infer/src/IR/Exceptions.mli | cut -d ' ' -f 2); do git grep -q -e '\braise .*'$ex || git grep -q -e 'Exceptions\.'$ex || echo $ex; done ``` Reviewed By: skcho Differential Revision: D21618645 fbshipit-source-id: f60a3f445 --- infer/man/man1/infer-full.txt | 6 ---- infer/man/man1/infer-report.txt | 6 ---- infer/man/man1/infer.txt | 6 ---- infer/src/IR/Exceptions.ml | 64 --------------------------------- infer/src/IR/Exceptions.mli | 14 -------- infer/src/base/IssueType.ml | 16 --------- infer/src/base/IssueType.mli | 12 ------- 7 files changed, 124 deletions(-) diff --git a/infer/man/man1/infer-full.txt b/infer/man/man1/infer-full.txt index 86fcabb94..5cc93ae4c 100644 --- a/infer/man/man1/infer-full.txt +++ b/infer/man/man1/infer-full.txt @@ -375,7 +375,6 @@ OPTIONS CHECKERS_PRINTF_ARGS (enabled by default), CLASS_CAST_EXCEPTION (disabled by default), CLASS_LOAD (enabled by default), - COMPARING_FLOAT_FOR_EQUALITY (enabled by default), COMPONENT_FACTORY_FUNCTION (enabled by default), COMPONENT_FILE_CYCLOMATIC_COMPLEXITY (enabled by default), COMPONENT_FILE_LINE_COUNT (disabled by default), @@ -388,7 +387,6 @@ OPTIONS CREATE_INTENT_FROM_URI (enabled by default), CROSS_SITE_SCRIPTING (enabled by default), Cannot_star (enabled by default), - Codequery (enabled by default), DANGLING_POINTER_DEREFERENCE (disabled by default), DEADLOCK (enabled by default), DEAD_STORE (enabled by default), @@ -478,9 +476,6 @@ OPTIONS REGISTERED_OBSERVER_BEING_DEALLOCATED (enabled by default), RESOURCE_LEAK (enabled by default), RETAIN_CYCLE (enabled by default), - RETURN_EXPRESSION_REQUIRED (enabled by default), - RETURN_STATEMENT_MISSING (enabled by default), - RETURN_VALUE_IGNORED (disabled by default), SHELL_INJECTION (enabled by default), SHELL_INJECTION_RISK (enabled by default), SKIP_FUNCTION (disabled by default), @@ -513,7 +508,6 @@ OPTIONS USE_AFTER_DELETE (enabled by default), USE_AFTER_FREE (enabled by default), USE_AFTER_LIFETIME (enabled by default), - Unknown_proc (enabled by default), VECTOR_INVALIDATION (enabled by default), WEAK_SELF_IN_NO_ESCAPE_BLOCK (enabled by default), Wrong_argument_number (enabled by default). diff --git a/infer/man/man1/infer-report.txt b/infer/man/man1/infer-report.txt index 7c925e112..ece5c33fa 100644 --- a/infer/man/man1/infer-report.txt +++ b/infer/man/man1/infer-report.txt @@ -105,7 +105,6 @@ OPTIONS CHECKERS_PRINTF_ARGS (enabled by default), CLASS_CAST_EXCEPTION (disabled by default), CLASS_LOAD (enabled by default), - COMPARING_FLOAT_FOR_EQUALITY (enabled by default), COMPONENT_FACTORY_FUNCTION (enabled by default), COMPONENT_FILE_CYCLOMATIC_COMPLEXITY (enabled by default), COMPONENT_FILE_LINE_COUNT (disabled by default), @@ -118,7 +117,6 @@ OPTIONS CREATE_INTENT_FROM_URI (enabled by default), CROSS_SITE_SCRIPTING (enabled by default), Cannot_star (enabled by default), - Codequery (enabled by default), DANGLING_POINTER_DEREFERENCE (disabled by default), DEADLOCK (enabled by default), DEAD_STORE (enabled by default), @@ -208,9 +206,6 @@ OPTIONS REGISTERED_OBSERVER_BEING_DEALLOCATED (enabled by default), RESOURCE_LEAK (enabled by default), RETAIN_CYCLE (enabled by default), - RETURN_EXPRESSION_REQUIRED (enabled by default), - RETURN_STATEMENT_MISSING (enabled by default), - RETURN_VALUE_IGNORED (disabled by default), SHELL_INJECTION (enabled by default), SHELL_INJECTION_RISK (enabled by default), SKIP_FUNCTION (disabled by default), @@ -243,7 +238,6 @@ OPTIONS USE_AFTER_DELETE (enabled by default), USE_AFTER_FREE (enabled by default), USE_AFTER_LIFETIME (enabled by default), - Unknown_proc (enabled by default), VECTOR_INVALIDATION (enabled by default), WEAK_SELF_IN_NO_ESCAPE_BLOCK (enabled by default), Wrong_argument_number (enabled by default). diff --git a/infer/man/man1/infer.txt b/infer/man/man1/infer.txt index 4a7d03499..ffeb3648c 100644 --- a/infer/man/man1/infer.txt +++ b/infer/man/man1/infer.txt @@ -375,7 +375,6 @@ OPTIONS CHECKERS_PRINTF_ARGS (enabled by default), CLASS_CAST_EXCEPTION (disabled by default), CLASS_LOAD (enabled by default), - COMPARING_FLOAT_FOR_EQUALITY (enabled by default), COMPONENT_FACTORY_FUNCTION (enabled by default), COMPONENT_FILE_CYCLOMATIC_COMPLEXITY (enabled by default), COMPONENT_FILE_LINE_COUNT (disabled by default), @@ -388,7 +387,6 @@ OPTIONS CREATE_INTENT_FROM_URI (enabled by default), CROSS_SITE_SCRIPTING (enabled by default), Cannot_star (enabled by default), - Codequery (enabled by default), DANGLING_POINTER_DEREFERENCE (disabled by default), DEADLOCK (enabled by default), DEAD_STORE (enabled by default), @@ -478,9 +476,6 @@ OPTIONS REGISTERED_OBSERVER_BEING_DEALLOCATED (enabled by default), RESOURCE_LEAK (enabled by default), RETAIN_CYCLE (enabled by default), - RETURN_EXPRESSION_REQUIRED (enabled by default), - RETURN_STATEMENT_MISSING (enabled by default), - RETURN_VALUE_IGNORED (disabled by default), SHELL_INJECTION (enabled by default), SHELL_INJECTION_RISK (enabled by default), SKIP_FUNCTION (disabled by default), @@ -513,7 +508,6 @@ OPTIONS USE_AFTER_DELETE (enabled by default), USE_AFTER_FREE (enabled by default), USE_AFTER_LIFETIME (enabled by default), - Unknown_proc (enabled by default), VECTOR_INVALIDATION (enabled by default), WEAK_SELF_IN_NO_ESCAPE_BLOCK (enabled by default), Wrong_argument_number (enabled by default). diff --git a/infer/src/IR/Exceptions.ml b/infer/src/IR/Exceptions.ml index c4a29463d..78e9a7d51 100644 --- a/infer/src/IR/Exceptions.ml +++ b/infer/src/IR/Exceptions.ml @@ -49,10 +49,6 @@ exception Cannot_star of L.ocaml_pos exception Class_cast_exception of Localise.error_desc * L.ocaml_pos -exception Codequery of Localise.error_desc - -exception Comparing_floats_for_equality of Localise.error_desc * L.ocaml_pos - exception Condition_always_true_false of Localise.error_desc * bool * L.ocaml_pos exception Custom_error of string * Localise.error_desc @@ -84,8 +80,6 @@ exception Inherently_dangerous_function of Localise.error_desc exception Internal_error of Localise.error_desc -exception Java_runtime_exception of Typ.Name.t * string * Localise.error_desc - exception Leak of bool * (visibility * Localise.error_desc) * bool * PredSymb.resource * L.ocaml_pos exception Missing_fld of Fieldname.t * L.ocaml_pos @@ -108,12 +102,6 @@ exception Retain_cycle of Localise.error_desc * L.ocaml_pos exception Registered_observer_being_deallocated of Localise.error_desc * L.ocaml_pos -exception Return_expression_required of Localise.error_desc * L.ocaml_pos - -exception Return_statement_missing of Localise.error_desc * L.ocaml_pos - -exception Return_value_ignored of Localise.error_desc * L.ocaml_pos - exception Skip_function of Localise.error_desc exception Skip_pointer_dereference of Localise.error_desc * L.ocaml_pos @@ -124,8 +112,6 @@ exception Symexec_memory_error of L.ocaml_pos exception Unary_minus_applied_to_unsigned_expression of Localise.error_desc * L.ocaml_pos -exception Unknown_proc - exception Wrong_argument_number of L.ocaml_pos type t = @@ -218,20 +204,6 @@ let recognize_exception exn = ; visibility= Exn_developer ; severity= None ; category= Prover } - | Codequery desc -> - { name= IssueType.codequery - ; description= desc - ; ocaml_pos= None - ; visibility= Exn_user - ; severity= None - ; category= Prover } - | Comparing_floats_for_equality (desc, ocaml_pos) -> - { name= IssueType.comparing_floats_for_equality - ; description= desc - ; ocaml_pos= Some ocaml_pos - ; visibility= Exn_user - ; severity= None - ; category= Nocat } | Condition_always_true_false (desc, b, ocaml_pos) -> let name = if b then IssueType.condition_always_true else IssueType.condition_always_false in { name @@ -360,14 +332,6 @@ let recognize_exception exn = ; visibility= Exn_developer ; severity= None ; category= Nocat } - | Java_runtime_exception (exn_name, _, desc) -> - let exn_str = Typ.Name.name exn_name in - { name= IssueType.register_from_string ~id:exn_str [Biabduction] - ; description= desc - ; ocaml_pos= None - ; visibility= Exn_user - ; severity= None - ; category= Prover } | Leak (fp_part, (exn_vis, error_desc), done_array_abstraction, resource, ocaml_pos) -> if done_array_abstraction then { name= IssueType.leak_after_array_abstraction @@ -452,13 +416,6 @@ let recognize_exception exn = ; visibility= Exn_user ; severity= Some Error ; category= Nocat } - | Return_expression_required (desc, ocaml_pos) -> - { name= IssueType.return_expression_required - ; description= desc - ; ocaml_pos= Some ocaml_pos - ; visibility= Exn_user - ; severity= None - ; category= Nocat } | Stack_variable_address_escape (desc, ocaml_pos) -> { name= IssueType.stack_variable_address_escape ; description= desc @@ -466,20 +423,6 @@ let recognize_exception exn = ; visibility= Exn_user ; severity= Some Error ; category= Nocat } - | Return_statement_missing (desc, ocaml_pos) -> - { name= IssueType.return_statement_missing - ; description= desc - ; ocaml_pos= Some ocaml_pos - ; visibility= Exn_user - ; severity= None - ; category= Nocat } - | Return_value_ignored (desc, ocaml_pos) -> - { name= IssueType.return_value_ignored - ; description= desc - ; ocaml_pos= Some ocaml_pos - ; visibility= Exn_user - ; severity= None - ; category= Nocat } | SymOp.Analysis_failure_exe _ -> { name= IssueType.failure_exe ; description= Localise.no_desc @@ -516,13 +459,6 @@ let recognize_exception exn = ; visibility= Exn_user ; severity= None ; category= Nocat } - | Unknown_proc -> - { name= IssueType.unknown_proc - ; description= Localise.no_desc - ; ocaml_pos= None - ; visibility= Exn_developer - ; severity= None - ; category= Nocat } | Wrong_argument_number ocaml_pos -> { name= IssueType.wrong_argument_number ; description= Localise.no_desc diff --git a/infer/src/IR/Exceptions.mli b/infer/src/IR/Exceptions.mli index a5ad3ae0f..9d828a04c 100644 --- a/infer/src/IR/Exceptions.mli +++ b/infer/src/IR/Exceptions.mli @@ -49,10 +49,6 @@ exception Cannot_star of Logging.ocaml_pos exception Class_cast_exception of Localise.error_desc * Logging.ocaml_pos -exception Codequery of Localise.error_desc - -exception Comparing_floats_for_equality of Localise.error_desc * Logging.ocaml_pos - exception Condition_always_true_false of Localise.error_desc * bool * Logging.ocaml_pos exception Custom_error of string * Localise.error_desc @@ -85,8 +81,6 @@ exception Inherently_dangerous_function of Localise.error_desc exception Internal_error of Localise.error_desc -exception Java_runtime_exception of Typ.Name.t * string * Localise.error_desc - exception Leak of bool * (visibility * Localise.error_desc) * bool * PredSymb.resource * Logging.ocaml_pos @@ -110,12 +104,6 @@ exception Retain_cycle of Localise.error_desc * Logging.ocaml_pos exception Registered_observer_being_deallocated of Localise.error_desc * Logging.ocaml_pos -exception Return_expression_required of Localise.error_desc * Logging.ocaml_pos - -exception Return_statement_missing of Localise.error_desc * Logging.ocaml_pos - -exception Return_value_ignored of Localise.error_desc * Logging.ocaml_pos - exception Skip_function of Localise.error_desc exception Skip_pointer_dereference of Localise.error_desc * Logging.ocaml_pos @@ -126,8 +114,6 @@ exception Symexec_memory_error of Logging.ocaml_pos exception Unary_minus_applied_to_unsigned_expression of Localise.error_desc * Logging.ocaml_pos -exception Unknown_proc - exception Wrong_argument_number of Logging.ocaml_pos val severity_string : severity -> string diff --git a/infer/src/base/IssueType.ml b/infer/src/base/IssueType.ml index d1b40f13a..d311c2b43 100644 --- a/infer/src/base/IssueType.ml +++ b/infer/src/base/IssueType.ml @@ -196,12 +196,6 @@ let class_cast_exception = let class_load = register_from_string ~id:"CLASS_LOAD" [ClassLoads] -let codequery = register_from_string ~id:"Codequery" [Biabduction] - -let comparing_floats_for_equality = - register_from_string ~id:"COMPARING_FLOAT_FOR_EQUALITY" [Biabduction] - - let component_factory_function = register_from_string ~id:"COMPONENT_FACTORY_FUNCTION" [Linters] let component_file_cyclomatic_complexity = @@ -499,14 +493,6 @@ let resource_leak = register_from_string ~id:"RESOURCE_LEAK" [Biabduction; Resou let retain_cycle = register_from_string ~enabled:true ~id:"RETAIN_CYCLE" [Biabduction] -let return_expression_required = register_from_string ~id:"RETURN_EXPRESSION_REQUIRED" [Biabduction] - -let return_statement_missing = register_from_string ~id:"RETURN_STATEMENT_MISSING" [Biabduction] - -let return_value_ignored = - register_from_string ~enabled:false ~id:"RETURN_VALUE_IGNORED" [Biabduction] - - let skip_function = register_from_string ~enabled:false ~id:"SKIP_FUNCTION" [Biabduction] let skip_pointer_dereference = @@ -558,8 +544,6 @@ let unary_minus_applied_to_unsigned_expression = let uninitialized_value = register_from_string ~id:"UNINITIALIZED_VALUE" [Uninit] -let unknown_proc = register_from_string ~id:"Unknown_proc" ~hum:"Unknown Procedure" [Biabduction] - let unreachable_code_after = register_from_string ~id:"UNREACHABLE_CODE" [BufferOverrun] let use_after_delete = register_from_string ~id:"USE_AFTER_DELETE" [Pulse] diff --git a/infer/src/base/IssueType.mli b/infer/src/base/IssueType.mli index dd8a626c2..ae09e36da 100644 --- a/infer/src/base/IssueType.mli +++ b/infer/src/base/IssueType.mli @@ -111,10 +111,6 @@ val class_cast_exception : t val class_load : t -val codequery : t - -val comparing_floats_for_equality : t - val complexity_increase : kind:CostKind.t -> is_on_ui_thread:bool -> t val component_factory_function : t @@ -294,12 +290,6 @@ val resource_leak : t val retain_cycle : t -val return_expression_required : t - -val return_statement_missing : t - -val return_value_ignored : t - val skip_function : t val skip_pointer_dereference : t @@ -332,8 +322,6 @@ val unary_minus_applied_to_unsigned_expression : t val uninitialized_value : t -val unknown_proc : t - val unreachable_code_after : t val use_after_delete : t