diff options
author | Chih-Hung Hsieh <chh@google.com> | 2016-07-29 17:01:17 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-07-29 17:01:17 +0000 |
commit | 89cc78b77ff162d061a4bb0cc920c48a1ac3ed91 (patch) | |
tree | 466ea17fd124a6b52e3b5c0d4fe661927732d29b | |
parent | 6d287b3de7245061d7917852063064bbf281ed57 (diff) | |
parent | 6dc68cb5f97a2f4fd3e0d105f34cd29dd73e0da5 (diff) | |
download | core-89cc78b77ff162d061a4bb0cc920c48a1ac3ed91.tar.gz core-89cc78b77ff162d061a4bb0cc920c48a1ac3ed91.tar.bz2 core-89cc78b77ff162d061a4bb0cc920c48a1ac3ed91.zip |
Merge \"Fix google-explicit-constructor warnings in system/core.\"
am: 6dc68cb5f9
Change-Id: I5a010465364b6e14423b19e8c0f9cffa58ee3152
34 files changed, 56 insertions, 56 deletions
diff --git a/debuggerd/test/BacktraceMock.h b/debuggerd/test/BacktraceMock.h index f75534eba..6104f7e0d 100644 --- a/debuggerd/test/BacktraceMock.h +++ b/debuggerd/test/BacktraceMock.h @@ -41,7 +41,7 @@ class BacktraceMapMock : public BacktraceMap { class BacktraceMock : public Backtrace { public: - BacktraceMock(BacktraceMapMock* map) : Backtrace(0, 0, map) { + explicit BacktraceMock(BacktraceMapMock* map) : Backtrace(0, 0, map) { if (map_ == nullptr) { abort(); } diff --git a/fastboot/socket.h b/fastboot/socket.h index de543dbab..7eaa0ab2c 100644 --- a/fastboot/socket.h +++ b/fastboot/socket.h @@ -104,7 +104,7 @@ class Socket { protected: // Protected constructor to force factory function use. - Socket(cutils_socket_t sock); + explicit Socket(cutils_socket_t sock); // Blocks up to |timeout_ms| until a read is possible on |sock_|, and sets |receive_timed_out_| // as appropriate to help distinguish between normal timeouts and fatal errors. Returns true if diff --git a/init/action.h b/init/action.h index 6dee2d0a5..0bae9f0ef 100644 --- a/init/action.h +++ b/init/action.h @@ -44,7 +44,7 @@ private: class Action { public: - Action(bool oneshot = false); + explicit Action(bool oneshot = false); bool AddCommand(const std::vector<std::string>& args, const std::string& filename, int line, std::string* err); diff --git a/init/parser/tokenizer.h b/init/parser/tokenizer.h index 8312a08e7..ade8f7389 100644 --- a/init/parser/tokenizer.h +++ b/init/parser/tokenizer.h @@ -36,7 +36,7 @@ namespace init { // a TOK_NEWLINE will not be generated for that line. class Tokenizer { public: - Tokenizer(const std::string& data); + explicit Tokenizer(const std::string& data); ~Tokenizer(); enum TokenType { TOK_START, TOK_END, TOK_NEWLINE, TOK_TEXT }; diff --git a/libbacktrace/UnwindMap.h b/libbacktrace/UnwindMap.h index f85b54a9f..d5bec069b 100644 --- a/libbacktrace/UnwindMap.h +++ b/libbacktrace/UnwindMap.h @@ -29,7 +29,7 @@ class UnwindMap : public BacktraceMap { public: - UnwindMap(pid_t pid); + explicit UnwindMap(pid_t pid); unw_map_cursor_t* GetMapCursor() { return &map_cursor_; } @@ -39,7 +39,7 @@ protected: class UnwindMapRemote : public UnwindMap { public: - UnwindMapRemote(pid_t pid); + explicit UnwindMapRemote(pid_t pid); virtual ~UnwindMapRemote(); bool Build() override; diff --git a/liblog/tests/benchmark.h b/liblog/tests/benchmark.h index 57b374873..e9280f63e 100644 --- a/liblog/tests/benchmark.h +++ b/liblog/tests/benchmark.h @@ -38,7 +38,7 @@ class Benchmark { Benchmark(const char* name, void (*fn)(int)) : name_(strdup(name)), fn_(fn) { BenchmarkRegister(this); } - Benchmark(const char* name) : name_(strdup(name)), fn_(NULL) {} + explicit Benchmark(const char* name) : name_(strdup(name)), fn_(NULL) {} virtual ~Benchmark() { free(name_); diff --git a/libmemunreachable/Allocator.h b/libmemunreachable/Allocator.h index a8f579ee1..539073961 100644 --- a/libmemunreachable/Allocator.h +++ b/libmemunreachable/Allocator.h @@ -109,13 +109,13 @@ public: } // Construct an STLAllocator on top of a Heap - STLAllocator(const Heap& heap) : + STLAllocator(const Heap& heap) : // NOLINT, implicit heap_(heap) { } // Rebind an STLAllocator from an another STLAllocator template<typename U> - STLAllocator(const STLAllocator<U>& other) : + STLAllocator(const STLAllocator<U>& other) : // NOLINT, implicit heap_(other.heap_) { } @@ -155,12 +155,12 @@ class Allocator : public STLAllocator<T> { public: ~Allocator() {} - Allocator(const Heap& other) : + Allocator(const Heap& other) : // NOLINT, implicit STLAllocator<T>(other) { } template<typename U> - Allocator(const STLAllocator<U>& other) : + Allocator(const STLAllocator<U>& other) : // NOLINT, implicit STLAllocator<T>(other) { } diff --git a/libmemunreachable/HeapWalker.h b/libmemunreachable/HeapWalker.h index 3c1b513c1..b25696fd4 100644 --- a/libmemunreachable/HeapWalker.h +++ b/libmemunreachable/HeapWalker.h @@ -48,7 +48,7 @@ struct compare_range { class HeapWalker { public: - HeapWalker(Allocator<HeapWalker> allocator) : allocator_(allocator), + explicit HeapWalker(Allocator<HeapWalker> allocator) : allocator_(allocator), allocations_(allocator), allocation_bytes_(0), roots_(allocator), root_vals_(allocator), segv_handler_(allocator), walking_ptr_(0) { diff --git a/libmemunreachable/LeakFolding.h b/libmemunreachable/LeakFolding.h index 732d3f281..9c6a525fc 100644 --- a/libmemunreachable/LeakFolding.h +++ b/libmemunreachable/LeakFolding.h @@ -54,7 +54,7 @@ class LeakFolding { bool dominator; SCCInfo* accumulator; - SCCInfo(Allocator<SCCInfo> allocator) : node(this, allocator), + explicit SCCInfo(Allocator<SCCInfo> allocator) : node(this, allocator), count(0), size(0), cuumulative_count(0), cuumulative_size(0), dominator(false), accumulator(nullptr) {} private: diff --git a/libmemunreachable/LinkedList.h b/libmemunreachable/LinkedList.h index 3e44035bd..132842da1 100644 --- a/libmemunreachable/LinkedList.h +++ b/libmemunreachable/LinkedList.h @@ -21,7 +21,7 @@ template<class T> class LinkedList { public: LinkedList() : next_(this), prev_(this), data_() {} - LinkedList(T data) : LinkedList() { + explicit LinkedList(T data) : LinkedList() { data_ = data; } ~LinkedList() {} diff --git a/libmemunreachable/PtracerThread.h b/libmemunreachable/PtracerThread.h index 4d6ca9a0d..f88b5994f 100644 --- a/libmemunreachable/PtracerThread.h +++ b/libmemunreachable/PtracerThread.h @@ -32,7 +32,7 @@ class Stack; // the parent. class PtracerThread { public: - PtracerThread(const std::function<int()>& func); + explicit PtracerThread(const std::function<int()>& func); ~PtracerThread(); bool Start(); int Join(); diff --git a/libmemunreachable/ScopedDisableMalloc.h b/libmemunreachable/ScopedDisableMalloc.h index 4f9637621..758d317aa 100644 --- a/libmemunreachable/ScopedDisableMalloc.h +++ b/libmemunreachable/ScopedDisableMalloc.h @@ -74,7 +74,7 @@ class ScopedDisableMalloc { class ScopedDisableMallocTimeout { public: - ScopedDisableMallocTimeout(std::chrono::milliseconds timeout = std::chrono::milliseconds(2000)) : + explicit ScopedDisableMallocTimeout(std::chrono::milliseconds timeout = std::chrono::milliseconds(2000)) : timeout_(timeout), timed_out_(false), disable_malloc_() { Disable(); } diff --git a/libmemunreachable/ScopedSignalHandler.h b/libmemunreachable/ScopedSignalHandler.h index e006d435e..1fd9d4d71 100644 --- a/libmemunreachable/ScopedSignalHandler.h +++ b/libmemunreachable/ScopedSignalHandler.h @@ -30,7 +30,7 @@ class ScopedSignalHandler { public: using Fn = std::function<void(ScopedSignalHandler&, int, siginfo_t*, void*)>; - ScopedSignalHandler(Allocator<Fn> allocator) : allocator_(allocator), signal_(-1) {} + explicit ScopedSignalHandler(Allocator<Fn> allocator) : allocator_(allocator), signal_(-1) {} ~ScopedSignalHandler() { reset(); } diff --git a/libmemunreachable/Semaphore.h b/libmemunreachable/Semaphore.h index 45e8c819d..6bcf4ea97 100644 --- a/libmemunreachable/Semaphore.h +++ b/libmemunreachable/Semaphore.h @@ -24,7 +24,7 @@ class Semaphore { public: - Semaphore(int count = 0) : count_(count) {} + explicit Semaphore(int count = 0) : count_(count) {} ~Semaphore() = default; void Wait(std::chrono::milliseconds ms) { diff --git a/libmemunreachable/Tarjan.h b/libmemunreachable/Tarjan.h index d7ecdb9ba..dcd139acb 100644 --- a/libmemunreachable/Tarjan.h +++ b/libmemunreachable/Tarjan.h @@ -62,7 +62,7 @@ using SCCList = allocator::vector<SCC<T>>; template<class T> class TarjanAlgorithm { public: - TarjanAlgorithm(Allocator<void> allocator) : index_(0), + explicit TarjanAlgorithm(Allocator<void> allocator) : index_(0), stack_(allocator), components_(allocator) {} void Execute(Graph<T>& graph, SCCList<T>& out); diff --git a/libmemunreachable/tests/MemUnreachable_test.cpp b/libmemunreachable/tests/MemUnreachable_test.cpp index 0747b12b6..2ae3db83e 100644 --- a/libmemunreachable/tests/MemUnreachable_test.cpp +++ b/libmemunreachable/tests/MemUnreachable_test.cpp @@ -27,7 +27,7 @@ void* ptr; class HiddenPointer { public: - HiddenPointer(size_t size = 256) { + explicit HiddenPointer(size_t size = 256) { Set(malloc(size)); } ~HiddenPointer() { diff --git a/libpixelflinger/codeflinger/ARMAssembler.h b/libpixelflinger/codeflinger/ARMAssembler.h index 7178c65df..76acf7e3a 100644 --- a/libpixelflinger/codeflinger/ARMAssembler.h +++ b/libpixelflinger/codeflinger/ARMAssembler.h @@ -35,7 +35,7 @@ namespace android { class ARMAssembler : public ARMAssemblerInterface { public: - ARMAssembler(const sp<Assembly>& assembly); + explicit ARMAssembler(const sp<Assembly>& assembly); virtual ~ARMAssembler(); uint32_t* base() const; diff --git a/libpixelflinger/codeflinger/ARMAssemblerProxy.h b/libpixelflinger/codeflinger/ARMAssemblerProxy.h index b85279485..10d039085 100644 --- a/libpixelflinger/codeflinger/ARMAssemblerProxy.h +++ b/libpixelflinger/codeflinger/ARMAssemblerProxy.h @@ -34,7 +34,7 @@ public: // ARMAssemblerProxy take ownership of the target ARMAssemblerProxy(); - ARMAssemblerProxy(ARMAssemblerInterface* target); + explicit ARMAssemblerProxy(ARMAssemblerInterface* target); virtual ~ARMAssemblerProxy(); void setTarget(ARMAssemblerInterface* target); diff --git a/libpixelflinger/codeflinger/Arm64Assembler.h b/libpixelflinger/codeflinger/Arm64Assembler.h index c9be11614..527c757aa 100644 --- a/libpixelflinger/codeflinger/Arm64Assembler.h +++ b/libpixelflinger/codeflinger/Arm64Assembler.h @@ -47,8 +47,8 @@ namespace android { class ArmToArm64Assembler : public ARMAssemblerInterface { public: - ArmToArm64Assembler(const sp<Assembly>& assembly); - ArmToArm64Assembler(void *base); + explicit ArmToArm64Assembler(const sp<Assembly>& assembly); + explicit ArmToArm64Assembler(void *base); virtual ~ArmToArm64Assembler(); uint32_t* base() const; diff --git a/libpixelflinger/codeflinger/CodeCache.h b/libpixelflinger/codeflinger/CodeCache.h index 0fb6fd5fe..c0e0684ef 100644 --- a/libpixelflinger/codeflinger/CodeCache.h +++ b/libpixelflinger/codeflinger/CodeCache.h @@ -42,7 +42,7 @@ template <typename T> class AssemblyKey : public AssemblyKeyBase { public: - AssemblyKey(const T& rhs) : mKey(rhs) { } + explicit AssemblyKey(const T& rhs) : mKey(rhs) { } virtual int compare_type(const AssemblyKeyBase& key) const { const T& rhs = static_cast<const AssemblyKey&>(key).mKey; return android::compare_type(mKey, rhs); @@ -56,7 +56,7 @@ private: class Assembly { public: - Assembly(size_t size); + explicit Assembly(size_t size); virtual ~Assembly(); ssize_t size() const; @@ -80,13 +80,13 @@ class CodeCache { public: // pretty simple cache API... - CodeCache(size_t size); - ~CodeCache(); - - sp<Assembly> lookup(const AssemblyKeyBase& key) const; + explicit CodeCache(size_t size); + ~CodeCache(); - int cache( const AssemblyKeyBase& key, - const sp<Assembly>& assembly); + sp<Assembly> lookup(const AssemblyKeyBase& key) const; + + int cache(const AssemblyKeyBase& key, + const sp<Assembly>& assembly); private: // nothing to see here... @@ -105,7 +105,7 @@ private: const AssemblyKeyBase* mKey; public: key_t() { }; - key_t(const AssemblyKeyBase& k) : mKey(&k) { } + explicit key_t(const AssemblyKeyBase& k) : mKey(&k) { } }; mutable pthread_mutex_t mLock; diff --git a/libpixelflinger/codeflinger/GGLAssembler.h b/libpixelflinger/codeflinger/GGLAssembler.h index ecc242a50..47dbf3a33 100644 --- a/libpixelflinger/codeflinger/GGLAssembler.h +++ b/libpixelflinger/codeflinger/GGLAssembler.h @@ -49,7 +49,7 @@ class RegisterAllocator public: class RegisterFile; - RegisterAllocator(int arch); + RegisterAllocator(int arch); // NOLINT, implicit RegisterFile& registerFile(); int reserveReg(int reg); int obtainReg(); @@ -59,7 +59,7 @@ public: class RegisterFile { public: - RegisterFile(int arch); + RegisterFile(int arch); // NOLINT, implicit RegisterFile(const RegisterFile& rhs, int arch); ~RegisterFile(); @@ -101,7 +101,7 @@ public: class Scratch { public: - Scratch(RegisterFile& regFile) + explicit Scratch(RegisterFile& regFile) : mRegFile(regFile), mScratch(0) { } ~Scratch() { @@ -177,8 +177,8 @@ class GGLAssembler : public ARMAssemblerProxy, public RegisterAllocator { public: - GGLAssembler(ARMAssemblerInterface* target); - virtual ~GGLAssembler(); + explicit GGLAssembler(ARMAssemblerInterface* target); + virtual ~GGLAssembler(); uint32_t* base() const { return 0; } // XXX uint32_t* pc() const { return 0; } // XXX @@ -206,7 +206,7 @@ public: struct reg_t { reg_t() : reg(-1), flags(0) { } - reg_t(int r, int f=0) + reg_t(int r, int f=0) // NOLINT, implicit : reg(r), flags(f) { } void setTo(int r, int f=0) { @@ -219,7 +219,7 @@ public: struct integer_t : public reg_t { integer_t() : reg_t(), s(0) { } - integer_t(int r, int sz=32, int f=0) + integer_t(int r, int sz=32, int f=0) // NOLINT, implicit : reg_t(r, f), s(sz) { } void setTo(int r, int sz=32, int f=0) { @@ -251,7 +251,7 @@ public: struct component_t : public reg_t { component_t() : reg_t(), h(0), l(0) { } - component_t(int r, int f=0) + component_t(int r, int f=0) // NOLINT, implicit : reg_t(r, f), h(0), l(0) { } component_t(int r, int lo, int hi, int f=0) diff --git a/libpixelflinger/codeflinger/tinyutils/smartpointer.h b/libpixelflinger/codeflinger/tinyutils/smartpointer.h index 9d0a16e5c..23a5f7e54 100644 --- a/libpixelflinger/codeflinger/tinyutils/smartpointer.h +++ b/libpixelflinger/codeflinger/tinyutils/smartpointer.h @@ -51,10 +51,10 @@ class sp public: inline sp() : m_ptr(0) { } - sp(T* other); + sp(T* other); // NOLINT, implicit sp(const sp<T>& other); - template<typename U> sp(U* other); - template<typename U> sp(const sp<U>& other); + template<typename U> sp(U* other); // NOLINT, implicit + template<typename U> sp(const sp<U>& other); // NOLINT, implicit ~sp(); diff --git a/libutils/tests/Looper_test.cpp b/libutils/tests/Looper_test.cpp index 17319e03f..8ebcfaf5a 100644 --- a/libutils/tests/Looper_test.cpp +++ b/libutils/tests/Looper_test.cpp @@ -76,7 +76,7 @@ public: int fd; int events; - StubCallbackHandler(int nextResult) : nextResult(nextResult), + explicit StubCallbackHandler(int nextResult) : nextResult(nextResult), callbackCount(0), fd(-1), events(-1) { } diff --git a/libutils/tests/StrongPointer_test.cpp b/libutils/tests/StrongPointer_test.cpp index f46d6d140..323a6f20a 100644 --- a/libutils/tests/StrongPointer_test.cpp +++ b/libutils/tests/StrongPointer_test.cpp @@ -23,7 +23,7 @@ using namespace android; class Foo : public LightRefBase<Foo> { public: - Foo(bool* deleted_check) : mDeleted(deleted_check) { + explicit Foo(bool* deleted_check) : mDeleted(deleted_check) { *mDeleted = false; } diff --git a/libutils/tests/TestHelpers.h b/libutils/tests/TestHelpers.h index d8e985e9c..6801cd739 100644 --- a/libutils/tests/TestHelpers.h +++ b/libutils/tests/TestHelpers.h @@ -60,7 +60,7 @@ class DelayedTask : public Thread { int mDelayMillis; public: - DelayedTask(int delayMillis) : mDelayMillis(delayMillis) { } + explicit DelayedTask(int delayMillis) : mDelayMillis(delayMillis) { } protected: virtual ~DelayedTask() { } diff --git a/logd/FlushCommand.h b/logd/FlushCommand.h index 92247739a..7172d5fc8 100644 --- a/logd/FlushCommand.h +++ b/logd/FlushCommand.h @@ -35,7 +35,7 @@ class FlushCommand : public SocketClientCommand { uint64_t mTimeout; public: - FlushCommand(LogReader &mReader, + explicit FlushCommand(LogReader &mReader, bool nonBlock = false, unsigned long tail = -1, unsigned int logMask = -1, diff --git a/logd/LogBuffer.h b/logd/LogBuffer.h index b390a0c7a..162c189dd 100644 --- a/logd/LogBuffer.h +++ b/logd/LogBuffer.h @@ -103,7 +103,7 @@ class LogBuffer { public: LastLogTimes &mTimes; - LogBuffer(LastLogTimes *times); + explicit LogBuffer(LastLogTimes *times); void init(); bool isMonotonic() { return monotonic; } diff --git a/logd/LogCommand.h b/logd/LogCommand.h index c944478f8..0adc2a1d7 100644 --- a/logd/LogCommand.h +++ b/logd/LogCommand.h @@ -22,7 +22,7 @@ class LogCommand : public FrameworkCommand { public: - LogCommand(const char *cmd); + explicit LogCommand(const char *cmd); virtual ~LogCommand() {} }; diff --git a/logd/LogReader.h b/logd/LogReader.h index 98674b8af..fdcedf152 100644 --- a/logd/LogReader.h +++ b/logd/LogReader.h @@ -27,7 +27,7 @@ class LogReader : public SocketListener { LogBuffer &mLogbuf; public: - LogReader(LogBuffer *logbuf); + explicit LogReader(LogBuffer *logbuf); void notifyNewLog(); LogBuffer &logbuf(void) const { return mLogbuf; } diff --git a/metricsd/collectors/cpu_usage_collector.h b/metricsd/collectors/cpu_usage_collector.h index f81dfcb95..9f92cf30c 100644 --- a/metricsd/collectors/cpu_usage_collector.h +++ b/metricsd/collectors/cpu_usage_collector.h @@ -23,7 +23,7 @@ class CpuUsageCollector { public: - CpuUsageCollector(MetricsLibraryInterface* metrics_library); + explicit CpuUsageCollector(MetricsLibraryInterface* metrics_library); // Initialize this collector's state. void Init(); diff --git a/metricsd/collectors/disk_usage_collector.h b/metricsd/collectors/disk_usage_collector.h index c1d45466f..288b34b15 100644 --- a/metricsd/collectors/disk_usage_collector.h +++ b/metricsd/collectors/disk_usage_collector.h @@ -23,7 +23,7 @@ class DiskUsageCollector { public: - DiskUsageCollector(MetricsLibraryInterface* metrics_library); + explicit DiskUsageCollector(MetricsLibraryInterface* metrics_library); // Schedule the next collection. void Schedule(); diff --git a/metricsd/uploader/metricsd_service_runner.h b/metricsd/uploader/metricsd_service_runner.h index f5dad21b2..b36d4a52a 100644 --- a/metricsd/uploader/metricsd_service_runner.h +++ b/metricsd/uploader/metricsd_service_runner.h @@ -27,7 +27,7 @@ class MetricsdServiceRunner { public: - MetricsdServiceRunner(std::shared_ptr<CrashCounters> counters); + explicit MetricsdServiceRunner(std::shared_ptr<CrashCounters> counters); // Start the Metricsd Binder service in a new thread. void Start(); diff --git a/trusty/gatekeeper/trusty_gatekeeper.h b/trusty/gatekeeper/trusty_gatekeeper.h index 82108dc04..2becc49a1 100644 --- a/trusty/gatekeeper/trusty_gatekeeper.h +++ b/trusty/gatekeeper/trusty_gatekeeper.h @@ -27,7 +27,7 @@ namespace gatekeeper { class TrustyGateKeeperDevice { public: - TrustyGateKeeperDevice(const hw_module_t* module); + explicit TrustyGateKeeperDevice(const hw_module_t* module); ~TrustyGateKeeperDevice(); hw_device_t* hw_device(); diff --git a/trusty/keymaster/trusty_keymaster_device.h b/trusty/keymaster/trusty_keymaster_device.h index cb74386b9..68cf40ca2 100644 --- a/trusty/keymaster/trusty_keymaster_device.h +++ b/trusty/keymaster/trusty_keymaster_device.h @@ -39,7 +39,7 @@ class TrustyKeymasterDevice { * These are the only symbols that will be exported by libtrustykeymaster. All functionality * can be reached via the function pointers in device_. */ - __attribute__((visibility("default"))) TrustyKeymasterDevice(const hw_module_t* module); + __attribute__((visibility("default"))) explicit TrustyKeymasterDevice(const hw_module_t* module); __attribute__((visibility("default"))) hw_device_t* hw_device(); ~TrustyKeymasterDevice(); |