Skip to content
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

add assume.c/.h, convert assert-like error checks into assume statements #216

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tehKaiN
Copy link
Member

@tehKaiN tehKaiN commented Dec 7, 2023

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@tehKaiN
Copy link
Member Author

tehKaiN commented Dec 7, 2023

Currently, there's a problem with Bartman suite, which doesn't allow inspecting variables in the middle of the call stack. The dirty solution is ensuring that assertions always trigger one level deep and convert the _assume() function into macro.

The better solution would be fixing the debugger support as explained in BartmanAbyss/vscode-amiga-debug#244 . We'll have to see how this pans out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ACE-specific assert implementation
1 participant