This repository was archived by the owner on Apr 21, 2025. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm really surprised we didn't already have this on...
@cbracken or @chinmaygarde are you aware of any reason why we wouldn't want to disable
NSAssert
in release?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.
Not really, we don't use foundation assertions.
If the assertion needs to be fatal in all modes, there is
FML_CHECK
. If its a useful signal while developing the engine, there isFML_DCHECK
. There are vanishingly few cases where the algorithmic complexity of an operation changes based on the either mode so it mostly just to indicate "actionable to end-users" vs "actionable to engine-developers". If its actionable to neither, there is typically no assertion.The contributing factor for this suppression seems to be here. I think that code handles the case via an early return.
It depends on whether the macOS/iOS embedder authors expect assertions to be blocked in release modes and whether this is a good assertion to have. At least to my reading, it looks like no one understands how we got into this situation and so we are disabling the assertion. But the ability to reason about the severity of ignoring the assertion and whether ignoring it will cause issues further down the line is perhaps lost now.
Uh oh!
There was an error while loading. Please reload this page.
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.
Agreed with @chinmaygarde. I don't think we'd left them enabled intentionally, but rather I think mostly assumed we were using the FML macros.
To be honest, I thought I had gone through and replaced any I found with FML macros at least in the macOS embedder, but maybe that was just cleaning up Windows assertions (e.g. flutter/engine#38826), and just imagined I'd also got around to it for macOS.
We should probably come to a decision as to whether we want to standardise on one other the other so we don't have a semi-random mix of the two. Personal preference would be to standardise on FML across the board both for consistency and because they provide more indication of intent, but either way is fine.
Happy to send a cleanup patch for the macOS embedder and common code. Happy to do iOS too, but am super familiar with the macOS code and it should be straightforward to reason about whether any should actually be FML_CHECK.
Uh oh!
There was an error while loading. Please reload this page.
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.
I think standardizing on the macros makes senses, though unless we have a lint forbidding
NSAsserts
and friends, they will sneak in via reviewers not being aware its disallowed.NSAssert
NSCAssert
I vote we should turn this on to match the Xcode default (
ENABLE_NS_ASSERTIONS
set toNO
in release) of havingNSAssert
s fire in debug but not in-the-wild production apps. But that wouldn't prevent us from auditing the embedder code to swap to the FML macros.