Skip to content

Commit aaa6d81

Browse files
authored
Merge pull request #7452 from qinheping/crangler-loop-invariant
Crangler: Add space between crangler-defines tokens
2 parents 48e1063 + 78fb718 commit aaa6d81

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

regression/crangler/function-contract-03/test.desc

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ test.json
44
activate-multi-line-match
55
^EXIT=0$
66
^SIGNAL=0$
7-
int f1\(int \*x1\)\n \_\_CPROVER\_requires\(\*x1\>1\&\&\*x1\<10000\) \_\_CPROVER\_ensures\(.*\=\=\*x1\+2\)
8-
int f2\(int \*x2\)\n \_\_CPROVER\_requires\(\*x2\>1\&\&\*x2\<10000\) \_\_CPROVER\_ensures\(.*\=\=\*x2\+1\)
7+
int f1\(int \*x1\)\n \_\_CPROVER\_requires\(\* \( signed long int \* \) x1 \> 1 \&\&.*\_\_CPROVER\_ensures\(.*\=\= \* x1 \+ 2 \)
8+
int f2\(int \*x2\)\n \_\_CPROVER\_requires\(\* x2 \> 1 \&\& \* x2 \< 10000 \) \_\_CPROVER\_ensures\(.*\=\= \* x2 \+ 1 \)
99
--
1010
--
1111
Annotate function contracts to functions f1 and f2.

regression/crangler/function-contract-03/test.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"functions": [
66
{
77
"f1": [
8-
"requires *x1 > 1 && *x1 < 10000",
8+
"requires *(signed long int*)x1 > 1 && *(signed long int*)x1 < 10000",
99
"ensures __CPROVER_return_value == *x1 + 2"
1010
],
1111
"f2": [

regression/crangler/loop-contract-01/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
test.json
33

4-
^\s+while\(i \< 2\) \_\_CPROVER\_assigns.*\_\_CPROVER\_loop\_invariant.*\_\_CPROVER_decreases
4+
^\s+while\(i \< 2\) \_\_CPROVER\_assigns.*\_\_CPROVER\_loop\_invariant\(\( unsigned long int \).*\_\_CPROVER_decreases
55
^EXIT=0$
66
^SIGNAL=0$
77
--

regression/crangler/loop-contract-01/test.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"functions": [
66
{
77
"foo": [
8-
"while 1 invariant i >= 0",
8+
"while 1 invariant (unsigned long int)i >= 0",
99
"while 1 assigns i, __CPROVER_POINTER_OBJECT(arr)",
1010
"while 1 decreases 2-i"
1111
]

src/crangler/c_defines.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ std::string c_definest::operator()(const std::string &src) const
6161
}
6262
else
6363
out << t.text;
64+
out << " ";
6465
}
6566

66-
return out.str();
67+
auto result = out.str();
68+
result.pop_back();
69+
70+
return result;
6771
}

0 commit comments

Comments
 (0)