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
048fcc96
Commit
048fcc96
authored
3 years ago
by
Andre Maroneze
Browse files
Options
Downloads
Patches
Plain Diff
[analysis-scripts] minor improvements
parent
43b341aa
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
share/analysis-scripts/estimate_difficulty.py
+6
-10
6 additions, 10 deletions
share/analysis-scripts/estimate_difficulty.py
with
6 additions
and
10 deletions
share/analysis-scripts/estimate_difficulty.py
+
6
−
10
View file @
048fcc96
...
...
@@ -80,26 +80,21 @@ def get_framac_libc_function_statuses(framac, framac_share):
re_include
=
re
.
compile
(
r
'
\s*#\s*include\s*(
"
|<)([^
"
>]+)(
"
|>)
'
)
def
grep_includes_in_file
(
file
):
res
=
[]
i
=
0
with
open
(
file
,
"
r
"
,
encoding
=
"
utf-8
"
,
errors
=
'
ignore
'
)
as
f
:
i
=
0
for
line
in
f
.
readlines
():
i
+=
1
m
=
re_include
.
match
(
line
)
if
m
:
kind
=
m
.
group
(
1
)
header
=
m
.
group
(
2
)
res
.
append
((
i
,
kind
,
header
))
return
res
yield
((
i
,
kind
,
header
))
def
get_includes
(
files
):
quote_includes
=
{}
chevron_includes
=
{}
for
filename
in
files
:
for
res
in
grep_includes_in_file
(
filename
):
line
=
res
[
0
]
kind
=
res
[
1
]
header
=
res
[
2
]
for
line
,
kind
,
header
in
grep_includes_in_file
(
filename
):
if
kind
==
'
<
'
:
includes
=
chevron_includes
[
header
]
if
header
in
chevron_includes
else
[]
else
:
...
...
@@ -165,6 +160,9 @@ warnings = 0
for
callee
in
sorted
(
callees
):
def
callee_status
(
status
,
standard
,
reason
):
global
warnings
if
status
==
"
warning
"
:
warnings
+=
1
if
verbose
or
debug
or
status
==
"
warning
"
:
print
(
f
"
-
{
status
}
:
{
callee
}
(
{
standard
}
)
{
reason
}
"
)
#print(f"callee: {callee}")
...
...
@@ -188,7 +186,6 @@ for callee in sorted(callees):
if
callee
in
posix_identifiers
and
"
notes
"
in
posix_identifiers
[
callee
]
and
"
variadic-plugin
"
in
posix_identifiers
[
callee
][
"
notes
"
]:
callee_status
(
"
ok
"
,
standard
,
"
is handled by the Variadic plug-in
"
)
else
:
warnings
+=
1
callee_status
(
"
warning
"
,
standard
,
"
has neither code nor spec in Frama-C
'
s libc
"
)
elif
callee
in
posix_identifiers
:
standard
=
"
POSIX
"
...
...
@@ -201,7 +198,6 @@ for callee in sorted(callees):
elif
callee
in
libc_defined_functions
:
callee_status
(
"
ok
"
,
standard
,
"
defined in Frama-C
'
s libc
"
)
else
:
warnings
+=
1
callee_status
(
"
warning
"
,
standard
,
"
has neither code nor spec in Frama-C
'
s libc
"
)
print
(
f
"
Function-related warnings:
{
warnings
}
"
)
...
...
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