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
e386b1af
Commit
e386b1af
authored
2 years ago
by
Andre Maroneze
Committed by
Thibault Martin
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
[Kernel] mergecil: remove static locals when removing duplicate function definitions
parent
0c5d3963
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/kernel_internals/typing/mergecil.ml
+14
-1
14 additions, 1 deletion
src/kernel_internals/typing/mergecil.ml
with
14 additions
and
1 deletion
src/kernel_internals/typing/mergecil.ml
+
14
−
1
View file @
e386b1af
...
...
@@ -1564,6 +1564,17 @@ let ignore_vi vi =
let
is_ignored_vi
vi
=
Cil_datatype
.
Varinfo
.
Set
.
mem
vi
!
ignored_vi
let
remove_function_statics
fdec
=
let
statics
=
Cil_datatype
.
Varinfo
.
Set
.
of_list
(
Ast_info
.
Function
.
get_statics
fdec
)
in
theFile
:=
List
.
filter
(
fun
g
->
match
g
with
|
GVar
(
vi
,
_
,
_
)
->
not
(
Cil_datatype
.
Varinfo
.
Set
.
mem
vi
statics
)
|
_
->
true
)
!
theFile
let
oneFilePass1
(
f
:
file
)
:
unit
=
H
.
add
fileNames
!
currentFidx
f
.
fileName
;
Kernel
.
feedback
~
dkey
:
Kernel
.
dkey_linker
...
...
@@ -2828,6 +2839,7 @@ let oneFilePass2 (f: file) =
(
mergePushGlobal
g'
);
(
H
.
add
emittedFunDefn
fdec'
.
svar
.
vname
(
fdec'
,
l
,
curSum
))
|
Some
(
_prevFun
,
prevLoc
,
prevSum
)
->
(* previous was found *)
(* restore old binding for vi, as we are about to drop
the new definition and its formals.
*)
...
...
@@ -2836,7 +2848,8 @@ let oneFilePass2 (f: file) =
Some l from getFormalsDecl
in case of a defined function. *)
Cil
.
setFormals
fdec
(
Option
.
get
defn_formals
);
(* previous was found *)
(* Remove static variables (avoids dangling globals in the AST *)
remove_function_statics
fdec'
;
if
(
curSum
=
prevSum
)
then
Kernel
.
warning
~
current
:
true
"dropping duplicate def'n of func %s at %a in favor of \
...
...
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