-
Notifications
You must be signed in to change notification settings - Fork 274
allow an empty assigns clause #6177
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
This adds support for an explicit empty assigns clause, denoting a pure function.
Codecov Report
@@ Coverage Diff @@
## develop #6177 +/- ##
===========================================
+ Coverage 67.40% 75.49% +8.08%
===========================================
Files 1157 1450 +293
Lines 95236 158479 +63243
===========================================
+ Hits 64197 119646 +55449
- Misses 31039 38833 +7794
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@@ -20,10 +20,16 @@ int baz() __CPROVER_ensures(__CPROVER_return_value == global) | |||
return global; | |||
} | |||
|
|||
void qux(void) __CPROVER_assigns() |
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 semantics of an empty assigns clause should be that the function doesn't change any (global) arguments, right?
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.
Yes!
One thing you could do with this is to allow calls to pure functions like these to appear in function contracts. SPARK uses these (expression functions IIRC) to remove the need to duplicate common annotations. Obviously we can use macros but once they need non-trivial control-flow, pure functions are much more preferable. |
This adds support for an explicit empty assigns clause, denoting a pure
function.