Use std::ignore rather than ignore_result in Crashpad

Bug: 1285085
Change-Id: I02f1eb608a704fe58b72c094b96af6c7577be4bf
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3373171
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
This commit is contained in:
Avi Drissman 2022-01-07 17:19:37 -05:00 committed by Crashpad LUCI CQ
parent ee230eef02
commit 23375ab37c
10 changed files with 26 additions and 23 deletions

2
DEPS
View File

@ -39,7 +39,7 @@ deps = {
'e1e7b0ad8ee99a875b272c8e33e308472e897660',
'crashpad/third_party/mini_chromium/mini_chromium':
Var('chromium_git') + '/chromium/mini_chromium@' +
'0243b40af70e34c81fc8a30d9b15cd276b2d49ba',
'bbb68fcec19ff7c268fadeebd2ef79f7203fa2f2',
'crashpad/third_party/libfuzzer/src':
Var('chromium_git') + '/chromium/llvm-project/compiler-rt/lib/fuzzer.git@' +
'fda403cf93ecb8792cb1d061564d89a6553ca020',

View File

@ -18,9 +18,9 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <tuple>
#include <utility>
#include "base/ignore_result.h"
#include "base/logging.h"
#include "build/build_config.h"
#include "client/settings.h"
@ -356,14 +356,14 @@ OperationStatus CrashReportDatabaseGeneric::FinishedWritingCrashReport(
return kFileSystemError;
}
// We've moved the report to pending, so it no longer needs to be removed.
ignore_result(report->file_remover_.release());
std::ignore = report->file_remover_.release();
// Close all the attachments and disarm their removers too.
for (auto& writer : report->attachment_writers_) {
writer->Close();
}
for (auto& remover : report->attachment_removers_) {
ignore_result(remover.release());
std::ignore = remover.release();
}
*uuid = report->ReportID();

View File

@ -25,8 +25,9 @@
#include <unistd.h>
#include <uuid/uuid.h>
#include <tuple>
#include "base/cxx17_backports.h"
#include "base/ignore_result.h"
#include "base/logging.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/posix/eintr_wrapper.h"
@ -385,14 +386,14 @@ CrashReportDatabaseMac::FinishedWritingCrashReport(
PLOG(ERROR) << "rename " << path.value() << " to " << new_path.value();
return kFileSystemError;
}
ignore_result(report->file_remover_.release());
std::ignore = report->file_remover_.release();
// Close all the attachments and disarm their removers too.
for (auto& writer : report->attachment_writers_) {
writer->Close();
}
for (auto& remover : report->attachment_removers_) {
ignore_result(remover.release());
std::ignore = remover.release();
}
Metrics::CrashReportPending(Metrics::PendingReportReason::kNewlyCreated);

View File

@ -21,9 +21,9 @@
#include <time.h>
#include <wchar.h>
#include <tuple>
#include <utility>
#include "base/ignore_result.h"
#include "base/logging.h"
#include "base/numerics/safe_math.h"
#include "base/strings/utf_string_conversions.h"
@ -735,14 +735,14 @@ OperationStatus CrashReportDatabaseWin::FinishedWritingCrashReport(
time(nullptr),
ReportState::kPending));
ignore_result(report->file_remover_.release());
std::ignore = report->file_remover_.release();
// Close all the attachments and disarm their removers too.
for (auto& writer : report->attachment_writers_) {
writer->Close();
}
for (auto& remover : report->attachment_removers_) {
ignore_result(remover.release());
std::ignore = remover.release();
}
*uuid = report->ReportID();

View File

@ -21,9 +21,9 @@
#include <stdint.h>
#include <memory>
#include <tuple>
#include <utility>
#include "base/ignore_result.h"
#include "base/logging.h"
#include "base/mac/mach_logging.h"
#include "base/strings/stringprintf.h"
@ -178,7 +178,7 @@ class HandlerStarter final : public NotifyServer::DefaultInterface {
handler_restarter->StartRestartThread(
handler, database, metrics_dir, url, annotations, arguments)) {
// The thread owns the object now.
ignore_result(handler_restarter.release());
std::ignore = handler_restarter.release();
}
// If StartRestartThread() failed, proceed without the ability to restart.
@ -362,7 +362,7 @@ class HandlerStarter final : public NotifyServer::DefaultInterface {
return false;
}
ignore_result(receive_right.release());
std::ignore = receive_right.release();
return true;
}

View File

@ -19,9 +19,9 @@
#include <memory>
#include <string>
#include <tuple>
#include "base/auto_reset.h"
#include "base/ignore_result.h"
#include "base/mac/scoped_mach_port.h"
#include "gtest/gtest.h"
#include "test/errors.h"
@ -212,7 +212,7 @@ void MachMultiprocess::MultiprocessChild() {
ScopedForbidReturn forbid_return;
// local_port is not valid in the forked child process.
ignore_result(info_->local_port.release());
std::ignore = info_->local_port.release();
info_->local_port.reset(NewMachPort(MACH_PORT_RIGHT_RECEIVE));
ASSERT_NE(info_->local_port, kMachPortNull);

View File

@ -18,9 +18,9 @@
#include <mach/mach.h>
#include <string>
#include <tuple>
#include "base/files/scoped_file.h"
#include "base/ignore_result.h"
#include "util/mach/child_port_types.h"
namespace crashpad {
@ -124,7 +124,7 @@ class ChildPortHandshakeTest;
//! // for use in the parent process.
//! if (child_port_handshake.RunClient(receive_right.get(),
//! MACH_MSG_TYPE_MOVE_RECEIVE)) {
//! ignore_result(receive_right.release());
//! std::ignore = receive_right.release();
//! }
//! \endcode
//!

View File

@ -16,7 +16,8 @@
#include <unistd.h>
#include "base/ignore_result.h"
#include <tuple>
#include "base/mac/scoped_mach_port.h"
#include "gtest/gtest.h"
#include "test/mac/mach_errors.h"
@ -154,7 +155,7 @@ TEST(MachMessage, MachMessageDestroyReceivedPort) {
ASSERT_EQ(right_type,
implicit_cast<mach_msg_type_name_t>(MACH_MSG_TYPE_PORT_SEND));
EXPECT_TRUE(MachMessageDestroyReceivedPort(port, MACH_MSG_TYPE_PORT_RECEIVE));
ignore_result(receive.release());
std::ignore = receive.release();
EXPECT_TRUE(MachMessageDestroyReceivedPort(port, MACH_MSG_TYPE_PORT_SEND));
}

View File

@ -18,9 +18,10 @@
#include <paths.h>
#include <unistd.h>
#include <tuple>
#include "base/check.h"
#include "base/files/scoped_file.h"
#include "base/ignore_result.h"
#include "base/posix/eintr_wrapper.h"
namespace crashpad {
@ -32,7 +33,7 @@ void CloseStdioStream(int desired_fd, int oflag) {
HANDLE_EINTR(open(_PATH_DEVNULL, oflag | O_NOCTTY | O_CLOEXEC)));
if (fd == desired_fd) {
// Weird, but play along.
ignore_result(fd.release());
std::ignore = fd.release();
} else {
PCHECK(fd.get() >= 0) << "open";
PCHECK(HANDLE_EINTR(dup2(fd.get(), desired_fd)) != -1) << "dup2";

View File

@ -15,8 +15,8 @@
#include "util/stream/file_encoder.h"
#include <memory>
#include <tuple>
#include "base/ignore_result.h"
#include "util/file/file_io.h"
#include "util/file/file_reader.h"
#include "util/file/scoped_remove_file.h"
@ -77,7 +77,7 @@ bool FileEncoder::Process() {
if (!output->Flush())
return false;
ignore_result(file_remover.release());
std::ignore = file_remover.release();
return true;
}