Merge \"Fix google-explicit-constructor warnings in system/core.\"

am: 6dc68cb5f9

Change-Id: I5a010465364b6e14423b19e8c0f9cffa58ee3152
This commit is contained in:
Chih-Hung Hsieh 2016-07-29 17:01:17 +00:00 committed by android-build-merger
commit 89cc78b77f
34 changed files with 56 additions and 56 deletions

View file

@ -41,7 +41,7 @@ class BacktraceMapMock : public BacktraceMap {
class BacktraceMock : public Backtrace { class BacktraceMock : public Backtrace {
public: public:
BacktraceMock(BacktraceMapMock* map) : Backtrace(0, 0, map) { explicit BacktraceMock(BacktraceMapMock* map) : Backtrace(0, 0, map) {
if (map_ == nullptr) { if (map_ == nullptr) {
abort(); abort();
} }

View file

@ -104,7 +104,7 @@ class Socket {
protected: protected:
// Protected constructor to force factory function use. // 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_| // 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 // as appropriate to help distinguish between normal timeouts and fatal errors. Returns true if

View file

@ -44,7 +44,7 @@ private:
class Action { class Action {
public: public:
Action(bool oneshot = false); explicit Action(bool oneshot = false);
bool AddCommand(const std::vector<std::string>& args, bool AddCommand(const std::vector<std::string>& args,
const std::string& filename, int line, std::string* err); const std::string& filename, int line, std::string* err);

View file

@ -36,7 +36,7 @@ namespace init {
// a TOK_NEWLINE will not be generated for that line. // a TOK_NEWLINE will not be generated for that line.
class Tokenizer { class Tokenizer {
public: public:
Tokenizer(const std::string& data); explicit Tokenizer(const std::string& data);
~Tokenizer(); ~Tokenizer();
enum TokenType { TOK_START, TOK_END, TOK_NEWLINE, TOK_TEXT }; enum TokenType { TOK_START, TOK_END, TOK_NEWLINE, TOK_TEXT };

View file

@ -29,7 +29,7 @@
class UnwindMap : public BacktraceMap { class UnwindMap : public BacktraceMap {
public: public:
UnwindMap(pid_t pid); explicit UnwindMap(pid_t pid);
unw_map_cursor_t* GetMapCursor() { return &map_cursor_; } unw_map_cursor_t* GetMapCursor() { return &map_cursor_; }
@ -39,7 +39,7 @@ protected:
class UnwindMapRemote : public UnwindMap { class UnwindMapRemote : public UnwindMap {
public: public:
UnwindMapRemote(pid_t pid); explicit UnwindMapRemote(pid_t pid);
virtual ~UnwindMapRemote(); virtual ~UnwindMapRemote();
bool Build() override; bool Build() override;

View file

@ -38,7 +38,7 @@ class Benchmark {
Benchmark(const char* name, void (*fn)(int)) : name_(strdup(name)), fn_(fn) { Benchmark(const char* name, void (*fn)(int)) : name_(strdup(name)), fn_(fn) {
BenchmarkRegister(this); BenchmarkRegister(this);
} }
Benchmark(const char* name) : name_(strdup(name)), fn_(NULL) {} explicit Benchmark(const char* name) : name_(strdup(name)), fn_(NULL) {}
virtual ~Benchmark() { virtual ~Benchmark() {
free(name_); free(name_);

View file

@ -109,13 +109,13 @@ public:
} }
// Construct an STLAllocator on top of a Heap // Construct an STLAllocator on top of a Heap
STLAllocator(const Heap& heap) : STLAllocator(const Heap& heap) : // NOLINT, implicit
heap_(heap) { heap_(heap) {
} }
// Rebind an STLAllocator from an another STLAllocator // Rebind an STLAllocator from an another STLAllocator
template<typename U> template<typename U>
STLAllocator(const STLAllocator<U>& other) : STLAllocator(const STLAllocator<U>& other) : // NOLINT, implicit
heap_(other.heap_) { heap_(other.heap_) {
} }
@ -155,12 +155,12 @@ class Allocator : public STLAllocator<T> {
public: public:
~Allocator() {} ~Allocator() {}
Allocator(const Heap& other) : Allocator(const Heap& other) : // NOLINT, implicit
STLAllocator<T>(other) { STLAllocator<T>(other) {
} }
template<typename U> template<typename U>
Allocator(const STLAllocator<U>& other) : Allocator(const STLAllocator<U>& other) : // NOLINT, implicit
STLAllocator<T>(other) { STLAllocator<T>(other) {
} }

View file

@ -48,7 +48,7 @@ struct compare_range {
class HeapWalker { class HeapWalker {
public: public:
HeapWalker(Allocator<HeapWalker> allocator) : allocator_(allocator), explicit HeapWalker(Allocator<HeapWalker> allocator) : allocator_(allocator),
allocations_(allocator), allocation_bytes_(0), allocations_(allocator), allocation_bytes_(0),
roots_(allocator), root_vals_(allocator), roots_(allocator), root_vals_(allocator),
segv_handler_(allocator), walking_ptr_(0) { segv_handler_(allocator), walking_ptr_(0) {

View file

@ -54,7 +54,7 @@ class LeakFolding {
bool dominator; bool dominator;
SCCInfo* accumulator; 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), count(0), size(0), cuumulative_count(0), cuumulative_size(0),
dominator(false), accumulator(nullptr) {} dominator(false), accumulator(nullptr) {}
private: private:

View file

@ -21,7 +21,7 @@ template<class T>
class LinkedList { class LinkedList {
public: public:
LinkedList() : next_(this), prev_(this), data_() {} LinkedList() : next_(this), prev_(this), data_() {}
LinkedList(T data) : LinkedList() { explicit LinkedList(T data) : LinkedList() {
data_ = data; data_ = data;
} }
~LinkedList() {} ~LinkedList() {}

View file

@ -32,7 +32,7 @@ class Stack;
// the parent. // the parent.
class PtracerThread { class PtracerThread {
public: public:
PtracerThread(const std::function<int()>& func); explicit PtracerThread(const std::function<int()>& func);
~PtracerThread(); ~PtracerThread();
bool Start(); bool Start();
int Join(); int Join();

View file

@ -74,7 +74,7 @@ class ScopedDisableMalloc {
class ScopedDisableMallocTimeout { class ScopedDisableMallocTimeout {
public: 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_() { timeout_(timeout), timed_out_(false), disable_malloc_() {
Disable(); Disable();
} }

View file

@ -30,7 +30,7 @@ class ScopedSignalHandler {
public: public:
using Fn = std::function<void(ScopedSignalHandler&, int, siginfo_t*, void*)>; 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() { ~ScopedSignalHandler() {
reset(); reset();
} }

View file

@ -24,7 +24,7 @@
class Semaphore { class Semaphore {
public: public:
Semaphore(int count = 0) : count_(count) {} explicit Semaphore(int count = 0) : count_(count) {}
~Semaphore() = default; ~Semaphore() = default;
void Wait(std::chrono::milliseconds ms) { void Wait(std::chrono::milliseconds ms) {

View file

@ -62,7 +62,7 @@ using SCCList = allocator::vector<SCC<T>>;
template<class T> template<class T>
class TarjanAlgorithm { class TarjanAlgorithm {
public: public:
TarjanAlgorithm(Allocator<void> allocator) : index_(0), explicit TarjanAlgorithm(Allocator<void> allocator) : index_(0),
stack_(allocator), components_(allocator) {} stack_(allocator), components_(allocator) {}
void Execute(Graph<T>& graph, SCCList<T>& out); void Execute(Graph<T>& graph, SCCList<T>& out);

View file

@ -27,7 +27,7 @@ void* ptr;
class HiddenPointer { class HiddenPointer {
public: public:
HiddenPointer(size_t size = 256) { explicit HiddenPointer(size_t size = 256) {
Set(malloc(size)); Set(malloc(size));
} }
~HiddenPointer() { ~HiddenPointer() {

View file

@ -35,7 +35,7 @@ namespace android {
class ARMAssembler : public ARMAssemblerInterface class ARMAssembler : public ARMAssemblerInterface
{ {
public: public:
ARMAssembler(const sp<Assembly>& assembly); explicit ARMAssembler(const sp<Assembly>& assembly);
virtual ~ARMAssembler(); virtual ~ARMAssembler();
uint32_t* base() const; uint32_t* base() const;

View file

@ -34,7 +34,7 @@ public:
// ARMAssemblerProxy take ownership of the target // ARMAssemblerProxy take ownership of the target
ARMAssemblerProxy(); ARMAssemblerProxy();
ARMAssemblerProxy(ARMAssemblerInterface* target); explicit ARMAssemblerProxy(ARMAssemblerInterface* target);
virtual ~ARMAssemblerProxy(); virtual ~ARMAssemblerProxy();
void setTarget(ARMAssemblerInterface* target); void setTarget(ARMAssemblerInterface* target);

View file

@ -47,8 +47,8 @@ namespace android {
class ArmToArm64Assembler : public ARMAssemblerInterface class ArmToArm64Assembler : public ARMAssemblerInterface
{ {
public: public:
ArmToArm64Assembler(const sp<Assembly>& assembly); explicit ArmToArm64Assembler(const sp<Assembly>& assembly);
ArmToArm64Assembler(void *base); explicit ArmToArm64Assembler(void *base);
virtual ~ArmToArm64Assembler(); virtual ~ArmToArm64Assembler();
uint32_t* base() const; uint32_t* base() const;

View file

@ -42,7 +42,7 @@ template <typename T>
class AssemblyKey : public AssemblyKeyBase class AssemblyKey : public AssemblyKeyBase
{ {
public: public:
AssemblyKey(const T& rhs) : mKey(rhs) { } explicit AssemblyKey(const T& rhs) : mKey(rhs) { }
virtual int compare_type(const AssemblyKeyBase& key) const { virtual int compare_type(const AssemblyKeyBase& key) const {
const T& rhs = static_cast<const AssemblyKey&>(key).mKey; const T& rhs = static_cast<const AssemblyKey&>(key).mKey;
return android::compare_type(mKey, rhs); return android::compare_type(mKey, rhs);
@ -56,7 +56,7 @@ private:
class Assembly class Assembly
{ {
public: public:
Assembly(size_t size); explicit Assembly(size_t size);
virtual ~Assembly(); virtual ~Assembly();
ssize_t size() const; ssize_t size() const;
@ -80,13 +80,13 @@ class CodeCache
{ {
public: public:
// pretty simple cache API... // pretty simple cache API...
CodeCache(size_t size); explicit CodeCache(size_t size);
~CodeCache(); ~CodeCache();
sp<Assembly> lookup(const AssemblyKeyBase& key) const;
int cache( const AssemblyKeyBase& key, sp<Assembly> lookup(const AssemblyKeyBase& key) const;
const sp<Assembly>& assembly);
int cache(const AssemblyKeyBase& key,
const sp<Assembly>& assembly);
private: private:
// nothing to see here... // nothing to see here...
@ -105,7 +105,7 @@ private:
const AssemblyKeyBase* mKey; const AssemblyKeyBase* mKey;
public: public:
key_t() { }; key_t() { };
key_t(const AssemblyKeyBase& k) : mKey(&k) { } explicit key_t(const AssemblyKeyBase& k) : mKey(&k) { }
}; };
mutable pthread_mutex_t mLock; mutable pthread_mutex_t mLock;

View file

@ -49,7 +49,7 @@ class RegisterAllocator
public: public:
class RegisterFile; class RegisterFile;
RegisterAllocator(int arch); RegisterAllocator(int arch); // NOLINT, implicit
RegisterFile& registerFile(); RegisterFile& registerFile();
int reserveReg(int reg); int reserveReg(int reg);
int obtainReg(); int obtainReg();
@ -59,7 +59,7 @@ public:
class RegisterFile class RegisterFile
{ {
public: public:
RegisterFile(int arch); RegisterFile(int arch); // NOLINT, implicit
RegisterFile(const RegisterFile& rhs, int arch); RegisterFile(const RegisterFile& rhs, int arch);
~RegisterFile(); ~RegisterFile();
@ -101,7 +101,7 @@ public:
class Scratch class Scratch
{ {
public: public:
Scratch(RegisterFile& regFile) explicit Scratch(RegisterFile& regFile)
: mRegFile(regFile), mScratch(0) { : mRegFile(regFile), mScratch(0) {
} }
~Scratch() { ~Scratch() {
@ -177,8 +177,8 @@ class GGLAssembler : public ARMAssemblerProxy, public RegisterAllocator
{ {
public: public:
GGLAssembler(ARMAssemblerInterface* target); explicit GGLAssembler(ARMAssemblerInterface* target);
virtual ~GGLAssembler(); virtual ~GGLAssembler();
uint32_t* base() const { return 0; } // XXX uint32_t* base() const { return 0; } // XXX
uint32_t* pc() const { return 0; } // XXX uint32_t* pc() const { return 0; } // XXX
@ -206,7 +206,7 @@ public:
struct reg_t { struct reg_t {
reg_t() : reg(-1), flags(0) { 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) { : reg(r), flags(f) {
} }
void setTo(int r, int f=0) { void setTo(int r, int f=0) {
@ -219,7 +219,7 @@ public:
struct integer_t : public reg_t { struct integer_t : public reg_t {
integer_t() : reg_t(), s(0) { 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) { : reg_t(r, f), s(sz) {
} }
void setTo(int r, int sz=32, int f=0) { void setTo(int r, int sz=32, int f=0) {
@ -251,7 +251,7 @@ public:
struct component_t : public reg_t { struct component_t : public reg_t {
component_t() : reg_t(), h(0), l(0) { 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) { : reg_t(r, f), h(0), l(0) {
} }
component_t(int r, int lo, int hi, int f=0) component_t(int r, int lo, int hi, int f=0)

View file

@ -51,10 +51,10 @@ class sp
public: public:
inline sp() : m_ptr(0) { } inline sp() : m_ptr(0) { }
sp(T* other); sp(T* other); // NOLINT, implicit
sp(const sp<T>& other); sp(const sp<T>& other);
template<typename U> sp(U* other); template<typename U> sp(U* other); // NOLINT, implicit
template<typename U> sp(const sp<U>& other); template<typename U> sp(const sp<U>& other); // NOLINT, implicit
~sp(); ~sp();

View file

@ -76,7 +76,7 @@ public:
int fd; int fd;
int events; int events;
StubCallbackHandler(int nextResult) : nextResult(nextResult), explicit StubCallbackHandler(int nextResult) : nextResult(nextResult),
callbackCount(0), fd(-1), events(-1) { callbackCount(0), fd(-1), events(-1) {
} }

View file

@ -23,7 +23,7 @@ using namespace android;
class Foo : public LightRefBase<Foo> { class Foo : public LightRefBase<Foo> {
public: public:
Foo(bool* deleted_check) : mDeleted(deleted_check) { explicit Foo(bool* deleted_check) : mDeleted(deleted_check) {
*mDeleted = false; *mDeleted = false;
} }

View file

@ -60,7 +60,7 @@ class DelayedTask : public Thread {
int mDelayMillis; int mDelayMillis;
public: public:
DelayedTask(int delayMillis) : mDelayMillis(delayMillis) { } explicit DelayedTask(int delayMillis) : mDelayMillis(delayMillis) { }
protected: protected:
virtual ~DelayedTask() { } virtual ~DelayedTask() { }

View file

@ -35,7 +35,7 @@ class FlushCommand : public SocketClientCommand {
uint64_t mTimeout; uint64_t mTimeout;
public: public:
FlushCommand(LogReader &mReader, explicit FlushCommand(LogReader &mReader,
bool nonBlock = false, bool nonBlock = false,
unsigned long tail = -1, unsigned long tail = -1,
unsigned int logMask = -1, unsigned int logMask = -1,

View file

@ -103,7 +103,7 @@ class LogBuffer {
public: public:
LastLogTimes &mTimes; LastLogTimes &mTimes;
LogBuffer(LastLogTimes *times); explicit LogBuffer(LastLogTimes *times);
void init(); void init();
bool isMonotonic() { return monotonic; } bool isMonotonic() { return monotonic; }

View file

@ -22,7 +22,7 @@
class LogCommand : public FrameworkCommand { class LogCommand : public FrameworkCommand {
public: public:
LogCommand(const char *cmd); explicit LogCommand(const char *cmd);
virtual ~LogCommand() {} virtual ~LogCommand() {}
}; };

View file

@ -27,7 +27,7 @@ class LogReader : public SocketListener {
LogBuffer &mLogbuf; LogBuffer &mLogbuf;
public: public:
LogReader(LogBuffer *logbuf); explicit LogReader(LogBuffer *logbuf);
void notifyNewLog(); void notifyNewLog();
LogBuffer &logbuf(void) const { return mLogbuf; } LogBuffer &logbuf(void) const { return mLogbuf; }

View file

@ -23,7 +23,7 @@
class CpuUsageCollector { class CpuUsageCollector {
public: public:
CpuUsageCollector(MetricsLibraryInterface* metrics_library); explicit CpuUsageCollector(MetricsLibraryInterface* metrics_library);
// Initialize this collector's state. // Initialize this collector's state.
void Init(); void Init();

View file

@ -23,7 +23,7 @@
class DiskUsageCollector { class DiskUsageCollector {
public: public:
DiskUsageCollector(MetricsLibraryInterface* metrics_library); explicit DiskUsageCollector(MetricsLibraryInterface* metrics_library);
// Schedule the next collection. // Schedule the next collection.
void Schedule(); void Schedule();

View file

@ -27,7 +27,7 @@
class MetricsdServiceRunner { class MetricsdServiceRunner {
public: public:
MetricsdServiceRunner(std::shared_ptr<CrashCounters> counters); explicit MetricsdServiceRunner(std::shared_ptr<CrashCounters> counters);
// Start the Metricsd Binder service in a new thread. // Start the Metricsd Binder service in a new thread.
void Start(); void Start();

View file

@ -27,7 +27,7 @@ namespace gatekeeper {
class TrustyGateKeeperDevice { class TrustyGateKeeperDevice {
public: public:
TrustyGateKeeperDevice(const hw_module_t* module); explicit TrustyGateKeeperDevice(const hw_module_t* module);
~TrustyGateKeeperDevice(); ~TrustyGateKeeperDevice();
hw_device_t* hw_device(); hw_device_t* hw_device();

View file

@ -39,7 +39,7 @@ class TrustyKeymasterDevice {
* These are the only symbols that will be exported by libtrustykeymaster. All functionality * These are the only symbols that will be exported by libtrustykeymaster. All functionality
* can be reached via the function pointers in device_. * 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(); __attribute__((visibility("default"))) hw_device_t* hw_device();
~TrustyKeymasterDevice(); ~TrustyKeymasterDevice();