[ThreadSafety] Do not report unprotected writes for c++.

Reviewed By: jberdine

Differential Revision: D5172030

fbshipit-source-id: 945acba
master
Daiva Naudziuniene 8 years ago committed by Facebook Github Bot
parent 5bed343280
commit f4b9bb3e3b

@ -1128,19 +1128,26 @@ let report_unsafe_accesses ~is_file_threadsafe aggregated_access_map =
else else
match snd (TraceElem.kind access), pre with match snd (TraceElem.kind access), pre with
| Access.Write, AccessPrecondition.Unprotected _ -> | Access.Write, AccessPrecondition.Unprotected _ ->
if threaded begin
then match Procdesc.get_proc_name pdesc with
reported_acc | Java _ ->
else if threaded
begin then
(* unprotected write. warn. *) reported_acc
report_thread_safety_violation else
tenv begin
pdesc (* unprotected write. warn. *)
~make_description:make_unprotected_write_description report_thread_safety_violation
access; tenv
update_reported access pname reported_acc pdesc
end ~make_description:make_unprotected_write_description
access;
update_reported access pname reported_acc
end
| _ ->
(* Do not report unprotected writes for ObjC_Cpp *)
reported_acc
end
| Access.Write, AccessPrecondition.Protected _ -> | Access.Write, AccessPrecondition.Protected _ ->
(* protected write, do nothing *) (* protected write, do nothing *)
reported_acc reported_acc

@ -1,5 +1,3 @@
codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_get2, 3, THREAD_SAFETY_VIOLATION, [access to `suspiciously_written`] codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_get2, 3, THREAD_SAFETY_VIOLATION, [access to `suspiciously_written`]
codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_get3, 0, THREAD_SAFETY_VIOLATION, [<Beginning of read trace>,access to `not_guarded`,<Beginning of write trace>,access to `not_guarded`] codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_get3, 0, THREAD_SAFETY_VIOLATION, [<Beginning of read trace>,access to `not_guarded`,<Beginning of write trace>,access to `not_guarded`]
codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_get4, 0, THREAD_SAFETY_VIOLATION, [<Beginning of read trace>,access to `suspiciously_read`,<Beginning of write trace>,access to `suspiciously_read`] codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_get4, 0, THREAD_SAFETY_VIOLATION, [<Beginning of read trace>,access to `suspiciously_read`,<Beginning of write trace>,access to `suspiciously_read`]
codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_set, 1, THREAD_SAFETY_VIOLATION, [access to `not_guarded`]
codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_set, 6, THREAD_SAFETY_VIOLATION, [access to `suspiciously_written`]

Loading…
Cancel
Save