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
e1367ffc
Commit
e1367ffc
authored
5 years ago
by
Basile Desloges
Browse files
Options
Downloads
Patches
Plain Diff
[eacsl:codegen] Support of variadic functions in `Constructor.mk_lib_call`
parent
8fba2241
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/src/code_generator/constructor.ml
+22
-13
22 additions, 13 deletions
src/plugins/e-acsl/src/code_generator/constructor.ml
with
22 additions
and
13 deletions
src/plugins/e-acsl/src/code_generator/constructor.ml
+
22
−
13
View file @
e1367ffc
...
@@ -69,21 +69,30 @@ let mk_lib_call ~loc ?result fname args =
...
@@ -69,21 +69,30 @@ let mk_lib_call ~loc ?result fname args =
let
vi
=
Misc
.
get_lib_fun_vi
fname
in
let
vi
=
Misc
.
get_lib_fun_vi
fname
in
let
f
=
Cil
.
evar
~
loc
vi
in
let
f
=
Cil
.
evar
~
loc
vi
in
vi
.
vreferenced
<-
true
;
vi
.
vreferenced
<-
true
;
let
make_args
args
param_ty
=
let
make_args
~
variadic
args
param_ty
=
List
.
map2
let
rec
make_rev_args
res
args
param_ty
=
(
fun
(
_
,
ty
,
_
)
arg
->
match
args
,
param_ty
with
let
e
=
|
arg
::
args_tl
,
(
_
,
ty
,
_
)
::
param_ty_tl
->
match
ty
,
Cil
.
unrollType
(
Cil
.
typeOf
arg
)
,
arg
.
enode
with
let
e
=
|
TPtr
_
,
TArray
_
,
Lval
lv
->
Cil
.
new_exp
~
loc
(
StartOf
lv
)
match
ty
,
Cil
.
unrollType
(
Cil
.
typeOf
arg
)
,
arg
.
enode
with
|
TPtr
_
,
TArray
_
,
_
->
assert
false
|
TPtr
_
,
TArray
_
,
Lval
lv
->
Cil
.
new_exp
~
loc
(
StartOf
lv
)
|
_
,
_
,
_
->
arg
|
TPtr
_
,
TArray
_
,
_
->
assert
false
in
|
_
,
_
,
_
->
arg
Cil
.
mkCast
~
force
:
false
~
newt
:
ty
~
e
)
in
param_ty
let
e
=
Cil
.
mkCast
~
force
:
false
~
newt
:
ty
~
e
in
args
make_rev_args
(
e
::
res
)
args_tl
param_ty_tl
|
arg
::
args_tl
,
[]
when
variadic
->
make_rev_args
(
arg
::
res
)
args_tl
[]
|
[]
,
[]
->
res
|
_
,
_
->
Options
.
fatal
"Mismatch between the number of expressions given and the number \
of arguments in the signature when calling function '%s'"
fname
in
List
.
rev
(
make_rev_args
[]
args
param_ty
)
in
in
let
args
=
match
Cil
.
unrollType
vi
.
vtype
with
let
args
=
match
Cil
.
unrollType
vi
.
vtype
with
|
TFun
(
_
,
Some
params
,
_
,
_
)
->
make_args
args
params
|
TFun
(
_
,
Some
params
,
variadic
,
_
)
->
make_args
~
variadic
args
params
|
TFun
(
_
,
None
,
_
,
_
)
->
[]
|
TFun
(
_
,
None
,
_
,
_
)
->
[]
|
_
->
assert
false
|
_
->
assert
false
in
in
...
...
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