Skip to content

Remove void_typet #4102

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 9 commits into from
Feb 7, 2019
Merged

Conversation

tautschnig
Copy link
Collaborator

I suggest reviewing commit-by-commit.

  • 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: 75d5d28).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/99859081
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.

@tautschnig
Copy link
Collaborator Author

I'm assuming the bot failure is genuine: @svorenova @thk123 whenever time permits, could you scan TG for occurrences of void_typet and update this as is done in the commits in this PR? That should be safe to do without depending on the changes in this PR.

@majakusber majakusber assigned antlechner and unassigned thk123 and majakusber Feb 6, 2019
@kroening
Copy link
Member

kroening commented Feb 6, 2019

You could also change typet void_type(); in c_types.h to return empty_typet.

@kroening kroening removed their assignment Feb 6, 2019
@majakusber majakusber assigned majakusber and unassigned antlechner Feb 6, 2019
@majakusber
Copy link

@tautschnig I made the companion PR here: https://github.com/diffblue/test-gen/pull/2999 Note that I would like to merge my PR before this one, to avoid clash.

@tautschnig
Copy link
Collaborator Author

@svorenova Thank you very much - yes, please do let me know when it's merged, I'd like to keep the bot (and thus TG) happy at all times to avoid spurious messages being posted.

@tautschnig
Copy link
Collaborator Author

You could also change typet void_type(); in c_types.h to return empty_typet.

Done, which made some further room for improvement apparent. I hope the additional 5 commits are ok to be in this PR.

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: 8a28d16).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/99961187
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.

@majakusber
Copy link

I updated the companion PR https://github.com/diffblue/test-gen/pull/2999

@majakusber
Copy link

@tautschnig The companion PR is merged now, you can merge this 👍

void_typet and empty_typet are effectively the same, but weren't consistently
used and thus void_typet is going away.
There was a mix of empty_typet, void_typet, and actual uses of java_void_type.
At the moment, they are all the same, but there is no compile-time guarantee
that this remains true.
void_typet was only sometimes used.
void_typet had 25 uses across the codebase, while its equivalent empty_typet has
84 uses. Only sometimes using "void_typet" requires that empty_typet and
void_typet forever stay the same.
This is consistent with what is done in the Java front-end. Also use the same
trick to construct only a single, shared instance of it.
Should we ever choose to add any annotations consistent use of the generator
function will ensure these are available.
Use empty_typet as done in all other places.
This has been cleaned up in f573d97 already, and future changes might see
complete removal of type() from codet.
Don't do incremental updates which may result in objects that do not match what
we build via constructors.
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: 32f4aa5).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100076282

@tautschnig tautschnig merged commit 2dc0863 into diffblue:develop Feb 7, 2019
@tautschnig tautschnig deleted the remove-void_typet branch February 7, 2019 13:11
@NlightNFotis
Copy link
Contributor

NlightNFotis commented Feb 8, 2019

Now this has been merged, but I have a question: Wouldn't it be better instead of completely removing void_typet to instead alias it to empty_typet?

That would make the API better and the semantics of some code much closer to the semantics of the languages they supposedly model (like C code). Because as far I understand the empty type is a concept present on functional languages. C descendants use void for the the same thing?

@tautschnig
Copy link
Collaborator Author

I had pondered to introduce a typedef, but my main concern was that there was no consistent use of one or the other. I have tried to clean this up, and now ended up (trying to) make consistent use of java_void_type() in the Java front-end, and void_type() in the C and C++ front-ends. I think that's fairly clean within the language front-ends now. That leaves as concern that those still return an empty_typet, but I think that's actually good, because we are converting towards goto programs, not either of the languages. If anything, we've probably been too close to C in the middle-end I think.

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

Successfully merging this pull request may close these issues.

8 participants