Skip to content

Requires and ensures clauses with descriptions #7181

Open
@feliperodri

Description

@feliperodri

Similar to how __CPROVER_assert(bool cond, char *msg) accepts a string that shows up in the terminal output,
we could modify the front end to allow users to name ensures and requires clauses in function contracts with an optional string. For example,

int foo(int *arr, size_t size)
__CPROVER_requires(size > 0 , "some text")
__CPROVER_ensures(__CPROVER_return_value == 1 , "some text")
{
}

Activity

martin-cs

martin-cs commented on Oct 3, 2022

@martin-cs
Collaborator

Sounds good. I guess the challenge is how to do it without breaking backwards compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Code ContractsFunction and loop contractsawsBugs or features of importance to AWS CBMC usersenhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @feliperodri@martin-cs@nwetzler

      Issue actions

        Requires and ensures clauses with descriptions · Issue #7181 · diffblue/cbmc