Skip to content

Use non-deprecated constructors for code*t [blocks: #3800] #3928

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 2 commits into from
Jan 28, 2019

Conversation

tautschnig
Copy link
Collaborator

The default constructor for codet is deprecated.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a 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).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

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: daca5ab).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/98599638
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.

Common spurious failures:

  • 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).

The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.

target_number(nil_target)
explicit instructiont(goto_program_instruction_typet _type)
: code(ID_nil),
source_location(static_cast<const source_locationt &>(get_nil_irep())),
Copy link
Member

Choose a reason for hiding this comment

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

This change adds non-trivial cost when constructing instructiont -- I am wondering whether we should instead move forward on the consolidation of the ireps in there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How about code(static_cast<codet &>(get_nil_irep()) as a cheaper alternative? Of course the proper consolidation is the correct long-term solution.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

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.

✔️
Passed Diffblue compatibility checks (cbmc commit: 5b54142).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/98710967

We do not use this anywhere except that a regression test relied on it for no
particular reason.
The default constructor for codet is deprecated.
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.

✔️
Passed Diffblue compatibility checks (cbmc commit: 55ca1ef).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/98738338

Copy link
Collaborator

@martin-cs martin-cs left a comment

Choose a reason for hiding this comment

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

Yes, although I am less convinced of the net value of this vs. some of the other construction PRs.

@@ -217,7 +217,6 @@ bool flow_insensitive_analysis_baset::do_function_call(
r->location_number=0;

goto_programt::targett t=temp.add_instruction(END_FUNCTION);
t->code.set(ID_identifier, code.function());
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this might be lost from a different commit. I'm not sure it is wrong but, thought you might want to know.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note that this is in a separate commit ("Do not sneak an ID_identifier entry into END_FUNCTION"). I ended up fixing this as the regression test touched in the very same commit had surprisingly started to fail. The root cause was that .is_nil() code doesn't get printed with --print-internal-representation, and the changes in this PR make an END_FUNCTION's code nil, unlike previously where it simply was uninitialised. So we ended up with a codet that has some content but still .is_nil().

@@ -648,7 +648,7 @@ void c_typecheck_baset::typecheck_declaration(
// mark as 'already typechecked'
make_already_typechecked(declaration.type());

codet contract;
irept contract;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is less type information really an improvement?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In this case: yes, because we really don't care about the container of the information, just the contents we put in it. And that declaration makes this explicit.

@@ -167,7 +167,6 @@ void goto_convert_functionst::convert_function(
goto_programt::targett end_function=tmp_end_function.add_instruction();
end_function->type=END_FUNCTION;
end_function->source_location=end_location;
end_function->code.set(ID_identifier, identifier);
Copy link
Collaborator

Choose a reason for hiding this comment

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

As with previous comment, is this from removing function names?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See above, part of the same cleanup.

@tautschnig tautschnig merged commit 51d8243 into diffblue:develop Jan 28, 2019
@tautschnig tautschnig deleted the deprecation-codet branch January 28, 2019 09:29
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.

7 participants