-
Notifications
You must be signed in to change notification settings - Fork 281
Fix accesses to exprt::opX() in ansi-c/ #5076
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
Conversation
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.
This PR failed Diffblue compatibility checks (cbmc commit: 291a871).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/125451568
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.
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 8688613).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/125461334
8688613
to
0a157dd
Compare
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 387fd14).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/131386071
src/ansi-c/expr2c.cpp
Outdated
to_code(to_unary_expr(src).op()).get_statement() != ID_block) | ||
return convert_norep(src, precedence); |
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.
May I ask for braces to be added?
src/ansi-c/expr2c.cpp
Outdated
to_unary_expr(src).op().id() == ID_predicate_passive_symbol) | ||
dest = to_unary_expr(src).op().get_string(ID_identifier); |
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.
Braces, please.
src/ansi-c/expr2c.cpp
Outdated
@@ -2082,7 +2082,7 @@ std::string expr2ct::convert_union( | |||
if(src.operands().size()!=1) | |||
return convert_norep(src, precedence); | |||
|
|||
std::string tmp=convert(src.op0()); | |||
std::string tmp = convert(to_union_expr(src).op()); |
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.
Hmm, could we actually get rid of tmp
here and just inline the convert
call below, where tmp
is currently used? (It would be nice if over time we could get rid of any uses of the non-descriptive name tmp
.)
src/ansi-c/expr2c.cpp
Outdated
@@ -2934,7 +2934,7 @@ std::string expr2ct::convert_code_assign( | |||
const code_assignt &src, | |||
unsigned indent) | |||
{ | |||
std::string tmp=convert_binary(src, "=", 2, true); | |||
std::string tmp = convert_binary(to_binary_expr(src), "=", 2, true); |
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.
As above: can tmp
please be removed and the call be inlined instead?
src/ansi-c/expr2c.cpp
Outdated
{ | ||
return convert(to_index_expr(object).array()); | ||
} |
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.
Braces don't seem to be necessary here (I'm only objecting to their use, because the other cases of this if
don't use braces either.
This improves type safety, and will enable restricing the exprt interface. These are the final ones in ansi-c/.
@tautschnig All done. |
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 3c117db).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/132746298
This improves type safety, and will enable restricing the exprt interface.
This is the final one in ansi-c/.