fuchsia: Don't use {0} for initialization

Fuchsia builds with -Wmissing-field-initializers. Remove these {0}s. It
all seems a bit awful, but as far as I can tell from reading
http://en.cppreference.com/w/cpp/language/aggregate_initialization, the
0 is unnecessary.

../../third_party/crashpad/minidump/minidump_system_info_writer_test.cc:42:27: error: missing field 'Buffer' initializer [-Werror,-Wmissing-field-initializers]
  MINIDUMP_STRING tmp = {0};
                            ^
			    1 error generated.


Bug: crashpad:196
Change-Id: I21f48eb24238a607475b0e92ffe5fd88386b40b6
Reviewed-on: https://chromium-review.googlesource.com/833454
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Scott Graham 2018-01-10 14:16:31 -08:00 committed by Commit Bot
parent fa197c267c
commit 9fa60710f9
3 changed files with 13 additions and 12 deletions

View File

@ -84,14 +84,16 @@ TEST(MinidumpMemoryInfoWriter, OneRegion) {
auto memory_map_region = std::make_unique<TestMemoryMapRegionSnapshot>();
MINIDUMP_MEMORY_INFO mmi = {0};
MINIDUMP_MEMORY_INFO mmi;
mmi.BaseAddress = 0x12340000;
mmi.AllocationBase = 0x12000000;
mmi.AllocationProtect = PAGE_READWRITE;
mmi.__alignment1 = 0;
mmi.RegionSize = 0x6000;
mmi.State = MEM_COMMIT;
mmi.Protect = PAGE_NOACCESS;
mmi.Type = MEM_PRIVATE;
mmi.__alignment2 = 0;
memory_map_region->SetMindumpMemoryInfo(mmi);
std::vector<const MemoryMapRegionSnapshot*> memory_map;

View File

@ -84,12 +84,11 @@ TEST(MinidumpStringWriter, MinidumpUTF16StringWriter) {
const size_t expected_utf16_units_with_nul =
kTestData[index].output_length + 1;
MINIDUMP_STRING tmp = {0};
MINIDUMP_STRING* tmp;
ALLOW_UNUSED_LOCAL(tmp);
const size_t expected_utf16_bytes =
expected_utf16_units_with_nul * sizeof(tmp.Buffer[0]);
ASSERT_EQ(string_file.string().size(),
sizeof(MINIDUMP_STRING) + expected_utf16_bytes);
expected_utf16_units_with_nul * sizeof(tmp->Buffer[0]);
ASSERT_EQ(string_file.string().size(), sizeof(*tmp) + expected_utf16_bytes);
const MINIDUMP_STRING* minidump_string =
MinidumpStringAtRVA(string_file.string(), 0);
@ -129,11 +128,11 @@ TEST(MinidumpStringWriter, ConvertInvalidUTF8ToUTF16) {
const MINIDUMP_STRING* minidump_string =
MinidumpStringAtRVA(string_file.string(), 0);
EXPECT_TRUE(minidump_string);
MINIDUMP_STRING tmp = {0};
MINIDUMP_STRING* tmp;
ALLOW_UNUSED_LOCAL(tmp);
EXPECT_EQ(minidump_string->Length,
string_file.string().size() - sizeof(MINIDUMP_STRING) -
sizeof(tmp.Buffer[0]));
EXPECT_EQ(
minidump_string->Length,
string_file.string().size() - sizeof(*tmp) - sizeof(tmp->Buffer[0]));
base::string16 output_string =
MinidumpStringAtRVAAsString(string_file.string(), 0);
EXPECT_FALSE(output_string.empty());

View File

@ -39,11 +39,11 @@ void GetSystemInfoStream(const std::string& file_contents,
const MINIDUMP_SYSTEM_INFO** system_info,
const MINIDUMP_STRING** csd_version) {
// The expected number of bytes for the CSD versions MINIDUMP_STRING::Buffer.
MINIDUMP_STRING tmp = {0};
MINIDUMP_STRING* tmp;
ALLOW_UNUSED_LOCAL(tmp);
const size_t kCSDVersionBytes = csd_version_length * sizeof(tmp.Buffer[0]);
const size_t kCSDVersionBytes = csd_version_length * sizeof(tmp->Buffer[0]);
const size_t kCSDVersionBytesWithNUL =
kCSDVersionBytes + sizeof(tmp.Buffer[0]);
kCSDVersionBytes + sizeof(tmp->Buffer[0]);
constexpr size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER);
constexpr size_t kSystemInfoStreamOffset =