[siof] Make siof reporting closer to other checkers

Summary: Don't use a hardcoded string, and enable reports in --issues-tests.

Reviewed By: jvillard

Differential Revision: D4110731

fbshipit-source-id: 9922557
master
Josh Berdine 8 years ago committed by Facebook Github Bot
parent ae7979b416
commit 7fc5b4d55d

@ -79,6 +79,7 @@ let return_statement_missing = "RETURN_STATEMENT_MISSING"
let skip_function = "SKIP_FUNCTION" let skip_function = "SKIP_FUNCTION"
let skip_pointer_dereference = "SKIP_POINTER_DEREFERENCE" let skip_pointer_dereference = "SKIP_POINTER_DEREFERENCE"
let stack_variable_address_escape = "STACK_VARIABLE_ADDRESS_ESCAPE" let stack_variable_address_escape = "STACK_VARIABLE_ADDRESS_ESCAPE"
let static_initialization_order_fiasco = "STATIC_INITIALIZATION_ORDER_FIASCO"
let strong_delegate_warning = "STRONG_DELEGATE_WARNING" let strong_delegate_warning = "STRONG_DELEGATE_WARNING"
let tainted_value_reaching_sensitive_function = "TAINTED_VALUE_REACHING_SENSITIVE_FUNCTION" let tainted_value_reaching_sensitive_function = "TAINTED_VALUE_REACHING_SENSITIVE_FUNCTION"
let unary_minus_applied_to_unsigned_expression = "UNARY_MINUS_APPLIED_TO_UNSIGNED_EXPRESSION" let unary_minus_applied_to_unsigned_expression = "UNARY_MINUS_APPLIED_TO_UNSIGNED_EXPRESSION"

@ -73,6 +73,7 @@ val return_value_ignored : t
val return_expression_required : t val return_expression_required : t
val return_statement_missing : t val return_statement_missing : t
val stack_variable_address_escape : t val stack_variable_address_escape : t
val static_initialization_order_fiasco : t
val strong_delegate_warning : t val strong_delegate_warning : t
val unary_minus_applied_to_unsigned_expression : t val unary_minus_applied_to_unsigned_expression : t
val uninitialized_value : t val uninitialized_value : t

@ -380,6 +380,7 @@ let should_report (issue_kind: Exceptions.err_kind) issue_type error_desc =>
registered_observer_being_deallocated, registered_observer_being_deallocated,
resource_leak, resource_leak,
retain_cycle, retain_cycle,
static_initialization_order_fiasco,
strong_delegate_warning, strong_delegate_warning,
tainted_value_reaching_sensitive_function, tainted_value_reaching_sensitive_function,
unsafe_guarded_by_access unsafe_guarded_by_access
@ -593,22 +594,24 @@ let module IssuesTests = {
ekind == Exceptions.Kerror || ekind == Exceptions.Kerror ||
IList.exists IList.exists
(Localise.equal error_name) (Localise.equal error_name)
[ Localise.[
Localise.assign_pointer_warning, assign_pointer_warning,
Localise.bad_pointer_comparison, bad_pointer_comparison,
Localise.component_factory_function, component_factory_function,
Localise.component_initializer_with_side_effects, component_initializer_with_side_effects,
Localise.component_with_multiple_factory_methods, component_with_multiple_factory_methods,
Localise.component_with_unconventional_superclass, component_with_unconventional_superclass,
Localise.cxx_reference_captured_in_objc_block, cxx_reference_captured_in_objc_block,
Localise.direct_atomic_property_access, direct_atomic_property_access,
Localise.field_not_null_checked, field_not_null_checked,
Localise.global_variable_initialized_with_function_or_method_call, global_variable_initialized_with_function_or_method_call,
Localise.mutable_local_variable_in_component_file, mutable_local_variable_in_component_file,
Localise.parameter_not_null_checked, parameter_not_null_checked,
Localise.registered_observer_being_deallocated, quandary_taint_error,
Localise.return_value_ignored, registered_observer_being_deallocated,
Localise.strong_delegate_warning return_value_ignored,
static_initialization_order_fiasco,
strong_delegate_warning
]; ];
if (in_footprint && should_report && error_filter source_file error_desc error_name) { if (in_footprint && should_report && error_filter source_file error_desc error_name) {
F.fprintf F.fprintf

@ -105,8 +105,8 @@ let report_siof pname loc bad_globals =
unit: %a" unit: %a"
pp_set bad_globals in pp_set bad_globals in
let description = pp_to_string pp_desc () in let description = pp_to_string pp_desc () in
let exn = Exceptions.Checkers let msg = Localise.to_string Localise.static_initialization_order_fiasco in
("STATIC_INITIALIZATION_ORDER_FIASCO", Localise.verbatim_desc description) in let exn = Exceptions.Checkers (msg, Localise.verbatim_desc description) in
Reporting.log_error pname ~loc exn Reporting.log_error pname ~loc exn

Loading…
Cancel
Save