Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pub
frama-c
Commits
795f8fc2
Commit
795f8fc2
authored
Jun 26, 2020
by
Allan Blanchard
Browse files
[Logic] factorize a code segment in Annotations
parent
af788529
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/kernel_services/ast_data/annotations.ml
View file @
795f8fc2
...
...
@@ -1052,6 +1052,10 @@ let get_full_spec kf ?stmt ?(behavior=[]) () =
|
[
{
annot_content
=
AStmtSpec
(
_
,
s
)}
]
->
s
|
_
->
Kernel
.
fatal
"More than one contract associated to a statement"
)
let
get_spec_behavior
s
=
function
|
None
->
Cil
.
find_default_behavior
s
|
Some
name
->
List
.
find_opt
(
fun
{
b_name
}
->
b_name
=
name
)
s
.
spec_behavior
let
add_assigns
~
keep_empty
e
kf
?
stmt
?
active
?
behavior
a
=
let
set_bhv
full_bhv
e_bhv
=
let
keep_empty
=
keep_empty
&&
full_bhv
.
b_assigns
=
WritesAny
in
...
...
@@ -1075,12 +1079,7 @@ let add_assigns ~keep_empty e kf ?stmt ?active ?behavior a =
)
in
let
old_spec
=
get_full_spec
kf
?
stmt
?
behavior
:
active
()
in
let
bhv
=
match
behavior
with
|
None
->
Cil
.
find_default_behavior
old_spec
|
Some
name
->
List
.
find_opt
(
fun
{
b_name
}
->
b_name
=
name
)
old_spec
.
spec_behavior
in
let
bhv
=
get_spec_behavior
old_spec
behavior
in
let
is_empty
=
match
bhv
with
|
None
->
true
...
...
@@ -1104,12 +1103,7 @@ let add_allocates ~keep_empty e kf ?stmt ?active ?behavior a =
(
Property
.
ip_allocation_of_behavior
kf
ki
active
full_bhv
);
in
let
old_spec
=
get_full_spec
kf
?
stmt
?
behavior
:
active
()
in
let
bhv
=
match
behavior
with
|
None
->
Cil
.
find_default_behavior
old_spec
|
Some
name
->
List
.
find_opt
(
fun
{
b_name
}
->
b_name
=
name
)
old_spec
.
spec_behavior
in
let
bhv
=
get_spec_behavior
old_spec
behavior
in
let
is_empty
=
match
bhv
with
|
None
->
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment