-
Notifications
You must be signed in to change notification settings - Fork 285
Invariant cleanup, util directory, files j-r #2892
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
Invariant cleanup, util directory, files j-r #2892
Conversation
hannes-steffenhagen-diffblue
left a comment
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.
One invariant I'd change, also please run git-clang-format
src/util/mp_arith.cpp
Outdated
| ullong_t shift=b.to_ulong(); | ||
| if(shift>true_size) | ||
| throw "shift value out of range"; | ||
| DATA_INVARIANT(shift<=true_size, "shift value must be in range"); |
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.
PRECONDITION
ebc8391 to
460ff53
Compare
|
@hannes-steffenhagen-diffblue (throws ashes on head ) - I did not push local changes. :( |
hannes-steffenhagen-diffblue
left a comment
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.
OK, minor ⛏️ aside
src/util/mp_arith.cpp
Outdated
| ullong_t shift=b.to_ulong(); | ||
| if(shift>true_size) | ||
| throw "shift value out of range"; | ||
| DATA_INVARIANT(shift <= true_size, "shift value must be in range"); |
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 should still be a PRECONDITION
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.
Yep. It is now that I pushed the local changes. (Doh!)
| assert(old_d->ref_count!=0); | ||
| PRECONDITION(old_d->ref_count != 0); | ||
|
|
||
| #ifdef REFERENCE_COUNTING_DEBUG |
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 seems like an odd change, was this done by clang-format?
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.
I have undone those indentations and it did not happen again upon a clang-format. (!?!)
460ff53 to
3a915bf
Compare
tautschnig
left a comment
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.
Mostly looks good except as noted below.
src/util/namespace.h
Outdated
| INVARIANT( | ||
| !not_found, | ||
| "we are assuming that a name exists in the namespace " | ||
| "when this function is called"); |
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.
Please include/keep id2string(name) in the error message.
src/util/rational.cpp
Outdated
| /// Rational Numbers | ||
|
|
||
| #include "rational.h" | ||
| #include "invariant.h" |
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.
Maintain lexicographic ordering of includes: move one line up.
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.
The first was the source file's own header. My lack of a spacing line did not make this clear.
Amended to:
#include "rational.h"
#include <algorithm>
#include <ostream>
#include "invariant.h"
src/util/reference_counting.h
Outdated
| #ifndef CPROVER_UTIL_REFERENCE_COUNTING_H | ||
| #define CPROVER_UTIL_REFERENCE_COUNTING_H | ||
|
|
||
| #include <cassert> |
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.
Should now be removed.
3a915bf to
8f28c2f
Compare
allredj
left a comment
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: 3a915bf).
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).
8f28c2f to
341f993
Compare
allredj
left a comment
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: 341f993).
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).
allredj
left a comment
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: 341f993).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/83828018
Cleanup of util directory, files j-r (json_irep.cpp withheld awaiting a review of cbmc exceptions)
Cleanup of asserts - replaced with invariants.
Removed all unstructured
throw(...)statements, replacing withINVARIANT,PRECONDITION, where appropriate.