From 6265674c980d8cb5e2bdea10de21b53d8705c847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Bostr=C3=B6m?= Date: Wed, 14 Aug 2024 13:09:43 +1000 Subject: [PATCH] Migrate to NOTREACHED() This was tested locally by adding "-Wunreachable-code-aggressive" after making NOTREACHED() [[noreturn]] in mini_chromium and then getting that to compile. Bug: chromium:40580068 Change-Id: I7ec1c72be1d73436d128660a621e9060eaebaee8 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5780891 Reviewed-by: Mark Mentovai --- client/crashpad_client_linux_test.cc | 4 +-- client/prune_crash_reports.cc | 4 +-- client/settings.cc | 3 +- handler/crash_report_upload_thread.cc | 3 +- handler/win/hanging_program.cc | 21 ++++++-------- minidump/minidump_context_writer_test.cc | 10 ++----- minidump/minidump_string_writer_test.cc | 10 ++----- minidump/minidump_system_info_writer.cc | 8 ++---- snapshot/cpu_context.cc | 18 ++++-------- snapshot/fuchsia/process_snapshot_fuchsia.cc | 3 +- snapshot/fuchsia/system_snapshot_fuchsia.cc | 15 ++++------ snapshot/linux/system_snapshot_linux.cc | 15 ++++------ snapshot/mac/cpu_context_mac.cc | 9 ++---- snapshot/mac/system_snapshot_mac.cc | 15 ++++------ snapshot/minidump/module_snapshot_minidump.cc | 6 ++-- .../minidump/process_snapshot_minidump.cc | 9 ++---- snapshot/minidump/system_snapshot_minidump.cc | 28 +++++++------------ .../process_snapshot_sanitized_test.cc | 5 ++-- snapshot/win/system_snapshot_win.cc | 15 ++++------ test/linux/fake_ptrace_connection.cc | 6 ++-- util/file/file_io_posix.cc | 3 +- util/file/file_io_win.cc | 6 ++-- util/file/output_stream_file_writer.cc | 3 +- util/mac/mac_util.cc | 3 +- util/mach/child_port_handshake.cc | 3 +- util/mach/exc_client_variants.cc | 3 +- util/mach/exception_ports.cc | 7 +---- util/mach/exception_ports_test.cc | 9 +++--- util/synchronization/scoped_spin_guard.h | 2 +- util/win/registration_protocol_win_test.cc | 3 +- 30 files changed, 83 insertions(+), 166 deletions(-) diff --git a/client/crashpad_client_linux_test.cc b/client/crashpad_client_linux_test.cc index ae76a7e4..1113cda5 100644 --- a/client/crashpad_client_linux_test.cc +++ b/client/crashpad_client_linux_test.cc @@ -760,12 +760,12 @@ class StartHandlerForChildTest : public Multiprocess { test_state_.ExpectReport(); } - void MultiprocessChild() { + [[noreturn]] void MultiprocessChild() { CHECK(test_state_.InstallHandler()); __builtin_trap(); - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } StartHandlerForClientTest test_state_; diff --git a/client/prune_crash_reports.cc b/client/prune_crash_reports.cc index 6e4c7b9c..ae71aee2 100644 --- a/client/prune_crash_reports.cc +++ b/client/prune_crash_reports.cc @@ -122,10 +122,8 @@ bool BinaryPruneCondition::ShouldPruneReport( return lhs_->ShouldPruneReport(report) && rhs_->ShouldPruneReport(report); case OR: return lhs_->ShouldPruneReport(report) || rhs_->ShouldPruneReport(report); - default: - NOTREACHED_IN_MIGRATION(); - return false; } + NOTREACHED(); } } // namespace crashpad diff --git a/client/settings.cc b/client/settings.cc index 420fbfc9..0174c62b 100644 --- a/client/settings.cc +++ b/client/settings.cc @@ -292,8 +292,7 @@ FileHandle Settings::GetHandleFromOptions( return OpenFileForReadAndWrite( file_path, options.mode, options.permissions); } - NOTREACHED_IN_MIGRATION(); - return kInvalidFileHandle; + NOTREACHED(); } Settings::ScopedLockedFileHandle Settings::OpenForReading() { diff --git a/handler/crash_report_upload_thread.cc b/handler/crash_report_upload_thread.cc index c224871a..8350d076 100644 --- a/handler/crash_report_upload_thread.cc +++ b/handler/crash_report_upload_thread.cc @@ -236,8 +236,7 @@ void CrashReportUploadThread::ProcessPendingReport( return; case CrashReportDatabase::kCannotRequestUpload: - NOTREACHED_IN_MIGRATION(); - return; + NOTREACHED(); } std::string response_body; diff --git a/handler/win/hanging_program.cc b/handler/win/hanging_program.cc index 00eaf171..371eadb9 100644 --- a/handler/win/hanging_program.cc +++ b/handler/win/hanging_program.cc @@ -28,7 +28,7 @@ namespace { -DWORD WINAPI Thread1(LPVOID context) { +[[noreturn]] DWORD WINAPI Thread1(LPVOID context) { HANDLE event = context; // Increase the thread priority as a hacky way to signal to @@ -40,17 +40,15 @@ DWORD WINAPI Thread1(LPVOID context) { Sleep(INFINITE); - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); } -DWORD WINAPI Thread2(LPVOID dummy) { +[[noreturn]] DWORD WINAPI Thread2(LPVOID dummy) { Sleep(INFINITE); - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); } -DWORD WINAPI Thread3(LPVOID context) { +[[noreturn]] DWORD WINAPI Thread3(LPVOID context) { // This is a convenient way to pass the event handle to loader_lock_dll.dll. HANDLE event = context; PCHECK(SetEnvironmentVariable( @@ -58,15 +56,12 @@ DWORD WINAPI Thread3(LPVOID context) { base::UTF8ToWide(base::StringPrintf("%p", event)).c_str())); HMODULE dll = LoadLibrary(L"loader_lock_dll.dll"); - if (!dll) - PLOG(FATAL) << "LoadLibrary"; + PCHECK(dll) << "LoadLibrary"; // This call is not expected to return. - if (!FreeLibrary(dll)) - PLOG(FATAL) << "FreeLibrary"; + PCHECK(FreeLibrary(dll)); - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); } } // namespace diff --git a/minidump/minidump_context_writer_test.cc b/minidump/minidump_context_writer_test.cc index 8eaae831..277bd4d3 100644 --- a/minidump/minidump_context_writer_test.cc +++ b/minidump/minidump_context_writer_test.cc @@ -50,14 +50,8 @@ class TestTypeNames { public: template static std::string GetName(int) { - if (std::is_same()) { - return "RVA"; - } - if (std::is_same()) { - return "RVA64"; - } - NOTREACHED_IN_MIGRATION(); - return ""; + static_assert(std::is_same() || std::is_same()); + return std::is_same() ? "RVA" : "RVA64"; } }; diff --git a/minidump/minidump_string_writer_test.cc b/minidump/minidump_string_writer_test.cc index 573eac69..e72832b4 100644 --- a/minidump/minidump_string_writer_test.cc +++ b/minidump/minidump_string_writer_test.cc @@ -36,14 +36,8 @@ class TestTypeNames { public: template static std::string GetName(int) { - if (std::is_same()) { - return "RVA"; - } - if (std::is_same()) { - return "RVA64"; - } - NOTREACHED_IN_MIGRATION(); - return ""; + static_assert(std::is_same() || std::is_same()); + return std::is_same() ? "RVA" : "RVA64"; } }; diff --git a/minidump/minidump_system_info_writer.cc b/minidump/minidump_system_info_writer.cc index 9fe3ac0e..e9e05124 100644 --- a/minidump/minidump_system_info_writer.cc +++ b/minidump/minidump_system_info_writer.cc @@ -136,9 +136,7 @@ void MinidumpSystemInfoWriter::InitializeFromSnapshot( cpu_architecture = kMinidumpCPUArchitectureRISCV64Breakpad; break; default: - NOTREACHED_IN_MIGRATION(); - cpu_architecture = kMinidumpCPUArchitectureUnknown; - break; + NOTREACHED(); } SetCPUArchitecture(cpu_architecture); @@ -185,9 +183,7 @@ void MinidumpSystemInfoWriter::InitializeFromSnapshot( operating_system = kMinidumpOSIOS; break; default: - NOTREACHED_IN_MIGRATION(); - operating_system = kMinidumpOSUnknown; - break; + NOTREACHED(); } SetOS(operating_system); diff --git a/snapshot/cpu_context.cc b/snapshot/cpu_context.cc index 71bf4ace..6b69edef 100644 --- a/snapshot/cpu_context.cc +++ b/snapshot/cpu_context.cc @@ -174,8 +174,7 @@ uint64_t CPUContext::InstructionPointer() const { case kCPUArchitectureRISCV64: return riscv64->pc; default: - NOTREACHED_IN_MIGRATION(); - return ~0ull; + NOTREACHED(); } } @@ -192,8 +191,7 @@ uint64_t CPUContext::StackPointer() const { case kCPUArchitectureRISCV64: return riscv64->regs[1]; default: - NOTREACHED_IN_MIGRATION(); - return ~0ull; + NOTREACHED(); } } @@ -202,13 +200,11 @@ uint64_t CPUContext::ShadowStackPointer() const { case kCPUArchitectureX86: case kCPUArchitectureARM: case kCPUArchitectureARM64: - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); case kCPUArchitectureX86_64: return x86_64->xstate.cet_u.ssp; default: - NOTREACHED_IN_MIGRATION(); - return ~0ull; + NOTREACHED(); } } @@ -221,8 +217,7 @@ bool CPUContext::HasShadowStack() const { case kCPUArchitectureX86_64: return x86_64->xstate.cet_u.cetmsr != 0; default: - NOTREACHED_IN_MIGRATION(); - return false; + NOTREACHED(); } } @@ -238,8 +233,7 @@ bool CPUContext::Is64Bit() const { case kCPUArchitectureMIPSEL: return false; default: - NOTREACHED_IN_MIGRATION(); - return false; + NOTREACHED(); } } diff --git a/snapshot/fuchsia/process_snapshot_fuchsia.cc b/snapshot/fuchsia/process_snapshot_fuchsia.cc index 1f51a4c9..bb144cba 100644 --- a/snapshot/fuchsia/process_snapshot_fuchsia.cc +++ b/snapshot/fuchsia/process_snapshot_fuchsia.cc @@ -115,8 +115,7 @@ crashpad::ProcessID ProcessSnapshotFuchsia::ProcessID() const { crashpad::ProcessID ProcessSnapshotFuchsia::ParentProcessID() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); // TODO(scottmg): https://crashpad.chromium.org/bug/196 - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); } void ProcessSnapshotFuchsia::SnapshotTime(timeval* snapshot_time) const { diff --git a/snapshot/fuchsia/system_snapshot_fuchsia.cc b/snapshot/fuchsia/system_snapshot_fuchsia.cc index a764e855..b95bf0d0 100644 --- a/snapshot/fuchsia/system_snapshot_fuchsia.cc +++ b/snapshot/fuchsia/system_snapshot_fuchsia.cc @@ -108,8 +108,7 @@ uint32_t SystemSnapshotFuchsia::CPUX86Signature() const { #if defined(ARCH_CPU_X86_64) return cpuid_.Signature(); #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } @@ -118,8 +117,7 @@ uint64_t SystemSnapshotFuchsia::CPUX86Features() const { #if defined(ARCH_CPU_X86_64) return cpuid_.Features(); #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } @@ -128,8 +126,7 @@ uint64_t SystemSnapshotFuchsia::CPUX86ExtendedFeatures() const { #if defined(ARCH_CPU_X86_64) return cpuid_.ExtendedFeatures(); #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } @@ -137,8 +134,7 @@ uint32_t SystemSnapshotFuchsia::CPUX86Leaf7Features() const { #if defined(ARCH_CPU_X86_64) return cpuid_.Leaf7Features(); #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } @@ -147,8 +143,7 @@ bool SystemSnapshotFuchsia::CPUX86SupportsDAZ() const { #if defined(ARCH_CPU_X86_64) return cpuid_.SupportsDAZ(); #else - NOTREACHED_IN_MIGRATION(); - return false; + NOTREACHED(); #endif } diff --git a/snapshot/linux/system_snapshot_linux.cc b/snapshot/linux/system_snapshot_linux.cc index 3eb91b4f..59b66c25 100644 --- a/snapshot/linux/system_snapshot_linux.cc +++ b/snapshot/linux/system_snapshot_linux.cc @@ -276,8 +276,7 @@ uint32_t SystemSnapshotLinux::CPUX86Signature() const { #if defined(ARCH_CPU_X86_FAMILY) return cpuid_.Signature(); #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } @@ -286,8 +285,7 @@ uint64_t SystemSnapshotLinux::CPUX86Features() const { #if defined(ARCH_CPU_X86_FAMILY) return cpuid_.Features(); #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } @@ -296,8 +294,7 @@ uint64_t SystemSnapshotLinux::CPUX86ExtendedFeatures() const { #if defined(ARCH_CPU_X86_FAMILY) return cpuid_.ExtendedFeatures(); #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } @@ -306,8 +303,7 @@ uint32_t SystemSnapshotLinux::CPUX86Leaf7Features() const { #if defined(ARCH_CPU_X86_FAMILY) return cpuid_.Leaf7Features(); #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } @@ -316,8 +312,7 @@ bool SystemSnapshotLinux::CPUX86SupportsDAZ() const { #if defined(ARCH_CPU_X86_FAMILY) return cpuid_.SupportsDAZ(); #else - NOTREACHED_IN_MIGRATION(); - return false; + NOTREACHED(); #endif // ARCH_CPU_X86_FMAILY } diff --git a/snapshot/mac/cpu_context_mac.cc b/snapshot/mac/cpu_context_mac.cc index c8eddfcd..c8db26e4 100644 --- a/snapshot/mac/cpu_context_mac.cc +++ b/snapshot/mac/cpu_context_mac.cc @@ -196,8 +196,7 @@ thread_state_flavor_t InitializeCPUContextX86Flavor( } default: { - NOTREACHED_IN_MIGRATION(); - return THREAD_STATE_NONE; + NOTREACHED(); } } } @@ -377,8 +376,7 @@ thread_state_flavor_t InitializeCPUContextX86_64Flavor( } default: { - NOTREACHED_IN_MIGRATION(); - return THREAD_STATE_NONE; + NOTREACHED(); } } } @@ -553,8 +551,7 @@ thread_state_flavor_t InitializeCPUContextARM64Flavor( } default: { - NOTREACHED_IN_MIGRATION(); - return THREAD_STATE_NONE; + NOTREACHED(); } } } diff --git a/snapshot/mac/system_snapshot_mac.cc b/snapshot/mac/system_snapshot_mac.cc index 933626fc..0242440e 100644 --- a/snapshot/mac/system_snapshot_mac.cc +++ b/snapshot/mac/system_snapshot_mac.cc @@ -204,8 +204,7 @@ uint32_t SystemSnapshotMac::CPUX86Signature() const { #if defined(ARCH_CPU_X86_FAMILY) return ReadIntSysctlByName("machdep.cpu.signature", 0); #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } @@ -215,8 +214,7 @@ uint64_t SystemSnapshotMac::CPUX86Features() const { #if defined(ARCH_CPU_X86_FAMILY) return ReadIntSysctlByName("machdep.cpu.feature_bits", 0); #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } @@ -226,8 +224,7 @@ uint64_t SystemSnapshotMac::CPUX86ExtendedFeatures() const { #if defined(ARCH_CPU_X86_FAMILY) return ReadIntSysctlByName("machdep.cpu.extfeature_bits", 0); #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } @@ -251,8 +248,7 @@ uint32_t SystemSnapshotMac::CPUX86Leaf7Features() const { CallCPUID(7, &eax, &ebx, &ecx, &edx); return ebx; #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } @@ -290,8 +286,7 @@ bool SystemSnapshotMac::CPUX86SupportsDAZ() const { // Test the DAZ bit. return fxsave.mxcsr_mask & (1 << 6); #else - NOTREACHED_IN_MIGRATION(); - return false; + NOTREACHED(); #endif } diff --git a/snapshot/minidump/module_snapshot_minidump.cc b/snapshot/minidump/module_snapshot_minidump.cc index 8d461b35..039ac59b 100644 --- a/snapshot/minidump/module_snapshot_minidump.cc +++ b/snapshot/minidump/module_snapshot_minidump.cc @@ -228,15 +228,13 @@ std::vector ModuleSnapshotMinidump::AnnotationObjects() std::set> ModuleSnapshotMinidump::ExtraMemoryRanges() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); - NOTREACHED_IN_MIGRATION(); // https://crashpad.chromium.org/bug/10 - return std::set>(); + NOTREACHED(); // https://crashpad.chromium.org/bug/10 } std::vector ModuleSnapshotMinidump::CustomMinidumpStreams() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); - NOTREACHED_IN_MIGRATION(); // https://crashpad.chromium.org/bug/10 - return std::vector(); + NOTREACHED(); // https://crashpad.chromium.org/bug/10 } bool ModuleSnapshotMinidump::InitializeModuleCrashpadInfo( diff --git a/snapshot/minidump/process_snapshot_minidump.cc b/snapshot/minidump/process_snapshot_minidump.cc index 472e0257..6ec51a03 100644 --- a/snapshot/minidump/process_snapshot_minidump.cc +++ b/snapshot/minidump/process_snapshot_minidump.cc @@ -135,8 +135,7 @@ crashpad::ProcessID ProcessSnapshotMinidump::ProcessID() const { crashpad::ProcessID ProcessSnapshotMinidump::ParentProcessID() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); - NOTREACHED_IN_MIGRATION(); // https://crashpad.chromium.org/bug/10 - return 0; + NOTREACHED(); // https://crashpad.chromium.org/bug/10 } void ProcessSnapshotMinidump::SnapshotTime(timeval* snapshot_time) const { @@ -208,8 +207,7 @@ std::vector ProcessSnapshotMinidump::Modules() const { std::vector ProcessSnapshotMinidump::UnloadedModules() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); - NOTREACHED_IN_MIGRATION(); // https://crashpad.chromium.org/bug/10 - return unloaded_modules_; + NOTREACHED(); // https://crashpad.chromium.org/bug/10 } const ExceptionSnapshot* ProcessSnapshotMinidump::Exception() const { @@ -229,8 +227,7 @@ std::vector ProcessSnapshotMinidump::MemoryMap() std::vector ProcessSnapshotMinidump::Handles() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); - NOTREACHED_IN_MIGRATION(); // https://crashpad.chromium.org/bug/10 - return std::vector(); + NOTREACHED(); // https://crashpad.chromium.org/bug/10 } std::vector ProcessSnapshotMinidump::ExtraMemory() diff --git a/snapshot/minidump/system_snapshot_minidump.cc b/snapshot/minidump/system_snapshot_minidump.cc index cfdedadf..b7c7bfd0 100644 --- a/snapshot/minidump/system_snapshot_minidump.cc +++ b/snapshot/minidump/system_snapshot_minidump.cc @@ -100,37 +100,32 @@ std::string SystemSnapshotMinidump::CPUVendor() const { void SystemSnapshotMinidump::CPUFrequency(uint64_t* current_hz, uint64_t* max_hz) const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); - NOTREACHED_IN_MIGRATION(); // https://crashpad.chromium.org/bug/10 + NOTREACHED(); // https://crashpad.chromium.org/bug/10 } uint32_t SystemSnapshotMinidump::CPUX86Signature() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); - NOTREACHED_IN_MIGRATION(); // https://crashpad.chromium.org/bug/10 - return 0; + NOTREACHED(); // https://crashpad.chromium.org/bug/10 } uint64_t SystemSnapshotMinidump::CPUX86Features() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); - NOTREACHED_IN_MIGRATION(); // https://crashpad.chromium.org/bug/10 - return 0; + NOTREACHED(); // https://crashpad.chromium.org/bug/10 } uint64_t SystemSnapshotMinidump::CPUX86ExtendedFeatures() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); - NOTREACHED_IN_MIGRATION(); // https://crashpad.chromium.org/bug/10 - return 0; + NOTREACHED(); // https://crashpad.chromium.org/bug/10 } uint32_t SystemSnapshotMinidump::CPUX86Leaf7Features() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); - NOTREACHED_IN_MIGRATION(); // https://crashpad.chromium.org/bug/10 - return 0; + NOTREACHED(); // https://crashpad.chromium.org/bug/10 } bool SystemSnapshotMinidump::CPUX86SupportsDAZ() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); - NOTREACHED_IN_MIGRATION(); // https://crashpad.chromium.org/bug/10 - return false; + NOTREACHED(); // https://crashpad.chromium.org/bug/10 } SystemSnapshot::OperatingSystem SystemSnapshotMinidump::GetOperatingSystem() @@ -178,14 +173,12 @@ std::string SystemSnapshotMinidump::OSVersionFull() const { std::string SystemSnapshotMinidump::MachineDescription() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); - NOTREACHED_IN_MIGRATION(); // https://crashpad.chromium.org/bug/10 - return std::string(); + NOTREACHED(); // https://crashpad.chromium.org/bug/10 } bool SystemSnapshotMinidump::NXEnabled() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); - NOTREACHED_IN_MIGRATION(); // https://crashpad.chromium.org/bug/10 - return false; + NOTREACHED(); // https://crashpad.chromium.org/bug/10 } void SystemSnapshotMinidump::TimeZone(DaylightSavingTimeStatus* dst_status, @@ -194,13 +187,12 @@ void SystemSnapshotMinidump::TimeZone(DaylightSavingTimeStatus* dst_status, std::string* standard_name, std::string* daylight_name) const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); - NOTREACHED_IN_MIGRATION(); // https://crashpad.chromium.org/bug/10 + NOTREACHED(); // https://crashpad.chromium.org/bug/10 } uint64_t SystemSnapshotMinidump::AddressMask() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); - NOTREACHED_IN_MIGRATION(); // https://crashpad.chromium.org/bug/10 - return 0; + NOTREACHED(); // https://crashpad.chromium.org/bug/10 } } // namespace internal diff --git a/snapshot/sanitized/process_snapshot_sanitized_test.cc b/snapshot/sanitized/process_snapshot_sanitized_test.cc index e9a835b1..772eadc6 100644 --- a/snapshot/sanitized/process_snapshot_sanitized_test.cc +++ b/snapshot/sanitized/process_snapshot_sanitized_test.cc @@ -129,8 +129,9 @@ void ChildTestFunction() { CRASHPAD_CHILD_TEST_MAIN(ChildToBeSanitized) { ChildTestFunction(); - NOTREACHED_IN_MIGRATION(); - return EXIT_SUCCESS; + + // This isn't reachable unless assertions inside ChildTestFunction fail. + NOTREACHED(); } void ExpectAnnotations(ProcessSnapshot* snapshot, bool sanitized) { diff --git a/snapshot/win/system_snapshot_win.cc b/snapshot/win/system_snapshot_win.cc index 65d06b27..160c41d8 100644 --- a/snapshot/win/system_snapshot_win.cc +++ b/snapshot/win/system_snapshot_win.cc @@ -360,8 +360,7 @@ uint32_t SystemSnapshotWin::CPUX86Signature() const { __cpuid(cpu_info, 1); return cpu_info[0]; #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } @@ -375,8 +374,7 @@ uint64_t SystemSnapshotWin::CPUX86Features() const { return (static_cast(cpu_info[2]) << 32) | static_cast(cpu_info[3]); #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } @@ -391,8 +389,7 @@ uint64_t SystemSnapshotWin::CPUX86ExtendedFeatures() const { return (static_cast(cpu_info[2]) << 32) | static_cast(cpu_info[3]); #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } @@ -410,8 +407,7 @@ uint32_t SystemSnapshotWin::CPUX86Leaf7Features() const { __cpuidex(cpu_info, 7, 0); return cpu_info[1]; #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } @@ -441,8 +437,7 @@ bool SystemSnapshotWin::CPUX86SupportsDAZ() const { // Test the DAZ bit. return (mxcsr_mask & (1 << 6)) != 0; #else - NOTREACHED_IN_MIGRATION(); - return 0; + NOTREACHED(); #endif } diff --git a/test/linux/fake_ptrace_connection.cc b/test/linux/fake_ptrace_connection.cc index 8eefe6b2..0f8551e4 100644 --- a/test/linux/fake_ptrace_connection.cc +++ b/test/linux/fake_ptrace_connection.cc @@ -90,15 +90,13 @@ ProcessMemoryLinux* FakePtraceConnection::Memory() { bool FakePtraceConnection::Threads(std::vector* threads) { // TODO(jperaza): Implement this if/when it's needed. - NOTREACHED_IN_MIGRATION(); - return false; + NOTREACHED(); } ssize_t FakePtraceConnection::ReadUpTo(VMAddress address, size_t size, void* buffer) { - NOTREACHED_IN_MIGRATION(); - return false; + NOTREACHED(); } } // namespace test diff --git a/util/file/file_io_posix.cc b/util/file/file_io_posix.cc index 37e923ac..fe7ed060 100644 --- a/util/file/file_io_posix.cc +++ b/util/file/file_io_posix.cc @@ -276,8 +276,7 @@ FileHandle StdioFileHandle(StdioStream stdio_stream) { return STDERR_FILENO; } - NOTREACHED_IN_MIGRATION(); - return kInvalidFileHandle; + NOTREACHED(); } } // namespace crashpad diff --git a/util/file/file_io_win.cc b/util/file/file_io_win.cc index 876f5783..002831fb 100644 --- a/util/file/file_io_win.cc +++ b/util/file/file_io_win.cc @@ -230,8 +230,7 @@ FileOffset LoggingSeekFile(FileHandle file, FileOffset offset, int whence) { method = FILE_END; break; default: - NOTREACHED_IN_MIGRATION(); - break; + NOTREACHED(); } LARGE_INTEGER distance_to_move; @@ -283,8 +282,7 @@ FileHandle StdioFileHandle(StdioStream stdio_stream) { standard_handle = STD_ERROR_HANDLE; break; default: - NOTREACHED_IN_MIGRATION(); - return INVALID_HANDLE_VALUE; + NOTREACHED(); } HANDLE handle = GetStdHandle(standard_handle); diff --git a/util/file/output_stream_file_writer.cc b/util/file/output_stream_file_writer.cc index 8d9cb976..150a9e7a 100644 --- a/util/file/output_stream_file_writer.cc +++ b/util/file/output_stream_file_writer.cc @@ -56,8 +56,7 @@ bool OutputStreamFileWriter::WriteIoVec(std::vector* iovecs) { } FileOffset OutputStreamFileWriter::Seek(FileOffset offset, int whence) { - NOTREACHED_IN_MIGRATION(); - return -1; + NOTREACHED(); } bool OutputStreamFileWriter::Flush() { diff --git a/util/mac/mac_util.cc b/util/mac/mac_util.cc index 37b595b6..b5e1aecd 100644 --- a/util/mac/mac_util.cc +++ b/util/mac/mac_util.cc @@ -207,8 +207,7 @@ int MacOSVersionNumber() { #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_13_4 // On macOS 10.13.4 and later, the sysctlbyname above should have been // successful. - NOTREACHED_IN_MIGRATION(); - return -1; + NOTREACHED(); #else // DT >= 10.13.4 // The Darwin major version is always 4 greater than the macOS minor version // for Darwin versions beginning with 6, corresponding to Mac OS X 10.2, diff --git a/util/mach/child_port_handshake.cc b/util/mach/child_port_handshake.cc index 3402d2da..5ddfb815 100644 --- a/util/mach/child_port_handshake.cc +++ b/util/mach/child_port_handshake.cc @@ -256,8 +256,7 @@ mach_port_t ChildPortHandshakeServer::RunServer( break; default: - NOTREACHED_IN_MIGRATION(); - break; + NOTREACHED(); } } diff --git a/util/mach/exc_client_variants.cc b/util/mach/exc_client_variants.cc index a2c63139..7c0baa88 100644 --- a/util/mach/exc_client_variants.cc +++ b/util/mach/exc_client_variants.cc @@ -123,8 +123,7 @@ kern_return_t UniversalExceptionRaise(exception_behavior_t behavior, new_state_count); default: - NOTREACHED_IN_MIGRATION(); - return KERN_INVALID_ARGUMENT; + NOTREACHED(); } } diff --git a/util/mach/exception_ports.cc b/util/mach/exception_ports.cc index 0f80887a..055fa116 100644 --- a/util/mach/exception_ports.cc +++ b/util/mach/exception_ports.cc @@ -80,12 +80,7 @@ ExceptionPorts::ExceptionPorts(TargetType target_type, mach_port_t target_port) break; default: - NOTREACHED_IN_MIGRATION(); - get_exception_ports_ = nullptr; - set_exception_ports_ = nullptr; - target_name_ = nullptr; - target_port_ = MACH_PORT_NULL; - break; + NOTREACHED(); } } diff --git a/util/mach/exception_ports_test.cc b/util/mach/exception_ports_test.cc index a6d065bc..15375d32 100644 --- a/util/mach/exception_ports_test.cc +++ b/util/mach/exception_ports_test.cc @@ -188,8 +188,7 @@ class TestExceptionPorts : public MachMultiprocess, } else if (who_crashes_ == kOtherThreadCrashes) { expect_behavior = EXCEPTION_STATE_IDENTITY; } else { - NOTREACHED_IN_MIGRATION(); - expect_behavior = 0; + NOTREACHED(); } EXPECT_EQ(behavior, expect_behavior); @@ -286,7 +285,7 @@ class TestExceptionPorts : public MachMultiprocess, } default: { - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } } } @@ -369,7 +368,7 @@ class TestExceptionPorts : public MachMultiprocess, break; } default: { - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } } } @@ -520,7 +519,7 @@ class TestExceptionPorts : public MachMultiprocess, } default: { - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } } } diff --git a/util/synchronization/scoped_spin_guard.h b/util/synchronization/scoped_spin_guard.h index 08141922..6e445b85 100644 --- a/util/synchronization/scoped_spin_guard.h +++ b/util/synchronization/scoped_spin_guard.h @@ -92,7 +92,7 @@ class ScopedSpinGuard final { SleepNanoseconds(kSpinGuardSleepTimeNanos); } - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } ~ScopedSpinGuard() { diff --git a/util/win/registration_protocol_win_test.cc b/util/win/registration_protocol_win_test.cc index 9ce265ac..4538d23c 100644 --- a/util/win/registration_protocol_win_test.cc +++ b/util/win/registration_protocol_win_test.cc @@ -98,8 +98,7 @@ void CheckAce(PACL acl, mask = label_ace->Mask; } break; default: - NOTREACHED_IN_MIGRATION(); - break; + NOTREACHED(); } ASSERT_EQ(check_mask, mask);