-
Notifications
You must be signed in to change notification settings - Fork 882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[iOS] - Replace NOTREACHED_IN_MIGRATION for iOS #26224
Conversation
@@ -49,7 +49,7 @@ - (instancetype)initWithNode:(const bookmarks::BookmarkNode*)node | |||
void BookmarkModelListener::BookmarkModelBeingDeleted() { | |||
// This is an inconsistent state in the application lifecycle. The bookmark | |||
// model shouldn't disappear. | |||
NOTREACHED_IN_MIGRATION(); | |||
CHECK(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it just become NOTREACHED()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Brandon, I think we will need to review the guidance to correct this PR[1]. NOTREACHED
is now [[noreturn]]
and so you should assume that a failed CHECK
/DCHECK
won't return, so we shouldn't have code after it for the failure path. A few examples on the guidance of "bad" code are like this:
// Bad:
//
// Do not handle `DCHECK()` failures. Use `CHECK()` instead and omit the
// conditional below.
DCHECK(foo); // Use CHECK() instead and omit conditional below.
if (!foo) {
...
}
// Bad:
//
// Use CHECK(bar); instead.
if (!bar) {
NOTREACHED();
}
We shouldn't be doing CHECK(FALSE)
as that should be NOTREACHED
. A CHECK
is a NOTREACHED
with a conditional in a way.
[1] https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/checks.md
…[[no_return]] where necessary.
Fixed. However, chromium doesn't seem to be doing the same: https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/bookmarks/bookmark_html_writer.cc;l=338?q=BookmarkCodec::kTypeFolder&ss=chromium%2Fchromium%2Fsrc They have: if (!url_string) {
NOTREACHED_IN_MIGRATION();
return false;
} instead of: CHECK(url_string); |
5268f19
to
c9882a5
Compare
Please read the document. |
c9882a5
to
1b3bf1d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Brandon for that. Looks good.
1b3bf1d
to
42d0912
Compare
42d0912
to
0f1b01b
Compare
Released in v1.73.51 |
Resolves brave/brave-browser#41886
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: