...of guarded variables, when the function is not marked as requiring locks:
class Return { Mutex mu; Foo foo GUARDED_BY(mu); Foo &returns_ref_locked() { MutexLock lock(&mu); return foo; // BAD } Foo &returns_ref_locks_required() SHARED_LOCKS_REQUIRED(mu) { return foo; // OK } };
This is implemented as -Wthread-safety-return and not part of
-Wthread-safety for now.
Or do you expect more warnings on return?