add assume.c/.h, convert assert-like error checks into assume statements #216
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.
Description
Adds assertion-like mechanism, which falls back to GCC13's assume attribute. Closes #204. On Bartman suite, this results with a breakpoint on where the failed error check took place.
Motivation and Context
Getting used to errors or not finding them among logs is quite common. Proposed feature makes them more apparent and also unifies the behavior on failed, often critical, error checks.
It also takes the burden off of failing gracefully of some parts, especially those, which shouldn't ever fail if user code is well formed.
Also generalizes
checkNull()
approach introduced by @approxit in state manager, adding it to remaining part of codebase.How Has This Been Tested?
Built Aminer with it, ran the game for a while, so apparently there are no regressions. Did some dummy checks to see if breakpoints on failed assumptions trigger properly.
Types of changes
Checklist