GCC fix: Don’t name a method exactly the same as its return type

While compiling, for example,
minidump_simple_string_dictionary_writer.cc:

In file included from
../../minidump/minidump_module_crashpad_info_writer.cc:21:0:
../../minidump/minidump_simple_string_dictionary_writer.h:55:45: error:
declaration of ‘const crashpad::MinidumpSimpleStringDictionaryEntry*
crashpad::MinidumpSimpleStringDictionaryEntryWriter::MinidumpSimpleStringDictionaryEntry()
const’ [-fpermissive]
       MinidumpSimpleStringDictionaryEntry() const;
                                             ^~~~~
In file included from
../../minidump/minidump_module_crashpad_info_writer.h:25:0,
                 from
../../minidump/minidump_module_crashpad_info_writer.cc:15:
../../minidump/minidump_extensions.h:255:26: error: changes meaning of
‘MinidumpSimpleStringDictionaryEntry’ from ‘struct
crashpad::MinidumpSimpleStringDictionaryEntry’ [-fpermissive]
 struct ALIGNAS(4) PACKED MinidumpSimpleStringDictionaryEntry {
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tested with:
 - GCC 4.9 from NDK r13 targeting arm with SDK 16
 - GCC 4.9 from NDK r13 targeting arm64 with SDK 21
 - GCC 6.2 targeting x86_64

BUG=crashpad:30

Change-Id: I1e5e6a21a24f19eef7602e4123459ce15f3b089e
Reviewed-on: https://chromium-review.googlesource.com/409624
Reviewed-by: Robert Sesek <rsesek@chromium.org>
This commit is contained in:
Mark Mentovai 2016-11-10 13:23:05 -05:00
parent dd85381a32
commit 5b14b41992
2 changed files with 4 additions and 4 deletions

View File

@ -34,8 +34,8 @@ MinidumpSimpleStringDictionaryEntryWriter::
} }
const MinidumpSimpleStringDictionaryEntry* const MinidumpSimpleStringDictionaryEntry*
MinidumpSimpleStringDictionaryEntryWriter::MinidumpSimpleStringDictionaryEntry() MinidumpSimpleStringDictionaryEntryWriter::
const { GetMinidumpSimpleStringDictionaryEntry() const {
DCHECK_EQ(state(), kStateWritable); DCHECK_EQ(state(), kStateWritable);
return &entry_; return &entry_;
@ -179,7 +179,7 @@ bool MinidumpSimpleStringDictionaryWriter::WriteObject(
std::vector<WritableIoVec> iovecs(1, iov); std::vector<WritableIoVec> iovecs(1, iov);
for (const auto& key_entry : entries_) { for (const auto& key_entry : entries_) {
iov.iov_base = key_entry.second->MinidumpSimpleStringDictionaryEntry(); iov.iov_base = key_entry.second->GetMinidumpSimpleStringDictionaryEntry();
iov.iov_len = sizeof(MinidumpSimpleStringDictionaryEntry); iov.iov_len = sizeof(MinidumpSimpleStringDictionaryEntry);
iovecs.push_back(iov); iovecs.push_back(iov);
} }

View File

@ -52,7 +52,7 @@ class MinidumpSimpleStringDictionaryEntryWriter final
//! //!
//! \note Valid in #kStateWritable. //! \note Valid in #kStateWritable.
const MinidumpSimpleStringDictionaryEntry* const MinidumpSimpleStringDictionaryEntry*
MinidumpSimpleStringDictionaryEntry() const; GetMinidumpSimpleStringDictionaryEntry() const;
//! \brief Sets the strings to be written as the entry objects key and value. //! \brief Sets the strings to be written as the entry objects key and value.
//! //!