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

Side-Effect Free Assetion Code #2447

Closed
LeStarch opened this issue Dec 21, 2023 · 0 comments
Closed

Side-Effect Free Assetion Code #2447

LeStarch opened this issue Dec 21, 2023 · 0 comments
Labels
bug High Priority High Priority issue that needs to be resolved.

Comments

@LeStarch
Copy link
Collaborator

F´ Version
Affected Component

Problem Description

FW_NO_ASSERT reduces the FW_ASSERT macro to "", that is, it is compiled-out. However, this breaks assertions with side-effect inducing code (see example below).

We need to fix several things:

  1. Clean up the fprime framework code to not depend on side-effects in FW_ASSERT calls
  2. Make the default FW_NO_ASSERT option maintain side-effects
  3. Add an option for power-users to return FW_NO_ASSERT to the completely removed case.
  4. Update style guidelines to call this coding flaw out

Example offending code:

FW_ASSERT(serializer.serialize(id) == Fw::SerializeStatus::FW_SERIALIZE_OK);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug High Priority High Priority issue that needs to be resolved.
Projects
None yet
Development

No branches or pull requests

2 participants