Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
87d5bd38
Commit
87d5bd38
authored
4 years ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[wp] use funbehavior in modes
parent
7e00d91d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/wp/cfgCalculus.ml
+22
-32
22 additions, 32 deletions
src/plugins/wp/cfgCalculus.ml
src/plugins/wp/cfgCalculus.mli
+1
-1
1 addition, 1 deletion
src/plugins/wp/cfgCalculus.mli
with
23 additions
and
33 deletions
src/plugins/wp/cfgCalculus.ml
+
22
−
32
View file @
87d5bd38
...
@@ -40,48 +40,38 @@ type assigns = WpPropId.assigns_full_info
...
@@ -40,48 +40,38 @@ type assigns = WpPropId.assigns_full_info
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
type
mode
=
{
type
mode
=
{
bhv
:
string
opt
io
n
;
(* Selected behavior (None is default) *)
bhv
:
funbehav
io
r
;
(* Selected behavior (None is default) *)
stmt
:
stmt
option
;
(* Stmt contract under proof *)
stmt
:
stmt
option
;
(* Stmt contract under proof *)
}
}
let
default_mode
=
{
bhv
=
None
;
stmt
=
None
}
let
get_modes
kf
=
let
get_modes
kf
=
default_mode
::
Annotations
.
fold_behaviors
begin
(
fun
_emitter
bhv
ms
->
{
bhv
;
stmt
=
None
}
::
ms
)
Annotations
.
fold_behaviors
kf
@@
(
fun
_emitter
b
ms
->
{
bhv
=
Some
b
.
b_name
;
stmt
=
None
}
::
ms
)
List
.
fold_right
kf
@@
(
fun
stmt
ms
->
List
.
fold_right
Annotations
.
fold_code_annot
(
fun
_emitter
ca
ms
->
(
fun
stmt
ms
->
match
ca
.
annot_content
with
Annotations
.
fold_code_annot
(
fun
_emitter
ca
ms
->
|
AStmtSpec
(
_
,
{
spec_behavior
=
bs
}
)
->
match
ca
.
annot_content
with
List
.
fold_right
(
fun
bhv
ms
->
{
|
AStmtSpec
(
_
,
{
spec_behavior
=
bs
}
)
->
bhv
;
{
bhv
=
None
;
stmt
=
Some
stmt
}
::
stmt
=
Some
stmt
;
List
.
fold_right
(
fun
b
ms
->
{
}
::
ms
)
bs
ms
bhv
=
Some
b
.
b_name
;
|
_
->
ms
stmt
=
Some
stmt
;
)
stmt
ms
}
::
ms
)
bs
ms
)
(
Kernel_function
.
get_definition
kf
)
.
sallstmts
[]
|
_
->
ms
)
stmt
ms
)
(
Kernel_function
.
get_definition
kf
)
.
sallstmts
[]
end
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
(* --- Property Selection by Mode --- *)
(* --- Property Selection by Mode --- *)
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
let
is_default
(
m
:
mode
)
=
m
.
bhv
=
None
let
is_default
_bhv
(
m
:
mode
)
=
Cil
.
is_default_behavior
m
.
bhv
let
is_selected_bhv
(
m
:
mode
)
(
bhv
:
funbehavior
)
=
let
is_selected_bhv
(
m
:
mode
)
(
bhv
:
funbehavior
)
=
match
m
.
bhv
with
m
.
bhv
.
b_name
=
bhv
.
b_name
|
None
->
Cil
.
is_default_behavior
bhv
|
Some
b
->
b
=
bhv
.
b_name
let
is_selected_for
(
m
:
mode
)
(
fors
:
string
list
)
=
let
is_selected_for
(
m
:
mode
)
(
fors
:
string
list
)
=
match
m
.
bhv
with
List
.
mem
m
.
bhv
.
b_name
fors
|
None
->
fors
=
[]
|
Some
b0
->
List
.
mem
b0
fors
let
is_selected_ca
~
goal
(
m
:
mode
)
(
ca
:
code_annotation
)
=
let
is_selected_ca
~
goal
(
m
:
mode
)
(
ca
:
code_annotation
)
=
match
ca
.
annot_content
with
match
ca
.
annot_content
with
...
@@ -90,7 +80,7 @@ let is_selected_ca ~goal (m: mode) (ca: code_annotation) =
...
@@ -90,7 +80,7 @@ let is_selected_ca ~goal (m: mode) (ca: code_annotation) =
|
AAssert
(
forb
,_
)
|
AAssert
(
forb
,_
)
|
AInvariant
(
forb
,_,_
)
|
AInvariant
(
forb
,_,_
)
->
not
goal
||
is_selected_for
m
forb
->
not
goal
||
is_selected_for
m
forb
|
AVariant
_
->
m
.
bhv
=
None
|
AVariant
_
->
is_default_bhv
m
|
AExtended
_
|
AStmtSpec
_
|
APragma
_
->
|
AExtended
_
|
AStmtSpec
_
|
APragma
_
->
assert
false
(* n/a *)
assert
false
(* n/a *)
...
@@ -103,14 +93,14 @@ let is_selected_property ~goal (m: mode) (p: Property.t) =
...
@@ -103,14 +93,14 @@ let is_selected_property ~goal (m: mode) (p: Property.t) =
|
PKRequires
bhv
|
PKAssumes
bhv
->
|
PKRequires
bhv
|
PKAssumes
bhv
->
Cil
.
is_default_behavior
bhv
||
is_selected_bhv
m
bhv
Cil
.
is_default_behavior
bhv
||
is_selected_bhv
m
bhv
|
PKEnsures
(
bhv
,_
)
->
is_selected_bhv
m
bhv
|
PKEnsures
(
bhv
,_
)
->
is_selected_bhv
m
bhv
|
PKTerminates
->
is_default
m
|
PKTerminates
->
is_default
_bhv
m
end
end
|
IPAllocation
{
ial_bhv
=
bhv
}
|
IPAssigns
{
ias_bhv
=
bhv
}
->
|
IPAllocation
{
ial_bhv
=
bhv
}
|
IPAssigns
{
ias_bhv
=
bhv
}
->
begin
match
bhv
with
begin
match
bhv
with
|
Id_loop
ca
->
is_selected_ca
~
goal
m
ca
|
Id_loop
ca
->
is_selected_ca
~
goal
m
ca
|
Id_contract
(
_
,
bhv
)
->
is_selected_bhv
m
bhv
|
Id_contract
(
_
,
bhv
)
->
is_selected_bhv
m
bhv
end
end
|
IPDecrease
{
id_ca
=
None
}
->
is_default
m
|
IPDecrease
{
id_ca
=
None
}
->
is_default
_bhv
m
|
IPDecrease
{
id_ca
=
Some
ca
}
->
is_selected_ca
~
goal
m
ca
|
IPDecrease
{
id_ca
=
Some
ca
}
->
is_selected_ca
~
goal
m
ca
|
IPComplete
_
|
IPDisjoint
_
|
IPFrom
_
|
IPComplete
_
|
IPDisjoint
_
|
IPFrom
_
|
IPGlobalInvariant
_
|
IPTypeInvariant
_
->
|
IPGlobalInvariant
_
|
IPTypeInvariant
_
->
...
...
This diff is collapsed.
Click to expand it.
src/plugins/wp/cfgCalculus.mli
+
1
−
1
View file @
87d5bd38
...
@@ -27,7 +27,7 @@ open Cil_types
...
@@ -27,7 +27,7 @@ open Cil_types
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
type
mode
=
{
type
mode
=
{
bhv
:
string
opt
io
n
;
(* Selected behavior (None is default) *)
bhv
:
funbehav
io
r
;
(* Selected behavior (None is default) *)
stmt
:
stmt
option
;
(* Stmt contract under proof *)
stmt
:
stmt
option
;
(* Stmt contract under proof *)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment