diff --git a/infer/tests/codetoanalyze/cpp/errors/issues.exp b/infer/tests/codetoanalyze/cpp/errors/issues.exp index 7d2f512ee..b86565d78 100644 --- a/infer/tests/codetoanalyze/cpp/errors/issues.exp +++ b/infer/tests/codetoanalyze/cpp/errors/issues.exp @@ -27,6 +27,8 @@ codetoanalyze/cpp/errors/mutex/std_mutex_lock_profiling.cpp, bad_usage1, 3, PREC codetoanalyze/cpp/errors/mutex/std_mutex_lock_profiling.cpp, bad_usage2, 3, PRECONDITION_NOT_MET, [start of procedure bad_usage2(),Skipped call: function or method not found] codetoanalyze/cpp/errors/mutex/std_mutex_lock_profiling.cpp, lp_lock, 7, DOUBLE_LOCK, [start of procedure lp_lock(),start of procedure detail::try_lock_impl(),Condition is false,return from a call to detail::try_lock_impl,Condition is false,Condition is true,start of procedure detail::lock_impl(),return from a call to detail::lock_impl] codetoanalyze/cpp/errors/mutex/timed_mutex.cpp, alarm1, 2, DOUBLE_LOCK, [start of procedure alarm1()] +codetoanalyze/cpp/errors/mutex/timed_mutex.cpp, try_lock_bad, 2, DOUBLE_LOCK, [start of procedure try_lock_bad()] +codetoanalyze/cpp/errors/mutex/timed_mutex.cpp, try_lock_bad, 2, DOUBLE_LOCK, [start of procedure try_lock_bad()] codetoanalyze/cpp/errors/npe/boxed_ptr.cpp, boxed_ptr::smart_ptr_null_field_deref, 2, NULL_DEREFERENCE, [start of procedure boxed_ptr::smart_ptr_null_field_deref(),start of procedure SmartPtr,return from a call to boxed_ptr::SmartPtr_SmartPtr,start of procedure get,return from a call to boxed_ptr::SmartPtr_get] codetoanalyze/cpp/errors/npe/boxed_ptr.cpp, boxed_ptr::smart_ptr_null_method_deref, 2, NULL_DEREFERENCE, [start of procedure boxed_ptr::smart_ptr_null_method_deref(),start of procedure SmartPtr,return from a call to boxed_ptr::SmartPtr_SmartPtr,start of procedure get,return from a call to boxed_ptr::SmartPtr_get] codetoanalyze/cpp/errors/npe/boxed_ptr.cpp, boxed_ptr::smart_ptr_null_method_deref2, 2, NULL_DEREFERENCE, [start of procedure boxed_ptr::smart_ptr_null_method_deref2(),start of procedure SmartPtr,return from a call to boxed_ptr::SmartPtr_SmartPtr,start of procedure get,return from a call to boxed_ptr::SmartPtr_get] diff --git a/infer/tests/codetoanalyze/cpp/errors/mutex/timed_mutex.cpp b/infer/tests/codetoanalyze/cpp/errors/mutex/timed_mutex.cpp index 46ff2e6a1..d70aff023 100644 --- a/infer/tests/codetoanalyze/cpp/errors/mutex/timed_mutex.cpp +++ b/infer/tests/codetoanalyze/cpp/errors/mutex/timed_mutex.cpp @@ -6,9 +6,26 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ +#include #include void alarm1(std::timed_mutex& m) { m.lock(); m.lock(); } + +void try_lock_bad(std::timed_mutex& m) { + m.try_lock(); + m.lock(); +} + +void try_lock_for_bad_FN(std::timed_mutex& m) { + m.try_lock_for(std::chrono::seconds(123)); + m.lock(); +} + +void try_lock_until_bad_FN(std::timed_mutex& m) { + std::chrono::time_point timeout; + m.try_lock_until(timeout); + m.lock(); +}