summaryrefslogtreecommitdiff
path: root/cfrontend/Cshmgen.v
diff options
context:
space:
mode:
Diffstat (limited to 'cfrontend/Cshmgen.v')
-rw-r--r--cfrontend/Cshmgen.v12
1 files changed, 10 insertions, 2 deletions
diff --git a/cfrontend/Cshmgen.v b/cfrontend/Cshmgen.v
index c5e9b8d..a459297 100644
--- a/cfrontend/Cshmgen.v
+++ b/cfrontend/Cshmgen.v
@@ -546,8 +546,16 @@ with transl_lbl_stmt (tyret: type) (nbrk ncnt: nat)
Definition prefix_var_name (id: ident) : errmsg :=
MSG "In local variable " :: CTX id :: MSG ": " :: nil.
-Definition transl_vars (l: list (ident * type)) :=
- AST.map_partial prefix_var_name var_kind_of_type l.
+Fixpoint transl_vars (l: list (ident * type)) : res (list (ident * var_kind)) :=
+ match l with
+ | nil => OK nil
+ | (id, ty) :: l' =>
+ match var_kind_of_type ty with
+ | Error msg => Error (MSG "In local variable " :: CTX id :: MSG ": " :: msg)
+ | OK vk =>
+ do tl' <- transl_vars l'; OK ((id, vk) :: tl')
+ end
+ end.
Definition transl_function (f: Clight.function) : res function :=
do tparams <- transl_vars (Clight.fn_params f);