Remove DCHECK(false) version of NOTREACHED()
This will let us rename NOTREACHED_NORETURN() to NOTREACHED(). TODOs are
left to figure out whether the DCHECKs should be turned into CHECKs or
just removed.
Bug: 40580068, 42271016
Change-Id: I02d4128bf7bddffbbde2c31a837961081b83b92b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/125870
Auto-Submit: Peter Boström <pbos@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index d1121fb..30da851 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -1027,7 +1027,9 @@
// Additional check, that all ok.
if (GetValidator()->has_read_problems()) {
- NOTREACHED();
+ // TODO(crbug.com/42271016): Figure out if this should be a CHECK() or the
+ // DCHECK() removed.
+ DCHECK(false);
return std::make_pair(CPDF_Parser::HANDLER_ERROR, nullptr);
}
diff --git a/core/fpdfapi/parser/cpdf_read_validator.cpp b/core/fpdfapi/parser/cpdf_read_validator.cpp
index 796354b..a1d8690 100644
--- a/core/fpdfapi/parser/cpdf_read_validator.cpp
+++ b/core/fpdfapi/parser/cpdf_read_validator.cpp
@@ -57,7 +57,9 @@
bool CPDF_ReadValidator::ReadBlockAtOffset(pdfium::span<uint8_t> buffer,
FX_FILESIZE offset) {
if (offset < 0) {
- NOTREACHED();
+ // TODO(crbug.com/42271016): Figure out if this should be a CHECK() or the
+ // DCHECK() removed.
+ DCHECK(false);
return false;
}
@@ -92,7 +94,9 @@
FX_SAFE_FILESIZE end_segment_offset = offset;
end_segment_offset += size;
if (!end_segment_offset.IsValid()) {
- NOTREACHED();
+ // TODO(crbug.com/42271016): Figure out if this should be a CHECK() or the
+ // DCHECK() removed.
+ DCHECK(false);
return;
}
end_segment_offset =
@@ -101,7 +105,9 @@
FX_SAFE_SIZE_T segment_size = end_segment_offset;
segment_size -= start_segment_offset;
if (!segment_size.IsValid()) {
- NOTREACHED();
+ // TODO(crbug.com/42271016): Figure out if this should be a CHECK() or the
+ // DCHECK() removed.
+ DCHECK(false);
return;
}
hints_->AddSegment(start_segment_offset, segment_size.ValueOrDie());
@@ -133,7 +139,9 @@
// Increase checked range to allow CPDF_SyntaxParser read whole buffer.
end_segment_offset += CPDF_Stream::kFileBufSize;
if (!end_segment_offset.IsValid()) {
- NOTREACHED();
+ // TODO(crbug.com/42271016): Figure out if this should be a CHECK() or the
+ // DCHECK() removed.
+ DCHECK(false);
return false;
}
end_segment_offset = std::min(
@@ -141,7 +149,9 @@
FX_SAFE_SIZE_T segment_size = end_segment_offset;
segment_size -= offset;
if (!segment_size.IsValid()) {
- NOTREACHED();
+ // TODO(crbug.com/42271016): Figure out if this should be a CHECK() or the
+ // DCHECK() removed.
+ DCHECK(false);
return false;
}
diff --git a/core/fxcrt/notreached.h b/core/fxcrt/notreached.h
index 8b542f5..3cc68f7 100644
--- a/core/fxcrt/notreached.h
+++ b/core/fxcrt/notreached.h
@@ -9,12 +9,6 @@
#include "core/fxcrt/check.h"
-// TODO(crbug.com/pdfium/2008): Migrate NOTREACHED() callers to
-// NOTREACHED_NORETURN() which is [[noreturn]] and always FATAL. Once that's
-// done, rename NOTREACHED_NORETURN() back to NOTREACHED() and remove the
-// non-FATAL version.
-#define NOTREACHED() DCHECK(false)
-
// NOTREACHED_NORETURN() annotates paths that are supposed to be unreachable.
// They crash if they are ever hit.
// TODO(crbug.com/pdfium/2008): Rename back to NOTREACHED() once there are no