Fix google-explicit-constructor warnings in utils.
* Declare explicit conversion constructors.
* Use NOLINT(implicit) for implicit conversion constructors.
Bug: 28341362
Change-Id: I4fb58fa32aafc520b2ed862a05a8bdbfabbc6c35
Test: build with WITH_TIDY=1
diff --git a/include/utils/Mutex.h b/include/utils/Mutex.h
index f027c79..8b720b9 100644
--- a/include/utils/Mutex.h
+++ b/include/utils/Mutex.h
@@ -48,8 +48,8 @@
};
Mutex();
- Mutex(const char* name);
- Mutex(int type, const char* name = NULL);
+ explicit Mutex(const char* name);
+ explicit Mutex(int type, const char* name = NULL);
~Mutex();
// lock or unlock the mutex
@@ -73,8 +73,8 @@
// constructed and released when Autolock goes out of scope.
class Autolock {
public:
- inline Autolock(Mutex& mutex) : mLock(mutex) { mLock.lock(); }
- inline Autolock(Mutex* mutex) : mLock(*mutex) { mLock.lock(); }
+ inline explicit Autolock(Mutex& mutex) : mLock(mutex) { mLock.lock(); }
+ inline explicit Autolock(Mutex* mutex) : mLock(*mutex) { mLock.lock(); }
inline ~Autolock() { mLock.unlock(); }
private:
Mutex& mLock;