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

This commit is contained in:
Chih-hung Hsieh 2016-07-29 16:57:17 +00:00 committed by Gerrit Code Review
commit 6dc68cb5f9
34 changed files with 56 additions and 56 deletions

View File

@ -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();
}

View File

@ -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

View File

@ -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);

View File

@ -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 };

View File

@ -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;

View File

@ -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_);

View File

@ -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) {
}

View File

@ -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) {

View File

@ -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:

View File

@ -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() {}

View File

@ -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();

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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) {

View File

@ -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);

View File

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

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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();

View File

@ -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) {
}

View File

@ -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;
}

View File

@ -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() { }

View File

@ -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,

View File

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

View File

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

View File

@ -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; }

View File

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

View File

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

View File

@ -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();

View File

@ -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();

View File

@ -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();