Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: I84effbdfa1b9b39328a909b7f70fe17e7ee316c8
diff --git a/libc/bionic/ifaddrs.cpp b/libc/bionic/ifaddrs.cpp
index 408949c..f5b080c 100644
--- a/libc/bionic/ifaddrs.cpp
+++ b/libc/bionic/ifaddrs.cpp
@@ -59,7 +59,7 @@
sockaddr_storage ifa_ifu;
char name[IFNAMSIZ + 1];
- ifaddrs_storage(ifaddrs** list) {
+ explicit ifaddrs_storage(ifaddrs** list) {
memset(this, 0, sizeof(*this));
// push_front onto `list`.
diff --git a/libc/bionic/libc_logging.cpp b/libc/bionic/libc_logging.cpp
index 6802944..517d047 100644
--- a/libc/bionic/libc_logging.cpp
+++ b/libc/bionic/libc_logging.cpp
@@ -107,7 +107,7 @@
struct FdOutputStream {
public:
- FdOutputStream(int fd) : total(0), fd_(fd) {
+ explicit FdOutputStream(int fd) : total(0), fd_(fd) {
}
void Send(const char* data, int len) {
diff --git a/libc/bionic/locale.cpp b/libc/bionic/locale.cpp
index b42b440..f26a5f2 100644
--- a/libc/bionic/locale.cpp
+++ b/libc/bionic/locale.cpp
@@ -44,10 +44,10 @@
struct __locale_t {
size_t mb_cur_max;
- __locale_t(size_t mb_cur_max) : mb_cur_max(mb_cur_max) {
+ explicit __locale_t(size_t mb_cur_max) : mb_cur_max(mb_cur_max) {
}
- __locale_t(const __locale_t* other) {
+ explicit __locale_t(const __locale_t* other) {
if (other == LC_GLOBAL_LOCALE) {
mb_cur_max = __bionic_current_locale_is_utf8 ? 4 : 1;
} else {
diff --git a/libc/bionic/net_if.cpp b/libc/bionic/net_if.cpp
index f8d73bd..db9c9ea2 100644
--- a/libc/bionic/net_if.cpp
+++ b/libc/bionic/net_if.cpp
@@ -77,7 +77,7 @@
if_list* next;
struct if_nameindex data;
- if_list(if_list** list) {
+ explicit if_list(if_list** list) {
// push_front onto `list`.
next = *list;
*list = this;
diff --git a/libc/bionic/system_properties.cpp b/libc/bionic/system_properties.cpp
index 9c992da..0f68431 100644
--- a/libc/bionic/system_properties.cpp
+++ b/libc/bionic/system_properties.cpp
@@ -192,7 +192,7 @@
const uint32_t n;
const prop_info *pi;
- find_nth_cookie(uint32_t n) : count(0), n(n), pi(NULL) {
+ explicit find_nth_cookie(uint32_t n) : count(0), n(n), pi(NULL) {
}
};
diff --git a/libc/malloc_debug/Config.cpp b/libc/malloc_debug/Config.cpp
index cc60086..6220a23 100644
--- a/libc/malloc_debug/Config.cpp
+++ b/libc/malloc_debug/Config.cpp
@@ -84,7 +84,7 @@
class PropertyParser {
public:
- PropertyParser(const char* property) : cur_(property) {}
+ explicit PropertyParser(const char* property) : cur_(property) {}
bool Get(std::string* property, size_t* value, bool* value_set);
diff --git a/libc/stdio/stdio.cpp b/libc/stdio/stdio.cpp
index 1c31a27..5df1bb9 100644
--- a/libc/stdio/stdio.cpp
+++ b/libc/stdio/stdio.cpp
@@ -90,7 +90,7 @@
class ScopedFileLock {
public:
- ScopedFileLock(FILE* fp) : fp_(fp) {
+ explicit ScopedFileLock(FILE* fp) : fp_(fp) {
FLOCKFILE(fp_);
}
~ScopedFileLock() {
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index 589cab4..d9b2523 100755
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -926,7 +926,7 @@
pthread_rwlock_t lock;
public:
- RwlockKindTestHelper(int kind_type) {
+ explicit RwlockKindTestHelper(int kind_type) {
InitRwlock(kind_type);
}
@@ -1539,7 +1539,7 @@
struct PthreadMutex {
pthread_mutex_t lock;
- PthreadMutex(int mutex_type) {
+ explicit PthreadMutex(int mutex_type) {
init(mutex_type);
}
@@ -1640,7 +1640,7 @@
}
public:
- MutexWakeupHelper(int mutex_type) : m(mutex_type) {
+ explicit MutexWakeupHelper(int mutex_type) : m(mutex_type) {
}
void test() {
diff --git a/tests/search_test.cpp b/tests/search_test.cpp
index 3900c89..d368f9f 100644
--- a/tests/search_test.cpp
+++ b/tests/search_test.cpp
@@ -49,7 +49,7 @@
}
struct node {
- node(const char* s) : s(strdup(s)) {}
+ explicit node(const char* s) : s(strdup(s)) {}
char* s;
};
@@ -115,7 +115,7 @@
}
struct pod_node {
- pod_node(int i) : i(i) {}
+ explicit pod_node(int i) : i(i) {}
int i;
};
@@ -136,7 +136,7 @@
}
struct q_node {
- q_node(int i) : i(i) {}
+ explicit q_node(int i) : i(i) {}
q_node* next;
q_node* prev;
diff --git a/tests/string_test.cpp b/tests/string_test.cpp
index 4b2cca2..2a9da10 100644
--- a/tests/string_test.cpp
+++ b/tests/string_test.cpp
@@ -163,7 +163,7 @@
template<class Character>
class StringTestState {
public:
- StringTestState(size_t MAX_LEN) : MAX_LEN(MAX_LEN), align1_index_(0), align2_index_(0) {
+ explicit StringTestState(size_t MAX_LEN) : MAX_LEN(MAX_LEN), align1_index_(0), align2_index_(0) {
int max_alignment = 64;
// TODO: fix the tests to not sometimes use twice their specified "MAX_LEN".
diff --git a/tests/sys_ptrace_test.cpp b/tests/sys_ptrace_test.cpp
index bd84d30..9071acf 100644
--- a/tests/sys_ptrace_test.cpp
+++ b/tests/sys_ptrace_test.cpp
@@ -59,7 +59,7 @@
class ChildGuard {
public:
- ChildGuard(pid_t pid) : pid(pid) {}
+ explicit ChildGuard(pid_t pid) : pid(pid) {}
~ChildGuard() {
kill(pid, SIGKILL);
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index b1f6364..10399c5 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -273,7 +273,7 @@
}
public:
- Counter(void (*fn)(sigval_t)) : value(0), timer_valid(false) {
+ explicit Counter(void (*fn)(sigval_t)) : value(0), timer_valid(false) {
memset(&se, 0, sizeof(se));
se.sigev_notify = SIGEV_THREAD;
se.sigev_notify_function = fn;