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
db205902
Commit
db205902
authored
8 years ago
by
Kostyantyn Vorobyov
Browse files
Options
Downloads
Patches
Plain Diff
Refactor valid and valid_read using allocated
parent
f60b1116
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/e-acsl/share/e-acsl/segment_model/e_acsl_segment_mmodel.c
+8
-25
8 additions, 25 deletions
...e-acsl/share/e-acsl/segment_model/e_acsl_segment_mmodel.c
with
8 additions
and
25 deletions
src/plugins/e-acsl/share/e-acsl/segment_model/e_acsl_segment_mmodel.c
+
8
−
25
View file @
db205902
...
@@ -77,31 +77,6 @@ static void mark_readonly(void * ptr) {
...
@@ -77,31 +77,6 @@ static void mark_readonly(void * ptr) {
/* E-ACSL annotations */
/* E-ACSL annotations */
/* ****************** */
/* ****************** */
static
int
valid
(
void
*
ptr
,
size_t
size
,
void
*
ptr_base
,
void
*
addr_of_base
)
{
uintptr_t
addr
=
(
uintptr_t
)
ptr
;
uintptr_t
base
=
(
uintptr_t
)
ptr_base
;
if
(
IS_ON_HEAP
(
addr
))
return
heap_allocated
(
addr
,
size
,
base
);
else
if
(
IS_ON_STACK
(
addr
)
||
IS_ON_TLS
(
addr
))
return
static_allocated
(
addr
,
size
,
base
);
else
if
(
IS_ON_GLOBAL
(
addr
))
return
static_allocated
(
addr
,
size
,
base
)
&&
!
global_readonly
(
addr
);
else
if
(
!
IS_ON_VALID
(
addr
))
return
0
;
return
0
;
}
static
int
valid_read
(
void
*
ptr
,
size_t
size
,
void
*
ptr_base
,
void
*
addr_of_base
)
{
uintptr_t
addr
=
(
uintptr_t
)
ptr
;
uintptr_t
base
=
(
uintptr_t
)
ptr_base
;
TRY_SEGMENT_WEAK
(
addr
,
return
heap_allocated
(
addr
,
size
,
base
),
return
static_allocated
(
addr
,
size
,
base
));
if
(
!
IS_ON_VALID
(
addr
))
return
0
;
return
0
;
}
/** \brief Return 1 if a given memory location is read-only and 0 otherwise */
/** \brief Return 1 if a given memory location is read-only and 0 otherwise */
static
int
readonly
(
void
*
ptr
)
{
static
int
readonly
(
void
*
ptr
)
{
uintptr_t
addr
=
(
uintptr_t
)
ptr
;
uintptr_t
addr
=
(
uintptr_t
)
ptr
;
...
@@ -109,6 +84,14 @@ static int readonly (void *ptr) {
...
@@ -109,6 +84,14 @@ static int readonly (void *ptr) {
return
IS_ON_GLOBAL
(
addr
)
&&
global_readonly
(
addr
)
?
1
:
0
;
return
IS_ON_GLOBAL
(
addr
)
&&
global_readonly
(
addr
)
?
1
:
0
;
}
}
static
int
valid
(
void
*
ptr
,
size_t
size
,
void
*
ptr_base
,
void
*
addr_of_base
)
{
return
allocated
((
uintptr_t
)
ptr
,
size
,
(
uintptr_t
)
ptr_base
)
&&
!
readonly
(
ptr
);
}
static
int
valid_read
(
void
*
ptr
,
size_t
size
,
void
*
ptr_base
,
void
*
addr_of_base
)
{
return
allocated
((
uintptr_t
)
ptr
,
size
,
(
uintptr_t
)
ptr_base
);
}
/*! NB: The implementation for this function can also be specified via
/*! NB: The implementation for this function can also be specified via
* \p base_addr macro that will eventually call ::TRY_SEGMENT. The following
* \p base_addr macro that will eventually call ::TRY_SEGMENT. The following
* implementation is preferred for performance reasons. */
* implementation is preferred for performance reasons. */
...
...
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