Disable Clang thread-safety checks in surfaceflinger unit tests
Parent bug: b/353324127. Enabling `thread-safety-reference-return`
to allow developers to utilize Clang thread safety guardrails.
The surfaceflinger unittest suite currently does not untilize mutex
locks when calling required thread-safe variables.
Example error:
frameworks/native/services/surfaceflinger/tests/unittests/TestableScheduler.h:133:52
error: returning variable 'mAttachedChoreographers' by reference
requires holding mutex 'mChoreographerLock' exclusively
[-Wthread-safety-reference-return]
Added NO_THREAD_SAFETY_ANALYSIS annotations to violating functions.
Bug: 354740314
Test: make
Change-Id: I95793ab942207660ea8e49cfd50d089e956a7ada
diff --git a/services/surfaceflinger/tests/unittests/TestableScheduler.h b/services/surfaceflinger/tests/unittests/TestableScheduler.h
index f063809..1f7bf5f 100644
--- a/services/surfaceflinger/tests/unittests/TestableScheduler.h
+++ b/services/surfaceflinger/tests/unittests/TestableScheduler.h
@@ -133,7 +133,9 @@
using Scheduler::resyncAllToHardwareVsync;
auto& mutableLayerHistory() { return mLayerHistory; }
- auto& mutableAttachedChoreographers() { return mAttachedChoreographers; }
+ auto& mutableAttachedChoreographers() NO_THREAD_SAFETY_ANALYSIS {
+ return mAttachedChoreographers;
+ }
size_t layerHistorySize() NO_THREAD_SAFETY_ANALYSIS {
return mLayerHistory.mActiveLayerInfos.size() + mLayerHistory.mInactiveLayerInfos.size();