summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHidehiko Abe <hidehiko@google.com>2018-02-22 02:41:22 +0900
committerTreehugger Robot <treehugger-gerrit@google.com>2018-02-22 00:25:05 +0000
commitd5a42bb5162a69f1e305f4353c9c2dd5cda33934 (patch)
treeed2b17ad15909d4e760b62854d1c41f3e31aca3c
parentdb03e04f4e02b208da755fc87770ee92c1ed0657 (diff)
downloadlibchrome-d5a42bb5162a69f1e305f4353c9c2dd5cda33934.tar.gz
Remove modification for missing-field-initializers from sources.
Since C++11, we have concrete semantics. Thus, we rely on it. Note that, we still need to keep LAZY_INSTANCE_INITIALIZER because it is a macro used in other project, which may have missing-field-initializers warning enabled. Bug: 73270448 Test: Built locally. Treehugger. Change-Id: Ieb59b25c2936d27c3501d21098b248fac2778f0a
-rw-r--r--Android.bp2
-rw-r--r--base/logging.cc1
-rw-r--r--base/posix/unix_domain_socket_linux.cc6
-rw-r--r--base/process/launch_posix.cc5
-rw-r--r--base/process/process_posix.cc5
-rw-r--r--base/threading/thread_local_storage.h2
-rw-r--r--base/trace_event/malloc_dump_provider.cc2
7 files changed, 5 insertions, 18 deletions
diff --git a/Android.bp b/Android.bp
index c208ed4e9a..ac00435be8 100644
--- a/Android.bp
+++ b/Android.bp
@@ -36,6 +36,7 @@ cc_defaults {
"-Wall",
"-Werror",
"-Wno-deprecated-declarations",
+ "-Wno-missing-field-initializers",
"-Wno-unused-parameter",
],
include_dirs: [
@@ -67,7 +68,6 @@ cc_defaults {
cflags: [
"-Wno-unused-function",
"-Wno-unused-variable",
- "-Wno-missing-field-initializers",
],
clang_cflags: [
diff --git a/base/logging.cc b/base/logging.cc
index ad9d84a07f..01e311b1b6 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -796,7 +796,6 @@ void LogMessage::Init(const char* file, int line) {
gettimeofday(&tv, nullptr);
time_t t = tv.tv_sec;
struct tm local_time;
- memset(&local_time, 0, sizeof(local_time));
localtime_r(&t, &local_time);
struct tm* tm_time = &local_time;
stream_ << std::setfill('0')
diff --git a/base/posix/unix_domain_socket_linux.cc b/base/posix/unix_domain_socket_linux.cc
index 25ddb5470a..8b3094eedf 100644
--- a/base/posix/unix_domain_socket_linux.cc
+++ b/base/posix/unix_domain_socket_linux.cc
@@ -50,8 +50,7 @@ bool UnixDomainSocket::SendMsg(int fd,
const void* buf,
size_t length,
const std::vector<int>& fds) {
- struct msghdr msg;
- memset(&msg, 0, sizeof(msg));
+ struct msghdr msg = {};
struct iovec iov = { const_cast<void*>(buf), length };
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
@@ -109,8 +108,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd,
ProcessId* out_pid) {
fds->clear();
- struct msghdr msg;
- memset(&msg, 0, sizeof(msg));
+ struct msghdr msg = {};
struct iovec iov = { buf, length };
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc
index 1c4df40665..2184051552 100644
--- a/base/process/launch_posix.cc
+++ b/base/process/launch_posix.cc
@@ -163,12 +163,7 @@ int sys_rt_sigaction(int sig, const struct kernel_sigaction* act,
// See crbug.com/177956.
void ResetChildSignalHandlersToDefaults(void) {
for (int signum = 1; ; ++signum) {
-#if defined(ANDROID)
- struct kernel_sigaction act;
- memset(&act, 0, sizeof(act));
-#else
struct kernel_sigaction act = {0};
-#endif
int sigaction_get_ret = sys_rt_sigaction(signum, nullptr, &act);
if (sigaction_get_ret && errno == EINVAL) {
#if !defined(NDEBUG)
diff --git a/base/process/process_posix.cc b/base/process/process_posix.cc
index db525f0355..3da6793afb 100644
--- a/base/process/process_posix.cc
+++ b/base/process/process_posix.cc
@@ -102,12 +102,7 @@ static bool WaitForSingleNonChildProcess(base::ProcessHandle handle,
return false;
}
-#if defined(ANDROID)
- struct kevent change;
- memset(&change, 0, sizeof(change));
-#else
struct kevent change = {0};
-#endif
EV_SET(&change, handle, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL);
int result = HANDLE_EINTR(kevent(kq.get(), &change, 1, NULL, 0, NULL));
if (result == -1) {
diff --git a/base/threading/thread_local_storage.h b/base/threading/thread_local_storage.h
index 5e70410af9..fd2a789d01 100644
--- a/base/threading/thread_local_storage.h
+++ b/base/threading/thread_local_storage.h
@@ -94,7 +94,7 @@ class BASE_EXPORT ThreadLocalStorage {
// initialization, as base's LINKER_INITIALIZED requires a constructor and on
// some compilers (notably gcc 4.4) this still ends up needing runtime
// initialization.
-#define TLS_INITIALIZER {false, 0, 0}
+ #define TLS_INITIALIZER {0}
// A key representing one value stored in TLS.
// Initialize like
diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc
index d78de9b548..7f2706092e 100644
--- a/base/trace_event/malloc_dump_provider.cc
+++ b/base/trace_event/malloc_dump_provider.cc
@@ -211,7 +211,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
&allocated_objects_size);
DCHECK(res);
#elif defined(OS_MACOSX) || defined(OS_IOS)
- malloc_statistics_t stats = {};
+ malloc_statistics_t stats = {0};
malloc_zone_statistics(nullptr, &stats);
total_virtual_size = stats.size_allocated;
allocated_objects_size = stats.size_in_use;