Replace CHECK(false) instances

In most cases NOTREACHED() is now a better option. Also performs
dead-code removal.

Bug: 40122554, 40580068
Change-Id: I2deffa59d375db7813ea6779b1d387718d5c62c7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/6013409
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
This commit is contained in:
Peter Boström 2024-11-13 17:08:24 +11:00 committed by Crashpad LUCI CQ
parent 02d094f3bb
commit 65a45013d0
3 changed files with 7 additions and 5 deletions

View File

@ -17,6 +17,7 @@
#include "base/check.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "client/crashpad_client.h"
#include "util/misc/paths.h"
@ -54,7 +55,7 @@ void CfgCrash() {
IndirectCall(&func);
} __except (EXCEPTION_EXECUTE_HANDLER) {
// CFG fast fail should never be caught.
CHECK(false);
NOTREACHED();
}
// Should only reach here if CFG is disabled.
abort();

View File

@ -17,6 +17,7 @@
#include "base/check.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "client/crashpad_client.h"
#include "util/misc/paths.h"
@ -43,7 +44,7 @@ void HeapCorruptionCrash() {
HeapDestroy(heap);
} __except (EXCEPTION_EXECUTE_HANDLER) {
// Heap corruption exception should never be caught.
CHECK(false);
NOTREACHED();
}
// Should never reach here.
abort();

View File

@ -20,6 +20,7 @@
#include <string>
#include "base/check.h"
#include "base/notreached.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "gtest/gtest.h"
@ -56,7 +57,7 @@ void ScopedTempDir::Rename() {
}
}
CHECK(false) << "Couldn't move to a new unique temp dir";
NOTREACHED() << "Couldn't move to a new unique temp dir";
}
// static
@ -70,8 +71,7 @@ base::FilePath ScopedTempDir::CreateTemporaryDirectory() {
return path_to_create;
}
CHECK(false) << "Couldn't create a new unique temp dir";
return base::FilePath();
NOTREACHED() << "Couldn't create a new unique temp dir";
}
} // namespace test