Move to newer clang annotations
Also enable -Wthread-safety-negative.
Changes:
Switch to capabilities and negative capabilities.
Future work:
Use capabilities to implement uninterruptible annotations to work
with AssertNoThreadSuspension.
Bug: 20072211
Change-Id: I42fcbe0300d98a831c89d1eff3ecd5a7e99ebf33
diff --git a/runtime/base/timing_logger.h b/runtime/base/timing_logger.h
index b300109..e10cd24 100644
--- a/runtime/base/timing_logger.h
+++ b/runtime/base/timing_logger.h
@@ -33,17 +33,17 @@
explicit CumulativeLogger(const std::string& name);
~CumulativeLogger();
void Start();
- void End() LOCKS_EXCLUDED(lock_);
- void Reset() LOCKS_EXCLUDED(lock_);
- void Dump(std::ostream& os) const LOCKS_EXCLUDED(lock_);
+ void End() REQUIRES(!lock_);
+ void Reset() REQUIRES(!lock_);
+ void Dump(std::ostream& os) const REQUIRES(!lock_);
uint64_t GetTotalNs() const {
return GetTotalTime() * kAdjust;
}
// Allow the name to be modified, particularly when the cumulative logger is a field within a
// parent class that is unable to determine the "name" of a sub-class.
- void SetName(const std::string& name) LOCKS_EXCLUDED(lock_);
- void AddLogger(const TimingLogger& logger) LOCKS_EXCLUDED(lock_);
- size_t GetIterations() const;
+ void SetName(const std::string& name) REQUIRES(!lock_);
+ void AddLogger(const TimingLogger& logger) REQUIRES(!lock_);
+ size_t GetIterations() const REQUIRES(!lock_);
private:
class HistogramComparator {
@@ -58,8 +58,8 @@
static constexpr size_t kInitialBucketSize = 50; // 50 microseconds.
void AddPair(const std::string &label, uint64_t delta_time)
- EXCLUSIVE_LOCKS_REQUIRED(lock_);
- void DumpHistogram(std::ostream &os) const EXCLUSIVE_LOCKS_REQUIRED(lock_);
+ REQUIRES(lock_);
+ void DumpHistogram(std::ostream &os) const REQUIRES(lock_);
uint64_t GetTotalTime() const {
return total_time_;
}