Skip to content

Replace use of #ifdef by template parameter in symex_assign #4840

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

Merged
merged 6 commits into from
Jun 26, 2019

Conversation

romainbrenguier
Copy link
Contributor

This make sure both branches could be compile (which was no longer the case), and open the possibility to unit-test both branches.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • [na] The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • [na] My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • [na] White-space or formatting changes outside the feature-related changed lines are in commits of their own.

This would not compile when USE_UPDATE is activated.
This make it easier to detect problems in the code that does not get
compiled, for instance here a missing ns argument, and open the
possibility to unit-test both versions of the function.
Documentation was missing.
In shift_indexed_access_to_lhs. This makes sure both branches could
compile correctly and open the possibility to test both branches.
In assign_array. This requires fixing some error in one of the branch
since the compiler was not looking at it before.
In assign_struct_member. This requires fixing some problems in one of
the branchs, as the compiler was not looking at it before.
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️
This PR failed Diffblue compatibility checks (cbmc commit: 43fffdf).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/116945274
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.

}
else
return with_exprt{idx.array(), idx.index(), ssa_rhs};
}();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get the point of this lambda function?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to make clear that this part of the code is just to find the new value of ssa_rhs. The alternative is to have directly an if statement and we wouldn't know what it's mutating without looking at the code inside the branches.

new_rhs.where().set(ID_component_name, component_name);
return std::move(new_rhs);
}
}();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, no idea why a lambda is the right thing here?

@romainbrenguier romainbrenguier merged commit ec90bba into diffblue:develop Jun 26, 2019
@romainbrenguier romainbrenguier deleted the clean-up/ifdef branch June 26, 2019 11:10
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.

5 participants